📄 pascal.txt
字号:
Borland Object Pascal - Getting Started Object Pascal Script
The purpose of this paper is to describe how to generate Borland Pascal code from class diagrams, state diagrams, and object interaction diagrams. These scripts are "getting started" scripts that must be updated for your development environment.
These scripts are "getting started" scripts that must be updated for your development environment.
1. Generating Pascal Code from a Class Diagram
Class Diagram: pascar.omt
Script Files: pascal1.sct
Main Files: pasuser.pas
The steps to generate Borland Object Pascal code and to compile the generated files are as follows:
>> Launch With Class from Windows
>> Open pascar.omt
>> Double click on each class to enter information in the Class Specification dialog box. Enter Unit name in
the File Name box and enter the Uses Unit names in the Include File box. Add a semicolon to the last unit
name
>> Select "Utilities - Generate Code File per Class"
>> Select pas as the custom file extension
>> Select pascal1.sct to generate the Pascal units
>> Select "File - Edit File" to examine the generated files, e.g. car.pas
>> Launch your Pascal environment
>> Compile, make, and build each generated file, e.g. VehicleU.pas, MotorUn.pas, CellulaU.pas,
PassengU.pas, TireUnit.pas, and CarUnit.pas.
>> Compile, make, build and execute pasuser.pas
Notes for generating Object Pascal (Turbo Pascal 5.5. or greater):
(1) In With Class enter the unit name in the class specification dialog box "File Name" field. The file name
becomes the unit file name and the unit name, e.g. file name = CarUnit.pas.
(2) For uses clause, enter the unit name in the Include Box. Enter the last unit followed by a ; e.g. UnitZ;
Ensure that the unit names entered in the Include Box are consistent with the unit names entered in the
CLASS_FILENAME Box.
(3) On the class diagram, insert parameters in the C++ form, e.g. Parameter_Type Parameter_Name - Integer
aNumber. The script variable PASCAL_OPERATION_PARAMETERS_WITH_VAR then puts the parameter
into the Pascal form, e.g. (Parameter_Name : Parameter_Type ; Var A_Parameter_Type : Parameter_Type) -
(A_Number : Integer ; Var A_Integer : Integer).
2. Generating Pascal Code from a State Diagram
************************************State Diagram*******************************************
State Diagrams: pastate.omt
Script Files: pastate.sct
The following are the general steps to test out the Object Pascal code generation scripts:
1. Create a directory for the state .omt files, script files, and Object Pascal files, e.g. WCSTATE.
2. Copy the appropriate files into each directory, e.g. copy st*.*.
3. In With Class open a state diagram, e.g. PASTATE.OMT.
4. Select Utilities - Generate State Code/Report to generate a text report. Enter a report file name,
e.g. RPTSTATE.TXT. Select a state report script, e.g. RPTSTATE.SCT, DDSTATE.SCT, or TABSTATE.SCT.
After report generation, select File - Edit File to examine the generated report.
5. Select Utilities - Generate Object Code/Report to generate Object Pascal code.
6. Enter the file name, e.g. CONTROLL.PAS
7. In the Object Pascal environment, compile and run the program.
8. Go back to With Class and update the state diagram with new states, events, conditions,
and actions and repeat the entire process.
3. Generating Pascal Code from an Object Interaction Diagram
*******************************************Object Interaction Diagram*******************************
Object Interaction Diagram: carobj.omt
Script Files: pasobmsg.sct
The steps to generate Borland Object Pascal messages to cut and paste into your Object Pascal code:
1. Open the object interaction diagram, e.g. carobj.omt
2. Select Generate Generate Generate Object Code/Report and select pasobmsg.omt
3. Enter the report file name, e.g. pasobmsg.txt
4. Cut each Object Pascal message and paste it into your class code.
4. Comments and suggestions are solicited. Richard Felsinger, RCF Associates 960 Scottland Dr, Mt Pleasant, SC 29464 71162.755@compuserve.com 803-881-3648
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -