1 /*  START OF:       mbuild_data_.incl.pl1                     *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
   2 
   3 /****^  HISTORY COMMENTS:
   4   1) change(2019-08-17,GDixon), approve(2019-10-25,MCR10069),
   5      audit(2020-01-20,Swenson), install(2020-01-20,MR12.6g-0035):
   6      Major and minor data structures used by the mbuild subsystem.
   7   2) change(2021-02-16,GDixon), approve(2021-02-22,MCR10086),
   8      audit(2021-03-17,Swenson), install(2021-03-17,MR12.6g-0051):
   9       A) Add constants shared by several mbuild programs:
  10                not_stored_in_library     no_containing_archive
  11                no_library_operation      unknown_archive_name
  12   3) change(2022-08-03,GDixon), approve(2022-09-05,MCR10126),
  13      audit(2022-10-12,Swenson), install(2022-10-12,MR12.8-1042):
  14      for build_data.version = "mbuild_data_0004" ---
  15       A) Dcl build_data.ssu_areaP -> ssu_area (a Multics area with standard properties).
  16       B) Add build_data.mbuild_cleanup: original_wdir, original_descriptor
  17       C) Add build_data.script_info substructure.
  18       D) Dcl build_data.switches.debugS switch.
  19       E) Add build_data.script_statusP -> script_status structure.
  20       F) Add build_data.monitor_dataP.
  21       G) Update initial comment describing Build Script Language, and
  22          later comments describing contents of build script segment
  23          (segment ending with .mb suffix).
  24   4) change(2022-10-15,GDixon), approve(2022-09-05,MCR10126a),
  25      audit(2022-10-25,Swenson), install(2022-10-25,MR12.8-1043):
  26       A) Remove constant BS_phase_default.  That value will be defined in the new
  27          mbuild_script_info_attr.incl.pl1 segment as the default_Phase constant.
  28       B) Correct comment describing how build_data.script_info substructure gets
  29          saved to build script.
  30                                                    END HISTORY COMMENTS */
  31 
  32 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *   */
  33 /*                                                                                                */
  34 /* Data structures used by the mbuild command, and its supporting subroutines.                    */
  35 /*                                                                                                */
  36 /* NOTE: The Tlist_base and Tlist_data sub-structures are declared in mbuild_Tlist_dcls_.incl.pl1 */
  37 /*                                                                                                */
  38 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *   */
  39 
  40 
  41 /* ------------------------------------------------------------------------------------------
  42 
  43 BNF for Build Script Language (used in MCRnnnnn.mb segs):
  44 
  45     -  { <alt-1> | <alt-2> | <alt-3> } identifies alternatives.  Choose only one of them.
  46        { <alt-1> | <alt-2> | <alt-3> }... says choose one or more of the alternatives.
  47 
  48    For full BNF description of Build Script Language, see:
  49      mbuild_script_parse_.rd            program that parses statements in this language.
  50 
  51      build_script.gi.info               help info block (in mbuild.info) describing the
  52                                         language from a user's viewpoint.
  53 
  54    ----------                                                                      ----------
  55 
  56 Flattened Description of Build Script Language:
  57 
  58  The script language given as BNF above generates statements such as those shown below.
  59  Items in braces are alternatives; only one is present in an actual statement.
  60 
  61  An archive statement is used only for a bound object having more than one source archive
  62  (i.e., where source archive has a .<digit> in its name; e.g. bound_pl1_.2.s.archive).
  63 
  64  An add_name or delete_name statement not used on a Bound_obj statement; names on a
  65  bound segment are specified by statements in its bindfile.
  66 
  67 
  68 Bound_obj       : <bound-object-name>       IN : <library-name>   { ADD | UPDATE  | DELETE }  ;
  69     bindfile    : <bind-file-name>                                { ADD | REPLACE | DELETE }  ;
  70  source_arch    : <bound-source-archive-name>                     { ADD | UPDATE  | DELETE }  ;
  71       source    : <source-seg-name>                               { ADD | REPLACE | DELETE }  <compiler-group> ;
  72 
  73 Unbound_obj     : <object-seg-name>         IN : <library-name>   { ADD | REPLACE | DELETE }  ;
  74       source    : <source-seg-name>                               { ADD | REPLACE | DELETE }  <compiler-group> ;
  75 
  76 Include         : <include-file-name>       IN : <library_name>   { ADD | REPLACE | DELETE }  ;
  77 Info            : <info-seg-primary-name>   IN : <library_name>   { ADD | REPLACE | DELETE }  ;
  78 
  79 Seg(<seg-type>) : <seg-name>                IN : <library_name>   { ADD | REPLACE | DELETE }  ;
  80 
  81 
  82 Either/both of these statements can follow:  Unbound_obj   Info   Seg
  83 add_name        : <name>... ;
  84 delete_name     : <name>... ;
  85    ----------                                                                      ----------
  86 
  87 
  88 Examples of Build Script Language
  89 
  90   EXAMPLE 1:  MCR001.mb
  91 
  92    Dir only containing pnotice_language_info_.cds and cds_args.incl.pl1 files.
  93 
  94     mbuild
  95 
  96     mbuild:  scan
  97 
  98     mbuild:  print
  99 
 100     Segments found by scan request:
 101       bound_pnotice_.s.archive:
 102         source:                pnotice_language_info_.cds        IN: tools.source  REPLACE compiler: cds;
 103 
 104       Include:                 cds_args.incl.pl1                 IN: lang.include  REPLACE;
 105 
 106     mbuild:  analyze
 107 
 108     mbuild:  print
 109 
 110      Bound_obj:                bound_pnotice_                    IN: tools  REPLACE;
 111          source:               pnotice_language_info_.cds         REPLACE            compiler: cds;
 112 
 113      Include:                  cds_args.incl.pl1                 IN: lang.include  REPLACE;
 114 
 115     mbuild:  quit
 116 
 117 
 118   EXAMPLE 2:  MCR002.mb
 119 
 120    Dir contains:
 121             Segments = 3, Lengths = 6.
 122 
 123             r w    2  bound_library_tools_.bind
 124             r w    1  library_pathname.info
 125                       lpn.info
 126             r w    3  library_pathname.pl1
 127 
 128     mbuild
 129 
 130     mbuild:  scan
 131 
 132     mbuild:  print
 133 
 134     Segments found by scan request:
 135       bound_library_tools_.archive:
 136         bindfile:              bound_library_tools_.bind         IN: tools.object  REPLACE;
 137 
 138       bound_library_tools_.s.archive:
 139         source:                library_pathname.pl1              IN: tools.source  REPLACE compiler: pl1 -ot;
 140 
 141       Info:                    library_pathname.info             IN: privileged.info  REPLACE;
 142                                  add_name:
 143                                    lpn.info;
 144 
 145     mbuild:  analyze
 146 
 147     mbuild:  print
 148 
 149      Bound_obj:                bound_library_tools_              IN: tools  REPLACE;
 150          bindfile:             bound_library_tools_.bind          REPLACE;
 151          source:               library_pathname.pl1               REPLACE            compiler: pl1 -ot;
 152 
 153      Info:                     library_pathname.info             IN: privileged.info  REPLACE;
 154                                  add_name:
 155                                    lpn.info;
 156 
 157     mbuild:  quit
 158 
 159 
 160   EXAMPLE 3:  MCR003.mb
 161 
 162    Dir contains:
 163 
 164     Segments = 3, Lengths = 11.
 165 
 166     r w    3  asu_data.archive
 167     r w    4  hcs_.alm
 168     rew    4  new_gate_.alm
 169 
 170 
 171     mbuild
 172     Installation directory: >user_dir_dir>Multics>GDixon>work>MCR003
 173 
 174     mbuild:  scan
 175 
 176     mbuild:  print
 177 
 178     Segments found by scan request:
 179       source:                  hcs_.alm                          IN: hard.source  REPLACE compiler: alm;
 180       source:                  new_gate_.alm                     IN: UNKNOWN.source  ADD compiler: alm;
 181 
 182       Seg(data_arch):          asu_data.archive                  IN: tools.execution  REPLACE;
 183 
 184     mbuild:  analyze
 185 
 186     mbuild:  print
 187 
 188      Unbound_obj:              hcs_                              IN: hard  REPLACE;
 189          source:               hcs_.alm                           REPLACE            compiler: alm;
 190 
 191      Unbound_obj:              new_gate_                         IN: UNKNOWN  ADD;
 192          source:               new_gate_.alm                      ADD                compiler: alm;
 193 
 194      Seg(data_arch):           asu_data.archive                  IN: tools.execution  REPLACE;
 195 
 196     mbuild:  quit
 197 
 198 
 199 
 200   EXAMPLE 4:  MCR004.mb
 201 
 202    Dir is adding a new bound segment: bound_mbuild_.
 203 
 204     Segments = 13, Lengths = 82.
 205 
 206     r w    1  bound_mbuild_.bind
 207     r w   54  bound_mbuild_.s.archive
 208     rew    2  mbuild_Tlist_.incl.pl1
 209     rew    1  mbuild_Tlist_dcls_.incl.pl1
 210     rew   14  mbuild_data_.incl.pl1
 211     rew    1  mbuild_display_dcls_.incl.pl1
 212     rew    2  mbuild_info_.incl.pl1
 213     rew    1  mbuild_request_parms_.incl.pl1
 214     rew    2  mbuild_type.info
 215               mbt.info
 216               mbuild_type.paradigm.info
 217               mbt.paradigm.info
 218               mbuild_type.pdm.info
 219               mbt.pdm.info
 220               mbuild_type.seg_type.info
 221               mbt.seg_type.info
 222               mbuild_type.seg.info
 223               mbt.seg.info
 224     rew    1  ssu_command_dcls_.incl.pl1
 225     rew    1  ssu_request_dcls_.incl.pl1
 226     rew    1  ssu_standalone_command_.incl.pl1
 227     rew    1  ssu_subroutine_dcls_.incl.pl1
 228 
 229 
 230    Since the directory contains a bind file bound_mbuild_.bind, analyze uses its
 231    Order statement to determine which source files are destined for the new bound
 232    object.  Analyze assumes new bound obj will be installed in sss library.
 233    It assumes all source fits into one source archive; therefore no archive
 234    statement is needed.
 235 
 236     mbuild
 237 
 238     mbuild:  scan; analyze; print
 239 
 240      Bound_obj:                bound_mbuild_                     IN: UNKNOWN  ADD;
 241          bindfile:             bound_mbuild_.bind                 ADD;
 242        source_arch:            bound_mbuild_.s.archive            ADD;
 243          source:               mbuild.pl1                         ADD                compiler: pl1 -ot;
 244          source:               mbuild_Tlist_.pl1                  ADD                compiler: pl1 -ot;
 245          source:               mbuild_analyze_.pl1                ADD                compiler: pl1 -ot;
 246          source:               mbuild_data_.pl1                   ADD                compiler: pl1 -ot;
 247          source:               mbuild_display_.pl1                ADD                compiler: pl1 -ot;
 248          source:               mbuild_et_.alm                     ADD                compiler: alm;
 249          source:               mbuild_info_.cds                   ADD                compiler: cds;
 250          source:               mbuild_info_find_.pl1              ADD                compiler: pl1 -ot;
 251          source:               mbuild_library_.pl1                ADD                compiler: pl1 -ot;
 252          source:               mbuild_lpn.pl1                     ADD                compiler: pl1 -ot;
 253          source:               mbuild_print_.pl1                  ADD                compiler: pl1 -ot;
 254          source:               mbuild_request_.pl1                ADD                compiler: pl1 -ot;
 255          source:               mbuild_request_parms_.pl1          ADD                compiler: pl1 -ot;
 256          source:               mbuild_request_tables_.alm         ADD                compiler: alm;
 257          source:               mbuild_scan_.pl1                   ADD                compiler: pl1 -ot;
 258          source:               mbuild_script_.pl1                 ADD                compiler: pl1 -ot;
 259          source:               mbuild_script_parse_.rd            ADD                compiler: rdc -ot -trace off;
 260          source:               mbuild_set_.pl1                    ADD                compiler: pl1 -ot;
 261          source:               mbuild_type.pl1                    ADD                compiler: pl1 -ot;
 262 
 263      Include:                  mbuild_Tlist_.incl.pl1            IN: lang.include  ADD;
 264      Include:                  mbuild_Tlist_dcls_.incl.pl1       IN: lang.include  ADD;
 265      Include:                  mbuild_data_.incl.pl1             IN: lang.include  ADD;
 266      Include:                  mbuild_display_dcls_.incl.pl1     IN: lang.include  ADD;
 267      Include:                  mbuild_info_.incl.pl1             IN: lang.include  ADD;
 268      Include:                  mbuild_request_parms_.incl.pl1    IN: lang.include  ADD;
 269      Include:                  ssu_command_dcls_.incl.pl1        IN: lang.include  ADD;
 270      Include:                  ssu_request_dcls_.incl.pl1        IN: lang.include  ADD;
 271      Include:                  ssu_standalone_command_.incl.pl1  IN: lang.include  ADD;
 272      Include:                  ssu_subroutine_dcls_.incl.pl1     IN: lang.include  ADD;
 273 
 274      Info:                     mbuild_type.info                  IN: UNKNOWN.info  ADD;
 275                                  add_name:
 276                                    mbt.info
 277                                    mbuild_type.paradigm.info
 278                                    mbt.paradigm.info
 279                                    mbuild_type.pdm.info
 280                                    mbt.pdm.info
 281                                    mbuild_type.seg_type.info
 282                                    mbt.seg_type.info
 283                                    mbuild_type.seg.info
 284                                    mbt.seg.info;
 285 
 286     mbuild:  quit
 287 
 288 
 289    At this point, the admin saves the build script (shown above) and edits
 290    the Bound_obj library to be tools.  The library for mbuild_type.info remains
 291    sss.info.  (tools.info selects >doc>info and >doc>privileged, introducing an
 292    ambiguity in target directory, which mbuild would complain about.)
 293 
 294    sss.info selects only >doc>info; whereas priv.info selects only >doc>privileged.
 295    Maybe we need a better name in multics_libraries_.ld to select just >doc>info,
 296    like: general.info ???
 297    ----------                                                                      ----------
 298 
 299 
 300 DIAGRAMS SHOWING INTERNAL STRUCTURES BUILT BY mbuild:
 301 
 302  Notes on Threaded Lists:
 303    The structures declared below are connected in two cardinality types:
 304     - one-to-one:              COMPILE.sourceP  <---->  SEG(source).COMPILEp
 305     - one-to-many:  SEG(source_arch).inArch_Tb  <--->>  SEG(source).inArch_Td
 306 
 307    mbuild uses threaded lists (Tlists) to do one-to-many connections between
 308    related structures.
 309      - A base structure (element name ending in _Tb) anchors the head/tail
 310        of a list.
 311      - A data structure (element name ending in _Td) stored within each
 312        list item threads between:
 313         - adjacent items of the list, or
 314         - anchor.head and first item of list, or
 315         - last item of list and anchor.tail.
 316 
 317    These structures are referred to in the diagrams below, and later in the actual
 318    structure declarations.  They are declared in mbuild_Tlist_dcls_.incl.pl1.
 319 
 320 
 321 Structure Elements in Diagrams Below:
 322 
 323   Seg:       Main structure representing a real segment:
 324               - found by a scan request;
 325               - fabricated to record output of a compile
 326                 or bind request.
 327 
 328              Designated symbol in diagrams below.........      Seg(<seg_type>)
 329               - seg_type indicates build type, output of:
 330                   mbuild_type seg -comment <seg-name>
 331 
 332              Main thread element of a structure                          Seg(source)
 333              is designated by name beginning with hyphen      scan_Tb:    -scan_Td
 334              and ending with _Td.  This element name
 335              appears either above or below the Seg(...)
 336              symbol.  The - points to build_data.xxx_Tb
 337              element (head/tail of list containing item)
 338              shown in left column of diagram.
 339 
 340              Data for other threads through the structure         Seg(source_arch)
 341              are indicated by other Td or Tb names                  inArch_Tb
 342              above/below the Seg symbol, with lines                   /
 343              pointing to other end of connection.  For               /
 344              example, a list anchored in a source archive        inArch_Td - - -  inArch_Td
 345              Seg(source_arch) goes thru each Seg(source)       Seg(source)      Seg(source)
 346              to be updated within that source archive.          -scan_Td         -scan_Td
 347 
 348              A one-to-one connection is designated by          Seg(source)  Seg(Unbound_obj)
 349              names ending in P or p above/below the Seg          COMPILEp     COMPILEp
 350              COMPILE or BOUNDOBJ or UNBOUNDOBJ                        \       /
 351              symbol.  For example, a link from                         \     /
 352              Seg(source) to its Compile symbol.                         sP oP
 353                                                                       COMPILE
 354   COMPILE:   A relationship symbol connecting a                        -COMPILE_Td
 355              a Seg(source) with its compiled
 356              Seg(Unbound_obj).  The COMPILE symbol itself
 357              does not represent any real segment; just
 358              this source-to-compiler-output relationship.
 359 
 360 
 361   BOUNDOBJ:  A relationship symbol connecting bound               bindfileP
 362              object's source and object archives,                 bound_objP
 363              bindfile, and output from bind command.            BOUNDOBJ
 364              operation.  See Diagrams 6B and 7 below.            -BOUNDOBJ_Td
 365                                                                   sourceArchs_Tb
 366                                                                   objectArchs_Tb
 367 
 368 UNBOUNDOBJ:  A relationship symbol identifying an               UNBOUNDOBJ
 369              unbound object to be installed without              -UNBOUNDOBJ_Td
 370              binding into a larger bound object.  Gate            sP
 371              segments are a good example.  See Diagram 7.
 372 
 373 
 374 STRUCTURES CREATED or USED by mbuild REQUESTS
 375 
 376 Request 1: scan
 377 
 378   Scans contents of an install directory containing just the source, bindfile, includes,
 379   info segs, and other files to be directly install.  It generates a threaded list of Seg
 380   structures, one for each segment found.  Segment <build-type> is not identified by the
 381   scan, so segments are represented with undesignated type Seg().
 382 
 383 
 384   build_data elements   (Diagram 1)
 385   - - - - - - - - - -
 386                 Seg()     Seg()       Seg()     Seg()      Seg()
 387      scan_Tb:    -scan_Td  -scan_Td    -scan_Td  -scan_Td   -scan_Td
 388 
 389    - The only identifying information in each Seg structure is the primary file name.
 390 
 391    - Only files on the scan_Tb thread are retained if user decides to start over by issuing
 392      a "clean" request.
 393 
 394       Policy: segments in this scan_Tb list (original segs in install dir) are never deleted
 395               from the install dir.
 396                Maybe: scan request will turn on safety switch for these segs.
 397 
 398 
 399 Request 2:  analyze
 400 
 401   Analyzes Seg() structures built by earlier scan or read requests.
 402 
 403   0) Checks that scan_Tb thread is non-empty.  That would mean neither scan nor read has been
 404      done.  Report "nothing to analyze" if list is empty.
 405 
 406   1) Walk down the scan_Tb thread, using Seg.name to look up build_type and paradigm for
 407      each segment.  Store build_type.mbuild_type as Seg.type.
 408 
 409   2) Place each Seg on a separate thread devoted to its build paradigm.  For example,
 410      a Seg(source) would be added to the source_Tb paradigm list, in addition to remaining
 411      on the scan_Tb list.
 412       a) For bindfile paradigm, add a BOUNDOBJ structure to manage bind operations using
 413          the bind file.
 414       b) For source paradigm, add a COMPILE structure to manage compiling the source.
 415       c) For target_only paradigm, the target_only_Tb thread base uses a to_Td thread
 416          data element; this shorter name avoids clutter in the diagram.
 417 
 418   build_data elements   (Diagram 2A)
 419   - - - - - - - - - -
 420                                                  Seg(bindfile)
 421       bindfile_Tb:                                -pdm_Td
 422                                     bindfileP - -  BOUNDOBJp
 423                                   BOUNDOBJ
 424       BOUNDOBJ_Tb:                 -BOUNDOBJ_Td
 425 
 426                      Seg(source)       Seg(source)         Seg(source)        Seg(source)
 427         source_Tb:    -pdm_Td           -pdm_Td             -pdm_Td            -pdm_Td
 428                        COMPILEp          COMPILEp            COMPILEp           COMPILEp
 429                          \                   \                   \                   \
 430                          sP oP               sP oP               sP oP               sP oP
 431                        COMPILE             COMPILE             COMPILE             COMPILE
 432        COMPILE_Tb:      -COMPILE_Td         -COMPILE_Td         -COMPILE_Td         -COMPILE_Td
 433 
 434                       Seg(include)  Seg(info)     Seg(exec_com)  Seg(<seg-type>)
 435    target_only_Tb:     -pdm_Td       -pdm_Td       -pdm_Td        -pdm_Td     ...
 436 
 437 
 438   3) For each Seg, use mblpn (library_pathname derivative) to determine if segment
 439      is replacing an existing segment in Multics Libraries (target segment).
 440      Get the target segment's:
 441       - containing directory path:    ex: >ldd>sss>source  or  >doc>info  or >ldd>include
 442       - containing archive (if any):  bound_xxx_.s.archive or bound_xxx_.archive
 443 
 444   4) Use that target segment information to set/adjust Seg.library; and to record
 445      Seg(source).containing_arch for a source replacing a bound segment source file.
 446       a) For Seg(bindfile) in bindfile_Tb list, also set BOUNDOBJ.library.
 447       b) For Seg(source) in source_Tb:
 448           i)  If Seg is replacing a component of a source archive:
 449               link Seg to a Seg(source_arch) structure based on target's archive name.
 450           ii) Otherwise, link Seg to an UNBOUNDOBJ structure.
 451       c) For Seg(source_arch) in source_archive_Tb, link Seg to a BOUNDOBJ structure
 452          based upon the source archive name.
 453       d) For BOUNDOBJ structure in BOUNDOBJ_Tb, set BOUNDOBJ.sourceArchsN = count
 454          of source archives currently in Multics Libraries for that bound segment.
 455 
 456   Note that members of UNBOUNDOBJ_Tb, BOUNDOBJ_Tb and COMPILE_Tb are not Seg
 457   structures, and therefore those Tbase lists do not have a build paradigm name.
 458 
 459   build_data elements   (Diagram 2B)
 460   - - - - - - - - - -
 461                                                                           UNBOUNDOBJ
 462     UNBOUNDOBJ_Tb:                                                         -UNBOUNDOBJ_Td
 463                                                  Seg(bindfile)              sP
 464       bindfile_Tb:                                -pdm_Td                    |
 465                                     bindfileP - -  BOUNDOBJp                 |
 466                                   BOUNDOBJ                                   |
 467       BOUNDOBJ_Tb:                 -BOUNDOBJ_Td                              |
 468                                     sourceArchsN                             |
 469                                     sourceArchs_Tb                           |
 470                                     /                                        |
 471                                 archs_Td- - - - - - - - - archs_Td           |
 472                               Seg(source_arch)          Seg(source_arch)     |
 473    source_arch_Tb:             -pdm_Td                   -pdm_Td             |
 474                                 inArch_Tb                 inArch_Tb          |
 475                                 /                              \             |
 476                         inArch_Td- - - - - inArch_Td          inArch_Td     UNBOUNDOBJp
 477                       Seg(source)       Seg(source)         Seg(source)    Seg(source)
 478         source_Tb:     -pdm_Td           -pdm_Td             -pdm_Td        -pdm_Td
 479                         COMPILEp          COMPILEp            COMPILEp       COMPILEp
 480                             \                   \                   \               \
 481                             sP oP               sP oP               sP oP           sP oP
 482                           COMPILE             COMPILE             COMPILE         COMPILE
 483        COMPILE_Tb:         -COMPILE_Td         -COMPILE_Td         -COMPILE_Td     -COMPILE_Td
 484 
 485                        Seg(include)  Seg(info)     Seg(exec_com)  Seg(<other>)
 486    target_only_Tb:      -pdm_Td       -pdm_Td       -pdm_Td        -pdm_Td     ...
 487 
 488 
 489 Request 3: save
 490 
 491   Saves a summary of the installation in Mbuild Script Language in a Seg(mb_script) segment,
 492   such as MCR10056.mb.
 493 
 494   FUTURE FEATURE:  If mbuild was invoked with -log, then each request is logged in a Seg(mb_log)
 495                    segment, such as MCR10056.mb.list.
 496 
 497   0) Check for any derived segments resulting from compiles, bind, etc.  If any are found,
 498      warn admin to do a clean before saving; abort the save request.
 499 
 500   1) Add an mbuild_support_Tbase thread, with Seg(mb_script) to track the script file (prevent
 501      it from being removed by a clean request).  Add a Seg(mb_log) to track requested log file.
 502 
 503   build_data elements   (Diagram 3)
 504   - - - - - - - - - -
 505                                                                           UNBOUNDOBJ
 506     UNBOUNDOBJ_Tb:                                                         -UNBOUNDOBJ_Td
 507                                                  Seg(bindfile)              sP
 508       bindfile_Tb:                                -pdm_Td                    |
 509                                     bindfileP - -  BOUNDOBJp                 |
 510                                   BOUNDOBJ                                   |
 511       BOUNDOBJ_Tb:                 -BOUNDOBJ_Td                              |
 512                                     sourceArchsN                             |
 513                                     sourceArchs_Tb                           |
 514                                     /                                        |
 515                                 archs_Td- - - - - - - - - archs_Td           |
 516                               Seg(source_arch)          Seg(source_arch)     |
 517    source_arch_Tb:             -pdm_Td                   -pdm_Td             |
 518                                 inArch_Tb                 inArch_Tb          |
 519                                 /                              \             |
 520                         inArch_Td- - - - - inArch_Td          inArch_Td     UNBOUNDOBJp
 521                       Seg(source)       Seg(source)         Seg(source)    Seg(source)
 522         source_Tb:     -pdm_Td           -pdm_Td             -pdm_Td        -pdm_Td
 523                         COMPILEp          COMPILEp            COMPILEp       COMPILEp
 524                             \                   \                   \               \
 525                             sP oP               sP oP               sP oP           sP oP
 526                           COMPILE             COMPILE             COMPILE         COMPILE
 527        COMPILE_Tb:         -COMPILE_Td         -COMPILE_Td         -COMPILE_Td     -COMPILE_Td
 528 
 529                        Seg(include)     Seg(info)     Seg(exec_com)    Seg(<other>)
 530    target_only_Tb:      -pdm_Td          -pdm_Td       -pdm_Td          -pdm_Td     ...
 531 
 532                        Seg(mb_script)   Seg(mb_log)
 533 mbuild_support_Tb:      -pdm_Td          -pdm_Td
 534 
 535 
 536   2) Create/replace the build script file <install_dir_entryname>.mb (e.g., MCR10056.mb)
 537      in the install directory.  Contents...
 538 
 539   3) Append statements to the build script, using the paradigm threads in build_data
 540      shown in Diagram 3.
 541       a) mbuild_support_Tb: append a Build_Script statement.
 542 
 543       b) BOUNDOBJ_Tb: Walk list; for each BOUNDOBJ item:
 544           - Append a Bound_obj statement.
 545 
 546           - If BOUNDOBJ.bindfileP is not null, append a bindfile statement.
 547 
 548           - If BOUNDOBJ.sourceArchsN > 1 then:
 549             - For each Seg(source_arch) in source_arch_Tb:
 550               - Append an <archive-stmt>.
 551               - For each Seg(source) in Seg(source_arch).inArch_Tb:
 552                 - Append a <source-stmt> for each modified source file.
 553           - If BOUNDOBJ.sourceArchsN = 1 then:
 554             - Append a source statement for each Seg(source) in the inArch_Tb
 555               list for that archive (each modified source file).
 556 
 557       c) UNBOUNDOBJ_Tb: Walk list; for each UNBOUNDOBJ item:
 558           - Append an Unbound_obj statement.
 559           - If UNBOUNDOBJ.add_nameP is not null, append an <add_name-stmt>.
 560           - If UNBOUNDOBJ.delete_nameP is not null, append a <delete_name-stmt>.
 561           - If UNBOUNDOBJ.sP is not null, append a source statement describing the
 562             Seg(source).
 563 
 564       d) target_only_Tbase: Walk list; for each Seg(...) item:
 565           - If Seg(include), append an Include statement.
 566           - If Seg(info), append an Info statement.
 567             - If Seg(info).add_nameP is not null, append an <add_name-stmt>.
 568             - If Seg(info).delete_nameP is not null, append a <delete_name-stmt>.
 569           - Otherwise, append a Seg statement.
 570             - If Seg(...).add_nameP is not null, append an <add_name-stmt>.
 571             - If Seg(...).delete_nameP is not null, append a <delete_name-stmt>.
 572 
 573 
 574 Request 4: read
 575 
 576   Reads the Build Script file written by a save request.
 577 
 578   1) Parse the <install_dir_entryname>.mb segment.  For each statement, construct the
 579      equivalent structure, as described in Diagram 3: save request (above).
 580   2) Scan the install directory, looking for files not given in the parsed Build Script.
 581       - Compare the scan_Tb from parsing with a separate scan_Tb generated by a
 582         private scan of the install directory.
 583       - Complain if other files are present.  (Admin should have done clean before the
 584         save request.  Or admin added files to install directory, not yet in script.
 585         - List files not in build script, and ask if those files should be removed
 586           from install directory.
 587           - If admin says "no", then abort the read request, preserving any existing data.
 588 
 589   These steps should resurrect Diagram 3 (including its implicit scan_Tb, which is not
 590   shown explicitly to simplify that diagram).
 591 
 592 
 593 Request 5: compile
 594 
 595   1) Walks down the COMPILE_Tb thread, compiling each of the Seg(source) files.
 596       - Generates a Seg(Unbound_obj) for the output segment of each compile, along with
 597         a new object_Tb anchor.
 598       - Sets source's COMPILE to point to Seg(Unbound_obj):  COMPILE.oP ---- Seg(Unbound_obj).COMPILEp
 599       - If any compile also generates an intermediate source, a Seg(INTERMEDIATE) is added,
 600         placed on an INTERMEDIATE_Tb thread.
 601       - If -list control argument is included when compiling, a Seg(listing) is added,
 602         placed on a listing_Tb thread.  Listing files are usually side-effects of
 603         compilation, but may optionally be installed in the >ldd>listings>LIBRARY directory.
 604      Generating Seg() structures for these side-effect files  ensures proper cleanup.
 605 
 606   2) If compiled Seg(Unbound_obj) is tied (via COMPILE and Seg(source) structures) to an
 607      UNBOUNDOBJ where: UNBOUNDOBJ.add_nameP ^= null or UNBOUNDOBJ.delete_nameP ^= null
 608       - For each name in UNBOUNDOBJ.add_nameP list, issue command:
 609          add_name Seg(Unbound_obj).name <add-seg-name> -bf
 610       - For each name in UNBOUNDOBJ.delete_nameP list, issue command:
 611          delete_name  <del-seg-name> -bf
 612 
 613 
 614   build_data Tbases   (Diagram 5)
 615   - - - - - - - - -
 616                        Seg(source)        Seg(source)          Seg(source)           Seg(source)
 617         source_Tb:      -pdm_Td            -pdm_Td              -pdm_Td               -pdm_Td
 618                          COMPILEp           COMPILEp             COMPILEp              COMPILEp
 619                             \                    \                    \                    \
 620                              \  Seg(Unbound_obj)  \  Seg(Unbound_obj)  \  Seg(Unbound_obj)  \  Seg(Unbound_obj)
 621    Unbound_obj_Tb:            \  -pdm_Td           \  -pdm_Td           \  -pdm_Td           \  -pdm_Td
 622                                \  COMPILEp          \  COMPILEp          \  COMPILEp          \  COMPILEp
 623                                 \   /                \   /                \   /                \   /
 624                                 sP oP               sP oP                sP oP                sP oP
 625                               COMPILE             COMPILE              COMPILE              COMPILE
 626         COMPILE_Tb:            -COMPILE_Td         -COMPILE_Td          -COMPILE_Td          -COMPILE_Td
 627                                 lP                                       iP
 628                                  |                                        |
 629                                COMPILEp                                   |
 630                              Seg(listing)                                 |
 631         listing_Tb:           -pdm_Td                                  COMPILEp
 632                                                                      Seg(INTERMEDIATE)
 633    INTERMEDIATE_Tb:                                                   -INTERMEDIATE_Td
 634 
 635 
 636 Request 6: archive_prep
 637 
 638   1) Walks down the BOUNDOBJ_Tb thread, getting a list of object archives for each bound segment.
 639      Adds a Seg(object_arch) for each object archive.
 640       a) Set operation = "UPDATE" for an object archive having a corresponding source archive
 641          attached to the BOUNDOBJ (the source archive is being modified); or to the object archive
 642          containing any modified bindfile.
 643       b) Set operation = "BIND-INPUT" for all other object archives.
 644 
 645   build_data elements   (Diagram 6A)
 646   - - - - - - - - - -
 647 
 648       bindfile_Tb:                      \                        -pdm_Td
 649                                        objectArchs_Tb          Seg(bindfile)
 650                                        bindfileP - - - - - - - - BOUNDOBJp
 651                                      BOUNDOBJ
 652       BOUNDOBJ_Tb:                    -BOUNDOBJ_Td
 653                                        sourceArchsN
 654                                        sourceArchs_Tb
 655                                       /
 656                                 archs_Td- - - - - - - - - archs_Td
 657                               Seg(source_arch)          Seg(source_arch)
 658    source_arch_Tb:             -pdm_Td                   -pdm_Td
 659                                 inArch_Tb                 inArch_Tb
 660                                /                               \
 661                         inArch_Td- - - - -inArch_Td           inArch_Td
 662                       Seg(source)       Seg(source)         Seg(source)
 663         source_Tb:     -pdm_Td           -pdm_Td             -pdm_Td
 664                          COMPILEp           COMPILEp              COMPILEp
 665                             \                    \                     \
 666                              \  Seg(Unbound_obj)  \  Seg(Unbound_obj)   \  Seg(Unbound_obj)
 667    Unbound_obj_Tb:            \  -pdm_Td           \  -pdm_Td            \  -pdm_Td
 668                                \  COMPILEp          \  COMPILEp           \  COMPILEp
 669                                 \   /                \   /                 \   /
 670                                 sP oP                sP oP                 sP oP
 671                               COMPILE              COMPILE               COMPILE
 672        COMPILE_Tb:             -COMPILE_Td          -COMPILE_Td           -COMPILE_Td
 673 
 674 
 675   2) At this point, the Seg(source_arch) have no corresponding segment in the install directory,
 676      unless the Seg(source_arch) is ADDing a new Seg(Bound_obj) to the library.
 677      Call library_fetch for each missing Seg(source_arch), to bring it into the install directory.
 678   3) At this point, the Seg(object_arch) are not present, and have no corresponding segment in
 679      the install directory.  Call library_fetch for each Seg(object_arch).operation = "UPDATE",
 680      to bring it into the install directory.
 681   4) Update/add/delete Seg(source) components into each Seg(source_arch) archive being modified.
 682      New/changed source files are not removed from the install dir as source archives are
 683      updated.
 684       (Policy: the original scan_Tb list of segments is never deleted from the install dir.)
 685   5) Update/add/delete Seg(Unbound_obj) components in each Seg(object_arch) archive to be modified.
 686      If any Seg(bindfile) is in the install directory, update it into its Seg(object_arch).
 687      Segments represented by Seg(Unbound_obj) are deleted as they are updated into their object
 688      archive.  The Seg(Unbound_obj) structures are then deleted.
 689      The segment represented by Seg(bindfile) remains in the install directory.
 690 
 691   At this point, parts of the internal representation relating to archive_prep are shown below.
 692 
 693   build_data elements   (Diagram 6B)
 694   - - - - - - - - - -
 695    object_arch_Tb:        -pdm_Td                   -pdm_Td                  -pdm_Td
 696                          Seg(object_arch)          Seg(object_arch)         Seg(object_arch)
 697                                 archs_Td- - - - - -  archs_Td- - - - - - - -  archs_Td
 698                                        \
 699       bindfile_Tb:                      \                        -pdm_Td
 700                                         objectArchs_Tb          Seg(bindfile)
 701                                         bindfileP - - - - - - - - BOUNDOBJp
 702                                       BOUNDOBJ
 703       BOUNDOBJ_Tb:                     -BOUNDOBJ_Td
 704                                         sourceArchsN
 705                                         sourceArchs_Tb
 706                                        /
 707                                 archs_Td- - - - - - - - - archs_Td
 708                               Seg(source_arch)          Seg(source_arch)
 709    source_arch_Tb:             -pdm_Td                   -pdm_Td
 710                                 inArch_Tb                 inArch_Tb
 711                                /                               \
 712                         inArch_Td - - - - inArch_Td           inArch_Td
 713                       Seg(source)       Seg(source)         Seg(source)
 714         source_Tb:     -pdm_Td           -pdm_Td             -pdm_Td
 715                         COMPILEp          COMPILEp            COMPILEp
 716                            \                   \                   \
 717    Unbound_obj_Tb:          \   /               \   /               \   /
 718                             sP oP               sP oP               sP oP
 719                           COMPILE             COMPILE             COMPILE
 720        COMPILE_Tb:         -COMPILE_Td         -COMPILE_Td         -COMPILE_Td
 721 
 722 
 723 
 724   6) Binds BOUNDOBJ Seg(object_arch) to produce a Seg(Bound_obj) output segment.
 725 
 726       - Walk the BOUNDOBJ_Tb list; for each BOUNDOBJ structure:
 727          - Bind together all the Seg(object_arch) segments.
 728 
 729   build_data elements   (Diagram 6C)
 730   - - - - - - - - - -
 731    object_arch_Tb:        -pdm_Td                   -pdm_Td                  -pdm_Td
 732                          Seg(object_arch)          Seg(object_arch)         Seg(object_arch)
 733                                 archs_Td- - - - - -  archs_Td- - - - - - - -  archs_Td
 734                                        \
 735       bindfile_Tb:                      \                     -pdm_Td
 736                                      objectArchs_Tbase       Seg(bindfile)
 737                                      bindfileP - - - - - - - - BOUNDOBJp
 738                                    BOUNDOBJ
 739       BOUNDOBJ_Tb:                  -BOUNDOBJ_Tdata
 740                                      sourceArchsN
 741                                      bound_objP - - - -  - - - BOUNDOBJp
 742                                      sourceArchs_Tb          Seg(Bound_obj)
 743      Bound_obj_Tb:                                            -pdm_Td
 744 
 745                                 UNBOUNDOBJ
 746     UNBOUNDOBJ_Tb:               -UNBOUNDOBJ_Td
 747                                   sP
 748                                    |
 749                          UNBOUNDOBJp
 750                        Seg(source)
 751         source_Tb:      -pdm_Td
 752                          COMPILEp
 753                                \    Seg(Unbound_obj)
 754    Unbound_obj_Tb:              \    -pdm_Td
 755                                  \    COMPILEp
 756                                   \   /
 757                                   sP oP
 758                                 COMPILE
 759        COMPILE_Tb:               -COMPILE_Td
 760 
 761 
 762 Request 8: install_ec
 763 
 764   Creates an exec_com of update_seg commands for installing (add/replace/delete) segments
 765    from the install directory into the Multics Libraries.
 766 
 767   Diagram 8 shows the structures that remain after the bind request.
 768 
 769   1) Create an exec_com: <install_dir_entryname>.mb.ec.  For example: MCR10056.mb.ec
 770 
 771   2) To this exec_com, add the following update_seg (us) lines.  Note the abbreviated form:
 772        us {replace|add|delete} Seg(...).name [lds pn BOUNDOBJ.library || ".x"]>== ...
 773      really means choose one of the following update_seg commands, based upon Seg.operation:
 774        us replace Seg().name [lds pn BOUNDOBJ.library || ".x"]>==            ...
 775        us add                [lds pn BOUNDOBJ.library || ".x"]>Seg(...).name ...
 776        us delete             [lds pn BOUNDOBJ.library || ".x"]>Seg(...).name ...
 777      The [lds pn ...] is replaced by result from the library_descriptor active function.
 778 
 779   a) update_seg initiate <install_dir_entryname>.io
 780 
 781   b) Walk BOUNDOBJ_Tbase; for each BOUNDOBJ structure:
 782       - us {replace|add|delete} Seg(source_arch).name   [lds pn BOUNDOBJ.library || ".s"]>== -ac
 783       - For each Seg(object_arch) not having Seg(object_arch).operation = "BIND-INPUT":
 784         - us {replace|add|delete} Seg(object_arch).name [lds pn BOUNDOBJ.library || ".o"]>== -ac
 785       - us {replace|add|delete} Seg(Bound_obj).name     [lds pn BOUNDOBJ.library || ".x"]>==
 786      All names placed by bind command on Seg(Bound_obj) will be on the installed target.
 787 
 788   c) Walk UNBOUNDOBJ_Tb; for each UNBOUNDOBJ structure:
 789       - us {replace|add|delete} Seg(source).name [lds pn UNBOUNDOBJ.library || ".s"]>== ...
 790       - us {replace|add|delete} Seg(Unbound_obj).name [lds pn UNBOUNDOBJ.library || ".o"]>== ...
 791       - us {replace|add|delete} Seg(Unbound_obj).name [lds pn UNBOUNDOBJ.library || ".x"]>== ...
 792      All names added to Seg(Unbound_obj) during bind request will be on the installed target.
 793 
 794   d) Walk the target_only_Tb; for each Seg(...) structure:
 795       - us {replace|add|delete} Seg(...).name [lds pn Seg(...).library]>== ...
 796      All names found on Seg(...) in the install directory will be on the installed target.
 797 
 798   e) If -listings was given to install_ec request, walk the listing_Tb   ; for each Seg(listing):
 799       - us {replace|add|delete} Seg(listing).name [lds pn Seg(listing).library]>== ...
 800 
 801 
 802   build_data elements   (Diagram 8)
 803   - - - - - - - - - -
 804                                                                                  UNBOUNDOBJ
 805     UNBOUNDOBJ_Tb:                                                                -UNBOUNDOBJ_Td
 806                                                                                    sP
 807    object_arch_Tb:     -pdm_Td               -pdm_Td               -pdm_Td          |
 808                       Seg(object_arch)      Seg(object_arch)      Seg(object_arch)  |
 809                              archs_Td- - - -  archs_Td- - - - - - - archs_Td        |
 810                                     \                                               |
 811       bindfile_Tb:                   \                        -pdm_Td               |
 812                                      objectArchs_Tb          Seg(bindfile)          |
 813                                      bindfileP - - - - - - - - BOUNDOBJp            |
 814                                    BOUNDOBJ                                         |
 815       BOUNDOBJ_Tb:                  -BOUNDOBJ_Td                                    |
 816                                      sourceArchsN                                   |
 817                                      bound_objP- - - - - - - - BOUNDOBJp            |
 818                                      sourceArchs_Tb          Seg(Bound_obj)         |
 819      Bound_obj_Tb:                     /                      -pdm_Td               |
 820                                       /                                             |
 821                                 archs_Td- - - - - - - - - archs_Td                  |
 822                               Seg(source_arch)          Seg(source_arch)            |
 823    source_arch_Tb:             -pdm_Td                   -pdm_Td                    |
 824                                 inArch_Tb                 inArch_Tb                 |
 825                                /         \                     \                    |
 826                         inArch_Td         inArch_Td          inArch_Td      UNBOUNDOBJp
 827                       Seg(source)       Seg(source)        Seg(source)    Seg(source)
 828         source_Tb:     -pdm_Td           -pdm_Td            -pdm_Td        -pdm_Td
 829                         COMPILEp          COMPILEp           COMPILEp       COMPILEp
 830                             \                 \                  \              \    Seg(Unbound_obj)
 831    Unbound_obj_Tb:           \                 \                  \              \    -pdm_Td
 832                               \                 \                  \              \    COMPILEp
 833                                \   /             \   /              \   /          \    /
 834                                sP oP             sP oP              sP oP          sP oP
 835                              COMPILE           COMPILE            COMPILE        COMPILE
 836        COMPILE_Tb:            -COMPILE_Td       -COMPILE_Td        -COMPILE_Td    -COMPILE_Td
 837                                lP                                   iP
 838                                 |                                    |
 839                                COMPILEp                              |
 840                              Seg(listing)                            |
 841        listing_Tb:            -pdm_Td                              COMPILEp
 842                                                                  Seg(intermediate)
 843   INTERMEDIATE_Tb:                                                -INTERMEDIATE_Td
 844 
 845                        Seg(include)    Seg(info)    Seg(exec_com)   Seg(<other>)
 846    target_only_Tb:      -pdm_Td         -pdm_Td      -pdm_Td         -pdm_Td      ...
 847 
 848                        Seg(mb_script)  Seg(mb_log)
 849 mbuild_support_Tb:      -pdm_Td         -pdm_Td
 850 
 851 
 852 Request 9: clean
 853 
 854   Removes all files derived from build operations.  The files found during the original
 855   scan request should remain in the install directory, along with any mbuild support files.
 856 
 857   1) Walk the listing_Tb, removing each Seg(listing) from the list and
 858      deleting its associated file.
 859   2) Walk the INTERMEDIATE_Tb, removing each Seg(intermediate) from the list and
 860      deleting its associated file.
 861   3) Walk the unbound_object_Tb, removing each Seg(Unbound_obj) from the list and
 862      deleting its associated file.
 863   4) Walk the source_archive_Tb, KEEPING each Seg(source_arch) in the list, but
 864      deleting its associated file.
 865   5) Walk the object_archive_Tb, removing each Seg(object_arch) from the list and
 866      deleting its associated file.
 867   6) Walk the bound_object_Tb, removing each Seg(Bound_obj) from the list and
 868      deleting its associated file.
 869 
 870   The result should be a data structure as shown in Diagram 3.
 871  * ------------------------------------------------------------------------------------------ */
 872 %page;
 873 /* ------------------------------------------------------------------------------------------
 874    MAJOR STRUCTURE:  build_data
 875 
 876    Data structure passed by the mbuild command to each of its requests and supporting subroutines.
 877    It provides the "mbuild database" of information gathered by a series of mbuild requests
 878    that describe an installation directory and its changeset.
 879    ------------------------------------------------------------------------------------------ */
 880 
 881   dcl 1 build_data aligned,
 882       2 header,                                             /* Header of structure:                                   */
 883         3 version char(20) var,                             /*   Version of this structure = mbuild_data_version_4    */
 884 
 885         3 directory char(168) unal,                         /*   Build directory pathname.                            */
 886         3 build_script_prefix char(24) var,                 /*   Build script name prefix (without .mb suffix).       */
 887         3 scan_Tb_via_request char(4),                      /*   Last request to replace contents of scan_Tb thread.  */
 888 
 889         3 mbuild_cleanup,                                   /*   Values to be restored when mbuild exits.             */
 890           4 original_wdir char(168) unal,                   /*     Working dir when mbuild was entered.               */
 891           4 original_descriptor char(168) unal,             /*     Process' current library descriptor when mbuild    */
 892                                                             /*       was entered.                                     */
 893 
 894       2 script_info aligned,                                /*   Information --  section of build script.             */
 895                                                             /*     Description of the installation, stored            */
 896                                                             /*     permanently only in the build script.              */
 897                                                             /*    save        (substructure written to build script)  */
 898                                                             /*    read -info  (substructure read/parsed from script)  */
 899         3 scalars,
 900           4 phase      char(20) var,                        /*  Phase of the build-install process...                 */
 901                                                             /*    values:  developing, auditing, installing           */
 902           4 descriptor char(168) var,                       /*  Path of library descriptor used for build script.     */
 903           4 log_dir    char(168) var,                       /*  Path of log directory used by the update_seg initiate */
 904                                                             /*   command placed in the .mb.ec install exec_com by the */
 905                                                             /*   install_ec request.                                  */
 906           4 install_ID char(20) var,                        /*  Default install_ID for: hcom af -install install_ID   */
 907 
 908         3 counts,
 909           4 apvN       fixed bin,                           /*  Count of approve_IDs in-use.                          */
 910           4 devN       fixed bin,                           /*  Count of developers in-use.                           */
 911           4 audN       fixed bin,                           /*  Count of auditors in-use.                             */
 912           4 instN      fixed bin,                           /*  Count of installers in-use.                           */
 913 
 914         3 arrays,
 915           4 approve_IDs (10) char(32) var,                  /*  Array of APPROVE_ID (MCRnnnnn) values.                */
 916                                                             /*   Default APPROVE_ID for: hcom af -apv {approve_ID}    */
 917                                                             /*   If 0 or more than 1 are given, user must supply the  */
 918                                                             /*   approve_ID in the hcom request.                      */
 919 
 920                                                             /* Person_ID.Project_ID names of people who saved the     */
 921                                                             /* build script in each phase of build-install process.   */
 922           4 devs        (10) char(32) var,                  /*  Array of developers.                                  */
 923           4 auds        (10) char(32) var,                  /*  Array of auditors.                                    */
 924           4 insts       (10) char(32) var,                  /*  Array of installers.                                  */
 925 
 926       2 progress aligned like bld_progress,                 /* Build Progress Indicators (saved between requests)     */
 927       2 switches,                                           /* Switches:                                              */
 928         3 debugS bit(1) unal,                               /*   T if:       invoked with: mbuild -debug (-db) arg    */
 929                                                             /*         toggled by request:    set -debug (-db)        */
 930         3 pad_sw bit(35) unal,
 931 
 932       2 ptrs,                                               /* Pointers to:                                           */
 933         3 ssu_areaP ptr,                                    /*   an ssu_-provided standard area.                      */
 934         3 areaP ptr,                                        /*   translator_temp_ area when seg structs live          */
 935         3 sciP ptr,                                         /*   subsystem control structure owned by ssu_            */
 936         3 lib_namesP ptr,                                   /*   library paths and preferred lib.dir name             */
 937         3 script_descripP ptr,                              /*   Description --  section of build script.             */
 938         3 script_statusP ptr,                               /*   Status --       section of build script.             */
 939         3 monitor_dataP ptr,                                /*   mbuild_monitor_ data structure                       */
 940 
 941       2 Special_Tb,                                         /* Special Threaded List Anchors                          */
 942         3 scan_Tb          aligned like Tlist_base,         /*                  scan_Tb -->> Seg.scan_Td              */
 943         3 INTERMEDIATE_Tb  aligned like Tlist_base,         /*          INTERMEDIATE_Tb -->> Seg.INTERMEDIATE_Td      */
 944       2 Struct_Tb,                                          /* Per-Structure Anchors:                                 */
 945         3 (BOUNDOBJ_Tb,                                     /*              BOUNDOBJ_Tb -->> BOUNDOBJ.BOUNDOBJ_Td     */
 946            COMPILE_Tb,                                      /*               COMPILE_Tb -->> COMPILE.COMPILE_Td       */
 947            Seg_Tb,                                          /*                   Seg_Tb -->> Seg.Seg_Td               */
 948            UNBOUNDOBJ_Tb                                    /*            UNBOUNDOBJ_Tb -->> UNBOUNDOBJ.UNBOUNDOBJ_Td */
 949            )               aligned like Tlist_base,
 950       2 pdm_Tb,                                             /* Per-Paradigm Anchors:                                  */
 951         3 (source_Tb,             bindfile_Tb,              /*       <paradigm_name>_Tb -->> Seg.pdm_Td               */
 952            source_arch_Tb,        object_arch_Tb,
 953            Bound_obj_Tb,          Unbound_obj_Tb,
 954            target_only_Tb,        listing_Tb,
 955            object_x_only_Tb,      mbuild_support_Tb
 956            )               aligned like Tlist_base;
 957 
 958   dcl  mbuild_data_version_3 char(20) var aligned int static options(constant) init("mbuild_data_0003");
 959   dcl  mbuild_data_version_4 char(20) var aligned int static options(constant) init("mbuild_data_0004");
 960 
 961   dcl 1 bld aligned like build_data based(Abuild_dataP),    /* Declaration of build_data used by each mbuild request  */
 962        Abuild_dataP ptr;
 963 
 964   dcl  ssu_area area based (bld.ssu_areaP);
 965 
 966 
 967 
 968 /* ------------------------------------------------------------------------------------------
 969    STRUCTURE:  bld_progress
 970 
 971    Describes progress made by mbuild requests to build and install the changeset in an
 972    installation directory.
 973    ------------------------------------------------------------------------------------------ */
 974 
 975   dcl 1 bld_progress aligned,
 976       2 (describedS,                                        /* set -description request: description gathered.        */
 977          scannedS,                                          /* scan: request complete.                                */
 978          analyzedS,                                         /* analyze: request complete.                             */
 979          compiledS,                                         /* compile: request complete.                             */
 980          preppedS,                                          /* archive_prep: request complete.                        */
 981          install_ecS                                        /* install_ec: request complete.                          */
 982          ) bit(1) unaligned,
 983       2 progress_pad bit(30) unaligned;
 984 
 985 
 986 /* ------------------------------------------------------------------------------------------
 987    STRUCTURE:  lib_names
 988 
 989    Array of node structures describing a library.directory: its preferred name,
 990    absolute directory pathname, and any problem found it attaching a preferred
 991    name that uniquely identifies a single library.directory.
 992 
 993    The preferred library name and pathname are extracted from the current library
 994    descriptor for the current user process.
 995    ------------------------------------------------------------------------------------------ */
 996 
 997   dcl 1 lib_names aligned based(lib_namesP),                /* List of library valid name/path combinations.          */
 998       2 descriptor char(168) var,                           /*  - library descriptor provided this data.              */
 999       2 namesN fixed bin,                                   /*  - Obtained from lib_descriptor_                       */
