

              LASI Data Structure Standard for Version 4.2

  The following information is supplied for use by anyone who may want to
  access the data structure of LASI drawings. LASI data files have two
  representations, internal and external. The information regarding
  internal data files is subject to change, and, be warned, any programs
  using it may need to be modified in the future. External (TLC) format
  will remain consistent, or at most a conversion program will be supplied
  if modifications are made.

  Internal data files are optimized for fast access and are used by the
  program itself as it executes. The form of these files is given below.

  Utilities may be written to operate on these files, but it may be
  somewhat more difficult due to the cell pointers used internally.

  External (TLC) files are ASCII files that contain cell references by
  name not pointer and data for objects in readable (and editable) ASCII.
  Transfer of cells between drawings can be more easily accomplished and
  utility programs can be mpre easily written when the external form is
  used.

  Internal form will first be described, then external.


  Notes:

    1. In records, separator characters will be shown in < >.
       <nl>= newline (<cr><lf>)
       <sp>= space

    2. Basic Units are the smallest unit of the 16-bit integers in which a
       drawing is maintained in the LASI data. Physical Units are the
       units in which you do a layout drawing (mil, um, etc.) These are
       related to the basic units by the Scale Factor.

    3. Version numbers may contain alpha characters but the number must
       always begin with a numeric character.



  1.0 Basic Drawing Files:

  A drawing consists of Drawing Basic Data files (.DBD) and a number of
  cell files (.BP4 and .CL4 files internally, or .TLC files externally).
  The DBD files are the CELLS4.DBD, CONSTS4.DBD and FORM.DBD files. These
  are ASCII sequential files. CELLS4.DBD contains the information
  regarding the cells associated with a drawing. CONSTS4.DBD contains the
  preserved constants that set up a drawing, i.e. window sizes, scales,
  etc. FORM.DBD contains permanent setup information for a drawing.

  There is also a TXT.DBD file that is binary and contains the text font
  patterns. This has to be edited using the MAKETXT.EXE program.


  1.1  CELLS4.DBD file:

  This is an ASCII sequential file consisting of the number of cells
  followed by 10-entry records for each cell.


  File Format:

  Number of Cells<nl>

  Cell 1 Record:
      Entry:
          1= Name of cell<nl>
          2= Rank of cell (1-15)<sp> (see below)
          3= Left boundary of cell in basic units<sp>
          4= Bottom boundary of cell in basic units<sp>
          5= Right boundary of cell in basic units<sp>
          6= Top boundary of cell in basic units<sp>
          7= Number of boxes in cell<sp>
          8= Number of poly in cell<sp>
          9= Number of vertices in cell<sp>
          10= Number of cells in cell<nl>

  Cell 2 Record: etc.,etc.,

  Notes:

    1. Cells may be in any order. A cell with rank other than 1-15 is
       uneditable.

    2. Pooled cells are marked with the 256-bit (100 hex) set to 1. Since
       pooled cells may have only a rank of 1, this number will always be
       257 for a pooled cell.


  1.2 CONSTS4.DBD File:

  The CONSTS4.DBD file is a nonessential file; if absent, it defaults to a
  standard configuration when the LASI program is started. When LASI is
  closed, a CONSTS4.DBD with the present configuration is written.

  It is possible for future versions of LASI to have different CONSTS4.DBD
  files, that is, compatibility is not guaranteed. In such case, deleting
  an old CONSTS4.DBD file and defaulting to the standard configuration at
  first will be necessary.

  It is expected that the first 3 entries (the version, the scale factor,
  and the physical units) will be unchanged, since they provide
  information to conversion utilities.

  File Format:

  The present CONSTS4.DBD file contains the following sequential ASCII
  data readable by a BASIC INPUT or a C scanf() function:

      The Version of LASI under which the file was made
      The Number of Basic Units per Physical Unit
      The Name of the Physical Unit
      A 64 character Color String with each character indicating the color
      of the layer (r=red etc.)
      64 FILL numbers indicating which fills are to be used on the
      corresponding layer.
      64 DASH numbers indicating which dashes are to be used on the
      corresponding layer.
      The Number of Working Grids
      All 10 Working Grids in basic units
      The Maximum Number of Ranks
      For 15 Cell Mode Ranks, the Working Grid Number, the Dot Grid,
      The Grid Visibility Flag, and the Window Width, the Window
      Center X and Y Positions, in basic units

  Integer Constants:
      Layer Number for ADD
      Drawing Resolution Limit Number
      Number of Arc Segments
      Default Path Width
      Octo Flag
      Path Center Line Flag
      Double Click Ticks
      Sort Backup Time
      Text Reference Flag
      Text Layer for ADD
      Default Text Width
      Fill with 0 to 16 entries

  Float Constants:
      The Maximum Number of Saved Windows (9)
      All Saved Window Widths, X Centers and Y Centers
      Text Spacing Ratio
      PSIZ Number
      Rotation Angle
      OVSZ Distance
      R Sheet Resistance
      C per Square
      R End Correction
      Fill with 0 to 16 entries

  String Constants:
      Kind of Object to be ADDed ("B","P", or Name of Cell)
      VIEW Layers
      OPEN Layers
      DASH Layers
      Arc Add Direction (cw, ccw)
      Fill with "reserved" to 8 entries
      "end"   (end marker for short read check)



  2.0  Cell Data Files

  There are two kinds of Cell Data Files BP4 files and CL4 files. BP4
  files contain the boxes, poly and vertices of a cell. CL4 files contain
  the cells within the cell. All cells have BP4 files, but only if a
  cell's rank > 1 will it have a CL4  file.

  All data files are binary files. Each block of data records is read
  until a zero is encountered in the first record entry. The box data
  records are placed first in a BP4 file, followed by the path data
  records, and finally by the vertex data records. This data structure
  allows any unknown cell file to be read into the drawing system without
  prior knowledge of the number or type of records.


  2.1  Box Data Structure

  Box data is kept in an array of structures with 5 integer members.

      Box Record Entries:

      0 = Bits 0-7 , Layer Number (1-64)
          Bits 8-11 , Active Side Program Flags (Cleared in File)
          Bits 12-13 , Unused Flags (Cleared in File)
          Bit 14, Program Out of Window Flag (Cleared in File)
          Bit 15, Unused (Cleared in File)

                        active side
                          | | | |
                  x x x x|x x x x|x x x x|x x x x
                    |             | | | | | | | |
                    owb           <--- layer --->
           (out of window bit)

      1= Lower Left Corner X Position in basic units

      2= Lower Left Corner Y Position

      3= Upper Right Corner X Position

      4= Upper Right Corner Y Position



  2.2  Path Data Structure:

  Path data is kept in an array of structures with 3 integer members.

  A variation in the normal path data structure is used in Vers 4 to store
  path entities that expand as written text. The path record contains a
  marker bit and orientation bits. The first vertex record is a normal
  vertex record which locates the text in the drawing, however, the
  subsequent records contain ASCII character codes as explained below.

  Path Record Entries:

      0 = Bits 0-7, Layer of Path (1-64)
          Bit 8, Path has 1 or more Active Vertices Flag (Cleared in
          File)

          Bits 9-15,

          If Normal Path:
              Program Flags (Cleared in File)

          else if Path Text:
              Bits 9-11, Orientation Bits (same as Cells)
              Bit 15 set indicates Path Text Record

                     0x3800     0x100
                      oren     active
                      | | |     |
                  x x x x|x x x x|x x x x|x x x x
                  | |       | |   | | | | | | | |
                  | owb     nop   <--- layer --->
                  text                0xFF

      1= If Normal Path:
          Width of Path in basic units (0 indicates Poly)

      else if Path Text:
          Size of Path Text (size of character field)

      2= Pointer to First Vertex of path in vertex array


  2.3  Vertex Data Structure:

  Vertex data is kept in a array of structures with 4 integer members.

  Vertex Record Entries:

      0 = Bits 0-12, Number of Path to which Vertex belongs
          Bit 13, Active Vertex Bit (Cleared in File)
          Bits 14-15,

          If Normal Paths:
              Program Flags (Cleared in File)
          else if Path Text:
              Bit 15 set indicates Path Text Character Record


                 0x4000
                 active
                    |
                  x x x x|x x x x|x x x x|x x x x
                  |   | | | | | | | | | | | | | |
                  |    <----- path number ----->
                  text vtx       0x3FFF
                  0x8000

      1= If Normal Path:
          X Position of Vertex in basic units

      else if Path Text:
          Two bytes ASCII Character Code

      2= If Normal Path:
          Y Position of Vertex in basic units

      else if Path Text:
          Two bytes ASCII Character Code

      3= Pointer to next Vertex in Vertex Array
          (Zero for the Last Vertex of a Path)


  2.4  Cell Data Structure:

  Cell data is kept in a 2-dimensional array of structures of 3 integer
  members. The added dimension is the depth of cell nesting, so that a
  parent cell remans loaded while lesser cells are load and drawn. In a
  CL4 file the nesting level is unnecessary, and the data is kept in a
  binary file following the same rules as the BP4 file but with the .CL4
  file extension.

  Cell Record Entries:

      0 = Bits 0-9, Number of cell in CELLS4.DBD list
          Bit 10, Active Cell Flag (Cleared in File)
          Bits 11-13, Orientation (See Below)
          Bit 14, Draw Outline Flag
          Bit 15, Extended Flag (reserved)

                 outl orien active
                    | | | | |
                  x x x x|x x x x|x x x x|x x x x
                  |           | | | | | | | | | |
                  |           <--- ref number -->
          (reserved extended)

      1= X Position of Cell in basic units

      2= Y Position of Cell in basic units

      Orientation:
          Bit 13, Cell is flipped in Y and then rotated
          Bits 12 and 11,
          0= no rotation
          1= 90 deg ccw rotation
          2= 180 deg ccw rotation
          3= 270 deg ccw rotation


  3.0 External Data Files:

  The external data file representation condenses the CELLS4.DBD, BP4 and
  CL4 files into one representation, thus making cells transportable. The
  files have the extension .TLC (Transportable LASI Cell). The same
  terminators are used as above so that TLC files can be read by BASIC or
  C.

  Each Cell has its own TLC file. This means that a TLC file may not
  really contain all the information to construct a cell if it has lesser
  cells within it. In that case, the TLC files for the lesser cells will
  have to be present for conversion to internal form. When converting to
  external form, the program TLC.EXE automatically makes the TLC files for
  lesser cells if they are not present in the MS-DOS directory. When
  conversion from external to internal is being done, the lesser cells are
  also made in internal form  by the TLC conversion program if not already
  present.

  The following records may be in ANY ORDER in a TLC file.

  Records in Detail

    Header Record:      <nl>= carriage return + linefeed    <sp>= space

        1= "=H" (literal)<nl>
        2= Name of Cell (DOS file name)<nl>
        3= Version of LASI (literal)<nl>
        4= Version of TLC (literal)<nl>
        5= Basic Units per Physical Unit<nl>
        6= Name of Physical Unit (literal)<nl>
        7= Date of Cell Conversion (literal)<nl>
        8= Time of Cell Conversion (literal)<nl>
        9= Rank of Cell<sp>
        10= Left Outline Boundary in basic units<sp>
        11= Bottom Boundary in basic units<sp>
        12= Right Boundary in basic units<sp>
        13= Top Boundary in basic units<nl>
        14= Number of Boxes<sp>
        15= Number of Paths<sp>
        16= Number of Vertices<sp>
        17= Number of Cells<nl>

        Note:  Versions must begin with a numeric character

    Cell Record Entries:

        1= "=C" (literal)<nl>
        2= Name of Lesser Cell<nl>
        3= Orientation (see below)<sp>
        4= X Position in basic units<sp>
        5= Y Position in basic units<sp>
        6= reserved (presently zero)<nl>

        Property Number: (0-15)
          16 bit integer, all bits 0 except:

            Bit 4,
              0= draw cell fully
              1= draw cell outline

          Orientation:
            Bit 3,
              0= cell not flipped
              1= cell is flipped in Y before rotation

            Bits 2 and 1,
              0,0 = no rotation
              0,1 = 90 deg rotation CCW
              1,0 = 180 deg rotation CCW
              1,1 = 270 deg rotation CCW

    Box Record Entries:

        1= "=B" (literal)<nl>
        2= Layer of Box<sp>
        3= X of Lower Left Corner in basic units<sp>
        4= Y of Lower Left Corner in basic units<sp>
        5= X of Upper Right Corner in basic units<sp>
        6= Y of Upper Right Corner in basic units<nl>

    Path/Poly Record Entries:

        1= "=P" (literal)<nl>
        2= Layer of Path/Poly<sp>
        3= Width in basic units<sp>
        4= No. of Vertices in path/poly<nl>
        5= Vertices in basic units in the form:
        X1<sp>Y1<sp>X2<sp>Y2<sp>X3<sp>Y3<sp>X4<sp>Y4<sp>X5<sp>Y5<nl>
        .......Xn-1<sp>Yn-1<sp>Xn<sp>Yn<nl>

        (Groups of 5 coordinates separated by <sp> ended by <nl>,
        always with <nl> after Last Coordinate Pair)

    Text Record Entries:

        1= "=T" (literal)<nl>
        2= Layer of Text<sp>
        3= Size in basic units<sp>
        4= No. of Vertices used by text (includes Ref Point)<sp>
        5= Orientation 0-7 (same as cells)<nl>
        6= X Ref Point in basic units<sp>
        7= Y Ref Point in basic units<nl>
        8= ASCII character text string<nl> (u/l case, up to 40 characters)
