2. Usage

After setting up classgen, usage is pretty easy. Starting classgen without any parameters makes it display the usage hint:

classgen [-f|-overwrite][-public] [-visitor] [-composite] <inputfile>

Given a example specification sample.cl we would simply enter:

classgen sample.cl

classgen generates the classes and writes them to the directory specified by the package statement in the specification (see language doc). If your running classgen in a folder called /cg_test and your specification contains a package sample.model; statement, the classes will be written to .cg_test/sample/model. If the package statement is omitted, classes will be written to the current directory.


classgen has the following optional parameters:

-overwrite prevents classgen from asking before overwriting existing files.
-f same as -overwrite.
-public all member variables of the classes will be declared public. No get/set-methods are generated.
-visitor generated classes are prepared for using the visitor design patter. Look here for further information.
-composite this parameter has still beta status. It makes classgen generate support methods which allow a visualization of parse trees and visitor runs. For further explanation please check the api documentation.


Assuming you want to generate classes from a specification called sample.cl with visitor pattern support enabled, the appropriate command would be:

classgen -visitor sample.cl

After some changes you want to generate the classes again. You're annoyed by the "overwrite [yna]" questions and use:

classgen -overwrite -visitor sample.cl

© copyright 2000, 2001, 2002 Sebastian Winter (winterse@in.tum.de) and Florian Deissenboeck (flo@deissenboeck.de)

© copyright 2000, 2001, 2002 Technical University of Munich, Germany