Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

multiCodeGen

Console C/C++ code generator for libraries: AdvancedMenu, SimpleGetstr

View on GitLab

Member rating

No ratings yet.

Sign in to rate this project.

README

pascal
                    ____  _ ______          __     ______         
   ____ ___  __  __/ / /_(_) ____/___  ____/ /__  / ____/__  ____ 
  / __ `__ \/ / / / / __/ / /   / __ \/ __  / _ \/ / __/ _ \/ __ \
 / / / / / / /_/ / / /_/ / /___/ /_/ / /_/ /  __/ /_/ /  __/ / / /
/_/ /_/ /_/\__,_/_/\__/_/\____/\____/\__,_/\___/\____/\___/_/ /_/

multiCodeGen — console C/C++ code generator for:


Installation

multiCodeGen doesn't need installation. It can run from any directory.

Get latest release here.

How it works

The idea of using multiCodeGen is as follows:

  1. ✒️ Write special configuration file for selected library.
  2. 🛠️ Feed that file to multiCodeGen and get a C header file.
  3. 📜 Include generated header file in your C/C++ software project.
  4. 🔓 Now you have access to data specified in configuration file.

Syntax of configuration file is much simpler and easier to maintain than code in C header file. This is the main reason to use such an approach.

Configuration file

Configuration file is a simple text file. It is divided into several sections.

Comments

Comments are used to give additional explanations. They begin with // or # and continue until the end of line.

Sections

Section is a part of configuration file that begins with a section header and ends when another section header is reached. Syntax of section header:

pascal
[SECTION_ID section_name]:

where

SECTION_ID — section identifier, usually in uppercase and may consist of several words, for example CONFIG, END etc.

section_name — optional name for the section, used to distinguish beetwen sections with the same IDs.

Section CONFIG

This section is common but not necessary. It contains parameters that describe your project.

Each parameter must be specified on a separate line without line breaks. It has simple syntax:

pascal
<param_name> = <param_value> // possible comment
Section END

This section is necessary. It marks the end of file. Colon in this section is optional. Do not forget to place this section at the end of file!

Example of configuration file
pascal
[CONFIG]:
parameter1 = value1 // comment

[WORK SECTION]:
data1 = data_value1 // comment

[END] # end of file

Generating C header

Once you have prepared configuration file for your project, you need to convert it to C code that can be included in your software project. Run in console (Windows):

batch
multiCodeGen-win32.exe  -l library  -i _configFile.txt  -o myGeneratedCheader.h

where

  • -i <file> specifies your configuration file,
  • -o <file> specifies your C header file with generated code,
  • -l <lib> specifies library for which code will be generated (see table below),
    -l key value
    sgs
    menu

More commands

To see all available commands and their short explanation type:

batch
multiCodeGen-win32.exe -h

Highlighting in Notepad++

If you use Notepad++ text editor for editing configuration files, then you can enable syntax highlighting. Just import multiCodeGen-syntax-notepad++.xml file:

  • Open Notepad++, go Language > User Defined Language > Define your language....
  • Click Import button and select multiCodeGen-syntax-notepad++.xml file.
  • Close User-Defined window.

For .txt configuration files you must select highlighter in Language menu every time when opening file. You can also use .mcg / .gen extension for configuration file to apply this highlighter automatically on opening file.

Contributing & feedback

Contributions and feedback are welcome! Not only will you help develop the library, but you’ll also learn how to use it best.

If you find some bugs or want to suggest an idea, please open an issue here. Before creating new issue, check if it has not been opened earlier.

License

multiCodeGen is distributed under MIT license.

(c) 2026, Riva Lab