548
Appendix I
Program Samples
Writing the function for receiving both bar code entry and key entry
Feature:
This function receives earlier one of either bar code entry or key entry. If bar
code reading is completed, the function returns the scanned bar code data; if
key entry comes first, the function inhibits bar code reading and echoes back
the key entry data, then returns the key entry data when the ENT key is
pressed.
If pressing the BS key or C key makes the input string empty, then the func-
tion becomes ready to receive the subsequent bar code entry or key entry.
Returned value: The function returns bar code data or key entry data which has come in until
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$
, it is not necessary to pass the value as an argu-
ment.
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
open "BAR:" as #f. no% code bar$
wait 0, 3
’Wait for completion of bar code reading or key entry.
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$?
Summary of Contents for BHT-BASIC 100 SERIES
Page 1: ......
Page 161: ...153 Chapter 10 Sleep Function CONTENTS 10 1 Sleep Function 154...
Page 163: ...155 Chapter 11 Resume Function CONTENTS 11 1 Resume Function 156...
Page 173: ...165 Chapter 13 Backlight Function CONTENTS 13 1 Backlight Function 166...
Page 249: ...241 Example CLOSE IF kyIn Y THEN KILL Master Dat END IF Reference Statements CLFILE...