
  This directory contains "gema", the general-purpose macro processor.
  The sub-directories are:

     src        source program (in C, according to the C95 standard)
     doc        documentation source, including Unix "man" page and user manual.
     examples   sample applications, including LaTeX to HTML conversion.
     test       scripts and data for functionality tests to verify build.

  This description applies to version 2.0.

  The program has been used on several varieties of Unix (including Linux),
  MS-DOS, Microsoft Windows, and Macintosh (both OS-X and earlier MACOS with
  MPW). It may need some modification for use on other systems, particularly
  in regard to pathname syntax and accessing file attributes; see the
  places where preprocessor commands test flags such as "MSDOS", "_WIN32",
  or "MACOS".  (Unix is the presumed default.)

  On Microsoft Windows, a solution file ("gema.sln") and project file are
  provided for Visual Studio 2019 or later.  Use the batch file
  "test\gematest.bat" (passing the executable file as the argument) to run
  the tests.   On most other systems, you can build the
  program by just cd-ing to the "src" directory and then running the
  command "make gema".  Some adjustments to the "Makefile" may be needed if
  the compiler is something other than "gcc".  The command "make test" will
  run the regression tests to verify the build.

  Further build details if needed:

    The source code will look best when viewed with a tab size of 8
    columns.  (I've tried to avoid use of tabs in newer code.)

    To build the program, you just need to use an ANSI C compiler to
    compile all of the ".c" files (except "gel_bind.c" and "gua.c")
    and link the resulting object files together.  An example "Makefile"
    for Unix is provided.  There is a "gbuild.bat" script for Windows.
    Normally you should compile with optimization (typically "-O2")
    and with the option "-DNDEBUG" to omit internal debugging checks.
    Use "-D_USE_WCHAR" for the Unicode configuration, or "-D_USE_STDIO"
    for the older configuration limited to 8-bit characters.
    You may also want to use "-DTRACE" to enable the experimental
    diagnostic trace option.
 
    After building the program, you can verify that it works correctly by
    running the command "make test" in the "src" directory, which uses
    the "gematest" script in the "test" directory, which takes the
    executable to be tested as its argument.  The test passes if no
    errors or file comparison differences are shown.  Alternatively,
    "make verbose-test" shows the commands being executed to verify
    that the tests are actually being run.

    Note that the result is just a single executable file.  There are no
    third-party dependencies.  The only libraries used are the C library
    and the interface libraries provided by the operating system.  So no
    installation process is needed; just copy the file to a directory
    which is in the path.  On Unix, you may also want to copy the man
    page "doc/gema.1" to somewhere such as "/usr/local/man/man1/gema.1".

  The "examples" directory includes the following non-trivial pattern files
  for document conversion:

      latex.dat      convert LaTeX to HTML with Unicode
      man-html.dat   convert "man" page from "nroff" to HTML
      ht.dat         convert HTML to LaTeX
      tex.dat        used with "latex.dat" for low-level TeX features
      spreadsheet-to-html.pat  convert tab-separated text to HTML table
      html-to-markdown.pat     convert HTML to Markdown
      
  The script "latex.sh" can be used for LaTeX to HTML conversion after
  modifying it for the actual location of the files used.  It takes care of
  automatically running the program a second time when needed to resolve
  forward references. 

  These conversion pattern files are not complete; they have been
  sufficient for the documents I have been working with, but you may find
  additional features that you need.  The conversion provides a clear
  warning about what is not recognized, and extending the patterns is easy.

  The example pattern files "color-cpp.pat", "color-java.pat", and
  "color-python.pat" generate an HTML rendering with syntax coloring for
  programs in the respective languages.

  The example pattern file "cdefs.pat" scans C or C++ code to produce a
  list of the identifiers defined, and "cxref.pat" produces a
  cross-reference list of where given identifiers are referenced.
  See the comments in the files for further information.

  Also in the "examples" directory is file "c2dyl.dat", which reads C
  source files and does a crude preliminary syntax conversion to the
  Dylan programming language.  Even if you aren't interested in Dylan, this
  file serves as an example of how recursive pattern matching can be used
  to parse infix expressions; note how the rules look very similar to a BNF
  description of the expression syntax.

  In case you found these files somewhere else, the official web site and
  source archive with the most recent version is at:
  http://sourceforge.net/projects/gema/

  The "doc" directory contains a "Makefile" for building various forms of
  the documents, but you probably want to just use the pre-built documents
  available under:  http://gema.sourceforge.net/

  "gema" is not a commercial product; it is distributed as open source
  software in order to maximize its usefulness.  Let me know if you find any
  bugs, but I don't promise to fix them.  If you fix something or extend
  the program yourself, please send me your improvements.  Subscribe to
  the SourceForge mailing list "gema-discussion" at
  https://sourceforge.net/projects/gema/lists/gema-discussion
  if you would like to be informed of any future updates.


				David N. Gray

				e-mail:  DGray@acm.org

				Mountain View, California

				last updated February 20, 2024

