Doc4GL documentation index page
This users manual is part of "DOC4GL" documentation set. Please see Doc4GL documentation index page for other related documents.
This User Manual is intended for person that will use already installed and configured DOC4GL tools.
Background
During the software development life cycle (SDLC) of a project , the documentation that associates the implementation in 4gl code to the functionality becomes rapidly unsynchronized. This fact occurs due to the form and place where this normally is stored.
The designer usually have to construct a document to define the functions, it's return values and parameters. It is common to use CASE tools such as the "Power Designer", putting inside of the processes definition the documentation descriptions of the program to be built.
In the initial phase of project development (if the manager was careful), it is probable that the documentation reflects the written code. When SDLC enters a phase of the most advanced processes, normally immediately after the first usable version, the chaos starts. The programmer has to make decisions, and the designer or manager does not have time to control everything. Thus the source code gets modified, but as the programmers by definition don't like to work on documentation, documentation is immediately unsynchronized and obsolete. The more time passes, more unsynchronized it is. Until it becomes useless.
It would be easy to blame the programmers, however, the documentation is usually hidden somewhere on the server, in a obscure directory inside a document (usually in .doc format ) normally with many pages. The context change is such, that it's not easy to demand such an effort. The approaches initiated with some work, as for example literate programming are in this respect recently more used.
The Java programming language is paradigmatic: The reference documentation of all API's is created by automatic processes, with information contained in source code. With this integration, we can easily note this improvements:
- Same tool used for programming and reference documentation (text editor, or CASE/RAD/IDE tools).
- Easy detection of documentation errors.
- Increased productivity.
- More communication inside of programming teams (given that all the functions will be registered).
About DOC4GL
This tool gives 4gl programmers functionality already present in Java (with Javadoc) or in the C/C++ (with projects as DoxyGen):
- Ability to include reference documentation in the 4gl source code.
- Generation of reference documentation in readable format.
- Ability to search generated documentation.
- Reference documents with diverse organizations.
Obviously, the programmers and project managers have to enforce the practice of amending the embedded documentation during the modifications to the programs. Also, they must manually define some patterns to the comments that will be inserted in the programs source code.
DOC4GL set of tools, sometimes also referred to as "fgldocumenter", or "fgldoc", where originally developed by Sergio Alexandre Ferreira for MoreData, and donated to Aubit 4gl project under GNU GPL license. It is now developed, maintained and supported as part of Aubit 4gl project.
For users not inclined to reading complete manual, some typical sequences for installation and execution of the tool are presented in this document. However, it is recommended for users that will perform installation and configuration tasks, to read other documents in DOC4GL documentation set, in particular the Technical Manual.
Please see Installation and Compilation instructions for details.
Please see Installation and Compilation instructions for details.
Here are few typical examples of execution with non-graphical User Interface, called Command line User Interface, or Character User Interface (CUI).To import information from 4GL source code to repository (normalized):
$ fgldoc --ui=CUI --action=importFgl --import_directory=/tmp --load_recursiveTo import information from CSV (Comma Separated Values) file to repository (normalized or not normalized):
$ fgldoc --ui=CUI --action=importCSV --sheet_file=/tmp/comments.csv --load_recursive --normalizeTo export from repository to 4gl source fiels:
$ fgldoc --ui=CUI --action=export2Fgl --sheet_file=<fileName> --export_directory=<directoryName>To export from repository to CSV (Comma Separated Values) file:
$ fgldoc --ui=CUI --action=export2Csv --export_directory = <directoryName> --export_source=<fglSourceName.4gl>To export form repository to HTML formatted file:
$ fgldoc --ui=CUI --action=export2Html --export_html_directory=<directory_name>
"fgldoc" - Interface for execution of documentation commands
This component (program) is used to execute actions provided by 4gl documenter. The majority of the documentation functions are executed via this program.
It is written in Perl programming language, and accepts following execution options:
- --help: Show this help
- --ui={GUI|CUI}: User interface with which the application will be executed:
- GUI: Graphical User Interface (Mode Perl/Tk)
- CUI: Command line User Interface. No user interaction. With this interface all options must be supplied on command line.
- --action=<ActionName>: Action to execute:
- importCSV: Imports the comments from comma separated file (generated by a spreadsheet program, for example).
- importFgl: Imports the comments from 4gl source file.
- export2Fgl: 4gl. Exports the comments to 4gl sources. The following parameters are also needed --exportDirectory and --exportSource .
- export2Csv: Exports comments to a file with separating character (CSV).
- export2Html: Exports the comments to a set of HTML, linked files.
- createRepository
- dropRepository
- --export_directory=<dirName>: In the case of exporting comments to 4gl sources, it must contain the name of the directory where to generate the files.
- --exportSource=<fglname>: In the case of exporting comments to 4gl source file, it will contain the name of the program source file.
- --quiet: Do not display ANY message to standard output.
- --insertEmptyComment: Indicates that empty comments are to be inserted in a function that was not defined it in the repository. Used with option of exporting to 4gl source files.
- --sheet_file=<SCVfilecName>: Indicates the name of the CSV file to use when importing or exporting to/from CSV file.
- --normalize: Indicates that the loaded information from CSV file must be normalized, and not only inserted in the table with structure equal to the CSV file.
- --clean_repository: Indicates that the repository must be cleaned before loading the information. WARNING: it will delete ALL data from repository.
- --send_line_to_log (FIXME: ???)
- --package_name=s: Name of package to insert during 4gl sources parsing.
- --load_recursive: In the case of processing information from 4gl source files, indicates that it must load files in the specified directory, and all sub-directories.
- --import_directory=s: Directory containing 4gl files to be loaded.
- --export_html_directory=<htmlDirectoryName>: Directory where files in HTML format will be exported / generated.
- --ignore_exist_dir: Ignore if the directory already exists. Used for the exporting HTML.
- --database=<database name>
- --locale=[en_us|pt_pt] language
CUI user interface
CUI stands for Command line User Interface. It's primarily used for the batch execution.
It is activated with option --ui=CUI.
Since there will be no interaction with the users, all necessary options must be supplied by command line parameters, or be available in the configuration file (normally ".fgldocrc").
GUI Interface
GUI interface was created using "Tk" Perl package. Therefore, Perl "Tk" module has to be installed.Click on the image to see screenshot of Doc4GL GUI interface in action, with main, options and Import configuration windows open.
A common mistake is to attempt execution in GUI mode, from terminal emulator window, without defining environment variable "$DISPLAY" to associated X GUI display. Please set your DISPLAY variable to appropriate value.
Following are GUI interface menu options:
File -> Open
Opens and reads the file that contains execution options for the tasks.By default, this file is "~/.fgldocrc".
File -> Save
Saves the current execution options in the configuration file (normally "~/.fgldocrc").File -> Exit
Saves the configuration and exits the program.Import -> CSV
Imports comments from CSV file (Character Separated) to the database repository in relational format.Import is performed in two phases:
You can specify:
- Load of the file into database table with the same structure.
- Normalize the information for the defined database relational model.
- File to load: Full name of the file to load, using File Chooser. Default extension is "txt".
- Clean the repository: Not used
- Normalization: When de-activated, second phase is not executed.
- Logging: When activated, each loaded string is sent to log file.
If the user selects Cancel button, or close the window, the operation is not executed, and focus is returned to the main menu.
The file must have as separator the <TAB> character between columns, and <Enter> between lines.
It must contain 7 columns whose information must be in this order:
- moduleName: Name of the 4gl module.
- idProcess: Process code same as in p4gl_process table
- functionName: Name of the function
- parametro: Parameter
- return: Description of the return values.
- call : (FIXME: ????)
- comments: Text comment for the function
Import -> 4gl Sources
Imports the available information and comments from 4gl source code.The information to provide in the window is:
- Name of package: Name of package that 4gl modules will be associated with. For now, used only to differentiate modules.
- Location of the directory: Full name of the directory under which 4gl sources to parse are available.
- Stack of modules: Full stack of the 4gl modules that it is to be parsed.
- Load comments: Load the fgldoc comments in the repository.
- Parse Only: Test if parsing is done successfully, do not load any information in the database.
- Repository: Information necessary to establish the connection with the database.
- Logging of database table use: If activated, information on table usage is loaded in the repository.
- Load parameters: If activated, indicates that parser must load the parameters of the functions in the repository.
- Load Strings: If activated, specify strings that will be loaded in the repository. Not used.
- Load local variables: If activated, indicates that the local variables will be loaded in the repository.
- Recursive: If activated, existing files with 4gl extension will be added to the stack of all 4gl files, in all sub-directories below the one specified.
If the user press the Cancel button, or close the window, the operation is not executed and focus is returned to the main menu.
Export -> CSV
Exports all the information available in the repository, to a text file with character separator (CSV).It takes the normalized data and inserts it in the de-normalized table p4gl_excel, before writing to the file.
The interface available in this version presents only one file to choose, the file and location where it is to be created..
If the user press the Cancel button, or close the window, the operation is not executed and focus is return to the main menu.
Export -> 4gl Sources
Inserts the information available in the repository, in the 4gl source files as fgldoc comments.The module comment is inserted at the beginning of the file.
The comments for each function are inserted just before its implementation in the source code.
It allows to configure the following options:
- Directory : Directory name where the 4gl source to insert the comments are located.
- 4gl module : Presents all the 4gl files that are in the chosen directory so the user can chose the one where to insert the comments.
- fgldoc comment replacement : If activated, it substitutes fgldoc comments that exist in the file, otherwise leaves them and creates a new one.
If the user press the <Cancel> button, or close the window, the operation is not executed, and focus is return to the main menu.
Export -> HTML
Although web browser interface written in JSP is also available, and can be used to browse on-line the information stored in the repository, some times is useful to be able to access that information directly from pure HTML files, and not to be dependent of the complex infrastructure with RDBMS, web server and JSP engine.
Click on the image to see picture o Doc4GL generated HTML static documentation
Click here to open in your web browser on-line demo of Static HTML Doc4GL generated documentation
This option allows to generate a fully linked HTML document structure, and allows user to browse it off-line, using only web browse, directly form the file system.
This way we can write the information to CD-ROM, or store it in one compressed archive file (for example, ".tgz") that can be sent by e-mail. It exports all data available in repository.
If the user press the <Cancel> button, or close the window, the operation is not executed, and control is returned to the main menu.
Options -> Show Log
It shows of hides log window during the program execution.Options - > Configure
Allows to configure the program execution options, namely:
- 4gl doc repository: Information needed for establishing the database connection.
- "syspgm" repository: Not used at the moment.
- CSV import file: Name of the default character separated file (CSV) used to load repository.
- XML file: Not used at the moment.
- CSV Export file: Name of the default file name to receive data for export actions.
- XML export file: Not used at the moment.
Web browser interface
Build in JSP (Java Server Pages) server-side scripting language, this component allows on-line access to the information in repository, from an html browser.
Click on the picture to see screenshot of Doc4GL web browser interface.
Click here to open in your web browser on-line demo of Doc4GL web browser Dynamic HTML, Java Server Pages/Java Servlet based, using Tomcat/Informix RDBMS via JDBC
Screen (web page) is divided in tree windows (frames):
The business processes frame presents the list of processes that exists in a table, with 4gl functions associated. Each one of these processes is a link that opens the window (page in the lower left HTML page frame) that will show the list of modules. There is an option to select all the processes.
- Business processes tree menu (based on loaded process .unl file)
- Modules / 4gl source files list (filtered or not by a process)
- Comments (filtered or not by module or process).
On the basis of the selected (or all) process, list is displayed of 4gl modules that contains functions associated to a process (with tag @process). Each module is a link that opens in frame comments of a module. It will have an option to show to all, in accordance with the selected process.
The comments of a module (or all of them) presents a summarized list of the functions of that module, followed later with more detailed information existing in the repository, namely:
- Name
- Text of the comment.
- Parameters: List and description
- Return values: Description of each return value.
- All other present tags in function's comment
The configuration file is used to configure execution actions, options and needed data.This file can be manually created or recorded using the available options when fgldoc is executed (in GUI or CUI user interface). By default, it's name is "fgldocrc" and is kept in the user home directory ("~" or $HOME). In this version, the file contains Perl variables assignment (kind of object serialization).
The variables available to configure tools actions are:
Following is an example of automatically generated configuration file:
- csvImportFile: Name of default CSV file for data import.
- xmlImportFile: Not used
- UI: Default Type of user interface.
- action: Default Action to execute.
- importInformixDir: INFORMIXDIR for the repository inside Informix RDBMS.
- importInformixServer: INFORMIXSERVER for the repository.
- importHost: Host name where the repository is available.
- importDatabase: Database name where the repository is implemented.
- importUser: User name for access to the database.
- exportInformixDir: (FIXME)
- exportInformixServer: (FIXME)
- exportHost: (FIXME)
- exportDatabase: (FIXME)
- exportUser: (FIXME)
- csvExportFile: Default name of CSV file where for export.
- xmlExportFile: Not used
- clearRepositoryOnImportCSV: Indicates if the repository should be cleaned when importing from CSV file.
- normalize: Indicates that when loading from CSV, the table p4gl_excel should be normalized.
- clearRepositoryOnImportXML: Not used
- loadComments: (FIXME)
- parseOnly: Indicates that during the 4gl source import only parse stage of the file will be performed. Used to check for syntax errors and usage of reserved words as identifiers. No data is inserted in the database
- loadTableUsage: Indicates to load the tables usage (only from non-dynamic SQL statements, prepared statements are ignored).
- loadParameters: Indicates that function parameters will be loaded during 4gl sources import.
- loadStrings: Not used.
- loadLocalVariables: Not used.
- sourceDir: The directory where the 4gl sources are located (for 4gl import).
- replaceFgldoc: Indicates that during the action of 4gl export, the comments should be overwritten if they exist.
- fglSource: The name of 4gl source file where the comments should be exported.
- logShowed: Not used.
- importFglLocation: The location of 4gl sources to be imported.
- loadFilesRecursive : When importing 4gl sources, indicates that we want to descent through sub-directories, and load each 4gl file.
$csvImportFile='/usr/home/sergio/MOB.txt'; $xmlImportFile='4gl_mapping.xml'; $UI='GUI'; $action='export2Fgl'; $importInformixDir='/usr/informix'; $importInformixServer='unstable'; $importHost='debian'; $importDatabase='p4gl_repository'; $importUser='sergio'; $exportInformixDir=undef; $exportInformixServer=undef; $exportHost='debian'; $exportDatabase='p4gl_repository'; $exportUser='sergio'; $csvExportFile='4gl_mapping.txt'; $xmlExportFile='4gl_mapping.xml'; $clearRepositoryOnImportCSV=undef; $normalize='1'; $clearRepositoryOnImportXML='false'; $loadComments=undef; $parseOnly=0; $loadTableUsage=undef; $loadParameters=1; $loadStrings=0; $loadLocalVariables=0; $sourceDir='/usr/home/sergio/tmp/src/AMARELA/4gl'; $replaceFgldoc=0; $fglSource='BdAmrCliente.4gl'; $logShowed='1'; $importFglLocation='/usr/home/sergio/AMARELA/src/4gl'; $loadFilesRecursive='1';= '1';
This executable program does the file parsing (with lexical and syntactic analysis) of the 4gl source file and all the DOC4GL special embedded comments. The name of the executable is "p4gl". It allows the following execution options:This executable is the core component of DOC4GL tool. When a project is well organized and structured, the functional documentation will be made by the programmers in each source program, and loaded to the repository using this tool.
- --help: Shows the help message
- -d: Bind debug mode that affects one dump of information the loaded one
- -i: Indicates that the program must insert data in repository database
- -v: Indicates verbose mode
- -w: Warning level (1,,10)
- -c: Generates information to the HTML file for specified module
- -s: Load information contained in comment (beginning with {**).
- -p package: Package name used to load the information
The parser is implemented with the reserved word limitation, that some 4gl compilers like Informix and 4js do not have. Because of that, the source code loaded should not contain reserved words as name of identifiers (example: you cant using display as variable name).
If this happens, and you intend to load the information from these programs, you can use one special comment that when inserted, makes parser ignore the 4gl code inserted between it. This special comment is :
{IGNORE}
...and ignores the code until it finds a new equal comment. For example:
...
{IGNORE}
DEFINE display SMALLINT
(IGNORE}
...If you try to load the information with reserved words without using special IGNORE comment, the parser will report syntax error.
Click here to see example of HTML module documentation generated using p4gl -c switch.
The repository is build in a fully normalized database, and is supported only by an Informix RDBMS, at the moment. We are working to have in a new version the ability to use other RDBMS such as PostgreSQL or MySQL.In the technical manual we present more detailed information about the data model.
The goal of development for this tool was the need to know more about 4gl projects, to enable modifications to that source code. In the process, we gain experience with this kind of work. Given the characteristics of the DOC4GL tool, we can say that this allows us to document a 4gl project in an iterative and evolutionary form.This happens because it is possible to do imports and exports in both directions, in several information formats, allowing as to modify it in this formats, and loaded it again (CSV, RDBMS, 4gl) and still be able to convert it in another format (with the exception of the generated HTML, that is unidirectional).
To document a 4gl project, we could follow this steps:
- Load a first version of 4gl information that originates in 4gl modules, using the import from 4gl sources to the database repository. After this action, all the modules, functions and parameters should be kept in the repository.
- Generate a CSV file with this loaded information.
- Edit the information in Excel, or other spreadsheet application.
- Update the repository information, with the one edited in the spreadsheet.
- Export the information to 4gl source modules.
- Modify the comments in the 4gl source modules.
- Load the information from 4gl sources as needed.
If we are starting with a new 4gl project, the development team should be strictly required to insert the DOC4GL comments during the programming work. This would prevented unnecessary modifications, and simplify the maintenance.If used, the list of TO-DO tasks to be performed, can be an important aid in the development process. Programmer can enter this TO-DO tasks in the source code that he is working on, without then necessity to change to another environment. He should describe tasks witch remain for later implementation, since often during the development, we still remember details that we can not implement at that time, for various reasons.
Current goals of Aubit 4gl development team for DOC4GL package are:
- At the moment, database access is performed:
- from Perl Manager tool via DBI layer and is database independent
- from web browser tool via JDBC and is database independent
- from ESQL/C parser/loader via Informix ESQL/C and is database DEPENDENT
We need to remove ESQL/C and Informix database engine dependency, by using Aubit 4gl ODBC connectivity, or by using a ESQL/C equivalent that allows multi-database access.
- Consider Aubit 4gl compiler parser, instead of custom made one, to remove reserved words limitations. This will not be easy, but it may be necessary.
- Examine benefits and option of writing 4GL parser for DoxyGen, based on Aubit 4gl compiler parser. The downside of using DoxyGen is that it has no form of database repository, and therefore no option for two way processing. Probably a no go.
- Create binary distribution (.tgz and RPM) and source code release for direct download.
- Implement syspgm and makefile importer, to be able to show which source files (modules) are used to build a program.
- Implement XML functionality as alternative to CSV load/export
- Extend processing of 4gl source files to .per .msg and .menu source files
- Track usage of form, help and menu files in a functions/source file
- Track functions invocations in a function/source file. ("Calls:")
- For each function show functions that call it. ("Called from:")
- Track referenced database tables in a form file
- Create HTML links to the described file in CVS web browser, like ViewCVS.
- Document Doc4GL code using DoxyGen comments.
- Translate Portuguese comments and messages in source code to English.
- Prompt to create repository database, if one does not exist, on fgldoc start-up.
- Move java package path from pt/moredata to org/aubit4gl/doc4gl
- many options won't work if locale is set incorrectly, but report no error! Always check that locale for fgldoc is set to the same locale as your system's default locale (try "locale" command if on UNIX)
- Add database data dictionary functionality; create link between "Table usage summary" table names and pages providing data dictionary display for that table.
- Crate separate page to contain all to-do entries
- Create way to define/design home page, provide link to home page in tree menu
- Enable search functionality in Browser (JSP) component
- Apply same CSS to JSP and HTML output
Manual:
- In description of each table of the relational repository, add descriptions for each column. Repository Data Model Create ERWin diagram of database, add it to this manual.
- Complete items marked with "FIXME"
- Describe new tag @form and @table. State that tables are tracked automatically, for static SQL. For Dynamic SQL use should use tag @table
- apparently, functions called and called from ARE tracked?
- add more examples
Known bugs:
- fgldoc does not report any error when using TEST button to test connection, when DBD::Informix is not installed. It does not even report that there is no DBD::Informix
- recursive import from 4gl will not start, if in top directory there are no 4gl files
- See file BUGS in root
Support for this package is provided under OpenSource development model, on the Aubit 4gl project mailing list. Please see Aubit 4gl project home and project pages for details.
Compatibility level, regarding parsing of 4GL language code, is dependency of the used parser. At the moment, this is fully compatible with Informix-4gl syntax up to version 7.2, version 7.3 was not tested. Aubit, 4Js and Plexus extensions to 4gl language will have unpredictable results. We intend to replace parser used in DOC4GL with Aubit 4gl parser in the future.
This software is released under GNU General Public License (GPL)
On-line API documentation for all Doc4GL components.
Doc4GL documentation index page Aubit 4gl project Aubit 4gl compiler documentation menu