Classic Computer Magazine Archive PROGRAM LISTING: 88-10b/TOOLBOX.ACT


; ACTION! TOOLBOX
; BY KEVIN SHERRATT
; (c)1988, ANTIC PUBLISHING

MODULE
 BYTE Index,
      Match
 BYTE ARRAY String,
            Word,
            Comlist

PROC Wordfind()
 BYTE Start,
      Counter
 FOR Counter=Index TO String(0)
 DO
  IF String(Index)<>32 THEN
   EXIT
  FI
  Index==+1
 OD
 Start=Index
 FOR Counter=Index TO String(0)
 DO
  IF String(Index)=32 THEN
   EXIT
  FI
  Index==+1
 OD
 ScopyS(Word,String,Start,Index)
RETURN

PROC Matchup(BYTE ARRAY Command, List BYTE Increment)
 BYTE Counter1,
      Counter2
 Match=0
 FOR Counter1=1 TO List(0) STEP Increment
 DO
  IF Command(1)=List(Counter1) THEN
   Match=1
   FOR Counter2=2 TO Increment
   DO
    IF List(Counter1+Counter2-1)=32 THEN
     EXIT
    ELSEIF Command(Counter2)<>List(Counter1+Counter2-1) THEN
     Match=0:EXIT
    FI
   OD
  FI
  IF Match=1 THEN
   EXIT
  FI
 OD
 IF Match=1 THEN
  Match=Counter1
 FI
RETURN

PROC Caller()
 Comlist="DOG CAT COW MULE"
 Print("TYPE ONE OF THE FOLLOWING: ")
 PrintE(Comlist)
 InputS(String)
 Index=1
 Wordfind()
 Matchup(Word, Comlist, 4)
 PrintE(Word)
 PrintBE(Match)
RETURN



Back to previous page