DIRECTORY
DBDefs USING [Index, IndexObject, FieldSequenceObject, FieldSequence, ValueSequence, ValueSequenceObject, Constraint, ConstraintObject, Value, ValueConstraint],
DB USING [FieldSpec, FieldSpecObject];
~
BEGIN
MakeFieldSpec:
PROC [count:
CARDINAL]
RETURNS [fields:
DB.FieldSpec] ~ {
fields ← NEW[DB.FieldSpecObject[count]]
};
MakeIndex:
PROC [count:
CARDINAL]
RETURNS [index: DBDefs.Index] ~ {
index ← NEW[DBDefs.IndexObject ← [key: 0, index: NIL, fields: MakeFieldSequence[count]]]
};
MakeFieldSequence:
PROC [count:
CARDINAL]
RETURNS [fields: DBDefs.FieldSequence] ~ {
fields ← NEW[DBDefs.FieldSequenceObject[count]]
};
MakeValueSequence: PROC [count: CARDINAL] RETURNS [vals: DBDefs.ValueSequence] ~ { vals ← NEW[DBDefs.ValueSequenceObject[count]] };
SetValueSequence:
PROC [vals: DBDefs.ValueSequence, pos:
CARDINAL, v: DBDefs.Value] ~
TRUSTED {
vals[pos] ← v
};
MakeConstraintSequence:
PROC [count:
CARDINAL, cList:
LIST
OF DBDefs.ValueConstraint]
RETURNS [c: DBDefs.Constraint] ~
TRUSTED {
pos: CARDINAL ← 0;
c ← NEW[DBDefs.ConstraintObject[count]];
FOR cL:
LIST
OF DBDefs.ValueConstraint ← cList, cL.rest
UNTIL cL =
NIL
DO
c[pos] ← cL.first;
pos ← pos + 1
ENDLOOP
};