RosettaCodeData/Task/Use-another-language-to-call-a-function/Lisaac/use-another-language-to-call-a-function-1.lisaac
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

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
);