1000       2 P (lib_namesN refer (lib_names.namesN)) ptr unal,   /*  - P->nodes ordered by length(path), longest first     */
1001       2 node (lib_namesN refer (lib_names.namesN)),
1002         3 library char(32) var,                             /*  - Preferred library name, should exactly identify...  */
1003         3 path char(168) var,                               /*  - Path of root directory in library.                  */
1004         3 problem char(52) var,                             /*  - Issue with preferred name for this path.            */
1005        lib_namesN fixed bin,
1006        lib_namesP ptr;
1007 
1008 
1009 %page;
1010 /* ------------------------------------------------------------------------------------------
1011    BUILD SCRIPT LAYOUT
1012 
1013     The build script is divided into four titled sections.  Each has different
1014     uses and parsing constraints.
1015 
1016     The sections appear in the following order.
1017 
1018     Description --
1019        Free-form lines of text providing an english description of the
1020        changes in an hcom summary style of wording and level of detail.
1021 
1022 
1023     Changes --
1024        Build Script Language statements defining details of the changes.
1025        Lines in this section are tokenized by lex_string_, and parsed by
1026        mbuild_script_parse_.rd.  For details of this Build Script Language,
1027        type:  help build_script.gi
1028 
1029 
1030     Information --
1031        Statements defining properties of the build that are maintained
1032        across mbuild invocations.  All statements have the syntax:
1033          Keyword: value(s);
1034        Lines in this section are tokenized by lex_string_, and parsed by
1035        mbuild_script_info_.rd.
1036 
1037        Display property values by request:  print -info
1038 
1039        Set individual property values as shown in table below.
1040 
1041          PROPERTY    SET BY
1042          --------    ---------------------------------------------------
1043          Phase       command:  mbuild -developing | -auditing | -installing
1044          Descriptor  command:  lds set DESCRIPTOR_NAME
1045                      request:  lds set DESCRIPTOR_NAME
1046          LogDir      command:  mbuild -set_log_dir DIR_PATH
1047                      request:  set -log_dir DIR_PATH
1048                      default:  [lds pn -lb *.log]      (default if no log_dir set explicitly)
1049 
1050          Approve_IDs request:  add -apv MCRnnnnn(s)   (adds an MCR to the list)
1051                                set -apv MCRnnnnn(s)   (replaces entire list with other MCR(s) )
1052          Install_ID  request:  set -in  MRrr.r-iiii
1053 
1054        Other properties are user IDs in the form person_name.project_name and are set
1055        (or added to) automatically for the current phase whenever a save request is
1056        performed (either by explicit request, or as side effect of set/add request).
1057 
1058          Developer:  PERSON_ID.PROJECT_ID ...;
1059          Auditor:    PERSON_ID.PROJECT_ID ...;
1060          Installer:  PERSON_ID.PROJECT_ID ...;
1061 
1062 
1063     Status --
1064        Free-form lines of text in which developer, auditor, and installer
1065        can note status of various actions required in preparing, auditing,
1066        and installing items in the  Changes --  section.  These lines are
1067        set via requests:  set -status  (prompts for lines to replace status)
1068                           add -status  (appends lines to existing status)
1069        They can be modified by editing the .mb script segment.
1070 
1071 
1072   Any lines appearing before the first titled section in the build script
1073   segment are treated as an untitled section:
1074 
1075     [untitled section]
1076        Lines before the first titled section are treated as the Changes
1077        section by default.  But if a named  Changes --  section appears
1078        later in the build script, lines in the untitled section are ignored
1079        by the read request, and erased by a later save request.  This allows
1080        a minimal build script to contain only Build Script Language statements
1081        and nothing else.  The first save request will put these untitled lines
1082        into a named Changes section, and add templates for the other named sections.
1083    ------------------------------------------------------------------------------------------ */
1084 %page;
1085 
1086   dcl  BS_titles (4) char(11) var int static options(constant) init(
1087           "Description", "Changes", "Information", "Status" );
1088                                                             /* Section titles for known (supported) sections          */
1089   dcl (BS_sect_Description  init(1),                        /*  - Constants for selecting a title by name             */
1090        BS_sect_Changes      init(2),
1091        BS_sect_Information  init(3),
1092        BS_sect_Status       init(4)
1093        ) fixed bin int static options(constant);
1094 
1095   dcl  BS_title_missing char(18) int static options(constant) init(
1096           "[untitled section]" );                           /* Section title  for lines preceding 1st section title   */
1097                                                             /* delimiter.                                             */
1098 
1099   dcl  BS_title_delimiter char(2) int static options(constant) init( "--" );
1100                                                             /* Section title must be followed by white space and --   */
1101 
1102 
1103   dcl  BS_description_instructions char(66) int static options(constant) init("
1104           (Please supply a history_comment-style summary of the changes.)
1105 ");
1106 
1107   dcl  BS_sect_Changes_title char(13) int static options(constant) init("
1108 Changes --
1109 
1110 ");
1111 
1112   dcl  BS_sect_Information_title char(17) int static options(constant) init("
1113 Information --
1114 
1115 ");
1116 
1117 
1118   dcl  BS_log_dir_default char(14) int static options(constant) init( "-library *.log" );
1119 
1120 
1121   dcl  BS_status_instructions (2) char(231) int static options(constant) init(
1122           "
1123   (A free-form text section for use by developer, auditor, and/or installer.
1124    Headings below suggest software development actions whose status could be
1125    tracked.  You may replace these instructions and those headings with text", "
1126    of your choice; or remove all lines, leaving just the  Status --
1127    delimiter if you choose not to record any status data.                   )
1128 "        );
1129 
1130   dcl  BS_status_template char(204) int static options(constant) init(
1131           "
1132     AREAS                               PROGRESS
1133  ------------------------------------   --------------
1134 
1135  -- Design
1136 
1137  -- Coding
1138 
1139  -- Testing
1140 
1141  -- Documentation
1142 
1143  -- History Comments
1144 
1145  -- MCR Approval
1146 
1147  -- Auditing
1148 
1149  -- Installing
1150 
1151 "         );
1152 %page;
1153 
1154 /* ------------------------------------------------------------------------------------------
1155    STRUCTURE:  script_descrip                     (bld.script_descripP -> script_descrip)
1156 
1157    Text string entered using the mbuild request:  set -desc
1158    or read into mbuild using the mbuild request:  read -desc
1159                                                   read
1160    ------------------------------------------------------------------------------------------ */
1161 
1162   dcl 1 script_descrip aligned based (script_descripP),     /* Description of the installation, stored permanently    */
1163                                                             /*  only in the build script.                             */
1164       2 L fixed bin(21),
1165       2 text char (script_textL refer (script_descrip.L)) varying,
1166        script_descripP ptr,
1167        script_textL fixed bin(21);
1168 
1169 
1170 
1171 /* ------------------------------------------------------------------------------------------
1172    STRUCTURE:  script_status                      (bld.script_statusP -> script_status)
1173 
1174    Text string entered using the mbuild request:  set -status
1175    or read into mbuild using the mbuild request:  read -status
1176                                                   read
1177    ------------------------------------------------------------------------------------------ */
1178 
1179   dcl 1 script_status aligned based (script_statusP),       /* Status of the installation, stored permanently         */
1180                                                             /*  only in the build script.                             */
1181       2 L fixed bin(21),
1182       2 text char (script_statusL refer (script_status.L)) varying,
1183        script_statusP ptr,
1184        script_statusL fixed bin(21);
1185 
1186 
1187 /* ------------------------------------------------------------------------------------------
1188    MAJOR STRUCTURE:  Seg
1189 
1190    Data describing each segment found in the installation directory, or created when building
1191    the changeset.
1192 
1193    Also, the Seg.common substructure is data that also appears in other major structures used
1194    by mbuild:  BOUNDOBJ, COMPILE, and UNBOUNDOBJ
1195    ------------------------------------------------------------------------------------------ */
1196 
1197   dcl 1 Seg aligned based(SegP),
1198       2 common,                                             /* Elems in: Seg, COMPILE, BOUNDOBJ, UNBOUNDOBJ, request  */
1199         3 info,
1200           4 struct char(4) var,                             /* = Seg, COMP, BND, or UBND                              */
1201           4 type char(16) var,                              /* = [mbt seg Seg.name -type]                             */
1202           4 name char(32) var,                              /* Entryname of this segment.                             */
1203           4 library char(32) var,                           /* Library for this seg: sss, tools, hard, unb, include,  */
1204                                                             /*  or for infos: sss.info, priv.info;                    */
1205                                                             /*  for subsystem infos: analyze_multics.info, bce.info   */
1206           4 operation char(12) var,                         /* = "ADD", "REPLACE", "UPDATE", or "DELETE"              */
1207                                                             /*   UPDATE designates archives whose component(s)        */
1208                                                             /*   will be REPLACEd.  Using REPLACE for an archive      */
1209                                                             /*   means the entire archive is REPLACEd without         */
1210                                                             /*   changing its components during the build process.    */
1211           4 archive_name char(32) var,                      /* Name of containing archive in Multics Libraries.       */
1212           4 compiler char(32) var,                          /* Name of compiler used to compile source segment.       */
1213           4 compile_options char(32) var,                   /* Specific compile options given in a .mb file.          */
1214           4 produced_by_compiler char(32) var,              /* Name of compiler which produced this derived segment.  */
1215           4 pad1 char(4),
1216         3 request_Td aligned like Tlist_data,     /*             request.request_Tb -->> Seg.request_Td (Per Request) */
1217       2 Td,
1218         3 (Seg_Td,                                /*              build_data.Seg_Tb -->> Seg.Seg_Td   (Per Structure) */
1219            pdm_Td,                                /*  build_data.<paradigm-name>_Tb -->> Seg.pdm_Td    (Per Paradigm) */
1220 
1221            scan_Td,                               /*             build_data.scan_Tb -->> Seg.scan_Td                  */
1222            INTERMEDIATE_Td,                       /*     build_data.INTERMEDIATE_Tb -->> Seg.INTERMEDIATE_Td          */
1223 
1224            archs_Td,                              /*        BOUNDOBJ.sourceArchs_Tb -->> Seg(source_arch).archs_Td    */
1225                                                   /*        BOUNDOBJ.objectArchs_Tb -->> Seg(object_arch).archs_Td    */
1226            inArch_Td                              /*     Seg(source_arch).inArch_Tb -->> Seg(source).inArch_Td        */
1227            ) aligned like Tlist_data,
1228       2 Tb,
1229         3 inArch_Tb aligned like Tlist_base,      /*     Seg(source_arch).inArch_Tb -->> Seg(source).inArch_Td        */
1230       2 ptrs,
1231         3 seg_typeP ptr,                          /*           Pointer to seg_type_info structure for this seg.       */
1232         3 build_typeP ptr,                        /*           Pointer to bld_paradigm_info structure for this seg.   */
1233 
1234         3 name_addP ptr,                          /*           Pointer to nm_data: names to be added to the seg.      */
1235         3 name_deleteP ptr,                       /*           Pointer to nm_data: names to be deleted from the seg.  */
1236 
1237         3 BOUNDOBJp ptr,                          /*                  Seg.BOUNDOBJp  --> BOUNDOBJ                     */
1238         3 COMPILEp ptr,                           /*                   Seg.COMPILEp  --> COMPILE                      */
1239         3 UNBOUNDOBJp ptr,                        /*                Seg.UNBOUNDOBJp  --> UNBOUNDOBJ                   */
1240         3 sArchP ptr,                             /*        Seg(object_arch).sArchP  --> Seg(source_arch)             */
1241        SegP ptr;
1242 
1243   dcl 1 sArch aligned like Seg based (sArchP),              /* Seg(source_arch) structure.                            */
1244        sArchP ptr;
1245   dcl 1 oArch aligned like Seg based (oArchP),              /* Seg(object_arch) structure.                            */
1246        oArchP ptr;
1247 
1248   dcl 1 nm_data aligned based(nm_dataP),                    /* List of names associated with seg entry.               */
1249       2 N fixed bin,                                        /*  Count of names in the list.                           */
1250       2 names (nm_dataN refer (nm_data.N)) char(32) var,    /*  Array of names.                                       */
1251        nm_dataP ptr,                                        /* Pointer to a names structure.                          */
1252        nm_dataN fixed bin;                                  /* Number of names to allocate in a new structure.        */
1253 
1254 
1255 /* ------------------------------------------------------------------------------------------
1256    STRUCTURE:  request
1257 
1258    Minor structure that mainly holds a threaded-list anchor (Tlist_base) substructure.
1259    The request threaded-list holds Seg (or COMPILE or BOUNDOBJ) structures to be operated
1260    upon by the current mbuild request.  The list is constructured by that mbuild request,
1261    and lives only while that request is running.  Before the request returned, the request
1262    threaded list MUST BE EMPTIED; this frees the Seg.request_Td threads in member Seg
1263    structures so those structures can appear in request threads of some subsequent mbuild
1264    request.
1265 
1266    NOTE: Each mbuild request that builds a request thread must establish a cleanup on-unit
1267          to empty that threaded list if operation of the request is interrupted and/or
1268          aborted.
1269    ------------------------------------------------------------------------------------------ */
1270 
1271   dcl 1 request aligned based (requestP),                   /* Structure to hold temporary per-request list anchor    */
1272       2 common,                                             /* Elems in: Seg, COMPILE, BOUNDOBJ, UNBOUNDOBJ, request  */
1273         3 info aligned like Seg.info,
1274         3 request_Td aligned like Tlist_data,               /*      request.request_Tb -->> Seg.request_Td  (Per Req) */
1275       2 Tb,                                                 /*  - other .info fields are blank.                       */
1276         3 request_Tb aligned like Tlist_base,
1277        requestP ptr;
1278 
1279 
1280 /* ------------------------------------------------------------------------------------------
1281    MAJOR STRUCTURE: COMPILE
1282 
1283    A "relationship structure" that manages the operation of compiling one Seg in the changeset.
1284    ------------------------------------------------------------------------------------------ */
1285 
1286   dcl 1 COMPILE aligned based(COMPILEp),
1287       2 common,                                             /* Elems in: Seg, COMPILE, BOUNDOBJ, UNBOUNDOBJ, request  */
1288         3 info aligned like Seg.info,
1289         3 request_Td aligned like Tlist_data,               /*      request.request_Tb -->> Seg.request_Td  (Per Req) */
1290       2 Td,
1291         3 COMPILE_Td aligned like Tlist_data,               /*   build_data.COMPILE_Tb -->> COMPILE.COMPILE_Tb        */
1292       2 ptrs,
1293         3 sourceP ptr,                                      /*         COMPILE.sourceP  --> Seg(source)               */
1294         3 objectP ptr,                                      /*         COMPILE.objectP  --> Seg(Unbound_obj)          */
1295         3 listingP ptr,                                     /*        COMPILE.listingP  --> Seg(listing)              */
1296         3 INTERMEDIATEp ptr,                                /*   COMPILE.INTERMEDIATEp  --> Seg(source)               */
1297                                                             /*                              .produced_by_compiler^="" */
1298        COMPILEp ptr;
1299 
1300 
1301 /* ------------------------------------------------------------------------------------------
1302    MAJOR STRUCTURE: BOUNDOBJ
1303 
1304    A "relationship structure" that manages the operations of assembling source, objects, and
1305    bindfile needed to create a single bound object (aka, bound segment).
1306    ------------------------------------------------------------------------------------------ */
1307 
1308   dcl 1 BOUNDOBJ aligned based(BOUNDOBJp),
1309       2 common,                                             /* Elems in: Seg, COMPILE, BOUNDOBJ, UNBOUNDOBJ, request  */
1310         3 info aligned like Seg.info,
1311         3 request_Td aligned like Tlist_data,               /*      request.request_Tb -->> Seg.request_Td  (Per Req) */
1312       2 Td,
1313         3 BOUNDOBJ_Td aligned like Tlist_data,              /*  build_data.BOUNDOBJ_Tb -->> BOUNDOBJ.BOUNDOBJ_Tb      */
1314       2 Tb,
1315         3 (sourceArchs_Tb,                                  /* BOUNDOBJ.sourceArchs_Tb -->> Seg(source_arch).archs_Td */
1316            objectArchs_Tb                                   /* BOUNDOBJ.objectArchs_Tb -->> Seg(object_arch).archs_Td */
1317            ) aligned like Tlist_base,
1318       2 ptrs,
1319         3 (bindfileP,                                       /*      BOUNDOBJ.bindfileP  --> Seg(bindfile)             */
1320            Bound_objP,                                      /*     BOUNDOBJ.bound_objP  --> Seg(Bound_obj)            */
1321            listingP                                         /*       BOUNDOBJ.listingP  --> Seg(listing)              */
1322            ) ptr,
1323       2 sourceArchsN fixed bin,                             /* Number of source archives for bound seg in libraries.  */
1324        BOUNDOBJp ptr;
1325 
1326 
1327 /* ------------------------------------------------------------------------------------------
1328    MAJOR STRUCTURE: UNBOUNDOBJ
1329 
1330    A "relationship structure" that manages the operation of assembling source and object
1331    needed to create a single unbound object (standalone program) to be installed.
1332    ------------------------------------------------------------------------------------------ */
1333 
1334   dcl 1 UNBOUNDOBJ aligned based(UNBOUNDOBJp),
1335       2 common,                                             /* Elems in: Seg, COMPILE, BOUNDOBJ, UNBOUNDOBJ, request  */
1336         3 info aligned like Seg.info,
1337         3 request_Td aligned like Tlist_data,               /*      request.request_Tb -->> Seg.request_Td  (Per Req) */
1338       2 Td,
1339         3 UNBOUNDOBJ_Td aligned like Tlist_data,            /*build_data.UNBOUNDOBJ_Tb -->> UNBOUNDOBJ.UNBOUNDOBJ_Tb  */
1340       2 ptrs,
1341         3 name_addP ptr,                                    /* Pointer to list of alternate names on the seg.         */
1342         3 name_deleteP ptr,                                 /* Pointer to list of names to be deleted from the seg.   */
1343 
1344         3 sourceP ptr,                                      /*      UNBOUNDOBJ.sourceP  --> Seg(source)               */
1345        UNBOUNDOBJp ptr;
1346 
1347   dcl (                                                     /* Initial values for elements of Seg.info                */
1348        unknown_type char(16) var,                           /*  - Seg type not yet determined.                        */
1349        not_stored_in_library char(32) var,                  /*  - Seg library not appropriate for given Seg type.     */
1350        unknown_library char(32) var,                        /*  - Seg library not yet determined.                     */
1351        no_library_operation char(12) var,                   /*  - Seg operation not appropriate for given Seg type.   */
1352        unknown_operation char(12) var,                      /*  - Seg operation not yet determined.                   */
1353        no_containing_archive char(32) var,                  /*  - Seg type not appropriate for archiving.             */
1354        unknown_archive_name char(32) var                    /*  - Seg type location unknown; could be archived.       */
1355        ) int static options(constant) init("");
1356 
1357 /*  END OF:         mbuild_data_.incl.pl1                     *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */