Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
6
Task/Function-prototype/Ada/function-prototype-1.adb
Normal file
6
Task/Function-prototype/Ada/function-prototype-1.adb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
function noargs return Integer;
|
||||
function twoargs (a, b : Integer) return Integer;
|
||||
-- varargs do not exist
|
||||
function optionalargs (a, b : Integer := 0) return Integer;
|
||||
-- all parameters are always named, only calling by name differs
|
||||
procedure dostuff (a : Integer);
|
||||
5
Task/Function-prototype/Ada/function-prototype-2.adb
Normal file
5
Task/Function-prototype/Ada/function-prototype-2.adb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
type Box; -- tell Ada a box exists (undefined yet)
|
||||
type accBox is access Box; -- define a pointer to a box
|
||||
type Box is record -- later define what a box is
|
||||
next : accBox; -- including that a box holds access to other boxes
|
||||
end record;
|
||||
4
Task/Function-prototype/Ada/function-prototype-3.adb
Normal file
4
Task/Function-prototype/Ada/function-prototype-3.adb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
package Stack is
|
||||
procedure Push(Object:Integer);
|
||||
function Pull return Integer;
|
||||
end Stack;
|
||||
13
Task/Function-prototype/Ada/function-prototype-4.adb
Normal file
13
Task/Function-prototype/Ada/function-prototype-4.adb
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package body Stack is
|
||||
|
||||
procedure Push(Object:Integer) is
|
||||
begin
|
||||
-- implementation goes here
|
||||
end;
|
||||
|
||||
function Pull return Integer;
|
||||
begin
|
||||
-- implementation goes here
|
||||
end;
|
||||
|
||||
end Stack;
|
||||
8
Task/Function-prototype/Ada/function-prototype-5.adb
Normal file
8
Task/Function-prototype/Ada/function-prototype-5.adb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
with Stack;
|
||||
procedure Main is
|
||||
N:integer:=5;
|
||||
begin
|
||||
Push(N);
|
||||
...
|
||||
N := Pull;
|
||||
end Main;
|
||||
39
Task/Function-prototype/COBOL/function-prototype.cob
Normal file
39
Task/Function-prototype/COBOL/function-prototype.cob
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
*> A subprogram taking no arguments and returning nothing.
|
||||
PROGRAM-ID. no-args PROTOTYPE.
|
||||
END PROGRAM no-args.
|
||||
|
||||
*> A subprogram taking two 8-digit numbers as arguments, and returning
|
||||
*> an 8-digit number.
|
||||
PROGRAM-ID. two-args PROTOTYPE.
|
||||
DATA DIVISION.
|
||||
LINKAGE SECTION.
|
||||
01 arg-1 PIC 9(8).
|
||||
01 arg-2 PIC 9(8).
|
||||
01 ret PIC 9(8).
|
||||
PROCEDURE DIVISION USING arg-1, arg-2 RETURNING ret.
|
||||
END PROGRAM two-args.
|
||||
|
||||
*> A subprogram taking two optional arguments which are 8-digit
|
||||
*> numbers (passed by reference (the default and compulsory for
|
||||
*> optional arguments)).
|
||||
PROGRAM-ID. optional-args PROTOTYPE.
|
||||
DATA DIVISION.
|
||||
LINKAGE SECTION.
|
||||
01 arg-1 PIC 9(8).
|
||||
01 arg-2 PIC 9(8).
|
||||
PROCEDURE DIVISION USING OPTIONAL arg-1, OPTIONAL arg-2.
|
||||
END PROGRAM optional-args.
|
||||
|
||||
*> Standard COBOL does not support varargs or named parameters.
|
||||
|
||||
*> A function from another language, taking a 32-bit integer by
|
||||
*> value and returning a 32-bit integer (in Visual COBOL).
|
||||
PROGRAM-ID. foreign-func PROTOTYPE.
|
||||
OPTIONS.
|
||||
ENTRY-CONVENTION some-langauge.
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
01 arg PIC S9(9) USAGE COMP-5.
|
||||
01 ret PIC S9(9) USAGE COMP-5.
|
||||
PROCEDURE DIVISION USING arg RETURNING ret.
|
||||
END PROGRAM foreign-func.
|
||||
Loading…
Add table
Add a link
Reference in a new issue