~ubuntu-branches/ubuntu/dapper/fpc/dapper

« back to all changes in this revision

Viewing changes to packages/extra/rexx/test/backward.fnc

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Laviola
  • Date: 2004-08-12 16:29:37 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040812162937-moo8ulvysp1ln771
Tags: 1.9.4-5
fp-compiler: needs ld, adding dependency on binutils.  (Closes: #265265)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*********************************************************************/
 
2
/* BACKWARD.FNC - Reverse the words in a string                      */
 
3
/*                                                                   */
 
4
/* This program is called by CALLREXX.EXE.                           */
 
5
/*                                                                   */
 
6
/* Input:  A string of words                                         */
 
7
/*                                                                   */
 
8
/* Output: A string containing the same words but in opposite order  */
 
9
/*                                                                   */
 
10
/*********************************************************************/
 
11
 
 
12
Parse Arg Data                         /* get argument string        */
 
13
OutString = ''                         /* initialize output to empty */
 
14
Count = Words(Data)                    /* find number of words       */
 
15
Do i = Count To 1 By -1                /* for each word in string    */
 
16
   OutString = OutString Word(Data,i)  /*   add word to output string*/
 
17
End /* end do */
 
18
Return Strip(OutString)                /* return reversed string,    */
 
19
                                       /* removing any blanks on the */
 
20
                                       /* front or back.             */
 
21