Download SIMSCRIPT II.5 User`s Manual
Transcript
2 Developing Simulation Models Using Command-Line Interface Developing a SIMSCRIPT II.5 program using command-line interface commands typically involves the following steps: 1. Preparing one or more SIMSCRIPT II.5 source files using a text editor. 2. Compiling the program and checking for compilation errors. 3. Editing and re-compiling the program, as needed, until there are no compilation errors. 4. Linking the object files generated by the compiler to produce an executable file. 5. Executing the program. 6. Debugging the program. In case of errors during execution, the program should be compiled with the debugging option linked and then executed with the interactive SIMSCRIPT symbolic debugger to examine the state of the program and find the cause of the error. 2.1 Preparing Source Files A SIMSCRIPT II.5 program may be prepared using vi, emacs or any other text editor. If the program is small, it is convenient to store the entire program within a single file. If the program is large, it is best to store each routine in a file of its own. Files containing SIMSCRIPT II.5 source code must be given names that end with .sim or .SIM. Although not a requirement, it is easier to compile and link a SIMSCRIPT II.5 program that is stored in a directory of its own; i.e., a directory containing the entire source files of the program in question and none of the source files of other programs. 2.2 Compiling The SIMSCRIPT II.5 compiler translates a program written in the SIMSCRIPT II.5 programming language into one or more object files. The compiler uses C as an intermediate language, but this is transparent to you, the SIMSCRIPT II.5 program developer. The compiler will write diagnostics — error messages and warning messages — to stderr. Errors prevent the generation of object files; warnings do not. See Appendix A for a complete list of error and warning messages that are issued by the compiler. The simc command is used to invoke the SIMSCRIPT II.5 compiler and linker. Its general form is: % simc [option] file.sim ... For example, to compile and link a program consisting of a single source file named