en:docs:tk:som:sc:ug

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:docs:tk:som:sc:ug [2024/10/09 03:39] prokusheven:docs:tk:som:sc:ug [2024/10/11 09:04] (current) – [Include section (Preprocessing)] prokushev
Line 24: Line 24:
   * Undocumented SOMTTypes now documented.   * Undocumented SOMTTypes now documented.
   * SOMIPC now supports IDL 4.2 specification.   * SOMIPC now supports IDL 4.2 specification.
-  * CORBA C Language Mapping Specification 1.0 now supported by default instead of SOM C Language mapping.+  * CORBA C Language Mapping Specification 1.0 now supported by default instead of CORBA 1.1 C Language mapping.
   * Added support of OIDL files   * Added support of OIDL files
  
Line 141: Line 141:
 Latest IBM SOM 3.0 supports CORBA IDL mostly at level of CORBA 1.1. somFree supports CORBA IDL 4.2 with all extensions found in SOM IDL. Latest IBM SOM 3.0 supports CORBA IDL mostly at level of CORBA 1.1. somFree supports CORBA IDL 4.2 with all extensions found in SOM IDL.
  
-  * Include Directives (optional)+==== Preprocessing ==== 
 + 
 +IDL shall be preprocessed according to the specification of the preprocessor in ISO/IEC 14882:2003. The preprocessor may be implemented as a separate process or built into the IDL compiler. 
 + 
 +Lines beginning with # (also called "directives"communicate with this preprocessor. White space may appear before the #. These lines have syntax independent of the rest of IDL; they may appear anywhere and have effects that last (independent of the IDL scoping rules) until the end of the translation unit. The textual location of IDL-specific pragmas may be semantically constrained. 
 + 
 +A preprocessing directive (or any line) may be continued on the next line in a source file by placing a backslash character (\), immediately before the newline at the end of the line to be continued. The preprocessor effects the continuation by deleting the backslash and the newline. A backslash character may not be the last character in a source file. 
 + 
 +The primary use of the preprocessing facilities is to include definitions from other IDL specifications. Text in files included with a #include directive is treated as if it appeared in the including file. 
 + 
 +todo: #line 
 +todo: #pragma 
 + 
 +==== Syntax ==== 
   * Type and Constant Declarations (optional)   * Type and Constant Declarations (optional)
   * Exception Declarations (optional)   * Exception Declarations (optional)
Line 147: Line 161:
   * Module declaration (optional)   * Module declaration (optional)
  
 +==== Example ====
 Let's try to define our class interface. Let's try to define our class interface.
  
Line 163: Line 178:
 Ok. Imagine, we need class to have access to Java objects. Let's write a class interface in terms of Interface Definition Language. Ok. Imagine, we need class to have access to Java objects. Let's write a class interface in terms of Interface Definition Language.
  
-<code>+<code idl>
  #include <somobj.idl>  #include <somobj.idl>
    
Line 184: Line 199:
 Classic IDL file contains definitions like Classic IDL file contains definitions like
  
-<code>+<code idl>
  interface <class> : <parent_class>  interface <class> : <parent_class>
  {  {
Line 196: Line 211:
 [http://www.omg.org OMG] IDL doesn't support methods override. SOM IDL has such feature (and incompatibility with OMG CORBA). This is done via keyword '''implementation'''. To solve problems with other IDL compilers such part must be wrapped to #ifdef structure: [http://www.omg.org OMG] IDL doesn't support methods override. SOM IDL has such feature (and incompatibility with OMG CORBA). This is done via keyword '''implementation'''. To solve problems with other IDL compilers such part must be wrapped to #ifdef structure:
  
-<code>+<code idl>
  #include <somobj.idl>  #include <somobj.idl>
    
Line 298: Line 313:
 using this script: using this script:
  
-<code>+<code rexx>
  /* REXX - our best dog */  /* REXX - our best dog */
    
Line 335: Line 350:
 As result, you'll have following: As result, you'll have following:
  
-<code>+<code idl>
  #include <JavaObject.idl>  #include <JavaObject.idl>
    
Line 366: Line 381:
   * Methods section (optional)   * Methods section (optional)
  
-==== Include section ====+==== Include section (Preprocessing) ==== 
 + 
 +Include section handled by SPP preprocessor. Preprocessor is a simple tool which includes files pointed by include section into the original file.
  
 Include section is optional and contains names of OIDL files with definition of parent class, metaclasses and private interfaces of ancestor classes. Include section is optional and contains names of OIDL files with definition of parent class, metaclasses and private interfaces of ancestor classes.
Line 378: Line 395:
 ancestor is the name of the OIDL file containing the private part of an ancestor class' interface needed in the definition of this class. If ancestor is enclosed in angle brackets (%%<>%%), the search for the file will begin in system-specific locations. If parent is enclosed in double quotation marks (%%""%%), the search for the file will begin in the local context, then move to the system-specific locations. ancestor is the name of the OIDL file containing the private part of an ancestor class' interface needed in the definition of this class. If ancestor is enclosed in angle brackets (%%<>%%), the search for the file will begin in system-specific locations. If parent is enclosed in double quotation marks (%%""%%), the search for the file will begin in the local context, then move to the system-specific locations.
  
-parent is the name of the OIDL file containing the parent class of the class for which the Include statement is provided. If parent is enclosed in angle +parent is the name of the OIDL file containing the parent class of the class for which the Include statement is provided. If parent is enclosed in angle brackets (%%<>%%), the search for the file will begin in system-specific locations. If parent is enclosed in double quotation marks (%%""%%), the search for the file will begin in the local context, then move to the system-specific locations.
-brackets (%%<>%%), the search for the file will begin in system-specific locations. If parent is enclosed in double quotation marks (%%""%%), the search for the file will begin in the local context, then move to the system-specific locations.+
  
 metaclass is the OIDL file containing the metaclass of the class for which the include statement is provided. If metaclass is enclosed in angle brackets (%%<>%%), the search for the file will begin in system-specific locations. If metaclass is enclosed in double quotation marks (%%""%%), the search for the file will begin in the local context, then move to the system-specific locations. metaclass is the OIDL file containing the metaclass of the class for which the include statement is provided. If metaclass is enclosed in angle brackets (%%<>%%), the search for the file will begin in system-specific locations. If metaclass is enclosed in double quotation marks (%%""%%), the search for the file will begin in the local context, then move to the system-specific locations.
 +
 +todo: @ line "file" "filepath"
  
 ==== Class section ==== ==== Class section ====
Line 471: Line 489:
 2. Support both entry points (emitSL and emit) in emitters. 2. Support both entry points (emitSL and emit) in emitters.
 somFree emitters automatically switches to IBM SOM 2.1 ABI on emit call and to IBM SOM 3.0 ABI on emitSL call. somFree emitters automatically switches to IBM SOM 2.1 ABI on emit call and to IBM SOM 3.0 ABI on emitSL call.
 +
 +todo: add info abount internal structures like in http://www.edm2.com/index.php/OS/2_Application_Binary_Interface_for_PowerPC_(32-bit)   http://www.os2site.com/sw/dev/info/abippc32.pdf
 ====== Список литературы ====== ====== Список литературы ======
  
  
-  - Object Management Group, «C Language Mapping Specification 1.0,» [В Интернете]. Available: https://www.omg.org/spec/C/. [Дата обращения: 24 Август 2022]. +  - Object Management Group, "Language Mapping Specification 1.0, 1999" Available: https://www.omg.org/spec/C/ 
-  - IBM, OS/2 2.0 Technical Library. System Object Model Guide and Reference. First Edition., 1991https://www.os2museum.com/files/docs/os220tl/os2-2.0-som-1991.pdf +  - IBM, "OS/2 2.0 Technical Library. System Object Model Guide and Reference. First Edition, 1991 Available: https://www.os2museum.com/files/docs/os220tl/os2-2.0-som-1991.pdf 
- +  - Object Management Group, "The Common Object Request Broker: Architecture and Specification. Revision 1.1, 1991" Available: https://www.omg.org/spec/CORBA/1.1
  
  
  
  
 +{{page>en:templates:tksomc}}