Structure Definition Language

From VSI OpenVMS Wiki
Revision as of 15:57, 21 December 2022 by Jane.doe (talk | contribs) (Created page with "'''Structure Definition Language (SDL)''' is a language used to write source statements that describe data structures and that can be translated to source statements in other...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Structure Definition Language (SDL) is a language used to write source statements that describe data structures and that can be translated to source statements in other languages. OpenVMS contains an SDL translator program.

SDL declarations translate to the following types of data items:

  • Scalar or dimensioned scalar data items (ITEM declarations)
  • Nonscalar data items (AGGREGATE and subaggregate declarations)
  • Named constants (CONSTANT declarations)
  • External entries (ENTRY declarations)
Language Option Target File Type
Ada /LANGUAGES=ADA .ADA
BASIC /LANGUAGES=BASIC .BAS
BLISS /LANGUAGES=BLISS .R32, .R64
BLISS /LANGUAFGES=BLISSF .R32, .R64
BLISS /LANGUAFGES=BLISS64 .R64
C/C++ /LANGUAGES=CC .H
DCL /LANGUAGES=DCL .COM
DATATRIEVE /LANGUAGES=DTR .DTR
FORTRAN /LANGUAGES=FORTRAN .FOR
MACRO /LANGUAGES=MACRO .MAR
Pascal /LANGUAGES=PASCAL .PAS
Kednos PL/I /LANGUAGES=PLI .PLI
SDML /LANGUAGES=SDML .SDML
DECTPU /LANGUAGES=TPU .TPU
UIL /LANGUAGES=UIL .UIL

Example .SDL file:

MODULE opr_descriptor IDENT "Version 2.0";
/* define constants and node structure for operators;"
#max_args = 10;
CONSTANT (fixed_binary,floating,char,untyped) EQUALS 1 INCREMENT 1;
AGGREGATE operator STRUCTURE
    PREFIX "opr_";
    flink ADDRESS;
    blink ADDRESS;
    opcount WORD;
    optype CHARACTER LENGTH 1;
    id WORD;
    operands LONGWORD DIMENSION 0:#max_args-1;
END operator;
#opsize = .;
CONSTANT opr_node_size EQUALS #opsize / 2;
ITEM current_node_ptr ADDRESS GLOBAL;
END_MODULE opr_descriptor;

Example of how the file above is translated into BLISS definitions:

$ sdl/language=bliss test
$ type test.r32
! ********************************************************************************************************************************
!  Created: 21-Dec-2022 10:51:34 by OpenVMS SDL EV3-3
!  Source:  21-DEC-2022 10:51:14 MYDISK:[JDOE]TEST.SDL;1
! ********************************************************************************************************************************

!*** MODULE opr_descriptor IDENT Version 2.0 ***
!  define constants and node structure for operators;"
literal fixed_binary = 1;
literal floating = 2;
literal char = 3;
literal untyped = 4;
macro operator = 0,0,0,0 %;
literal opr_s_operator = 53;
macro opr_a_flink = 0,0,32,0 %;
macro opr_a_blink = 4,0,32,0 %;
macro opr_w_opcount = 8,0,16,1 %;
macro opr_t_optype = 10,0,8,0 %;
macro opr_w_id = 11,0,16,1 %;
macro opr_l_operands = 13,0,0,1 %;
literal opr_s_operands = 40;
literal opr_node_size = 26;
external current_node_ptr; 

Example of how the file above is translated into C definitions:

$ sdl/language=c test
$ type test.h
/********************************************************************************************************************************/
/* Created: 21-Dec-2022 10:53:23 by OpenVMS SDL EV3-3      */
/* Source:  21-DEC-2022 10:51:14 MYDISK:[JDOE]TEST.SDL;1 */
/********************************************************************************************************************************/
/*** MODULE opr_descriptor IDENT Version 2.0 ***/
#pragma __member_alignment __save
#pragma __nomember_alignment
/* define constants and node structure for operators;"                      */
#define fixed_binary 1
#define floating 2
#define char 3
#define untyped 4
struct operator {
    int *opr_a_flink;
    int *opr_a_blink;
    short int opr_w_opcount;
    char opr_t_optype;
    short int opr_w_id;
    int opr_l_operands [10];
    } ;
#define opr_node_size 26  

#pragma __extern_model __save
#pragma __extern_model __strict_refdef
extern int *current_node_ptr;
#pragma __extern_model __restore  


#pragma __member_alignment __restore