<<>> <> <> <> <> <<>> <> <> <<>> DIRECTORY Rope USING [ROPE], IO USING [STREAM]; Customize: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Rope.ROPE; AnyString: TYPE = REF; --Either ROPE, REF TEXT, or, ATOM <> <<>> <> <<1) A database might have a syntax error. This is considered an user error; Customize tries to continue and returns just an error message to its caller. >> <<2) A query might be malformed. This is a client error which causes an error to be raised.>> <<3) A returned value might have an unexpected form. This is a user error, and the client application has to deal with that; Customize doesn't notice. >> <<4) A type converter might raise an error. This is considered a client error. It is assumed that the conversion goal type sufficiently restrict type converters to the ones desired by the client application.>> <<>> <> <<1) Constructing the same query, or, updating the same database from different threads is an error. >> <<2) Querying a database while updating it might cause the query to miss an entry. The database itself is not affected. >> <<3) Multiple queries on the same database need not be monitored. >> <<4) Changing the query data while a query is in progress may cause the query to fail, but it will not affect the database. Do not use the same query concurrently on different databases.>> <<>> <<>> <> DBreadonly: TYPE = REF READONLY DBRec; DB: TYPE = REF DBRec; <> DBRec: PRIVATE TYPE; CreateDB: PROC [] RETURNS [DB]; <> UpdateDB: PROC [db: DB, stream: IO.STREAM] RETURNS [errors: ROPE]; < and merge database entries into . If a specification is identical to one that already exists, the later one takes precedence. >> <<>> UpdateDBString: PROC [db: DB, string: AnyString] RETURNS [errors: ROPE]; < and and merge database entries into . >> <<>> UpdateDBExplicite: PROC [db: DB, key: AnyString, value: REF] RETURNS [errors: ROPE]; < and add as database entry into . >> <> <<>> UpdateDBFromFile: PROC [file: REF, inputDb: DB ¬ NIL] RETURNS [db: DB, errors: ROPE]; < is updated and returned again. a STREAM or a string (string is interpreted as a file name). Not found files are reported like syntax errors in the data base.>> <> DoQuery: PROC [db: DBreadonly, query: Query] RETURNS [REF]; < with . >> DoQueryString: PROC [db: DBreadonly, string: AnyString ¬ NIL] RETURNS [REF]; <> < strings.>> <> Query: TYPE = REF QueryRep; QueryRep: TYPE; <> QueryState: PROC [query: Query] RETURNS [state: NAT]; < of query in construction. Meaning of numerical value is private. >> NewQuery: PROC [reserve: NAT ¬ 16, useMemory: Query ¬ NIL] RETURNS [Query]; <> <<: allocates enough memory for about steps or options.>> ResetQuery: PROC [query: Query, state: NAT ¬ 0]; <. =0 means reset to empty.>> CopyQuery: PROC [query: Query, reserve: NAT ¬ 0] RETURNS [Query]; <> << is a guess: allocates enough memory to append about more steps or options.>> <<>> AppendStepOnly: PROC [query: Query] RETURNS [Query]; <; The new step has no options yet.>> < or new query if new memory allocation needed.>> <<>> AppendOptionOnly: PROC [query: Query, option: AnyString ¬ NIL] RETURNS [Query]; <. >> << must not be empty.>> < or new query if new memory allocation needed.>> <<>> AppendStep: PROC [query: Query, val1, val2: AnyString ¬ NIL] RETURNS [Query]; <> <; Also appends up to two options to new step.>> < or new query if new memory allocation needed.>> <<>> FreeQuery: PRIVATE PROC [query: Query]; <> <> ParseQuery: PROC [string: AnyString ¬ NIL] RETURNS [Query]; < into a query. >> <> QueryError: ERROR [what: ROPE]; <<>> END.