The text of a manual · part 6 of 47
PDT 1100 Terminal Programmer's Guide: Chapter 2 Development Environment and Procedures, pages 37 to 46
Pages 37 to 46 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 37
Development Environment and Procedures
Table 2-1. Output from the Windows Compiler Output
Destination
Conditions
User program (object program)
File XXX.PD3 (in the directory When the specified source where the source program is program has been normally located) compiled without a syntax error or fatal error.
Error message (Syntax error)
File XXX.ERR (in the directory A syntax error is detected. where the source program is located)
Error message (Fatal error)
Main Window
Debug information
File XXX.ADR (in the directory The Debug information file check box is selected in the where the source program is Compiling Options dialog located) box. File XXX.LBL (in the directory where the source program is located)
Source line– Address information Label– Address information Variable– Intermediate language information
Address–Source list
A fatal error is detected.
File XXX.SYM (in the directory where the source program is located) File XXX.LST (in the directory The Address-source List check box is selected in the where the source program is Compiling Options dialog located) box.
Symbol table
The Symbol table check box is selected in the Compiling Options dialog box.
Cross reference
The X (Cross) reference check box is selected in the Compiling Options dialog box.
Sizes of variables
File XXX.ERR (in the directory The Variable size check box is selected in the Compiling where the source program is Options dialog box. located).
XXX represents a source program filename.
2-11
Page 38
PDT 1100 Terminal Programmer’s Guide
Displaying the Compile Result Files (XXX.ERR) Set the editor to display the XXX.ERR files generated by the Compiler: 1. From the Editor menu, choose Set Editor.
Figure 2-5. Editor Menu The Set Editor dialog box appears as shown below.
Figure 2-6. Set Editor Dialog Box 2. In the Command Line box, type the filename of the editor. If the editor is not located in the current directory or working directory, type the directory name. If you don't know the filename of the editor or the directory name, choose the Browse button in the Set Editor dialog box to display the Browse dialog box. Select the appropriate filename from the list, and choose the OK button.
Generating a User Program Use the same procedure as the Windows–based Compiler. Refer to Screen Shown During Execution of the Compiler on page 2-10.
Error Messages The Compiler may detect two types of compilation errors: syntax errors and fatal errors. The contents of the error output is the same as for the Windows–based Compiler.
2-12
Page 39
Development Environment and Procedures
Syntax Errors If the Compiler detects a syntax error, it outputs the error message to the XXX.ERR file opened by the editor preset by the Set Editor command in the Editor menu. The total number of the detected syntax errors appears on the main window.
Compiling the test TEST.SRC 0002 Error Statement Compiled End
36099010.eps
Figure 2-7. Syntax Error Screen
Fatal Errors If the Compiler detects a fatal error, it outputs the error message to the main window.
Compiling the test TEST.SRC fatal error 30: Cannot find include file “XXX”
36099010.eps
Figure 2-8. Fatal Error Screen
ERRORLEVEL The Windows-based Compiler does not support the ERRORLEVEL function.
2-13
Page 40
PDT 1100 Terminal Programmer’s Guide
Outputting Error Messages and Variables Size (if selected) The Compiler outputs error messages (if any) and variables size (if selected) to the XXX.ERR file. After compilation, if the XXX.ERR file has been made, the Compiler automatically opens the file by the preset editor. The default editor is the notepad.exe provided with Windows. Using an editor with the tag-jump function allows you to efficiently correct the source program file which caused an error. For details about the tag-jump function, refer to the user's manual of the editor.
36099013.eps
Figure 2-9. TEST.ERR Screen
Compiling Options Specifying the check box option in the Compiling Options dialog box causes the Compiler to output the specified debug information or list files. For details, refer to Generating a User Program on page 2-12. Table 2-2. List of Compiling Options Available Compiling Options
Description
Debug Outputs a debug information file. If this option is not selected, no debug information file information file is output (default). (For details, refer to the +D option in the Windows–based Compiler.) Address-source List
Outputs an address-source list to the file XXX.LST. If this option is not selected, no address-source list is output (default). (For details, refer to the +L option in the Windows–based Compiler.)
Symbol table
Outputs a symbol table to the file XXX.LST. If this option is not selected, no symbol table is output (default). (For details, refer to the +S option in the Windows– based Compiler.)
2-14
Page 41
Development Environment and Procedures
Table 2-2. List of Compiling Options Available (Continued) Compiling Options
Description
X (Cross) reference
Outputs a cross reference to the file XXX.LST. If this option is not selected, no cross reference is output (default). (For details, refer to the +X option in the Windows–based Compiler.)
Variable size
Outputs the sizes of common variables, work variables, and register variables to the file XXX.ERR. If this option is not selected, no variable size is output (default). (For details, refer to the +V option in the Windows–based Compiler.) [Example] C>BHTC3 prog2 +V The output for this example is as follows: Common = XXXXX bytes (XXXXX bytes on memory. XXXXX bytes in file) Work = XXXXX bytes (XXXXX bytes on memory. XXXXX bytes in file) Register = XXXXX bytes in file
The Windows-based Compiler does not support the +W option available in the Windows version.
Designating the Work Drive and Directory Designate the work drive and directory of the Compiler by setting the Windows environmental variables. If you don't designate them, the Compiler creates a directory according to the priority below. 1. In the directory set in the TMP. 2. In the directory set in the TEMP. (The Windows version does not refer to this environmental variable.) 3. In the directory where the Compiler is located, if no work drive or directory has been set in both the TMP and TEMP or if invalid values have been specified in them. During compilation, the Compiler creates a work file in the directory as defined above. After compilation, it erases the work file.
2-15
Page 42
PDT 1100 Terminal Programmer’s Guide
Downloading Ir-Transfer Utility C & Ir-Transfer Utility E Ir-Transfer Utility C & E transfers user programs and data files (e.g., master files) between the PDT 1100 and the connected Windows personal computer. It has the following functions: ! ! ! ! !
Downloading extension programs Downloading programs Downloading data Uploading programs Uploading data.
For operations of Ir-Transfer Utility C & E, refer to the PDT 1100 Terminal Transfer Utility Guide.
Setting up the PDT 1100 Before downloading user programs, initialize the RAM and flash ROM if the error message below appears. “System error ! Contact your administrator. Note the error drive. (DRIVE x)”
This message appears in the following cases: ! !
The PDT 1100 is first powered on from the time of purchase. The PDT 1100 is powered on after being left without battery cartridge loaded for a long time.
Caution Initialization erases all programs and data stored in the RAM and flash ROM and resets the system calendar clock and communications parameters to their defaults. Therefore, set those reset parameters in System Mode before accessing the download menu. For details about initialization and downloading, refer to the PDT 1100 Terminal Product Reference Guide.
2-16
Page 43
Development Environment and Procedures
Executing a User Program Starting To run a user program, start System Mode and select the desired program in the Program Execution menu. If you have selected a user program as an execution program in the Setting menu of System Mode, the PDT 1100 runs the user program when powered on. For the operating procedure of System Mode, refer to the PDT 1100 User's Manual.
Execution The Interpreter interprets and executes a user program from the first statement to the next, one by one.
Termination The PDT 1100 system program terminates a running user program if: ! ! !
the END, POWER OFF, or POWER 0 statement is executed in a user program, the power switch is pressed, no valid operations are performed within the specified time length (automatic powering-off) Valid operations:
- Entry by pressing any key - Bar code reading by pressing the trigger switch - Data transmission - Data reception
Specified time length:
Length of time specified by the POWER statement in the user program. If not specified in the program, three minutes applies.
the battery voltage level becomes low. Low battery: If the voltage level of the battery cartridge or that of the alkaline cells drops below the specified level, the PDT 1100 displays the low battery warning message on the LCD and powers itself off. If the resume function is activated in System Mode, only the execution of the END, POWER OFF, or POWER 0 statement can terminate a running user program. Other cases above merely turn off the power, so turning it on again resumes the program.
2-17
Page 44
PDT 1100 Terminal Programmer’s Guide
2-18
Page 45
Chapter 3 Program Structure Statement Blocks A statement block is a significant set of statements (also called “program routine”). The following types of statement blocks are available in programming the PDT 1100:
Subroutines A subroutine is a statement block called from the main routine or other subroutines by the GOSUB statement. Using the RETURN statement passes control from the called subroutine back to the statement immediately following the GOSUB statement in the original main routine or subroutine.
Error-/Event-Handling Routines An error- or event-handling routine is a statement block to which program control passes when an error trap or event (of keystroke) trap occurs during program execution, respectively. The RESUME statement passes control from the error-handling routine back to the desired statement. The RETURN statement in the keyboard interrupt event-handling routine returns control to the statement following the one that caused the interrupt.
Block-Format User-Defined Functions A user-defined function comes in two formats: one-line format and block format, both of which can be called from the main routine or subroutines. (Before calling user-defined functions, it is necessary to define those functions by DEF FN statements.)
3-1
Page 46
PDT 1100 Terminal Programmer’s Guide
The block-format user-defined function has the same structure as a statement block. Generally, it should be placed at the beginning of a program before the main routine starts.
Global Variables and Local Variables Global variables may be accessed by the same variable's name from any statement in a complete program. They include work variables, register variables, and common variables. Local variables are valid only within individual statement blocks where each of them is used. A dummy argument defined by the DEF FN statement is one of the local variables.
Block-Structured Statements The statements listed below have the statement block structure and are useful for structured programming. FOR...NEXT IF...THEN...ELSE...END IF SELECT...CASE...END SELECT WHILE...WEND
Nested Structure Block-structured statements allow you to write nesting programs as shown below. FOR i=1 TO 10 FOR j=2 TO 10 STEP 2 PRINT i, j, k NEXT j NEXT i
Nesting subroutines as shown below is also possible. GOSUB aaa : aaa PRINT “aaa” GOSUB bbb RETURN bbb PRINT “bbb” RETURN
3-2