langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

@ -0,0 +1,2 @@
(set 'a '(1 2 3))
(address a)

View file

@ -0,0 +1 @@
issquare(n, &m)

View file

@ -0,0 +1,3 @@
declare p pointer;
k = addr(b); /* Obtain address of variable, stored in integer variable k */
p = addr(q); /* assigns address to pointer variable p. */

View file

@ -0,0 +1 @@
my $x; say $x.WHERE;

View file

@ -0,0 +1,18 @@
'get a variable's address:
DIM x AS INTEGER, y AS LONG
y = VARPTR(x)
'can't set the address of a single variable, but can access memory locations
DIM z AS INTEGER
z = PEEK(INTEGER, y)
'or can do it one byte at a time
DIM zz(1) AS BYTE
zz(0) = PEEK(BYTE, y)
zz(1) = PEEK(BYTE, y + 1)
'(MAK creates an INTEGER, LONG, or QUAD out of the next smaller type)
z = MAK(INTEGER, zz(0), zz(1))
'*can* set the address of an array
DIM zzz(1) AS BYTE AT y
'zzz(0) = low byte of x, zzz(1) = high byte of x

View file

@ -0,0 +1,2 @@
a.i = 5
MessageRequester("Address",Str(@a))

View file

@ -0,0 +1,7 @@
a.i = 5
*b.Integer = @a ;set *b equal to the address of variable a
*c.Integer = $A100 ;set *c to point at memory location $A100 (in hex)
MessageRequester("Address",Str(*b)) ;display the address being pointed at by *b
MessageRequester("Value",Str(*b\i)) ;de-reference the pointer *b to display the data being pointed at

View file

@ -0,0 +1,2 @@
variable a
&a

View file

@ -0,0 +1,2 @@
variable b
100 @last !d->xt

View file

@ -0,0 +1,2 @@
needs bad'
^bad'pool @

View file

@ -0,0 +1 @@
100 ^bad'pool !

View file

@ -0,0 +1,7 @@
include c:\cxpl\codes;
int A, B;
[B:= addr A;
HexOut(0, B); CrLf(0);
B(0):= $1234ABCD;
HexOut(0, A); CrLf(0);
]