OpenTTD Source: src/strgen/strgen.cpp File Reference

OpenTTD Source 13.2.1

Data Structures | Macros | Functions | Variables
strgen.cpp File Reference
`#include "../stdafx.h"`
`#include "../core/endian_func.hpp"`
`#include "../string_func.h"`
`#include "../strings_type.h"`
`#include "../misc/getoptdata.h"`
`#include "../table/control_codes.h"`
`#include "strgen.h"`
`#include <stdarg.h>`
`#include <exception>`
`#include <unistd.h>`
`#include <sys/stat.h>`
`#include "../table/strgen_tables.h"`
`#include "../safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | FileStringReader
| A reader that simply reads using fopen. More...
struct | FileWriter
| Yes, simply writing to a file. More...
struct | HeaderFileWriter
struct | LanguageFileWriter
| Class for writing a language to disk. More...

## Macros
#define | LINE_NUM_FMT(s) "%s:%d: " s ": %s\n"

## Functions
void CDECL | strgen_warning (const char *s,...)
void CDECL | strgen_error (const char *s,...)
void NORETURN CDECL | strgen_fatal (const char *s,...)
void NORETURN CDECL | error (const char *s,...)
bool | CompareFiles (const char *n1, const char *n2)
static void | ottd_mkdir (const char *directory)
| Multi-OS mkdirectory function.
static char * | mkpath (char *buf, const char *last, const char *path, const char *file)
| Create a path consisting of an already existing path, a possible path separator and the filename. More...
static char * | replace_pathsep (char *s)
int CDECL | main (int argc, char *argv[])

## Variables
static const OptionData | _opts []
| Options of strgen. More...

## Detailed Description

Tool to create computer readable (stand-alone) translation files.

Definition in file strgen.cpp.

## Function Documentation

## ◆ mkpath()

static char* mkpath | ( | char * | buf,
|  | const char * | last,
|  | const char * | path,
|  | const char * | file
| ) |  |
| inlinestatic

Create a path consisting of an already existing path, a possible path separator and the filename.

The separator is only appended if the path does not already end with a separator

Definition at line 391 of file strgen.cpp.

References strecpy().

## Variable Documentation

## ◆ _opts

const OptionData _opts[]
| static

Initial value:
= {
GETOPT_NOVAL( 'v', "--version"),
GETOPT_GENERAL('C', '\0', "-export-commands", ODF_NO_VALUE),
GETOPT_GENERAL('L', '\0', "-export-plurals", ODF_NO_VALUE),
GETOPT_GENERAL('P', '\0', "-export-pragmas", ODF_NO_VALUE),
GETOPT_NOVAL( 't', "--todo"),
GETOPT_NOVAL( 'w', "--warning"),
GETOPT_NOVAL( 'h', "--help"),
GETOPT_GENERAL('h', '?', nullptr, ODF_NO_VALUE),
GETOPT_VALUE( 's', "--source_dir"),
GETOPT_VALUE( 'd', "--dest_dir"),
GETOPT_END(),
}

Options of strgen.

Definition at line 419 of file strgen.cpp.

GETOPT_VALUE
#define GETOPT_VALUE(shortname, longname)
Short option with value.
Definition: getoptdata.h:76
GETOPT_NOVAL
#define GETOPT_NOVAL(shortname, longname)
Short option without value.
Definition: getoptdata.h:69
GETOPT_END
#define GETOPT_END()
Option terminator.
Definition: getoptdata.h:107
GETOPT_GENERAL
#define GETOPT_GENERAL(id, shortname, longname, flags)
General macro for creating an option.
Definition: getoptdata.h:62
ODF_NO_VALUE
@ ODF_NO_VALUE
A plain option (no value attached to it).
Definition: getoptdata.h:15