32 lines
663 B
Text
32 lines
663 B
Text
Section Header
|
|
|
|
+ name := QUERY;
|
|
- external := `#define main _query_main`;
|
|
- external := `#define query Query`;
|
|
|
|
Section External
|
|
|
|
- query(buffer : NATIVE_ARRAY[CHARACTER], size : NATIVE_ARRAY[INTEGER]) : INTEGER <- (
|
|
+ s : STRING_CONSTANT;
|
|
+ len, result : INTEGER;
|
|
s := "Here am I";
|
|
len := s.count;
|
|
(len > size.item(0)).if {
|
|
result := 0;
|
|
} else {
|
|
1.to len do { i : INTEGER;
|
|
buffer.put (s @ i) to (i - 1);
|
|
};
|
|
size.put len to 0;
|
|
result := 1;
|
|
};
|
|
result
|
|
);
|
|
|
|
Section Public
|
|
|
|
- main <- (
|
|
+ buffer : NATIVE_ARRAY[CHARACTER];
|
|
+ size : NATIVE_ARRAY[INTEGER];
|
|
query(buffer, size); // need this to pull the query() method
|
|
);
|