Implement a new command for str files called read with
a parameter name specifying the file to read.
read name=gacto2.str
This command is processed as follows:
locate the file named in the parameter
push the current file name
switch output to the new file
(locate(NameParValue, Path) ->
(
seeing(Current), % Check current_input/1 and set_input/1
push(Current),
see(Path)
)
;
assert_error(['Could not find file',NameParValue])
When eof is detected reading is
returned to the last pushed file if any, or end
processing.
TopLevel.pl
readlines(FileType):-
setcount(line,1),
repeat,
readline2(List,Last), % get the character List %
inccount(line,L),
get_tokens(FileType,List,Tokens),% lexical analysis %
get_string(List,Line), % make a string %
set_prop(line,number,L),
set_prop(line,text,Line),
processLine(FileType,Tokens), % parsing and execution%
% NEW
((was_read_command(FileType,Tokens,NewFile) ->
(seeing(Current),push(Current),see(NewFile))
;
true
)
% what about line numbers?
echo_line(L,Line),
set_prop(line,last,Line),
check_eof(Last,EOF),
% Changed
(EOF = eof ->
(pop(previous) ->
(Seen(current), see(previous),fail) %continue previous
;
true % nothing more to process
)
; % not end of file check errors
not(errors:check_continuation)
),
processLine(FileType,eof),!. % end of file reached %
check_eof(eof):- % eof and no previous file on stack
empty_file_stack, !.
check_eof(eof):-
get_value(file_stack,[File|Rest]),
get_value(stru_file,Current_file),
close(Current_file),
file_base_name(Current_file,Basename),
report([nl,write('Finished included structure:'),write(Basename),nl]),
put_value(file_stack,Rest),
open_file_read(File),
set_input(File).
empty_file_stack:-
get_value(file_stack,[]),!.
How to specify locations of the inserted files.
The most common usage scenario will be
that a file specifying the structure of a new
source incorporates the base definitions of the
source oriented model
Use python style notation where fonder are separated by "."
and the last token is expected to by a file name with extension "str".
escrituras.str
note doc Estrutura para escrituras
note read the default stru for portuguese acts
read name=system.pt.base
system/pt/base.str
note doc Grupos bases documentos portugueses
note read os conceitos básicos
read name=system.base
system It is the default dir for structures kleio-home/conf/stru/, or,
in mhk instalations, mhk-home/system/kleio/conf/stru
or what is defined in env variable $KLEIO_STRU_DIR
sources is the directory defined as sources in the token used to access kleio-server
structures is the directory defined as structures in the same token (see below).
system.gacto2" : KLEIO_STRU_DIR/gacto2.str
sources.stru.chronolgy" : /kleio-home/projects/ilhavo-editor/sources/stru/chronology.str
structures.paroquiais.batismos.mybapt" : /kleio-home/projects/ilhavo-editor/structures/paroquiais/mybapts.str
Nos ficheiros stru a leitura de outra estrutura seria feira com o comando read/lege
read name=system.pt.base
Note that KLEIO_STRU_DIR can Be set in a environment variable of the server and defaults to
KLEIO_HOME_DIR/system/conf/kleio/stru/
There is a utility predicate add-to-property-list which is good for the “push" and "pop".
system.stru: basic "system" groups
system_pt.stru: basic "portuguese" groups
baptismos
casamentos
obitos
devassas
notariais
listas
To allow for incremental definitions if group A is in part of group X and group B specializes Group A then Group B
would be allowed as part of X.
part name=historical-source;
part=historical-act
part name=fonte; source=historical-source
part name=bap; source=historical-act
...
fonte$...
bap$...
Implement a new command for
str
files calledread
with a parametername
specifying the file to read.This command is processed as follows:
When
eof
is detected reading is returned to the last pushed file if any, or end processing.TopLevel.pl
How to specify locations of the inserted files.
The most common usage scenario will be that a file specifying the structure of a new source incorporates the base definitions of the source oriented model
Use python style notation where fonder are separated by "." and the last token is expected to by a file name with extension "str".
escrituras.str
system/pt/base.str
system
It is the default dir for structureskleio-home/conf/stru/
, or, inmhk
instalations,mhk-home/system/kleio/conf/stru
or what is defined in env variable
$KLEIO_STRU_DIR
sources
is the directory defined as sources in the token used to access kleio-serverstructures
is the directory defined asstructures
in the same token (see below).Example of user token
In requests with this token:
Note that KLEIO_STRU_DIR can Be set in a environment variable of the server and defaults to KLEIO_HOME_DIR/system/conf/kleio/stru/
There is a utility predicate
add-to-property-list
which is good for the “push" and "pop".system.stru: basic "system" groups
system_pt.stru: basic "portuguese" groups
baptismos
casamentos
obitos
devassas
notariais
listas
To allow for incremental definitions if group A is in
part
of group X and group B specializes Group A then Group B would be allowed as part of X.