Added June 2023
xcall MIAMEX, MX_TRANSCOPY, op, srcfile, dstfile, tcffile, section, status{, flags, maxlen, errmsg}
MX_TRANSCOPY (MIAMEX 202) copies and translates a file, applying a series of regular expression replacement operations such that the destination file is a variant of the source. The new term "transcopy"—translate or transform plus copy—was coined to describe this operation.
Parameters
op (Num) [in]
must be set to 1
srcfile (String) [in]
source filespec
dstfile (String) [in]
destination filespec; replaced if already exists
tcffile (String) [in]
configuration filespec; see TCF specification
section (String) [in]
optional section name within the TCF
status (Signed Int) [out]
on success, number of modified lines; see table below for errors
flags (Int) [in]
optional REGEXxs flags combined with any that are set in the TCF
maxlen (Int) [in]
optional max length of source lines to support; default 16K
errmsg (String) [out]
set only if status < 0)
Comments
This function (Op 1) is essentially equivalent to the compiler transclude mechanism (++include with integrated transcopy) and may be used to debug your ++include TCF files. But it is also useful for general purpose file translations.
Errors (status parameter)
Value |
Description |
---|---|
-2 to -25 |
|
-101 to -199 |
pattern compiliation errors (same as REGEXxs) |
-93 to -99 |
misc errors (same as REGEXxs) |
-92 |
unable to allocate sufficient memory |
-91 |
input file error |
-90 |
output file error |
-89 |
invalid item or syntax error in TCF |
-88 |
too many s#/r# pairs in TCF |
-87 |
TCF maximum line length exceeded |
-86 |
unable to open TCF |
-85 |
TCF section not found |
-84 |
Unable to load REGEX library (PCRE) |
History
2023 June, A-Shell 6.5.1732: Function added to A-Shell.