MS(5ICD)

NAME
ms, box, term, mc, me, comment - basic LDMC functions

SYNOPSIS

MODEL *ms (name,comment)
char *name, *comment;

box (layer,xl,xr,yb,yt,dx,nx,dy,ny,comment)
char *layer, *comment;
int xl, xr, yb, yt, dx, nx, dy, ny;

TERM *term (layer,xl,xr,yb,yt,name,dx,nx,dy,ny,comment)
char *layer, *name, *comment;
int xl, xr, yb, yt, dx, nx, dy, ny;

INST *mc (inst_name,name,mir,rot,tx,ty,dx,nx,dy,ny,comment)
char *inst_name, *name, *comment;
int mir, rot, tx, ty, dx, nx, dy, ny;

MODEL *me (comment)
char *comment;

comment (text)
char *text;

DESCRIPTION
These functions will generate the corresponding LDM statements in the output file when they are called, stdout being the default output. The output file can be changed by the setout(5ICD) function. For the programmers convenience, he can enter these functions in his program text using the syntax of LDM, perhaps with some C variables instead of numbers or names. The LDMC preprocessor, see ldmcc(1ICD), will then translate this LDMC source code into pure C.

Ms will check whether name is not used before. If so, that fact is reported, and all box and term functions until the corresponding me are effectively discarded. They notice the fact that the cell was multiply defined, and return immediately. Otherwise, a new MODEL node is created, and initialized. The address of the new MODEL node is returned, NULL upon error.

Nested ms's are permitted, all global variables, (this, l_xl, l_xr, l_yb, l_yt, see ldmcintro(5ICD), and some globals used by the LDMC functions internally) are then pushed on a stack and popped after the corresponding me. The LDM text of a cell is only written to the output by the me function, so the LDM output file will not contain any nested cell descriptions.

The box function checks its arguments and will eventually complain, for example, about such things as bad coordinates when xl exceeds xr. Also, box will update the bounding-box and box-bounding-box fields of the current MODEL node as well as the external integers l_xl l_xr, l_yb and l_yt.

The term function does the same as box does, but can also create one or more TERM nodes. Term will create one or more TERM nodes only if the first character of name is a valid side specifier. A side specifier is a 'l', 'r', 'b' or 't' character, indicating that the terminal is a left, right, bottom or top terminal. This information is, for example, used by abut(5ICD) or pitch(5ICD). If the first character of name is not a valid side specifier, this is not an error and the terminal statement will still be seen in the LDM output text. However, the terminal will not be remembered in the LDMC datastructure.

Of left and right terminals, (terminals with an 'l' or 'r' side specifier) only the repetition in the y-direction is remembered, and saved in the index field of the TERM node. The term function will now, for left and right terminals, create (ny+1) terminal nodes with the index field of the TERM nodes counting from 0 to ny inclusive, where ny is the terminal repetition in vertical direction. The xl and xr fields of the TERM nodes will all be identical, but the yb and yt fields are given by (yb+index*dy) and (yt+index*dy). Of bottom and top terminals, only the repetition in the x-direction is saved mutatis mutandis.

The mc function also checks its arguments, and will update the bounding-box and mc-bounding-box members of the current MODEL node, as well as l_xl, l_xr, l_yb and l_yt. If you don't want to give the new mc statement an instance name, the corresponding argument must be the NULL pointer or the NULL string.

First, it is checked whether the referenced cell does actually exist. If not, that fact is reported and the mc statement will not be remembered in the LDMC datastructure. Otherwise, when an instance name is given, a new INST node with that name is created only if this instance name was not already used in the current cell. When no instance name is given, a new INST node is only created when this mc statement was the first reference to that cell. The name of the new INST node is now the cell name. Every following reference to that cell without an instance name will cause the previously created INST node to be overwritten with the new cell-call parameters. Thus, when no instance name is given, only the latest reference to each cell is remembered.

The me function will generate the me statement in the LDM output file. The address of the MODEL node of the terminating cell is returned.

Comment is a function that is used to include a comment line in the output text. The text argument need not include the colon (:), but not the newline (\n).

SEE ALSO
ldmcc(1ICD), ldmcintro(5ICD)