Rules for Mapping into C The following table summarizes the rules of mapping into C for: ● Types of parameters for procedures and functions ● Returned type of functions Note: ● The first level of all arrays should be defined as User-defined type in order to restrict the ‘second’ dimension. ● Unrestricted strings and bit-arrays are not allowed as returned type of a function. ● Numeric Input parameters can be mixed up i.e., integer, real and bit-arrays can be mixed when used as actual and formal parameters. Type Function Type In Param Out/InOut Param Primitive (*) int f(); int P; int *P; UDT defined as Primitive UDT f(); UDT P; UDT *P; Record/Union rec *f(); REC *P; REC *P; String char *f(); char *P; char *P; UDT defined as String char *f(); UDT P; UDT P; Bit BIT_ARRAY *f(); BIT_ARRAY *P; BIT_ARRAY *P; Bit-array BIT_ARRAY *f(); BIT_ARRAY *P; BIT_ARRAY *P; UDT defined as Bit-array BIT_ARRAY *f(); BIT_ARRAY *P; UDT *P; UDT Array of Primitive int *f(); UDT P; UDT P; UDT Array of String -- Illegal -- UDT P; UDT P; UDT Array of Bit-array -- Illegal -- UDT P; UDT P; UDT array of direct R/U -- Illegal -- UDT P; UDT P; UDT array of UDT2 UDT2 *f(); UDT P; UDT P; Array of Primitive -- Illegal -- int *P; int *P; Array of Record/Union -- Illegal -- -- Illegal -- -- Illegal -- Array of String -- Illegal -- char *P; char *P; Array of Bit-array -- Illegal -- BIT_ARRAY *P; BIT_ARRAY *P; (*) Primitive type is one of: integer, real, condition, or enumerated type. In the above matrix, integers are taken as example.
The following table summarizes the rules of mapping into C for: