
538
Appendix I
Appendix IAppendix I
Appendix I
Program Samples
Program SamplesProgram Samples
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
function 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
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
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$ = ""
Comentarios a estos manuales