The text of a manual · part 39 of 47
PDT 1100 Terminal Programmer's Guide: Appendix C Character Sets, pages 352 to 356
Pages 352 to 356 of 413, from PDT 1100 Terminal Programmer's Guide
The original document is the PDF (3.5 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Symbol PDT-1100
Page 352
Appendix J Program Samples Writing a Function Following is a sample function for receiving bar code and key entry. Feature:
This function determines whether bar code data or keyed data is entered first, and returns that data. If pressing the Backspace key or Clear key empties the input string, the function is ready to receive the subsequent bar code entry or key entry.
Returned value:
The function returns bar code or key entry received (before the ENT key is pressed) as a string.
Arguments:
f.no%
Specifies the file number which opens the bar code device file. (Invariant allowed)
bar$
Specifies bar code reading. (Invariant allowed) Ex. “M:10-20” max%
Specifies the maximum length of a returned string.
esc$
If a key(s) contained in this string is entered, the function returns the key entry only.
Work:
.kb$ and .rt$
If you use an invariant for f.no% or bar$, you don’t need to pass the value as an argument. The bar$ can pass a single type of bar code. If two or more types are required, directly describe necessary invariants. def fnbarkey$(f. no%, bar$, max%, esc$) while 1
J-1
Page 353
PDT 1100 Terminal Programmer’s Guide open “BAR:” as #f. no% code bar$ wait 0, 3 ' Wait for completion of bar code reading or key press. if loc(#f. no%) then beep ' Beep when bar code reading is completed. fnbarkey$ = input$(max%, #f. no%)
' For displaying: ' rt$ = input$(max%, #f. no%) : print .rt$; ' fnbarkey$ = .rt$ close #f. no% exit def else close #f. no% ' Receive only key entry. .rt$ = “” .kb$ = input$(1) while .kb$<>“” if instr(esc$, .kb$) then ' Key designated in esc$? fnbarkey$ = .kb$ ' Then, return the character. exit def endif select .kb$ case chr$(13) fnbarkey$ = .rt$ exit def case chr$(8) ' BS key. if len(.rt$) then print chr$(8); ' Erase one character. .rt$ = left$(.rt$, len(.rt$)-1) endif case chr$(24) ' Clear key. while len(.rt$) ' Erase all characters entered. print chr$(8); .rt$ = left$(.rt$, len(.rt$)-1) wend case else if len(.rt$)<max% then
' Check if only numeric data should be received. print .kb$; ' Echo back. .rt$ = .rt$ + .kb$ else beep ' Exceeded number of characters error. endif end select if .rt$=“” then ' If input string is empty, go back to the initial state. .kb$ = “”
J-2
Page 354
Program Samples else .kb$ = input$(1) ' Subsequent key entry. wend endif wend end def
Testing the Written Function while 1 'Infinite loop a$ = fnbarkey$ (1, “A”, 15, “DL”) 'F4 and SFT/F4 as escape characters. print if a$<>“D” and a$<>“L” then print “Data=”; a$ else print “ESC(“;a$;”) key push” endif wend end
J-3
Page 355
PDT 1100 Terminal Programmer’s Guide
J-4
Page 356
Appendix K Quick Reference for Statements and Functions Controlling Program Flow Statements
Definitions
CALL
Calls an FN3 function.
CHAIN
Transfers control to another program.
END
Terminates program execution.
FOR...NEXT
Defines a loop containing instructions to be executed a specified number of times.
GOSUB
Branches to a subroutine.
GOTO
Branches to a specified label.
IF...THEN...ELSE...END IF Conditionally executes specified statement blocks depending upon the evaluation of a conditional expression. ON...GOSUB
Branches to one of specified labels according to the value of an expression.
ON...GOTO
Branches to one of specified labels according to the value of an expression.
RETURN
Returns control from a subroutine or an event-handling routine (for keystroke interrupt).
SELECT... CASE...END SELECT
Conditionally execute a statement block depending upon the value of an expression.
WHILE...WEND
Continues to execute a statement block as long as the conditional expression is true.
K-1