Skip to content

Development

Tuomas Lähteenmäki edited this page Dec 23, 2025 · 6 revisions

Development and Build System

NameGen v1.3.1 (Xmas-Edition) has been refactored into a modular architecture to ensure scalability, ease of maintenance, and professional-grade data handling.

📂 Project Structure

The project is organized into logical directories to separate source code from headers, data, and build artifacts:

  • src/: Implementation files (.c).
    • main.c: Application entry point and high-level control.
    • args.c: Command-line argument parsing, language selection (--lp), and version info.
    • generator.c: The "Engine" — handles historical periods (1–7), name selection, and random seeding.
    • logic.c: Advanced simulation logic for families, couples, and birth year calculations.
    • output.c: Formatters for Plain Text, JSON, and CSV exports.
  • include/: Header files (.h) containing function prototypes, the Args structure, and version.h.
  • data/: CSV database files for first names and surnames. Multilingual guideline files (e.g., guidelines_fi.txt).
  • bin/: (Created after build) Contains the final executable (namegen.exe).
  • obj/: (Created after build) Contains temporary object files.

🛠️ Build System

The project is cross-platform and can be built using a Makefile (GCC/MinGW) or the Code::Blocks project file (namegen.cbp).

Key Makefile Commands

Command Action
make Compiles the project and creates the executable in bin/namegen.
make clean Removes all temporary build files (obj/) and binaries (bin/).
make test Builds the project and runs the test_namegen.py automation suite.

Compilation Logic

The Makefile is dynamic. It automatically detects any new .c files added to the src/ directory, ensuring that modular expansion requires no manual build script updates.


🚀 Building from Source

To build NameGen on a Linux system or Windows (with GCC/MinGW installed), follow these steps:

  1. Clone or download the repository.
  2. Open a terminal in the project root directory.
  3. Compile by running:
    make
  4. Run the program: ./bin/namegen --help

🧪 Automated Testing We maintain high data quality through automated testing. The build system integrates directly with our Python test suite. The v1.3.1 suite now includes Family Verification, ensuring surnames and ages are correctly linked across generated family members.

make test

The test suite validates:

  • JSON Integrity: Ensures output is 100% schema-compliant.
  • Family Logic: Confirms surname consistency and realistic age gaps.
  • Deterministic Seeding: Confirms that the --seed flag produces identical results across runs.

📋 Technical Specifications

  • Language: Pure C (C99/C11 standard).
  • Memory Management: Efficient stack-based allocation for name buffers to prevent leaks.
  • Portability: Uses #ifdef _WIN32 / #ifdef linux constructs for cross-platform console handling.
  • License: GPL v3.0.

Clone this wiki locally