Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

LIB_$INTRO                        Domain/OS                         LIB_$INTRO


NAME
     intro - calls to manipulate predefined large sets

SYNOPSIS (C)
     #include <apollo/base.h>

     void lib_$init_set(
          void *set,
          short &set_size)

     void lib_$add_to_set(
          void *set,
          short &set_size,
          short &element)

     void lib_$clr_from_set(
          void *set,
          short &set_size,
          short &element)

     boolean lib_$member_of_set(
          void *set,
          short &set_size,
          short &element)

SYNOPSIS (FORTRAN)
     %include '/sys/ins/base.ins.ftn'

           integer*4 set(8)
           integer*2 set_size, element
           logical in_set

           call lib_$init_set(set, set_size)
           call lib_$add_to_set(set, set_size, element)
           call lib_$clr_from_set(set, set_size, element)

           in_set = lib_$member_of_set(set, set_size, element)

DESCRIPTION
     Domain/OS calls use predefined types that are instances of Pascal set
     types.  C and FORTRAN do not directly support set types, although small
     sets (sets with 32 or fewer elements) are commonly implemented as con-
     stant masks and manipulated with logical operators.  However, sets with a
     large number of elements (up to 256) are not easily handled in C and FOR-
     TRAN, so Domain/OS provides four special functions prefixed with the
     lib_$ identifier to manipulate predefined "large set" types in C and FOR-
     TRAN programs.  The large set manipulation functions are the following:

          lib_$init_set
               Initializes set by removing all possible members.

          lib_$add_to_set
               Makes element a member of set.

          lib_$clr_from_set
               Makes element not a member of set.

          lib_$member_of_set
               Returns a Boolean value indicating whether element is a member
               of set.  All bits in the return are set to 1 for true, and all
               bits are cleared to 0 for false.

     All current large sets are declared as eight-element arrays of unsigned
     four-byte integers.  Each bit in the integer array represents a single
     element, so a large set can contain up to 256 elements.  When a bit is 1,
     the corresponding element is a member of the set; when a bit is 0, the
     corresponding element is not a member of the set.  The set_size argument
     to the lib_$ calls allows the calls to function with sets of arbitrary
     size; though for all predefined large set types currently in use,
     set_size is just 256.

     A large set type is diagrammed below.


           15                                                           0
           ______________________________________________________________
           |                     elements 240 - 255                      |
           |_____________________________________________________________|
           |                     elements 224 - 239                      |
           |_____________________________________________________________|
           |                     elements 208 - 223                      |
           |_____________________________________________________________|
           |                     elements 192 - 207                      |
           |_____________________________________________________________|
           |                     elements 176 - 191                      |
           |_____________________________________________________________|
           |                     elements 160 - 175                      |
           |_____________________________________________________________|
           |                     elements 144 - 159                      |
           |_____________________________________________________________|
           |                     elements 128 - 143                      |
           |_____________________________________________________________|
           |                     elements 112 - 127                      |
           |_____________________________________________________________|
           |                     elements 96 - 111                       |
           |_____________________________________________________________|
           |                      elements 80 - 95                       |
           |_____________________________________________________________|
           |                      elements 64 - 79                       |
           |_____________________________________________________________|
           |                      elements 48 - 63                       |
           |_____________________________________________________________|
           |                      elements 32 - 47                       |
           |_____________________________________________________________|
           |                      elements 16 - 31                       |
           |_____________________________________________________________|
           |                      elements 0 - 15                        |
           ______________________________________________________________
           15                                                           0


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026