IBM
Contents Index Previous Next



The Symbol Table


The symbol table is used for storing information mainly about the static properties of the SDL system, such as the block structure, connections of channels and the valid input signal set for processes. Some dynamic properties are also placed in the symbol table; for example the list of all active process instances of a process instance set. This is part of the node representing the process instance set.

The nodes in the symbol table are structs with components initialized in the declaration. During the initialization of the application, in the yInit function in generated code, a tree is built up from these nodes.

Symbol Table Tree Structure

The symbol table is created in two steps:

  1. First, symbol table nodes are declared as structs with components initialized in the declaration (in generated code).
  2. Then, the yInit function (in generated code) updates some components in the nodes and builds a tree from the nodes. This operation is not needed in an application!

The following names can be used to refer to some of the nodes that are always present. These names are defined in scttypes.h.

xSymbolTableRoot
xEnvId
xSrtN_SDL_Bit
xSrtN_SDL_Bit_String
xSrtN_SDL_Boolean
xSrtN_SDL_Character
xSrtN_SDL_Charstring
xSrtN_SDL_Duration
xSrtN_SDL_IA5String
xSrtN_SDL_Integer
xSrtN_SDL_Natural
xSrtN_SDL_Null
xSrtN_SDL_NumericString
xSrtN_SDL_Object_Identifier
xSrtN_SDL_Octet
xSrtN_SDL_Octet_String
xSrtN_SDL_PId
xSrtN_SDL_PrintableString
xSrtN_SDL_Real
xSrtN_SDL_Time
xSrtN_SDL_VisibleString

xSymbolTableRoot is the root node in the symbol table tree. Below this node the system node is inserted. After the system node, there is a node representing the environment of the system (xEnvId). Then there is one node for each package referenced from the SDL system. This is true also for the package predefined containing the predefined data types. The nodes for the predefined data types, that are sons to the node for the package predefined, can be directly referenced by the names xSrtN_SDL_xxx, according to the list above.

Nodes in the symbol table are placed in the tree exactly according its place of declaration in SDL. A node that represent an item declared in a block is placed as a child to that block node, and so on. The hierarchy in the symbol table tree will directly reflect the block structure and declarations within the blocks and processes.

A small example can be found in Figure 559. The following node types will be present in the tree:

Node Type Description
xSystemEC

Represent the system or the system instance.

xSystemTypeEC

Represents a system type.

xPackageEC

Represents a package.

xBlockEC

Represent blocks and block instances.

xBlockTypeEC

Represents a block type.

xBlockSubstEC

Represents a block substructure and can be found as a child of a block node.

xProcessEC

Represent processes and process instances. The environment process node is placed after the system node and is used to represent the environment of the system.

xProcessTypeEC

Represents a process type.

xServiceEC

Represents a service or service instance.

xServiceTypeEC

Represents a service type.

xProcedureEC

Represents a procedure.

xOperatorEC

Represents an operator diagram, i.e. an ADT operator with an implementation in SDL.

xCompoundStmtEC

Represents a compound statement containing variable declarations.

xSignalEC 

xTimerEC

Represents a signal or timer type.

xRPCSignalEC

Represents the implicit signals (pCALL, pREPLY) used to implement RPCs.

xSignalParEC

There will be one signal parameter node, as a child to a signal, timer, and RPC signal node, for each signal or timer parameter.

xStartUpSignalEC

Represents a start-up signal, that is, the signal sent to a newly created process containing the actual FPAR parameters. An xStartUpSignalEC node is always placed directly after the node for its process.

xSortEC
xSyntypeEC

Represents a newtype or a syntype.

Struct Component 
Node 
(xVariableEC)

A sort node representing a struct has one struct component node as child for each struct component in the sort definition.

xLiteralEC

A sort node similar to an enum type has one literal node as child for each literal in literal list.

xStateEC

Represents a state and can be found as a child to process and procedure nodes.

xVariableEC 
xFormalParEC

Represents a variable (DCL) or a formal parameter (FPAR) and can be found as children of process and procedure nodes.

xChannelEC 
xSignalRouteEC

xGate

Represents a channel, a signal route, or a gate.

xRemoteVarEC

Represents a remote variable definition.

xRemotePrdEC

Represents a remote procedure definition.

xSyntVariableEC

Represents implicit variables or components introduced by the Cadvanced/Cbasic SDL to C Compiler. Used only by the Explorer.

xSynonymEC

Represent synonyms. Used only by the Explorer.

The nodes (the struct variables) will in generated code be given names according to the following table:

ySysR_SystemName
        (system, system type, system instance)
yPacR_PackageName
yBloR_BlockName
        (block, block type, block instance)
yBSuR_SubstructureName
yPrsR_ProcessName
        (process, process type, process instance)
yPrdR_ProcedureName  (procedure, operator)
ySigR_SignalName
        (signal, timer, startup signal, RPC signal)
yChaR_ChannelName    (channel, signal route, gate)
yStaR_StateName
ySrtR_NewtypeName    (newtype, syntype)
yLitR_LiteralName
yVarR_VariableName
       (variable, formal parameter, signal
        parameter, struct component, synt.variable)
yReVR_RemoteVariable
yRePR_RemoteProcedure

In most cases it is of interest to refer to a symbol table node via a pointer. By taking the address of a variable according to the table above, i.e.

& yPrsR_Process1

such a reference is obtained. For backward compatibility, macros according to the following example is also generated for several of the entity classes:

#define yPrsN_ProcessName  (&yPrsR_ProcessName)

Types Representing the Symbol Table Nodes

The following type definitions, from the file scttypes.h, are used in connection with the symbol table:

typedef enum {
  xRemoteVarEC,
  xRemotePrdEC,
  xSignalrouteEC,
  xStateEC,
  xTimerEC,
  xFormalParEC,
  xLiteralEC,
  xVariableEC,
  xBlocksubstEC,
  xPackageEC,
  xProcedureEC,
  xOperatorEC,
  xProcessEC,
  xProcessTypeEC,
  xGateEC,
  xSignalEC,
  xSignalParEC,
  xStartUpSignalEC,
  xRPCSignalEC,
  xSortEC,
  xSyntypeEC,
  xSystemEC,
  xSystemTypeEC,
  xBlockEC,
  xBlockTypeEC,
  xChannelEC,
  xServiceEC,
  xServiceTypeEC,
  xCompoundStmtEC,
  xSyntVariableEC
  xMonitorCommandEC
}   xEntityClassType;


typedef enum {
  xPredef, xUserdef, xEnum,
  xStruct, xArray, xGArray, xCArray,
  xOwn, xORef, xRef, xString,
  xPowerSet, xGPowerSet, xBag, xInherits, xSyntype,
  xUnion, xUnionC, xChoice
}   xTypeOfSort;

typedef char  *xNameType;


typedef struct xIdStruct {
   xEntityClassType  EC;
#ifdef XSYMBTLINK
   xIdNode           First;
   xIdNode           Suc;
#endif
   xIdNode           Parent;
#ifdef XIDNAMES
   xNameType         Name;
#endif
}  xIdRec;


                            /*BLOCKSUBSTRUCTURE*/
typedef struct xBlockSubstIdStruct {
   xEntityClassType  EC;
#ifdef XSYMBTLINK
   xIdNode           First;
   xIdNode           Suc;
#endif
   xIdNode           Parent;
#ifdef XIDNAMES
   xNameType         Name;
#endif
}  xBlockSubstIdRec;

                                  /*LITERAL*/
typedef struct xLiteralIdStruct {
   xEntityClassType  EC;
#ifdef XSYMBTLINK
   xIdNode           First;
   xIdNode           Suc;
#endif
   xIdNode           Parent;
#ifdef XIDNAMES
   xNameType         Name;
#endif
   int               LiteralValue;
}  xLiteralIdRec;

                                  /*PACKAGE*/
typedef struct xPackageIdStruct {
   xEntityClassType  EC;
#ifdef XSYMBTLINK
   xIdNode           First;
   xIdNode           Suc;
#endif
   xIdNode           Parent;
#ifdef XIDNAMES
   xNameType         Name;
#endif
#ifdef XIDNAMES
   xNameType         ModuleName;
#endif
}  xPackageIdRec;



                                  /*SYSTEM*/
typedef struct xSystemIdStruct {
   xEntityClassType  EC;
#ifdef XSYMBTLINK
   xIdNode           First;
   xIdNode           Suc;
#endif
   xIdNode           Parent;
#ifdef XIDNAMES
   xNameType         Name;
#endif
   xIdNode          *Contents;
   xPrdIdNode       *VirtPrdList;
   xSystemIdNode     Super;
#ifdef XTRACE
   int               Trace_Default;
#endif
#ifdef XGRTRACE
   int               GRTrace;
#endif
#ifdef XMSCE
   int               MSCETrace;
#endif
}  xSystemIdRec;


                       /*CHANNEL,SIGNALROUTE,GATE*/
#ifndef XOPTCHAN
typedef struct xChannelIdStruct {
   xEntityClassType  EC;
#ifdef XSYMBTLINK
   xIdNode           First;
   xIdNode           Suc;
#endif
   xIdNode           Parent;
#ifdef XIDNAMES
   xNameType         Name;
#endif
   xSignalIdNode    *SignalSet; /*Array*/
   xIdNode          *ToId;      /*Array*/
   xChannelIdNode    Reverse;
}  xChannelIdRec;   /* And xSignalRouteEC.*/
#endif


                                  /*BLOCK*/
typedef struct xBlockIdStruct {
   xEntityClassType  EC;
#ifdef XSYMBTLINK
   xIdNode           First;
   xIdNode           Suc;
#endif
   xIdNode           Parent;
#ifdef XIDNAMES
   xNameType         Name;
#endif
   xBlockIdNode      Super;
   xIdNode          *Contents;
   xPrdIdNode       *VirtPrdList;
   xViewListRec     *ViewList;
   int               NumberOfInst;
#ifdef XTRACE
   int               Trace_Default;
#endif
#ifdef XGRTRACE
   int               GRTrace;
#endif
#ifdef XMSCE
   int               MSCETrace;
   int               GlobalInstanceId;
#endif
}  xBlockIdRec;


                                  /*PROCESS*/
typedef struct xPrsIdStruct {
   xEntityClassType  EC;
#ifdef XSYMBTLINK
   xIdNode           First;
   xIdNode           Suc;
#endif
   xIdNode           Parent;
#ifdef XIDNAMES
   xNameType         Name;
#endif
   xStateIdNode     *StateList;
   xSignalIdNode    *SignalSet;
#ifndef XNOUSEOFSERVICE
   xIdNode          *Contents;
#endif
#ifndef XOPTCHAN
   xIdNode          *ToId; /*Array*/
#endif
   int               MaxNoOfInst;
#ifdef XNRINST
   int               NextNr;
   int               NoOfStaticInst;
#endif
   xPrsNode         *ActivePrsList;
   xptrint           VarSize;
#if defined(XPRSPRIO) || defined(XSIGPRSPRIO) || \
    defined(XPRSSIGPRIO)
   int               Prio;
#endif
   xPrsNode         *AvailPrsList;
#ifdef XTRACE
   int               Trace_Default;
#endif
#ifdef XGRTRACE
   int               GRTrace;
#endif
#ifdef XBREAKBEFORE
   char   *(*GRrefFunc) (int, xSymbolType *);
   int               MaxSymbolNumber;
   int               SignalSetLength;
#endif
#ifdef XMSCE
   int               MSCETrace;
#endif
#ifdef XCOVERAGE
   long int         *CoverageArray;
   long int          NoOfStartTransitions;
   long int          MaxQueueLength;
#endif
   void            (*PAD_Function) (xPrsNode);
   void            (*Free_Vars) (void *);
   xPrsIdNode        Super;
   xPrdIdNode       *VirtPrdList;
   xBlockIdNode      InBlockInst;
#ifdef XBREAKBEFORE
   char             *RefToDefinition;
#endif
}  xPrsIdRec;


#ifndef XNOUSEOFSERVICE
                                  /*SERVICE*/
typedef struct xSrvIdStruct {
   xEntityClassType  EC;
#ifdef XSYMBTLINK
   xIdNode           First;
   xIdNode           Suc;
#endif
   xIdNode           Parent;
#ifdef XIDNAMES
   xNameType         Name;
#endif
   xStateIdNode     *StateList;
   xSignalIdNode    *SignalSet;
#ifndef XOPTCHAN
   xIdNode          *ToId;
#endif
   xptrint           VarSize;
#ifdef XBREAKBEFORE
   char   *(*GRrefFunc) (int, xSymbolType *);
   int               MaxSymbolNumber;
   int               SignalSetLength;
#endif
#ifdef XCOVERAGE
   long int         *CoverageArray;
   long int          NoOfStartTransitions;
#endif
   xSrvNode         *AvailSrvList;
   void            (*PAD_Function) (xPrsNode);
   void            (*Free_Vars) (void *);
   xSrvIdNode        Super;
   xPrdIdNode       *VirtPrdList;
}  xSrvIdRec;
#endif


                                  /*PROCEDURE*/
typedef struct xPrdIdStruct {
   xEntityClassType  EC;
#ifdef XSYMBTLINK
   xIdNode           First;
   xIdNode           Suc;
#endif
   xIdNode           Parent;
#ifdef XIDNAMES
   xNameType         Name;
#endif
   xStateIdNode     *StateList;
   xSignalIdNode    *SignalSet; 
   xbool           (*Assoc_Function) (xPrsNode);
   void            (*Free_Vars) (void *);
   xptrint           VarSize;
   xPrdNode         *AvailPrdList;
#ifdef XBREAKBEFORE
   char           *(*GRrefFunc) (int, xSymbolType*);
   int               MaxSymbolNumber;
   int               SignalSetLength;
#endif
#ifdef XCOVERAGE
   long int         *CoverageArray;
#endif
   xPrdIdNode        Super;
   xPrdIdNode       *VirtPrdList;
}  xPrdIdRec;


