⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 borland.txt

📁 c#设计模式WithCla
💻 TXT
字号:
Generating C++ for Borland C++

The purpose of this paper is to describe how to generate Borland C++ 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. Borland C++ Version 3.X - Getting Started BC 3X Script

Class Diagram: bc3car.omt
Script Files: bc3head.sct and bcfunc.sct  
Main File: bcmain.cpp

The steps to generate C++ and to compile the generated files are as follows:

>> Launch With Class from Windows
>> Open bc3car.omt
>> Double click on the Car class and select Class Spec dialog box and enter the include file listimp.h.
This is for the BI_ListImp <XXX> Class to implement 1 to Many relationships
>> Select "Utilities - Generate Code File per Class"
>> Select h as the file extension
>> Select bc3head.sct to generate the header files (.h)
>> Select "Utilities - Generate Code File per Class"
>> Select cpp as the file extension
>> Select bcfunc.sct to generate the source code files (.cpp)
>> Select "File - Edit File" to examine the generated files, e.g. car.h
>> Launch Borland C++ Version 3.X
>> Create the Car Project, e.g. carproj.mak
>> Add the .cpp files to the project
>> Compile all .cpp files
>> Compile bcmain.cpp
>> Execute the project

Notes for Borland C++ 3.X.  The script bc3head.sct prints the include file #include <listimp.h> for 1 : Many relationships for the BI_ListImp collection class.  To use another collection class update bc3head.sct for another collection class and include file.  If desired change BI_ListImp in this script to BI_ArrayAsVector with arrays.h or BI_StackAsVector with stacks.h or BI_BagAsVector with bags.h.   You may enter other include file names in the include box in With Class, e.g. strng.h for String class. 

In Borland C++ 3.X enter the following options:
Application: Large Memory Model
Linker Link Libraries: Static for all libraries
Include Directories: c:\bc\include;c:\bc\owl\include; c:\bc\classlib\include
Library Directories: c:\bc\lib;c:\bc\owl\lib;c:\classlib\lib;
Compiler - Code Generation - Defines WIN31

2. Borland C++ Version 4.X with EasyWin - Getting Started BC 4X Script

Class Diagram: bc4car.omt
Script Files: bc4head.sct and bcfunc.sct 
Main File: bcmain.cpp

The steps to generate Borland 4.X C++ and to compile the generated files are as follows:

>> Launch With Class from Windows
>> Open bc4car.omt
>> Double click on the Car class and select Class Spec dialog box and enter the include file classlib\listimp.h.
This is for the TListImp <XXX> Class to implement 1 to Many relationships
>> Select "Utilities - Generate Code File per Class"
>> Select h as the file extension
>> Select bc4head.sct to generate the header files (.h)
>> Select "Utilities - Generate Code File per Class"
>> Select cpp as the file extension
>> Select cppfunc.sct to generate the source code files (.cpp)
>> Select "File - Edit File" to examine the generated files, e.g. car.h
>> Run your C++ environment
>> Create the Car Project, e.g. carproj.mak
>> Add the .cpp files to the project
>> Compile all .cpp files
>> Compile bcmain.cpp
>> Execute the project

Notes for Borland C++ 4.X.  Enter include file names in the include box in With Class, e.g. cstring.h for string class.  For 1 : Many relationships enter classlib\listimp.h in the include box for TListImp <XXX> class.  XXX represents the class names of the objects in the collection, e.g. Passenger.  If desired change TListImp in this script with TArray with classlib\arrays.h, TStack with classlib\stacks.h, TBag with classlib\bags.h.

3. C++ Code Generation from State Diagrams
The following are the general steps to test out the C++ code generation scripts from state diagrams:

  1. Create a directory for the state .omt files, script files, and C++ 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. ST1STATE.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 State Code/Report" to generate C++ code.

  6. Enter the header file name, e.g. CONTROLL.H

  7. Select the header code generation script, e.g. STAHEAD1.SCT.

  8. Select "Edit - Edit File" and open CONTROLL.H for review.

  9. Select "Utilities - Generate State Code/Report".

  10. Enter the source file name, e.g. CONTROLL.CPP

  11. Select the source code generation script, e.g. STAFUNC1.SCT.

  12. Select "Edit - Edit File" and open CONTROLL.CPP for review.

  13. In your C++ environment, create a project, e.g. STATE1.MAK and add the CONTROLL.CPP and ST1MAIN1.CPP.

  14. Compile and run the program.  

  15. Go back to With Class and update the state diagram with new states, events, conditions, and actions and repeat the entire process.
4. Creating Message Sequence Tables from Object Interaction Diagrams
Object Interaction Diagram: CAROBJ.OMT
Script File: TABOBMSG.SCT

The following are the general steps to generate the message sequence table and then update C++ code with messages.
- Open the object interaction diagram, e.g. CAROBJ.OMT.
- Select "Utilities - Generate Object Code/Report".
- Enter a report name, e.g. TABMSG.TXT.
- Browse and select the message sequence table script, e.g. TABOBMSG.SCT to generate the message sequence table.
- Cut and paste messages from the message sequence table into your code.
- As required update the object interaction diagram and the message sequence script (TABOBMSG.SCT) and repeat the process.

5. Updated scripts are requested.  Many thanks, Richard Felsinger, RCF Associates, 960 Scottland Dr, Mt Pleasant, SC 29464 telephone 803-881-3648 e-mail 71162.755@compuserve.com.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -