~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to packages/extra/rexx/test/callrexx.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Uses
2
 
{$IFDEF OS2}
3
 
  DosCalls,
4
 
{$ENDIF OS2}
5
 
  RexxSAA;
6
 
 
7
 
Var
8
 
  Arg: RxString;                       // argument string for REXX
9
 
  RexxRetVal: RxString;                // return value from REXX
10
 
  RC: Cardinal;                        // return code from REXX
11
 
Const
12
 
  Str: PChar = 'These words will be swapped'; // text to swap
13
 
  RexxRc: Integer = 0;                // return code from function
14
 
Begin
15
 
  Write('This program will call the REXX interpreter ');
16
 
  WriteLn('to reverse the order of the');
17
 
  Write(#9'words in a string.  ');
18
 
  WriteLn('The interpreter is invoked with an initial');
19
 
  Write(#9'environment name of "FNC" ');
20
 
  WriteLn('and a file name of "backward.fnc"');
21
 
 
22
 
  // By setting the strlength of the output RXSTRING to zero, we
23
 
  // force the interpreter to allocate memory and return it to us.
24
 
  // We could provide a buffer for the interpreter to use instead.
25
 
 
26
 
  RexxRetVal.StrLength:=0;          // initialize return to empty
27
 
 
28
 
  MakeRxString(Arg, Str, StrLen(Str)); // create input argument
29
 
 
30
 
  // Here we call the interpreter.  We don't really need to use
31
 
  // all the casts in this call; they just help illustrate
32
 
  // the data types used.
33
 
  RC:=RexxStart(1,                // number of arguments
34
 
                addr(arg),        // array of arguments
35
 
                'backward.fnc',   // name of REXX file
36
 
                0,                // No INSTORE used
37
 
                'FNC',            // Command env. name
38
 
                RXSUBROUTINE,     // Code for how invoked
39
 
                0,                // No EXITs on this call
40
 
                rexxrc,           // Rexx program output
41
 
                rexxretval );     // Rexx program output
42
 
 
43
 
  WriteLn('Interpreter Return Code: ', RC);
44
 
  WriteLn('Function Return Code:    ', rexxrc);
45
 
  WriteLn('Original String:         ', arg.strptr);
46
 
  WriteLn('Backwards String:        ', StrPas(rexxretval.strptr));
47
 
 
48
 
{$IFDEF OS2}
49
 
  DosFreeMem(RexxRetVal.StrPtr);   // Release storage
50
 
{$ELSE OS2}
51
 
  {$WARNING Memory allocated for RexxRetVal.StrPtr^ should be freed using native API!}
52
 
{$ENDIF OS2}
53
 
End.