typedef struct xRemotePrdIdStruct {
   xEntityClassType    EC;
#ifdef XSYMBTLINK
   xIdNode             First;
   xIdNode             Suc;
#endif
   xIdNode             Parent;
#ifdef XIDNAMES
   xNameType           Name;
#endif
   xRemotePrdListNode  RemoteList;   
}  xRemotePrdIdRec;


                                /* SIGNAL, TIMER */
typedef struct xSignalIdStruct {
   xEntityClassType  EC;
#ifdef XSYMBTLINK
   xIdNode           First;
   xIdNode           Suc;
#endif
   xIdNode           Parent;
#ifdef XIDNAMES
   xNameType         Name;
#endif
   xptrint           VarSize;
   xSignalNode      *AvailSignalList;
   xbool           (*Equal_Timer) (void *, void *);
#ifdef XFREESIGNALFUNCS
   void            (*Free_Signal) (void *);
#endif
#ifdef XBREAKBEFORE
   char             *RefToDefinition;
#endif
#if defined(XSIGPRIO) || defined(XSIGPRSPRIO) || 
defined(XPRSSIGPRIO)
   int               Prio;
#endif
}  xSignalIdRec;  /* and xTimerEC, xStartUpSignalEC,
                     and xRPCSignalEC.*/


                                  /*STATE*/
typedef struct xStateIdStruct {
   xEntityClassType  EC;
#ifdef XSYMBTLINK
   xIdNode           First;
   xIdNode           Suc;
#endif
   xIdNode           Parent;
#ifdef XIDNAMES
   xNameType         Name;
#endif
   int               StateNumber;
   xInputAction     *SignalHandlArray;
   int              *InputRef;
   xInputAction    (*EnablCond_Function)
                          (XSIGTYPE, void *);
   void            (*ContSig_Function)
                  (void *, int *, xIdNode *, int *);
   int               StateProperties;
#ifdef XCOVERAGE
   long int         *CoverageArray;
#endif
   xStateIdNode      Super;
#ifdef XBREAKBEFORE
   char             *RefToDefinition;
#endif
}  xStateIdRec;


                                  /*SORT*/
typedef struct xSortIdStruct {
   xEntityClassType  EC;
#ifdef XSYMBTLINK
   xIdNode           First;
   xIdNode           Suc;
#endif
   xIdNode           Parent;
#ifdef XIDNAMES
   xNameType         Name;
#endif
#ifdef XFREEFUNCS
   void            (*Free_Function) (void **);
#endif
#ifdef XTESTF
   xbool           (*Test_Function) (void *);
#endif
   xptrint           SortSize;
   xTypeOfSort       SortType;
   xSortIdNode       CompOrFatherSort;
   xSortIdNode       IndexSort;
   long int          LowestValue;
   long int          HighestValue;
   long int          yrecIndexOffset;
   long int          typeDataOffset;
}  xSortIdRec;

                                  /*VARIABLE,...*/
typedef struct xVarIdStruct {
   xEntityClassType  EC;
#ifdef XSYMBTLINK
   xIdNode           First;
   xIdNode           Suc;
#endif
   xIdNode           Parent;
#ifdef XIDNAMES
   xNameType         Name;
#endif
   xSortIdNode       SortNode;
   xptrint           Offset;
   xptrint           Offset2;
   int               IsAddress;
}  xVarIdRec;    /* And xFormalParEC and
                        xSignalParEC.*/


typedef struct xRemoteVarIdStruct {
   xEntityClassType     EC;
#ifdef XSYMBTLINK
   xIdNode              First;
   xIdNode              Suc;
#endif
   xIdNode              Parent;
#ifdef XIDNAMES
   xNameType            Name;
#endif
   xptrint              SortSize;
   xRemoteVarListNode   RemoteList;
}  xRemoteVarIdRec;



There are also pointer types defined for each of the xECIdStruct according to the following example:

typedef XCONST struct xIdStruct  *xIdNode;

The type definitions above define the contents in the symbol table nodes. Each xECIdStruct, where EC should be replaced by an appropriate string, have the first five components in common. These components are used to build the symbol table tree. To access these components, a pointer to a symbol table node can be type cast to any of the xIdECNode types. The type xIdNode is used as such general type, for example when traversing the tree.

The five components present in all xIdNode are:

Next there are components depending on what entity class that is to be represented. Below we discuss the non-common elements in the other xECIdStruct.

Package

System, System Type

Channel, Signal route, Gate

