Data Structures | Defines | Functions | Variables

strgen.cpp File Reference

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

#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"

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...

Defines

#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, size_t buflen, const char *path, const char *file)
 Create a path consisting of an already existing path, a possible path separator and the filename.
static char * replace_pathsep (char *s)
int CDECL main (int argc, char *argv[])

Variables

static const OptionData _opts []
 Options of strgen.

Detailed Description

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

Definition in file strgen.cpp.


Function Documentation

static char* mkpath ( char *  buf,
size_t  buflen,
const char *  path,
const char *  file 
) [inline, static]

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 387 of file strgen.cpp.

References ttd_strlcpy().


Variable Documentation

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', '?',  NULL,               ODF_NO_VALUE),
    GETOPT_VALUE(     's',  "--source_dir"),
    GETOPT_VALUE(     'd',  "--dest_dir"),
  GETOPT_END(),
}

Options of strgen.

Definition at line 413 of file strgen.cpp.