' SEARCH.LST
' --------
' SEARCH.INL, 50 Bytes
INLINE quoted%,50
'
' Searchstring:
'
a$="This is a ® string ¯ in which the  ®® positions ¯  of quotation ¯  marks will be searched for."
quopen%=174      ! ASCII Quotation marks open
quclose%=175     ! ASCII Quotation marks close
locat%=55       ! ASCII Position in test string (a$)
'
' Search for quotation marks
'
ALERT 2,"Search for quotation marks |in GFA-Basic|or GFA-Assembler?",1,"Basic|Ass.",question%
t=TIMER
'
' GFA-Basic
IF question%=1
  prop%=@search(VARPTR(a$),quopen%,quclose%,locat%)
ELSE
  ' GFA-Assembler:
  '
  ' Calling assembler program, with
  '   L:V:a$  = the address of the string information
  '   quopen%  = Quotation marks left
  '   quclose% = Quotation marks right
  '   locat%  = Position of character to be analysed
  '   prop%    = Properties of character 55
  '         0: outside of quotation marks
  '       <>0: inside of quotation marks
  prop%=C:quoted%(L:V:a$,quopen%,quclose%,locat%)
ENDIF
'
tt=(TIMER-t)/200
t$=STR$(tt)
'
PRINT " Test string: |12345678901234567890123456789012345678901234567890|"
test$=a$
WHILE test$<>""
  PRINT TAB(14);"|";LEFT$(test$,50);"|"
  test$=MID$(test$,51)
  IF locat%<50 AND locat%>=0
    PRINT TAB(15+locat%);"^"
  ENDIF
  SUB locat%,50
WEND
PRINT "Properties of character at position specified: ";prop%
IF prop%<=0
  PRINT "The character is outside the quotation marks."
ELSE
  PRINT "The character is inside the quotation marks."
ENDIF
'
IF question%=1
  ALERT 1,"Searching for quotation marks | in GFA-Basic takes|"+t$+" seconds.",1," OK ",d%
ELSE
  ALERT 1,"Searching for quotation marks | in GFA-Assembler takes|"+t$+" seconds.",1," OK ",d%
ENDIF
'
EDIT
'
FUNCTION search(p%,auf%,zu%,pos%)
  LOCAL prop%
  prop%=0
  FOR m%=p% TO p%+pos%-1
    IF BYTE{m%}=auf%
      INC prop%
    ENDIF
    IF BYTE{m%}=zu%
      DEC prop%
    ENDIF
  NEXT m%
  RETURN prop%
ENDFUNC