For channels, signal routes, and gates there are always two consecutive xChannelIdNodes in the symbol table, representing the two possible directions for a channel, signal route, or gate. The components are:

Block, Block Type, Block Instance

Process, Process Type, Process Instance

Service, Service Type, Service Instance

Procedure, Operator Diagram, Compound Statement

Note that operator diagrams and compound statements containing variable declarations are treated as procedures. However, such objects can, for example, not contain states.

Remote Procedure

Signal, Timer, StartUpSignal, and RPC Signals

State

Sort and Syntype

SortType is xArray, xGArray, xCArray
SortType is xString, xGPowerSet, xBag
SortType is xPowerSet, xRef, xOwn, xORef
SortType is xInherits
SortType is xSyntype

Variable, FormalPar, SignalPar, and Struct Components

Remote Variable

Type Info Nodes

This section describes the most important implementation details regarding the type info node. Type info nodes are data structures that are used during run-time by the functions providing generic implementations of SDL operators. As the type info nodes contain essentially the same information as the xSortIdNodes, the type info nodes are used in more and more places in the code where xSortIdNode previously were used. In the longer perspective the xSortIdNode will be removed completely.

The type definitions that describe the type info nodes are listed in the sctpred.h file.

Each type info node is a struct that consists of:

The following utility macros can be used to configure the type info nodes:

#ifndef T_CONST
#define T_CONST const
#endif

#ifndef T_SDL_EXTRA_COMP
#define T_SDL_EXTRA_COMP
#define T_SDL_EXTRA_VALUE
#endif

#ifndef T_SDL_USERDEF_COMP
#define T_SDL_USERDEF_COMP
#endif

#if defined(XREADANDWRITEF) && !defined(T_SDL_NAMES)
#define T_SDL_NAMES
#endif

#ifdef T_SDL_NAMES
#define T_SDL_Names(P) , P
#else
#define T_SDL_Names(P)
#endif

#ifdef T_SIGNAL_SDL_NAMES
#define T_Signal_SDL_Names(P) , P
#else
#define T_Signal_SDL_Names(P)
#endif

#ifdef T_SDL_INFO
#define T_SDL_Info(P) , P
#else
#define T_SDL_Info(P)
#endif

#ifndef XNOUSE_OPFUNCS
#define T_SDL_OPFUNCS(P) , P
#else
#define T_SDL_OPFUNCS(P)
#endif

struct tSDLFuncInfo;

General Components

The following components are available for all type info nodes. The definition of the components is only listed in this section, but it is valid for each type info node listed in the next section.

/* --- General type information for SDL types --- */

typedef T_CONST struct tSDLTypeInfoS {
  tSDLTypeClass   TypeClass;
  unsigned char   OpNeeds;
  xptrint         SortSize;
  struct tSDLFuncInfo *OpFuncs;
  T_SDL_EXTRA_COMP
#ifdef T_SDL_NAMES
  char           *Name;
#endif
#ifdef XREADANDWRITEF
  xIdNode         FatherScope;
  xSortIdNode     SortIdNode;
#endif
} tSDLTypeInfo;

The following macros can be used to test these properties:

#define NEEDSFREE(P) \
  (((tSDLTypeInfo *)(P))->OpNeeds & (unsigned char)1)
#define NEEDSEQUAL(P) \
  (((tSDLTypeInfo *)(P))->OpNeeds & (unsigned char)2)
#define NEEDSASSIGN(P) \
  (((tSDLTypeInfo *)(P))->OpNeeds & (unsigned char)4)
#define NEEDSINIT(P) \
  (((tSDLTypeInfo *)(P))->OpNeeds & (unsigned char)8)

Type Info Node Optimization

Depending on the operations used for data types in the translated system, some of the type info nodes might not be needed. The purpose of this described optimization is to remove such type info nodes.

The first step is to surround all type info nodes with #ifdefs according to the example for the predefined type integer below.

 #ifndef XTNOUSE_Integer
tSDLTypeInfo ySDL_SDL_Integer = {
  ....
  };
#endif

This means that the type info node for integer can be removed by defining XTNOUSE_Integer.

The names for the predefined data types in the #ifndef statements are:

#ifndef XTNOUSE_Integer
#ifndef XTNOUSE_Real
#ifndef XTNOUSE_Natural
#ifndef XTNOUSE_Boolean
#ifndef XTNOUSE_Character
#ifndef XTNOUSE_Time
#ifndef XTNOUSE_Duration
#ifndef XTNOUSE_Pid
#ifndef XTNOUSE_Charstring
#ifndef XTNOUSE_Bit
#ifndef XTNOUSE_Bit_string
#ifndef XTNOUSE_Octet
#ifndef XTNOUSE_Octet_string
#ifndef XTNOUSE_IA5String
#ifndef XTNOUSE_NumericString
#ifndef XTNOUSE_PrintableString
#ifndef XTNOUSE_VisibleString
#ifndef XTNOUSE_NULL
#ifndef XTNOUSE_Object_identifier

