langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
3
Task/Memory-allocation/Objeck/memory-allocation.objeck
Normal file
3
Task/Memory-allocation/Objeck/memory-allocation.objeck
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
foo := Object->New(); // allocates an object on the heap
|
||||
foo_array := Int->New[size]; // allocates an integer array on the heap
|
||||
x := 0; // allocates an integer on the stack
|
||||
1
Task/Memory-allocation/PARI-GP/memory-allocation.pari
Normal file
1
Task/Memory-allocation/PARI-GP/memory-allocation.pari
Normal file
|
|
@ -0,0 +1 @@
|
|||
allocatemem(100<<20)
|
||||
12
Task/Memory-allocation/PL-I/memory-allocation-1.pli
Normal file
12
Task/Memory-allocation/PL-I/memory-allocation-1.pli
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
mainproc: proc options(main) reorder;
|
||||
|
||||
subproc: proc;
|
||||
dcl subvar char init ('X');
|
||||
|
||||
put skip data(subvar);
|
||||
subvar = 'Q';
|
||||
end subproc;
|
||||
|
||||
call subproc();
|
||||
call subproc();
|
||||
end mainproc;
|
||||
17
Task/Memory-allocation/PL-I/memory-allocation-2.pli
Normal file
17
Task/Memory-allocation/PL-I/memory-allocation-2.pli
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
mainproc: proc options(main) reorder;
|
||||
dcl ctlvar char ctl;
|
||||
|
||||
alloc ctlvar;
|
||||
ctlvar = 'A';
|
||||
alloc ctlvar;
|
||||
ctlvar = 'B';
|
||||
alloc ctlvar;
|
||||
ctlvar = 'C';
|
||||
|
||||
put skip data(ctlvar);
|
||||
free ctlvar;
|
||||
put skip data(ctlvar);
|
||||
free ctlvar;
|
||||
put skip data(ctlvar);
|
||||
free ctlvar;
|
||||
end mainproc;
|
||||
27
Task/Memory-allocation/PL-I/memory-allocation-3.pli
Normal file
27
Task/Memory-allocation/PL-I/memory-allocation-3.pli
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
mainproc: proc options(main) reorder;
|
||||
dcl list_ptr ptr init (sysnull());
|
||||
dcl list_top ptr init (sysnull());
|
||||
dcl list_end ptr init (addr(list_top));
|
||||
dcl i fixed bin (31);
|
||||
|
||||
dcl 1 list based(list_ptr),
|
||||
2 list_nxt ptr init (sysnull()),
|
||||
2 list_data fixed bin (31) init (i);
|
||||
|
||||
/*
|
||||
* Allocate the list
|
||||
*/
|
||||
do i = 1 to 4;
|
||||
alloc list;
|
||||
list_end -> list_nxt = list_ptr;
|
||||
list_end = list_ptr;
|
||||
end;
|
||||
|
||||
/*
|
||||
* Print the list
|
||||
*/
|
||||
do list_ptr = list_top repeat list_nxt
|
||||
while(list_ptr ^= sysnull());
|
||||
put skip list(list_data);
|
||||
end;
|
||||
end mainprog;
|
||||
9
Task/Memory-allocation/Pascal/memory-allocation-1.pascal
Normal file
9
Task/Memory-allocation/Pascal/memory-allocation-1.pascal
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
type
|
||||
TByteArray = array of byte;
|
||||
var
|
||||
A: TByteArray;
|
||||
begin
|
||||
setLength(A,1000);
|
||||
...
|
||||
setLength(A,0);
|
||||
end;
|
||||
11
Task/Memory-allocation/Pascal/memory-allocation-2.pascal
Normal file
11
Task/Memory-allocation/Pascal/memory-allocation-2.pascal
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
type
|
||||
Tcl = class
|
||||
dummy: longint;
|
||||
end;
|
||||
var
|
||||
c1: cl;
|
||||
begin
|
||||
c1:=Tcl.create;
|
||||
...
|
||||
c1.destroy;
|
||||
end;
|
||||
1
Task/Memory-allocation/Perl-6/memory-allocation.pl6
Normal file
1
Task/Memory-allocation/Perl-6/memory-allocation.pl6
Normal file
|
|
@ -0,0 +1 @@
|
|||
my $buffer = Buf.new(0 xx 1024);
|
||||
15
Task/Memory-allocation/PureBasic/memory-allocation.purebasic
Normal file
15
Task/Memory-allocation/PureBasic/memory-allocation.purebasic
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
*buffer=AllocateMemory(20)
|
||||
|
||||
*newBuffer = ReAllocateMemory(*buffer, 2000) ;increase size of buffer
|
||||
;*buffer value is still valid if newBuffer wasn't able to be reallocated
|
||||
If *newBuffer <> 0
|
||||
*buffer = *newBuffer : *newBuffer = 0
|
||||
EndIf
|
||||
|
||||
FreeMemory(*buffer)
|
||||
|
||||
|
||||
size=20
|
||||
; allocate an image for use with image functions
|
||||
CreateImage(1,size,size)
|
||||
FreeImage(1)
|
||||
14
Task/Memory-allocation/Retro/memory-allocation.retro
Normal file
14
Task/Memory-allocation/Retro/memory-allocation.retro
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
( display total memory available )
|
||||
@memory putn
|
||||
|
||||
( display unused memory )
|
||||
@memory here - putn
|
||||
|
||||
( display next free address )
|
||||
here putn
|
||||
|
||||
( allocate 1000 cells )
|
||||
1000 allot
|
||||
|
||||
( free 500 cells )
|
||||
-500 allot
|
||||
1
Task/Memory-allocation/SNOBOL4/memory-allocation-1.sno
Normal file
1
Task/Memory-allocation/SNOBOL4/memory-allocation-1.sno
Normal file
|
|
@ -0,0 +1 @@
|
|||
newstring = "This is creating and saving" " a new single string " "starting with three separate strings."
|
||||
1
Task/Memory-allocation/SNOBOL4/memory-allocation-2.sno
Normal file
1
Task/Memory-allocation/SNOBOL4/memory-allocation-2.sno
Normal file
|
|
@ -0,0 +1 @@
|
|||
newarray = array(100)
|
||||
1
Task/Memory-allocation/SNOBOL4/memory-allocation-3.sno
Normal file
1
Task/Memory-allocation/SNOBOL4/memory-allocation-3.sno
Normal file
|
|
@ -0,0 +1 @@
|
|||
newtable = table()
|
||||
1
Task/Memory-allocation/SNOBOL4/memory-allocation-4.sno
Normal file
1
Task/Memory-allocation/SNOBOL4/memory-allocation-4.sno
Normal file
|
|
@ -0,0 +1 @@
|
|||
data("listnode(next,prev,datafield1,datafield2)")
|
||||
1
Task/Memory-allocation/SNOBOL4/memory-allocation-5.sno
Normal file
1
Task/Memory-allocation/SNOBOL4/memory-allocation-5.sno
Normal file
|
|
@ -0,0 +1 @@
|
|||
newnode = listnode(,,"string data value1",17)
|
||||
1
Task/Memory-allocation/SNOBOL4/memory-allocation-6.sno
Normal file
1
Task/Memory-allocation/SNOBOL4/memory-allocation-6.sno
Normal file
|
|
@ -0,0 +1 @@
|
|||
datafield1(newnode) = "updated data value 1"
|
||||
1
Task/Memory-allocation/SNOBOL4/memory-allocation-7.sno
Normal file
1
Task/Memory-allocation/SNOBOL4/memory-allocation-7.sno
Normal file
|
|
@ -0,0 +1 @@
|
|||
newnode =
|
||||
1
Task/Memory-allocation/SNOBOL4/memory-allocation-8.sno
Normal file
1
Task/Memory-allocation/SNOBOL4/memory-allocation-8.sno
Normal file
|
|
@ -0,0 +1 @@
|
|||
collect()
|
||||
5
Task/Memory-allocation/XPL0/memory-allocation.xpl0
Normal file
5
Task/Memory-allocation/XPL0/memory-allocation.xpl0
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
int Array(10); \allocates 10 integers (40 bytes) of heap space
|
||||
Array2:= Reserve(10*4); \another way to allocate 10 integers of heap space
|
||||
Array3:= MAlloc(4); \allocate 4 paragraphs (64 bytes) of conventional memory
|
||||
...
|
||||
Release(Array3); \release this memory so it can be used elsewhere
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
10 REM This code is written for a 48k spectrum
|
||||
20 CLEAR 65535 - 8192: REM reserve 8192 bytes of memory
|
||||
30 CLEAR 65535: REM unreserve the memory, moving the ramtop back to the top of the ram
|
||||
Loading…
Add table
Add a link
Reference in a new issue