Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,34 @@
include c:\cxpl\codes; \intrinsic 'code' declarations
string 0; \use zero-terminated strings
proc QSort(Array, Num); \Quicksort Array into ascending order
char Array; \address of array to sort
int Num; \number of elements in the array
int I, J, Mid, Temp;
[I:= 0;
J:= Num-1;
Mid:= Array(J>>1);
while I <= J do
[while Array(I) < Mid do I:= I+1;
while Array(J) > Mid do J:= J-1;
if I <= J then
[Temp:= Array(I); Array(I):= Array(J); Array(J):= Temp;
I:= I+1;
J:= J-1;
];
];
if I < Num-1 then QSort(@Array(I), Num-I);
if J > 0 then QSort(Array, J+1);
]; \QSort
func StrLen(Str); \Return number of characters in an ASCIIZ string
char Str;
int I;
for I:= 0 to -1>>1-1 do
if Str(I) = 0 then return I;
char Str;
[Str:= "Pack my box with five dozen liquor jugs.";
QSort(Str, StrLen(Str), 1);
Text(0, Str); CrLf(0);
]