Home Page   We Generate Your Software.
Products Services Company Technology Demo Contact Site Map Search
Please note: this document is currently under revision.
The information herein contained, while still valid, does not reflect the latest state of the described technology.
The Somusar/SoProTech[tm] Booklet Series
Volume IV

"somusar/Tefigel: A Tutorial Introduction"

Printer friendly


Contents
1. Introduction
2. Language Summary
3. Text File Components
4. Text File Processing
5. Modularity
6. Multilanguage Applicability
7. Generating Object-oriented Languages
8. Generating Internet-oriented Languages and Protocols
9. Generating Procedural Languages
9.1 C
9.2 Visual Basic®
9.3 COBOL
9.4 RPG
10. Generating Scripting or Special-purpose Languages
11. Advanced Features and Topics
12. A More Extensive Example
13. Further Reading

Chapter 9 - Generating Procedural Languages

9.1 - C        top

Code Example 28 - Generating C
Generate set and get "methods" for two "members" of a C "class".
Source code - File "language/c_getset"
    1      @ dash &
    2      @ language/c/get_set(int,Quantity,quantity)
    3      @ language/c/get_set(double,Percentage,percentage)
	       
Output of "/opt/somusar/bin/tefigel language/c_getset"
    1      static int quantity;
    2      
    3      int getQuantity() {
    4          return quantity;
    5      }
    6      
    7      void setQuantity( int v_quantity ) {
    8          quantity = v_quantity;
    9      }
   10      
   11      static double percentage;
   12      
   13      double getPercentage() {
   14          return percentage;
   15      }
   16      
   17      void setPercentage( double v_percentage ) {
   18          percentage = v_percentage;
   19      }
   20      
	       

C get/set subroutine - File "language/c/get_set"
    1      @ interface(TYPE,IdId,idId)
    2      static TYPE idId;
    3      
    4      TYPE get&IdId() {
    5          return idId;
    6      }
    7      
    8      void set&IdId( TYPE v_&idId ) {
    9          idId = v_&idId;
   10      }
   11      
	       

9.2 - Visual Basic®        top

Code Example 29 - Generating Visual Basic®
Visual Basic® fragment containing a comment and a message to be printed out in a message box.
Source code - File "language/vbasic"
    1      @ set msg=Hello!
    2      ' Print out a message
    3      MsgBox "The message is: msg"
    4      
	       
Output of "/opt/somusar/bin/tefigel language/vbasic"
    1      ' Print out a message
    2      MsgBox "The message is: Hello!"
    3      
	       

9.3 - COBOL        top

Code Example 30 - Generating COBOL
Small fragment of PROCEDURE DIVISION that prints out a message.
Source code - File "language/cobol"
    1      @ set program_name=PROGRAM 0
    2      @ set hello_message=Hello, world!
    3            ****************************************************************
    4             PROCEDURE DIVISION.
    5             P0.
    6            ** print a message
    7                 DISPLAY 'program_name: hello_message'.
    8      
	       
Output of "/opt/somusar/bin/tefigel language/cobol"
    1            ****************************************************************
    2             PROCEDURE DIVISION.
    3             P0.
    4            ** print a message
    5                 DISPLAY 'PROGRAM 0: Hello, world!'.
    6      
	       

9.4 - RPG        top

Code Example 31 - Generating RPG
RPG fragment containing a comment and a message to be printed out.
Source code - File "language/RPG"
    1      @ set msg=Unknown Code
    2       * Display an error message
    3      Dtext               m                       msgtext('msg')
	       
Output of "/opt/somusar/bin/tefigel language/RPG"
    1       * Display an error message
    2      Dtext               m                       msgtext('Unknown Code')
	       

[Previous chapter]    [Next chapter]    [Back to top]

http:// www.somusar.com  / doc  / booklets  / tefigel_tut  - Powered by SoProMach
Copyright © 2003-2012 Somusar - Trademarks - Legal - Privacy - Webmaster