For user defined types the name is selected according to the following algorithm.

  1. If the type name is unique (case sensitive, as C is case sensitive), that is there is only one data type in the system with this name, then name in the #ifndef will be:

XTNOUSE_typename

  1. If the type name is not unique but type name plus the name of the scope where the type is defined is unique, the name in the #ifndef will be:
    XTNOUSE_typename_scopename
    
  2. In other cases the name in the #ifndef will be:
    XTNOUSE_typename-with-prefix-or-suffix
    

Using only this part of the algorithm it is of course possible to manually write a .h file with the suitable defines to remove the type info nodes that are not used. The compiler/linker can help finding unused data.

However the code generator calculates the usage of type info nodes. This information will be stored in the file:

sdl_cfg.h

The last section in this file will contain the defines for the usage of type info nodes.

Example 509 : Usage of type info nodes

 #ifdef XUSE_TYPEINFONODE_CFG
/* Type info node configuration */
#define XTNOUSE_Boolean
#define XTNOUSE_Character
#define XTNOUSE_Charstring
/* NOT #define XTNOUSE_Integer*/
....
....
/* NOT #define XTNOUSE_s*/
#endif

For every data type in the system there will be one line indicating if the type info node is used or not. Please note also that it is necessary to define XUSE_TYPEINFONODE_CFG at compilation, otherwise the automatically computed type info node optimization will not be used.

The file sdl_cfg.h is automatically included and used in Cmicro. In Cadvanced and C Code Generator the following code can be found in scttypes.h:

#ifdef USER_CONFIG
#include "sct_mcf.h"
#elif defined(AUTOMATIC_CONFIG)
#include "sdl_cfg.h"
#endif

So by defining USER_CONFIG and including sdl_cfg.h in sct_mcf.h or by defining AUTOMATIC_CONFIG the computed type info node optimization is used.

Sometimes the automatic computation on used type info nodes might fail. The most obvious case is usage inside inline C code. As the code generator does not parse such code, it has no chance to know of such usage. To cope with these situations the user has the possibility to tell the code generator that certain type info nodes are used, and thereby also the nodes that the particular node depends on. It is of course possible for a user to manually handle these situations be inserting proper #define and #undef after the type info node configuration. However this might prove difficult due to all the dependencies between type info nodes.

A user can tell the code generator that certain type info nodes are used by specifying this in a file. The code generator will look for such a file according to the following:

If the environment variable TAU_TYPEINFOCFG is defined, the value of this variable is treated as a file name (including path) and this file is read. If the code generator can not open this file it will produce an error.

If the environment variable is not defined a file with the name 'typeinfo.cfg' is looked for. In SDL Suite the code generator will first look in the source directory and if it can not find the file there it will look in the directory where SDL Suite is started from. If a 'typeinfo.cfg' file is found it is read. If no such file is found the code generator assumes that the user does not have a type info configuration file.

The contents of the type info configuration file should be:

Each type that should be registered as used should be mentioned on a line of its own, starting with the type name. If the several data types with the same name exist in the system the type name can be followed be the name of the scope that the data is defined in. One or more spaces or tabs should separate the type name and the scope name.

Example 510 : Type name and scope name

typename1
typename2 scopename2
typename3

The code generator will search for data types that match the criteria (name or name/scope) given above. The search will in SDL Suite follow the case sensitivity option in the tool. The following rules then apply:

If case sensitive search is used the predefined types should be given according to the following table:

Integer
Real
Natural
Boolean
Character
Time
Duration
Pid
Charstring
Bit
Bit_string
Octet
Octet_string
IA5String
NumericString
PrintableString
VisibleString
NULL
Object_identifier

The name of the scope for these types is: Predefined

Memory optimization

