![]() |
Modified: 31.01.2009 | |
xMarkup is a program to perform text transformations in a set of text files (see xMarkup User's Guide). Engine of xMarkup is emplemented as console Win32 application for Windows 9x/NT/2K/XP/2003 and written in Icon programming language. As command line mode is not very convenient way to work so afterwards the Graphical User's Interface was developed. GUI is developed in Delphi 7 and incorporated many useful features.
Integration with external text editor Notepad++ provides user with powerful and convenient development environment (IDE). Script of processing rules is edited with source code highlighting and using of auto-completion. Any other editor instead of Notepad++ may be used if needed. For example, MyDevStudio or WinPad XP.
GUI is integrated with external program WinMerge, which may be used to analyze differences between source and output text files, which processed by xMarkup. Any other diff tool instead of WinMerge may be used if needed. For example, KDiff3.
GUI has options to validate defined procedural macros. This provides user with much easy and fast development of macro procedures.
Screen output of xMarkup may be copied to output file.
All preferences and parameters of user's session my be saved to file to be loaded then to repeat the processing of source data.
Development of GUI was done within ISTC project #3361р. Participation in this project became possible due to support of Vladimir Litvinov (litvinov@snezhinsk.ru), who is a technical editor of Russian Virtual Library.
GUI uses free Delphi-component TmFileScan, which was developed by Mats Asplund, MASoft. With help of this nice package the search of source files is implemented.
Version 2.0, April 2007
Initial version of GUI released. It's numbered 2.0 in accordance with version of console engine.
Version 2.0.1, July 2007
Fixed an error when file of parameters is being rewritten each time as processing is started (autosave mode) even it was not changed.
Version 2.1.0, October 2007
Added possibility to change font and color settings for work windows.
Version 2.1.1, April 2008
Added new functionality from console engine:
@include directive open included file for edit.Version 2.1.2, May 2008
Fixed bugs in console engine.
Version 2.1.3, September 2008
Simple alphabetical sort of source files' list changed to hierarchical sort of file paths. In the top of the list added a panel, click on which changes sorting order.
Version 2.1.4, January 2009
Fixed output mode in which output files shall be named by adding "xm$" prefix to the name of source files. On the tab "Help" added link to download page of xmarkup.
To process some source files with help of xMarkup GUI you shall make the following steps:
User may don't worry about original source files - the utily NEVER changes them! Output files are copied to defined output folder or created together with source files but with prefix "xm$" in a name. By default output files are not created at all.
xMarkup GUI contains from a main window, which has a set of functional tabs. Below is description of these tabs.
This page is opened first when program starts. On this page a list of source files to be processed is composed.

The page contains followng elements:
Adding of files to source list can be done incrementally many times. By default source list is ordered each time when new files are added to it. When you add files with help of search this operation may be interrupted in any moment by pressing Esc button or Ctrl-C.
Navigation through source list and selection its items are performed as usual in Windows - by means of mouse or keyboard. Double click on selected file or pressing of Enter makes it to be open. Pressing of Del removes selected file(s) from source list. Pressing of right mouse button activates context pop-up menu:
Menu items "Compare", "Open Result", "Edit Result" are enabled only when output file was created during processing of source file.
While processing in status line the progress-bar is indicated, which shows elapsed time and percent of completed job. Console output of utility is displayed in bottom window (you may change modes of this output on the tab Results).

Execution of processing may be interrupted in any moment by pressing of [Stop] button or Ctrl-C.
On this page the needed parameters of user's interface are set.

The page contains following elements:
Files, which are explicitly opened from macro-procedures during processing for read/write shall be located in defined working folder. For example,
procedure initialize
in := open("infile.txt", "r")
out := open("outfile.txt", "w")
...
t := get_content("infile.txt")
end
If you specife full paths to these files they may be located anywhere, of course. This also true for macro-definition @read(file).
Please note that the results of processing are always created in defined output folder (see the next chapter).
On this page the options of console output and creation mode for output results are set.

The page contains following elements.
Options of console (screen) output:
Parameters, which define how to store the results of processing:
On this page the processing rules for source files are defined.

The page contains following elements:
As editing of lists in table form may be unconvenient (e.g. when you need to insert or delete rows) it's recommended to use external text editor for that (see chapter 5).
On this page some additional options of processing are set. To get detailed description of these options please refer to xMarkup User's Guide.

The page contains following elements.
Parameters of internal counters:
Additional options:
On this page the procedural macros are defined.

The page contains following elements:
@include (to include content of external file) then you can open this file for editing by double mouse click on the line with directive.
On this page the copyright and links to program documentation are provided.

xMarkup GUI supports integration with any external text editor, which may be used for convenient viewing or editing of processed files or script with processing rules. If editor Notepad++ is installed on your system then it will be used by default. You may define other editor on tab page Preferences.
Notepad++ provides automatical highlighting of syntax of script with processing rules (file types .par or .xm). For example,

Pressing of Ctrl+Space activates operation of text auto-completion, with help of which you may choose required name of macro-definition or built-in function.
When script is modified and saved in the external editor and then user returns to xMarkup the dialog window is opened with proposal to reload the script:
Please answer "Yes" if you want to synchronuze changes.
xMarkup GUI supports integration with external program to check differences between files (diff tool), with help of which you can visually analyze differences between source and output files. If program WinMerge is installed on your system then it will be used by default. You may define other diff tool on tab page Preferences. Only one requirement for diff tool exists - startup command for this programm shall be in format:
<program-name> file-1 file-2
To find differences between source and target files after completion of processing you shall choose required source file (on page Source Files) and click by rigt mouse on it. Then choose "Compare" in opened pop-up menu. Comparing is possible only when output files are created (see page Results).
This chapter describes how to debug macro-procedures defined in processing rules.
With help of this mode the rough syntax errors in macro-procedures are debugged. It done by compilation of source code of processing rules by Icon compiler. However, it shall be taken into account that Icon compiler checks code only by syntax (in Icon it may be very strange or exotic!). So some invalid constructions may be treated as valid and produce an error only during Real-time execution. For example, Icon doesn't check existance of called functions or procedures on compilation phase.
Test compilation is performed by pressing of button [Test Compile] on the page [Macros]. Below the example of output listing of compiler is provided:

In this case in source line #6 the rigth closing bracket is missed:
t := tower(@body
and following "if-then" statement in the line #7 was not recognized.
With help of this mode the each statement of macro-code is checked during simulation of Run-time execution. This mode is useful for smooth debugging of source code. For example, to check usage of defined variables and functions. Test run is performed by pressing of button [Test Run] on the page [Macros]:

In this case source line
t := tower(@body)
produces Icon Run-time error 106 due to name "tower" is not recognized as name of defined procedure (right name is "lower").
Description of all possible Run-Time errors may be found in Appendix G (page 319) of book Icon Programming Language.
With help of this mode you can watch processing of source files step-by-step. To activate this mode you shall choose option [Debug Mode] on the page [Results] and then start processing:

After each processing step (that is search and transformation of the next text element) xMarkup suspends execution and waits user's input. You shall input in console window the number of answer (1-3) and then press Enter:
| © Sergey Logichev,
1999-2008 |
||