13.9 Property Interface

ORIGIN '~beta/basiclib/betaenv';
LIB_DEF 'mpsproperty' '../lib';
INCLUDE '~beta/containers/list';
INCLUDE '~beta/basiclib/repstream';
BODY 'private/propertyBody'
(*
 * COPYRIGHT
 *       Copyright (C) Mjolner Informatics, 1986-93
 *       All rights reserved.
 *)

--- LIB: attributes ---
constType: (# exit 1 #); 
StringType: (# exit 2 #); 
nameType: (# exit 3 #);
parValue: 
  (# repSave:< (* Private *) 
       (# f: ^repetitionStream enter f[] do INNER #)
  #);
constElement: parValue
  (# c: @integer;
     repsave::< (* Private *) (# do c -> f.putInt #)
  #);
StringElement: parValue
  (# s: @text;
     repsave::< (* Private *) (# do  s[] -> f.putText #)
  #);
nameElement: parValue
  (# n: @text;
     repsave::< (* Private *) (# do n[] -> f.putText #)
  #);
propertyList: 
  (# propElement: 
       (# prop: @text;
          par: @parameterList;
          <<SLOT propertyPropertyListPropElementRepresentationPrivate: attributes>>;
       #);
     propList: @list
       (# element::< propElement;
          <<SLOT propertyPropertyListPropListRepresentationPrivate: attributes>>;
       #);
     init: (# do propList.init #);
     <<SLOT propertyPropertyListRepresentationPrivate: attributes>>;
     addProp: 
       (# propName: ^text;
          newPropElement: ^propElement;
          ifPropExist:< (# delete: @boolean do true -> delete; INNER exit delete #);
          newPar: 
            (# parType:< parValue;
               val: ^parType;
               par: ^parElement;
            do &parElement[] -> par[]; 
               &parType[] -> par.val[] -> val[];
               INNER; 
               par[] -> newPropElement.par.append
            #);
          addString: newPar
            (# parType::< stringElement;
               s: ^text;
            enter s[]
            do stringType -> par.type; s -> val.s;
            #);
          addName: newPar
            (# parType::< nameElement;
               n: ^text
            enter n[] do nameType -> par.type; n -> val.n;
            #);
          addConst: newPar
            (# parType::< constElement;
               c: @integer
            enter c do constType -> par.type; c -> val.c;
            #);
       enter propName[]
       ...
       #);
     findProp: 
       (# name: ^text;
          l: ^proplist.element
       enter name[]
       ...
       exit l[]
       #);
     deleteProp: 
       (# prop: ^text;
       enter prop[]
       do ...
       #);
     scanProp: 
       (# currentParList: ^parameterList;
          doProp:< 
            (# prop: ^text;
               getName: 
                 (# notAName:< (# do INNER #);
                    name: ^text;
                 do ...
                 exit name[]
                 #);
               getConst: 
                 (# notAConst:< (# do INNER #);
                    const: @integer
                 do ...
                 exit const
                 #);
               getString: 
                 (# notAString:< (# do INNER #);
                    string: ^text
                 do ...
                 exit string[]
                 #);
               scanParameters: 
                 (# doConst:< (# c: @integer enter c do INNER #);
                    doString:< (# s: ^text enter s[] do INNER #);
                    doName:< (# n: ^text enter n[] do INNER #);
                 ...
                 #)
               
            enter prop[]
            do INNER
            #);
       ...
       #);
     GetProp: ScanProp
       (# doProp::< (# do (if (prop[]->P.equalNCS) then INNER if)#);
          P: ^text
       enter P[]
       #);
  #);
parameterList: list(# element::< parElement #);
parElement: 
  (# val: ^parvalue;
     type: @integer;
     <<SLOT propertyParElementLocalsPrivate: attributes>>;
  #)


13.9 Property Interface
© 1991-2002 Mjølner Informatics
[Modified: Wednesday August 26th 1998 at 14:07]