$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 "MLIB4" '/*--------------------------------------------------------- ' CWORD() ' Returns the word at the current cursor location. ' EXAMPLE: T$ = CWORD '/*--------------------------------------------------------- FUNCTION CWORD() PUBLIC AS STRING ML$ = "" MR$ = "" MCOL = POS MROW = CSRLIN CNT = 0 DO T = SCREEN(MROW,MCOL+CNT,0) IF T <> 32 THEN MR$ = MR$ + CHR$(T) CNT = CNT + 1 END IF LOOP UNTIL T = 32 OR CNT = 80 CNT = 1 DO T = SCREEN(MROW,MCOL-CNT,0) IF T <> 32 THEN ML$ = CHR$(T) + ML$ CNT = CNT + 1 END IF LOOP UNTIL T = 32 OR (MCOL-CNT) < 1 CWORD = ML$ + MR$ END FUNCTION '/*--------------------------------------------------------- ' CLS ' LOCATE 1,1 ' PRINT "Testing CWORD function" ' LOCATE 1,10 ' A$ = CWORD ' LOCATE 3,1 ' PRINT A$ ' INPUT Z