$CPU 8086 ' make compatible with XT systems $LIB ALL OFF ' turn off all PowerBASIC libraries $ERROR ALL OFF ' turn off all PowerBASIC error checking $OPTIMIZE SIZE ' optimize for smaller code $COMPILE UNIT ' compile to a UNIT (.PBU) '$COMPILE EXE ' compile to a UNIT (.PBU) DEFINT A-Z ' Required for all numeric functions, forces PB to not ' include floating point in UNIT (makes it smaller) '/*------------------------------------------------------------------*/ $CODE SEG "MLIB1" '/*------------------------------------------------------------------*/ ' GETPARM(OPT$,SEARCH$) ' Searchs OPT$ for match of SEARCH$. If found, a string is returned ' containing the text bound in '' that immediately follow SEARCH$. ' EXAMPLE: OPT$ = "WS'10' FILL'176' ALLOW'ABCDEFGH'" ' WS = VAL(GETPARM(OPT$,"WS") WS = 10 ' FILLCHAR$ = CHR$(VAL(GETPARM(OPT$,"FILL"))) ° ' ALLOW$ = GETPARM(OPT$,"ALLOW") ABCDEFG '/*------------------------------------------------------------------*/ FUNCTION GETPARM(OPT$,SEARCH$) PUBLIC AS STRING FUNCTION = "" SPF = INSTR(1,UCASE$(OPT$),UCASE$(SEARCH$)) IF SPF > 0 THEN L = LEN(SEARCH$) EP = INSTR(SPF+L+1,OPT$,"'") FUNCTION = MID$(OPT$,SPF+L+1,EP-SPF-L-1) END IF END FUNCTION '/*------------------------------------------------------------------*/