In the kernel file sctpred.c the following functions are conditionally defined (using #ifdef) to save memory when they are not needed:

GenericIsAssigned
IsPointerToMake
GenericMakeStruct
GenericGetValue
GenericSetValue

The conditional definitions are based on usage in the kernel or generated code. However if there is a need for some reason to use them directly, it is needed to make them accessible by manually defining a flag corresponding to each function named XMK_USE_FUNC_<function name in capital letters>:

XMK_USE_FUNC_GENERICISASSIGNED
XMK_USE_FUNC_ISPOINTERTOMAKE
XMK_USE_FUNC_GENERICMAKESTRUCT
XMK_USE_FUNC_GENERICGETVALUE
XMK_USE_FUNC_GENERICSETVALUE

Furthermore the function GenericDefault has additional #ifdef constructions inside the function to save memory in some cases.

Type-Specific Components

The following section lists the components that defines the type info nodes. Only the type-specific components are explained. The general components are listed and explained in the section above.

Enumeration types

/* ------------- Enumeration type --------------- */
typedef T_CONST struct {
  int             LiteralValue;
  char           *LiteralName;
} tSDLEnumLiteralInfo;

typedef T_CONST struct tSDLEnumInfoS {
  tSDLTypeClass   TypeClass;
  unsigned char   OpNeeds;
  xptrint         SortSize;
  struct tSDLFuncInfo *OpFuncs;
  T_SDL_EXTRA_COMP
#ifdef T_SDL_NAMES
  char           *Name;
#endif
#ifdef XREADANDWRITEF
  xIdNode         FatherScope;
  xSortIdNode     SortIdNode;
#endif
#ifdef XREADANDWRITEF
  int             NoOfLiterals;
  tSDLEnumLiteralInfo *LiteralList;
#endif
} tSDLEnumInfo;

Syntypes, types with inheritance, and Own, Ref, Oref instantiations

/* ------ Syntype, Inherits, Own, Oref, Ref ----- */
typedef T_CONST struct tSDLGenInfoS {
  tSDLTypeClass   TypeClass;
  unsigned char   OpNeeds;
  xptrint         SortSize;
  struct tSDLFuncInfo *OpFuncs;
  T_SDL_EXTRA_COMP
#ifdef T_SDL_NAMES
  char           *Name;
#endif
#ifdef XREADANDWRITEF
  xIdNode         FatherScope;
  xSortIdNode     SortIdNode;
#endif
  tSDLTypeInfo   *CompOrFatherSort;
} tSDLGenInfo;

Powersets (implemented as unsigned in [ ])

/* ------------------ Powerset ------------------ */
typedef T_CONST struct tSDLPowersetInfoS {
  tSDLTypeClass   TypeClass;
  unsigned char   OpNeeds;
  xptrint         SortSize;
  struct tSDLFuncInfo *OpFuncs;
  T_SDL_EXTRA_COMP
#ifdef T_SDL_NAMES
  char           *Name;
#endif
#ifdef XREADANDWRITEF
  xIdNode         FatherScope;
  xSortIdNode     SortIdNode;
#endif
  tSDLTypeInfo   *CompSort;
  int             Length;
  int             LowestValue;
} tSDLPowersetInfo;

Structs

/* ------------------- Struct ------------------- */
typedef int (*tGetFunc) (void *);
typedef void (*tAssFunc) (void *, int);


typedef T_CONST struct {
  xptrint     OffsetPresent; /* 0 if not optional */
  void       *DefaultValue;
} tSDLFieldOptInfo;


typedef T_CONST struct {
  tGetFunc        GetTag;
  tAssFunc        AssTag;
} tSDLFieldBitFInfo;


typedef T_CONST struct {
  tSDLTypeInfo   *CompSort;
#ifdef T_SDL_NAMES
  char           *Name;
#endif
  xptrint         Offset;     /* ~0 for bitfield */
  tSDLFieldOptInfo *ExtraInfo;
} tSDLFieldInfo;


typedef T_CONST struct tSDLStructInfoS {
  tSDLTypeClass   TypeClass;
  unsigned char   OpNeeds;
  xptrint         SortSize;
  struct tSDLFuncInfo *OpFuncs;
  T_SDL_EXTRA_COMP
#ifdef T_SDL_NAMES
  char           *Name;
#endif
#ifdef XREADANDWRITEF
  xIdNode         FatherScope;
  xSortIdNode     SortIdNode;
#endif
  tSDLFieldInfo  *Components;
  int             NumOfComponents;
} tSDLStructInfo;

Choice and #union

/* ---------------- Choice, Union --------------- */

typedef T_CONST struct {
  tSDLTypeInfo        *CompSort;
#ifdef T_SDL_NAMES
  char                *Name;
#endif
} tSDLChoiceFieldInfo;

typedef T_CONST struct tSDLChoiceInfoS {
  tSDLTypeClass   TypeClass;
  unsigned char   OpNeeds;
  xptrint         SortSize;
  struct tSDLFuncInfo *OpFuncs;
  T_SDL_EXTRA_COMP
#ifdef T_SDL_NAMES
  char           *Name;
#endif
#ifdef XREADANDWRITEF
  xIdNode         FatherScope;
  xSortIdNode     SortIdNode;
#endif
  tSDLChoiceFieldInfo *Components;
  int                  NumOfComponents;
  xptrint              OffsetToUnion;
  xptrint              TagSortSize;
#ifdef XREADANDWRITEF
  tSDLTypeInfo        *TagSort;
#endif
} tSDLChoiceInfo;

Array and Carray

/* --------------- Array, CArray ---------------- */
typedef T_CONST struct tSDLArrayInfoS {
  tSDLTypeClass   TypeClass;
  unsigned char   OpNeeds;
  xptrint         SortSize;
  struct tSDLFuncInfo *OpFuncs;
  T_SDL_EXTRA_COMP
#ifdef T_SDL_NAMES
  char           *Name;
#endif
#ifdef XREADANDWRITEF
  xIdNode         FatherScope;
  xSortIdNode     SortIdNode;
#endif
  tSDLTypeInfo   *CompSort;
  int             Length;
#ifdef XREADANDWRITEF
  tSDLTypeInfo   *IndexSort;
  int             LowestValue;
#endif
} tSDLArrayInfo;

General arrays

A general array is an array that is represented as a linked list in C.


/* ------------------- GArray ------------------- */
typedef T_CONST struct tSDLGArrayInfoS {
  tSDLTypeClass   TypeClass;
  unsigned char   OpNeeds;
  xptrint         SortSize;
  struct tSDLFuncInfo *OpFuncs;
  T_SDL_EXTRA_COMP
#ifdef T_SDL_NAMES
  char           *Name;
#endif
#ifdef XREADANDWRITEF
  xIdNode         FatherScope;
  xSortIdNode     SortIdNode;
#endif
  tSDLTypeInfo   *IndexSort;
  tSDLTypeInfo   *CompSort;
  xptrint         yrecSize;
  xptrint         yrecIndexOffset;
  xptrint         yrecDataOffset;
  xptrint         arrayDataOffset;
} tSDLGArrayInfo;

General powersets, Bags, Strings and Object_identifier

/* -- GPowerset, Bag, String, Object_Identifier - */
typedef T_CONST struct tSDLGenListInfoS {
  tSDLTypeClass   TypeClass;
  unsigned char   OpNeeds;
  xptrint         SortSize;
  struct tSDLFuncInfo *OpFuncs;
  T_SDL_EXTRA_COMP
#ifdef T_SDL_NAMES
  char           *Name;
#endif
#ifdef XREADANDWRITEF
  xIdNode         FatherScope;
  xSortIdNode     SortIdNode;
#endif
  tSDLTypeInfo   *CompSort;
  xptrint         yrecSize;
  xptrint         yrecDataOffset;
} tSDLGenListInfo;
Limited strings

A limited string is a string that is implemented as an array in C.


/* ------------------ LString ------------------- */
typedef T_CONST struct tSDLLStringInfoS {
  tSDLTypeClass   TypeClass;
  unsigned char   OpNeeds;
  xptrint         SortSize;
  struct tSDLFuncInfo *OpFuncs;
  T_SDL_EXTRA_COMP
#ifdef T_SDL_NAMES
  char           *Name;
#endif
#ifdef XREADANDWRITEF
  xIdNode         FatherScope;
  xSortIdNode     SortIdNode;
#endif
  tSDLTypeInfo   *CompSort;
  int             MaxLength;
  xptrint         DataOffset;
} tSDLLStringInfo;

SDL type (C representation decided with a #ADT directive)

/* ------------------ Userdef ------------------- */
/* used for user defined types #ADT(T(h)) */
typedef T_CONST struct tSDLUserdefInfoS {
  tSDLTypeClass   TypeClass;
  unsigned char   OpNeeds;
  xptrint         SortSize;
  struct tSDLFuncInfo *OpFuncs;
  T_SDL_EXTRA_COMP
#ifdef T_SDL_NAMES
  char           *Name;
#endif
#ifdef XREADANDWRITEF
  xIdNode         FatherScope;
  xSortIdNode     SortIdNode;
#endif
  T_SDL_USERDEF_COMP
} tSDLUserdefInfo;

SDL signal

A signal is treated in the same way as a struct.


/* ------------------- Signal ------------------- */
typedef T_CONST struct {
  tSDLTypeInfo       *ParaSort;
  xptrint             Offset;
} tSDLSignalParaInfo;

typedef T_CONST struct tSDLSignalInfoS {
  tSDLTypeClass   TypeClass;
  unsigned char   OpNeeds;
  xptrint         SortSize;
  struct tSDLFuncInfo *OpFuncs;
  T_SDL_EXTRA_COMP
#ifdef T_SIGNAL_SDL_NAMES
  char           *Name;
#endif
  tSDLSignalParaInfo *Param;
  int             NoOfPara;
} tSDLSignalInfo;


http://www.ibm.com/rational
Contents Index Previous Next