dadllmultiline
DLL Usage description
Library: dadllmultiline
This library contains the functionality to work with multiline texts. From 6.1 b on multiline texts are handled completely different to be able to get one sync point when we want to attach an export process to an import process.(at this sync point ALL ascii file fields should be known for one record, including the multiline fields).
Basically an ascii field of type multiline will be filled with the name of a temporary file containing the text. However as text for several languages may be passed for one multiline it should contain multiple file names plus a language indicator. The solution implemented is that a multiline variable will be filled as follows:
- '<tmp_file_name> <language_list>' And that, if filled, files will exist with a filename like <tmp_file_name> but with their 3rd character (of the filename part) replaced by the language code. (Note that this scheme depends on the fact that the 3rd character of a temporary file name is indifferent for all calls to creat.tmp.file$() and thus the generated filenames will also be unique)
More information about the interfaces can be found in the description per function.
DLL Prototypes
function extern add.text(
const string text.field(),
const string text(),
long do.append,
string lang(1) )
pre : true (text.field should contain the name of the textfield!) post : IF
old(text.field) <> 0 and do.append
THEN the text <text> is appended to the text of language <lang>
of the textnumber found in <text.field>
ELSE the text <text> is placed under a new textnumber and in
language <lang> and text.field contains that new textnumber
(text.field itself is constant, but the variable whose name is
contained in text.field will be taken resp. changed!)
function extern copy.multiline(
long source.fp,
long target.fp )
pre : source.fp is a filepointer to a file open for reading and
target.fp is a filepointer to a file open for writing post : All
multiline texts that appear in the file, source.fp is
pointing to, directly folllowing the internal file pointer
are appended to the file, target.fp is pointing to. state : the internal
filepointer of source.fp points to the first
non-multiline text line ahead of the internal filepointer.
function extern process.multiline.to.text.field(
const string text.field(),
const string multiline.fld(),
long do.append )
pre : multiline.field is filled according to the standard filling for
a multiline field. post : text.field is filled with the textnum that
refers to the texts
created from the multiline field, if do.append held then the
texts are merely appended to any already existing texts.
(text.field itself is constant, but the variable whose name is
contained in text.field will be taken resp. changed!) state : For all
texts that were added succesfully, the file containing
that text will be deleted. The original temporary file will
also be deleted (even if the text for language 'p' failed).
function extern process.text.field.to.multiline(
const string text.fld(),
long text.num,
ref string multiline.fld(),
long is.audit.update )
pre : text.field contains the name of a triton table text field!
and this table field contains a textnumber that is passed via
text.num post : multiline.fld contains its correct value (see general
remarks)
and the files containing the texts are created.
function extern long read.multiline.from.ascii.file(
long fptr,
const string casf() )
pre : At least one multiline field exists for the ascii file that is
currently being processed. fptr points to the file currently
being processed. The position in the file is at the beginning
of the line following the ascii line currently being processed.
casf should be stripped. All multiline fields should be empty return:
Whether errors were encountered. post : All multiline texts that follow the
current line are processed,
for example:
- All multiline variables of the current ascii file have been
filled as they should be.
- The files containing the texts and with the appropriate names
have been created. state : Before: the internal file pointer of fptr
is pointing to the
beginning of the line following the dataline currently being
processed.
After: the internal file pointer of fptr is pointing to the
beginning of the next DATAline.
function extern remove.temporary.multiline.files(
const string multiline.fld() )
pre : process.text.field.to.multiline has been called post : the file
multiline.fld is removed
function extern long text.append(
long tm.textno.main,
long tm.textno.append )
pre : tm.textno.main and/or tm.textno.append are valid textnumbers
containing text in one or more languages post : tm.textno.main is
extended with the contents tm.textno.append desc : Two steps:
1. the contents of the tm.textno.main is read up until the last
line
2. this last line will be combined with the contents of tm.
textno.append return: Number of lines appended
function extern write.multiline.to.ascii.file(
long fptr,
const string fdnm(),
const string multiline.fld() )
pre : fdnm is a multiline ascii field (without casf_ in front of it!)
and multiline.fld contains the contents of fdnm
and fptr points to a file open for writing post : * the texts for all
languages for this multiline field have
been written to the file fptr points to
* All tmp files containing the texts have been removed
* the tmp??????? file has been removed
function extern long xch.text.defaults(
domain ttadv.txtc text.field fixed,
ref domain tttxt.txtg textgr,
ref domain tttxt.opwd edit.opt )
desc : precondition, return value and postcondition are the same as
for the funtion text.defaults(text.field, textgr, edit.opt)
the only difference is that this function internally stores results of previous
calls to this function, resulting in a better performance if this function is
called more than once for the same text field.