MINERVA text processing and blackboards used for program conversion; here to convert a MINERVA source program from old (until MINERVA 1.2) to new (from MINERVA 1.3) gui predicates.
The converter convgui.min is 50 lines, driven by the specification given in oldgui.min.
The example is configured as standalone application. Invoke e.g. on Unix with
Go.sh myguiprogram.minwhich will generate myguiprogram.min.new
The conversion is implemented with string replacement using substitute_all/4 for all lines of the source file and for all conversions defined in "oldgui.min".
From the manual:
substitute_all(+regexp, +string, +substitution, -result)
In "string" replaces all substrings defined by "regexp"
with "substitution". The modified string is returned
in "result".
The program first reads oldgui.min
applet__get_code_base(A,B) :- applet_getCodeBase(A,B). applet__get_document_base(A,B) :- applet_getDocumentBase(A,B). :second converts its clauses into a procedure to convert strings like
applet__get_code_base --> applet_getCodeBase applet__get_document_base --> applet_getDocumentBase :
finally applies this procedure to all lines of the source program.
| scroll to top |
|