SCHEMA EXPRESS_builtins; FUNCTION ABS ( P : NUMBER ) : NUMBER; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (v class val: (v pltNativeValue) abs)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: (v abs)] #*); END_FUNCTION; FUNCTION ACOS ( P : NUMBER ) : REAL; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltRealLiteral val: (v pltNativeValue) arcCos)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: (v arcCos)] #*); END_FUNCTION; FUNCTION ASIN ( P : NUMBER ) : REAL; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltRealLiteral val: (v pltNativeValue) arcSin)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: (v arcSin)] #*); END_FUNCTION; FUNCTION ATAN ( V1 : NUMBER; V2 : NUMBER ) : REAL; (*# | v | (v := self v1) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltRealLiteral val: (v pltNativeValue) arcTan)] #*) (*# | v | ^ (v := self v1) ifNotNil: [self return: (v arcTan)] #*); END_FUNCTION; FUNCTION BLENGTH ( P : BINARY ) : INTEGER; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltIntegerLiteral val: (v pltNativeValue) size)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: (v size)] #*); END_FUNCTION; FUNCTION COS ( P : NUMBER ) : REAL; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltRealLiteral val: (v pltNativeValue) cos)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: (v cos)] #*); END_FUNCTION; FUNCTION EVEN ( P : NUMBER ) : BOOLEAN; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltLogicalLiteral val: (v pltNativeValue) even)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: (v even)] #*); END_FUNCTION; FUNCTION EXISTS ( P : GENERIC ) : BOOLEAN; (*# (self p) ifMissing: [^ self return: (PltLogicalLiteral val: false) ] ifNotMissing: [^ self return: (PltLogicalLiteral val: true) ] #*) (*# | v | ^ (self return: self p notNil) #*); END_FUNCTION; FUNCTION EXP ( P : NUMBER ) : REAL; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltRealLiteral val: (v pltNativeValue) exp)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: (v exp)] #*); END_FUNCTION; FUNCTION FORMAT ( PN : NUMBER; PF : STRING ) : STRING; (*# | n f formatted | (n := self pN) ifMissing: [^ self return: n] ifNotMissing: [(f := self pF) ifMissing: [^ self return: f] ifNotMissing: [formatted := PlatypusExpressBuiltinFormatFormatter format: n pltNativeValue sourceFormat: f pltNativeValue trimBoth. ^ self return: (PltStringLiteral val: formatted)]] #*) (*# | n f formatted | (n := self pN) ifNil: [^ self return: n] ifNotNil: [(f := self pF) ifNil: [^ self return: f] ifNotNil: [formatted := PlatypusExpressBuiltinFormatFormatter format: n sourceFormat: f trimBoth. ^ self return: formatted]] #*); END_FUNCTION; FUNCTION HIBOUND ( P : AGGREGATE OF GENERIC ) : INTEGER; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: v upperBound] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: (v upperBound)] #*); END_FUNCTION; FUNCTION HIINDEX ( P : AGGREGATE OF GENERIC ) : INTEGER; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [((v := v pltNativeValue) isPltArray) ifTrue: [^ self return: (v upperBound)] ifFalse: [^ self return: (PltIntegerLiteral val: ( v pltNativeValue ) size)]] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: (v upperBound)] #*); END_FUNCTION; FUNCTION LENGTH ( P : STRING ) : INTEGER; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltIntegerLiteral val: (v pltNativeValue) size)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: (v size)] #*); END_FUNCTION; FUNCTION LOBOUND ( P : AGGREGATE OF GENERIC ) : INTEGER; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [ (v := v lowerBound) ifMissing: [^ self return: (PltIntegerLiteral val: 0)] ifNotMissing: [^ self return: v]]. #*) (*# | v | ^ (v := self p) ifNotNil: [self return: (v lowerBound)] #*); END_FUNCTION; FUNCTION LOG ( P : NUMBER ) : REAL; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltRealLiteral val: (v pltNativeValue) ln)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: (v ln)] #*); END_FUNCTION; FUNCTION LOG2 ( P : NUMBER ) : REAL; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltRealLiteral val: (v pltNativeValue) log: 2)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: (v log: 2)] #*); END_FUNCTION; FUNCTION LOG10 ( P : NUMBER ) : REAL; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltRealLiteral val: (v pltNativeValue) log)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: (v log)] #*); END_FUNCTION; FUNCTION LOINDEX ( P : AGGREGATE OF GENERIC ) : INTEGER; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [((v := v pltNativeValue) isPltArray) ifTrue: [^ self return: (v lowerBound)] ifFalse: [^ self return: (PltIntegerLiteral val: 1)]] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: (v lowerBound)] #*); END_FUNCTION; FUNCTION ODD ( P : INTEGER ) : BOOLEAN; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltLogicalLiteral val: (v pltNativeValue) odd)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: v odd] #*); END_FUNCTION; FUNCTION ROLESOF ( P : GENERIC ) : SET OF STRING; (*# | arg result tmpResult | (arg := self p) ifMissing: [^ self return: arg] ifNotMissing: [result := PltSetInstance new. tmpResult := Set new. self dataDo: [:d | d rolesOf: arg in: tmpResult]. result contents: tmpResult. ^ self return: result] #*) (*# | arg result | (arg := self p) ifNil: [^ self return: arg] ifNotNil: [ result := Set new. self dataDo: [:d | d rolesOf: arg in: result]. ^ self return: result] #*); END_FUNCTION; FUNCTION SIN ( P : NUMBER ) : REAL; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltRealLiteral val: (v pltNativeValue) sin)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: v sin] #*); END_FUNCTION; FUNCTION SIZEOF ( P : AGGREGATE OF GENERIC ) : INTEGER; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltIntegerLiteral val: (v pltNativeValue) size)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: v size] #*); END_FUNCTION; FUNCTION SQRT ( P : NUMBER ) : REAL; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltRealLiteral val: (v pltNativeValue) sqrt)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: v sqrt] #*); END_FUNCTION; FUNCTION TAN ( P : NUMBER ) : REAL; (*# | v | (v := self p) ifMissing: [^ self return: v] ifNotMissing: [^ self return: (PltRealLiteral val: (v pltNativeValue) tan)] #*) (*# | v | ^ (v := self p) ifNotNil: [self return: v tan] #*); END_FUNCTION; FUNCTION TYPEOF ( P : GENERIC ) : SET OF STRING; (*# | arg result | (arg := self p) ifMissing: [^ self return: arg] ifNotMissing: [ result := PltSetInstance new. result contents: (PlatypusExpressTypeOfBuilder typeOfSetFor: arg computedDomain). ^ self return: result] #*) (*# | arg result | (arg := self p) ifNil: [^ self return: arg] ifNotNil: [ (arg isKindOf: PlatypusComplexInstance) ifTrue: [result := OrderedCollection new. arg records do: [:rec | result addAll: (PlatypusExpressTypeOfBuilder typeOfSetFor: rec class platypusMetaData)]] ifFalse: [result := (PlatypusExpressTypeOfBuilder typeOfSetFor: arg class platypusMetaData)]. ^ self return: (result collect: [:r | r val])] #*); END_FUNCTION; FUNCTION USEDIN ( T : GENERIC; R : STRING ) : BAG OF GENERIC; (*# | result tmpResult ent role schemaEntityAttribute schemaKey entityKey attributeKey | ent := self t. role := self r. result := PltBagInstance new. ent ifMissing: [^ self return: ent] ifNotMissing: [ role ifMissing: [^ self return: role] ifNotMissing: [ tmpResult := Bag new. role pltNativeValue ifEmpty: [schemaKey := ''. entityKey := ''. attributeKey := ''] ifNotEmpty: [:arg | schemaEntityAttribute := role pltNativeValue findTokens: $.. schemaKey := schemaEntityAttribute first asUppercase. entityKey := schemaEntityAttribute second asUppercase. attributeKey := schemaEntityAttribute third asUppercase]. self dataDo: [:d | d rolesValue: ent roleSchema: schemaKey roleEntity: entityKey roleAttribute: attributeKey in: tmpResult]. result contents: tmpResult. ^ self return: result]] #*) (*# | result tmpResult ent role schemaEntityAttribute schemaKey entityKey attributeKey | ent := self t. role := self r. result := Bag new. ent ifNil: [^ self return: ent] ifNotNil: [ role ifNil: [^ self return: role] ifNotNil: [ role ifEmpty: [schemaKey := ''. entityKey := ''. attributeKey := ''] ifNotEmpty: [:arg | schemaEntityAttribute := role findTokens: $.. schemaKey := schemaEntityAttribute first asUppercase. entityKey := schemaEntityAttribute second asUppercase. attributeKey := schemaEntityAttribute third asUppercase]. self dataDo: [:d | d rolesValue: ent roleSchema: schemaKey roleEntity: entityKey roleAttribute: attributeKey in: result]. ^ self return: result]] #*); END_FUNCTION; FUNCTION VALUE ( V : STRING ) : NUMBER; (*# | param nb result | param := self v. param pltNativeValue isString ifTrue: [[nb := param pltNativeValue asNumber. result := nb isInteger ifTrue: [PltIntegerLiteral new] ifFalse: [PltRealLiteral new]. result val: nb] on: Error do: [result := PltMissingValue new]] ifFalse: [result := PltMissingValue new]. ^ self return: result #*) (*# | param nb result | (param := self v) isString ifTrue: [[result := param asNumber] on: Error do: [result := nil]] ifFalse: [result := nil]. ^ self return: result #*); END_FUNCTION; FUNCTION VALUE_IN ( C : AGGREGATE OF GENERIC : gen; V : GENERIC : gen ) : LOGICAL; (*# self signal: 'Value_in primitive is not implemented'. #*) (*# self signal: 'VALUE_IN primitive is not implemented'. #*); RETURN ( ? ); END_FUNCTION; FUNCTION VALUE_UNIQUE ( V : AGGREGATE OF GENERIC ) : LOGICAL; (*# self signal: 'Value_unique primitive is not implemented'. #*) (*# self signal: 'VALUE_UNIQUE primitive is not implemented'. #*); RETURN ( ? ); END_FUNCTION; PROCEDURE INSERT ( VAR PL : LIST OF GENERIC : gen; PE : GENERIC : gen; PP : INTEGER ); (*# | l e p | l := self pL. e := self pE. p := self pP pltNativeValue. l pltAdd: e beforeIndex: p #*) (*# | l e p | l := self pL. e := self pE. p := self pP. p <= 0 ifTrue: [l addFirst: e] ifFalse: [p >= l size ifTrue: [l addLast: e] ifFalse: [l add: e afterIndex: p]] #*); END_PROCEDURE; PROCEDURE REMOVE ( VAR PL : LIST OF GENERIC : gen; PP : INTEGER ); (*# | l p | l := self pL. p := self pP pltNativeValue. l removeAt: p #*) (*# | l p | l := self pL. p := self pP. l removeAt: p #*); END_PROCEDURE; FUNCTION NVL ( P : GENERIC : gen1; substitute : GENERIC : gen1 ) : GENERIC : gen1; (*# | v | (v := self p) ifMissing: [^ self return: (self substitute)] ifNotMissing: [^ self return: (v)] #*) (*# | v | ^ (v := self p) ifNil: [self return: self substitute] ifNotNil: [self return: v] #*); END_FUNCTION; END_SCHEMA;