
testfile.mpc   version 1.07
30-JAN-1998, David Mathog, Biology Division, Caltech

This is a testfile for miniproc.  It demonstrates most of the functions
and also shows some of the available programming tricks.  Run it with
a command line like:

  miniproc testfile.mpc test1=1 test2=0 test3=0


first=a simple string second=var third=3 3 spaces at end will NOT be removed   
a simple stringvar3
var4 is foobar first line of continued include var2 here-var-second line of continued and last line
var5 is var1
*var5 is <<*var5>>
Testing in line quoted substitution to standard output stream
#__var3=3 this could have been the first command
#__var3=3 this could have been the second command

Testing *var operations

Should be: *resolve1=base **resolve2=foo
Is:        *resolve1=base **resolve2=foo 

substitution level is 1

subs is a variable that changes the substitution level, it defaults to 1
you can change it on the command line by adding "subs=5", for instance. Set
it to zero to shut off substitution.

the line that follows and begins with BIGTEST should read
  BIGTEST < < < < var2 > >< < var3 > > >>  for subs level 0
  BIGTEST < < var3 > >                     for subs level 1
  BIGTEST 3                                for subs levels 2 and up
BIGTEST <<var3>>

The next line should be <<<<a simple string>>>> for subs level 1
<<<<a simple string>>>>

Testing redirect to second file test2.txt
back in test.txt after an append operation.

testing writing strings to output file.
first write this big old string                                         
next write this small string
next 2 lines are blank


preceding 2 lines are blank
Testing f$in and f$read by reading test2.txt twice
first pass reading and echoing test2.txt
  this is the first line of test2.txt
testing redirect back to, and appending to test.txt, after next line
  this is the last line of test2.txt
second pass reading and echoing test2.txt
  this is the first line of test2.txt
testing redirect back to, and appending to test.txt, after next line
  this is the last line of test2.txt
Close test2.txt by f$in with no filename

test redirect through f$in, several layers deep
 Also testing local integer and string variables
 and local macros

  This is input redirect level 1, going down
  This is input redirect level 2, going down
  This is input redirect level 3, going down
  This is input redirect level 4, going down
  This is input redirect level 5, going down
  This is input redirect level 5, going up
    Local variable :var   is 5
    Local variable :var2  is 0
    Local variable :var3  is a string with 5 in it
    Result of :localmacro is 32
  This is input redirect level 4, going up
    Local variable :var   is 4
    Local variable :var2  is 0
    Local variable :var3  is a string with 4 in it
    Result of :localmacro is 16
  This is input redirect level 3, going up
    Local variable :var   is 3
    Local variable :var2  is 0
    Local variable :var3  is a string with 3 in it
    Result of :localmacro is 8
  This is input redirect level 2, going up
    Local variable :var   is 2
    Local variable :var2  is 0
    Local variable :var3  is a string with 2 in it
    Result of :localmacro is 4
  This is input redirect level 1, going up
    Local variable :var   is 1
    Local variable :var2  is 0
    Local variable :var3  is a string with 1 in it
    Result of :localmacro is 2

Testing f$break,  the form of f$exit which must be used within
  if/elseif/else structures.  Create a command file break_test.mpc
  and then execute it.

   takebreak exists, using f$break to break back to main from test

Testing time functions:

  Time variables have been set to:

  day is Mon
  month is Feb
  wday is 2
  yday is 33
  dd is 2
  mm is 2
  yyyy is 1998
  hour is 11
  minute is 27
  second is 57
  unixtime is 886418877
  Results from f$file_info on testfile.mpc (which exists) are:
    exists   1
    size     22132
    modtime  886174356
  Results from f$file_info on notreal.mpc (which doesn't exist) are:
    exists   0
    size     22132
    modtime  886174356
testing f$evaluate add
  10 = add 1 2 3 4
  20 = add 1 2 3 4 intopA (intopA=10)
testing f$evaluate subtract
  -8 = subtract 1 2 3 4
  -18 = subtract 1 2 3 4 intopA (intopA=10)
testing f$evaluate multiply
  24 = multiply 1 2 3 4
  240 = multiply 1 2 3 4 intopA (intopA=10)
testing f$evaluate divide
  0 = divide 1 2 3 4
  0 = divide 1 2 3 4 intopA (intopA=10)
testing f$evaluate eq
  1 = eq 4 4 4 4
  0 = eq 0 4 4 4
  0 = eq 8 4 4 4
  0 = eq 4 4 4 16
  0 = eq 0 4 4 16
  0 = eq 8 4 4 16
  0 = eq 4 4 4 -4
  0 = eq 0 4 4 -4
  0 = eq 8 4 4 -4
testing f$evaluate ne
  0 = ne 4 4 4 4
  1 = ne 0 4 4 4
  1 = ne 8 4 4 4
  0 = ne 4 4 4 16
  1 = ne 0 4 4 16
  1 = ne 8 4 4 16
  0 = ne 4 4 4 -4
  1 = ne 0 4 4 -4
  1 = ne 8 4 4 -4
testing f$evaluate le
  1 = le 4 4 4 4
  1 = le 0 4 4 4
  0 = le 8 4 4 4
  1 = le 4 4 4 16
  1 = le 0 4 4 16
  0 = le 8 4 4 16
  0 = le 4 4 4 -4
  0 = le 0 4 4 -4
  0 = le 8 4 4 -4
testing f$evaluate ge
  1 = ge 4 4 4 4
  0 = ge 0 4 4 4
  1 = ge 8 4 4 4
  0 = ge 4 4 4 16
  0 = ge 0 4 4 16
  0 = ge 8 4 4 16
  1 = ge 4 4 4 -4
  0 = ge 0 4 4 -4
  1 = ge 8 4 4 -4
testing f$evaluate lt
  0 = lt 4 4 4 4
  1 = lt 0 4 4 4
  0 = lt 8 4 4 4
  0 = lt 4 4 4 16
  1 = lt 0 4 4 16
  0 = lt 8 4 4 16
  0 = lt 4 4 4 -4
  0 = lt 0 4 4 -4
  0 = lt 8 4 4 -4
testing f$evaluate gt
  0 = gt 4 4 4 4
  0 = gt 0 4 4 4
  1 = gt 8 4 4 4
  0 = gt 4 4 4 16
  0 = gt 0 4 4 16
  0 = gt 8 4 4 16
  0 = gt 4 4 4 -4
  0 = gt 0 4 4 -4
  1 = gt 8 4 4 -4
testing f$evaluate xor
  0 = xor 1 1 1 1
  1 = xor 1 0 0 0
  0 = xor 0 0 0 1
  0 = xor 1 0 0 0 0 1
  0 = xor 1 0 1 1
  0 = xor 1 1 1 1 1 0
  0 = xor 1 1 1 1
  0 = xor 0 0 0 0
  0 = xor 0 0 0 0 1
testing f$evaluate or
  1 = or 1 1 1 1
  1 = or 1 0 0 0
  1 = or 0 0 0 1
  1 = or 1 0 0 0 0 1
  1 = or 1 0 1 1
  1 = or 1 1 1 1 1 0
  1 = or 1 1 1 1
  0 = or 0 0 0 0
  1 = or 0 0 0 0 1
testing f$evaluate and
  1 = and 1 1 1 1
  0 = and 1 0 0 0
  0 = and 0 0 0 1
  0 = and 1 0 0 0 0 1
  0 = and 1 0 1 1
  0 = and 1 1 1 1 1 0
  1 = and 1 1 1 1
  0 = and 0 0 0 0
  0 = and 0 0 0 0 1
testing f$evaluate nor
  0 = nor 1 1 1 1
  0 = nor 1 0 0 0
  0 = nor 0 0 0 1
  0 = nor 1 0 0 0 0 1
  0 = nor 1 0 1 1
  0 = nor 1 1 1 1 1 0
  0 = nor 1 1 1 1
  1 = nor 0 0 0 0
  0 = nor 0 0 0 0 1
testing f$evaluate nand
  0 = nand 1 1 1 1
  1 = nand 1 0 0 0
  1 = nand 0 0 0 1
  1 = nand 1 0 0 0 0 1
  1 = nand 1 0 1 1
  1 = nand 1 1 1 1 1 0
  0 = nand 1 1 1 1
  1 = nand 0 0 0 0
  1 = nand 0 0 0 0 1
testing f$evaluate not
  0 = not 4
  1 = not 0
testing f$evaluate head
  [] = head 0 &first &second &third &fourth
  [firs] = head 4 &first &second &third &fourth
  [firstsecondt] = head 12 &first &second &third &fourth
  [firstsecondthirdfourth] = head 40 &first &second &third &fourth
testing f$evaluate tail
  [] = tail 0 &first &second &third &fourth
  [urth] = tail 4 &first &second &third &fourth
  [dthirdfourth] = tail 12 &first &second &third &fourth
  [firstsecondthirdfourth] = tail 40 &first &second &third &fourth
testing f$evaluate segment
  irst = segment 2 4 &first &second &third &fourth
  stsecondth = segment 4 10 &first &second &third &fourth
  ndthirdfourth = segment 10 100 &first &second &third &fourth
testing f$evaluate tostring
  10 = tostring 10 &%d
      0010 = tostring 10 &%8.4d
  (bell) = tostring 7 &%c
testing f$evaluate getenv
  status, getenv(home) = 1, usrdisk:[users.mathog]
testing f$evaluate tointeger
  1234 = tointeger &1234
testing f$evaluate tohex
  240 = tohex &F0
testing f$evaluate tooctal
  15 = tooctal &17
testing f$evaluate append
  FirstSecondThirdFourthBigAndLongAndLast = append &First &Second &Third &Fourth &BigAndLongAndLast
testing f$evaluate uppercase
  FIRSTSECONDTHIRDFOURTHBIGANDLONGANDLAST = uppercase &First &Second &Third &Fourth &BigAndLongAndLast
testing f$evaluate lowercase
  firstsecondthirdfourthbigandlongandlast = lowercase &First &Second &Third &Fourth &BigAndLongAndLast
testing f$evaluate shortest
  First = shortest &First &Second &Third &Fourth &BigAndLongAndLast
testing f$evaluate longest
  BigAndLongAndLast = longest &First &Second &Third &Fourth &BigAndLongAndLast
testing f$evaluate lexhigh
  Third = lexhigh &First &Second &Third &Fourth &BigAndLongAndLast
testing f$evaluate lexlow
  BigAndLongAndLast = lexlow &First &Second &Third &Fourth &BigAndLongAndLast
testing f$evaluate eliminate
  bEhj = eliminate  &abcDEFghijk &aBcDeFgHiJk
testing f$evaluate retain
  acDFgik = retain  &abcDEFghijk &aBcDeFgHiJk
testing f$evaluate stringdel
  cDi = stringdel &abcDEFghijk &ab &CD &Fg &Eh &jk
testing f$evaluate compare
  0 = compare  &abcDEFghijk &aBcDe &FgHiJk
  1 = compare  &abcdefghijk &abcde &fghijk
  1 = compare  &abcdefghijk &abcdefghijk
  0 = compare  &abcdefghijk &abcdefghijklonger
testing f$evaluate ccompare
  1 = ccompare  &abcDEFghijk &aBcDe &FgHiJk
  1 = ccompare  &abcdefghijk &abcde &fghijk
  1 = ccompare  &abcdefghijk &abcdefghijk
  0 = ccompare  &abcdefghijk &abcdefghijklonger
testing f$evaluate element
  first = f$evaluate stringresult element 1 &, &first,second,third,fourth
    status is  1
  third = f$evaluate stringresult element 3 &, &first,second,third,fourth
    status is  1
   = f$evaluate stringresult element 8 &, &first,second,third,fourth
    status is  0
testing f$evaluate locate
  4 = f$evaluate intresult locate &abc &123abc45678
  0 = f$evaluate intresult locate &Abc &123abc45678
  0 = f$evaluate intresult locate &6789 &123abc45678
  9 = f$evaluate intresult locate &678 &123abc45678
testing f$evaluate length
  20 = length  &abc &123abc45678 &foobar
testing f$evaluate resize
    stringresult=[this is the text string]
  make it bigger (enlarge to 1000 characters)
    stringresult=[this is the text string]
    STATUS is 1
  make it smaller (reduce to 5 characters)
    stringresult=[this]
    STATUS is 0
  make it as small as possible (reduce to 1 character)
    stringresult=[]
    STATUS is 0
Testing loop iteration in a macro, there should be 3 iterations
this is loop iteration 1
this is loop iteration 2
this is loop iteration 3
Testing if elseif else endif structure  with 
   test1 = 1
   test2 = 0
   test3 = 0
                            mtest1 is true
This is the macro contents1
It doesn't do much of anything
                            mtest1 is true mtest2 and mtest3 are false
This is the macro contents2
It doesn't do much of anything either

Testing ifnot, elseifnot  else endif structure  with 
   test1 = 1
   test2 = 0
   test3 = 0
                            mtest1 is true, mtest2 is false
Testing f$type
  The type of var3 is 1
  The type of var2 is 2
  The type of makemacro is 3
  The type of foobar is 0
Testing if, else with f$evaluate add
  f$evaluate add, correct choice
Testing if, else with f$evaluate add
  f$evaluate add, correct choice
Testing if, else with f$evaluate lexhigh
  f$evaluate lexhigh, correct choice
Testing if, else with f$evaluate lexlow
  f$evaluate lexlow, correct choice
Testing if, else with f$<- lexhigh
  f$<- lexhigh, correct choice
Testing if, else with f$<- lexlow
  f$<- lexlow, correct choice

Testing ifnot with string
  correct choice
  correct choice

Testing elseifnot with string
  correct choice
  correct choice

Testing ifnot with string function
  correct choice
  correct choice

Testing elseifnot with string function
  correct choice
  correct choice

Testing ifnot with int function
  correct choice
  correct choice

Testing elseifnot with int function
  correct choice
  correct choice
Testing pseudoarrays using macros to create and display the results
The array values are just the indices multiplied together
    myarray[1,1]=1
    myarray[1,2]=2
    myarray[1,3]=3
    myarray[1,4]=4
    myarray[2,1]=2
    myarray[2,2]=4
    myarray[2,3]=6
    myarray[2,4]=8
    myarray[3,1]=3
    myarray[3,2]=6
    myarray[3,3]=9
    myarray[3,4]=12
    myarray[4,1]=4
    myarray[4,2]=8
    myarray[4,3]=12
    myarray[4,4]=16
    myarray[5,1]=5
    myarray[5,2]=10
    myarray[5,3]=15
    myarray[5,4]=20
Calling secondary input file:

IN altprefix.mpc file:

Now testing macro 1

  MACRO1, altprefix is $

Now testing macro 2

  MACRO2, altprefix is ^

Now testing macro 3

  MACRO3, altprefix is @

Now testing macro 4

  MACRO2, altprefix is ~

IN testfile.mpc file:
Now testing macro 1

  MACRO1, altprefix is $

Now testing macro 2

  MACRO2, altprefix is ^

Now testing macro 3

  MACRO3, altprefix is @

Now testing macro 4

  MACRO2, altprefix is ~

