Blender  V3.3
Classes | Macros | Typedefs | Enumerations | Functions
msgfmt.c File Reference
#include <stdlib.h>
#include <string.h>
#include "BLI_dynstr.h"
#include "BLI_fileops.h"
#include "BLI_ghash.h"
#include "BLI_linklist.h"
#include "BLI_memarena.h"
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"

Go to the source code of this file.

Classes

struct  Message
 
struct  Offset
 

Macros

#define NULLSEP_STR   "\xff"
 
#define NULLSEP_CHR   '\xff'
 

Typedefs

typedef struct Message Message
 
typedef struct Offset Offset
 

Enumerations

enum  eSectionType { SECTION_NONE = 0 , SECTION_CTX = 1 , SECTION_ID = 2 , SECTION_STR = 3 }
 

Functions

static char * trim (char *str)
 
static char * unescape (char *str)
 
static int qsort_str_cmp (const void *a, const void *b)
 
static char ** get_keys_sorted (GHash *messages, const uint32_t num_keys)
 
BLI_INLINE size_t uint32_to_bytes (const int value, char *bytes)
 
BLI_INLINE size_t msg_to_bytes (char *msg, char *bytes, uint32_t size)
 
static char * generate (GHash *messages, size_t *r_output_size)
 
static void add (GHash *messages, MemArena *memarena, const Message *msg)
 
static void clear (Message *msg)
 
static int make (const char *input_file_name, const char *output_file_name)
 
int main (int argc, char **argv)
 

Macro Definition Documentation

◆ NULLSEP_CHR

#define NULLSEP_CHR   '\xff'

Definition at line 43 of file msgfmt.c.

◆ NULLSEP_STR

#define NULLSEP_STR   "\xff"

Definition at line 42 of file msgfmt.c.

Typedef Documentation

◆ Message

typedef struct Message Message

◆ Offset

typedef struct Offset Offset

Enumeration Type Documentation

◆ eSectionType

Enumerator
SECTION_NONE 
SECTION_CTX 
SECTION_ID 
SECTION_STR 

Definition at line 45 of file msgfmt.c.

Function Documentation

◆ add()

static void add ( GHash messages,
MemArena memarena,
const Message msg 
)
static

◆ clear()

static void clear ( Message msg)
static

◆ generate()

static char* generate ( GHash messages,
size_t *  r_output_size 
)
static

◆ get_keys_sorted()

static char** get_keys_sorted ( GHash messages,
const uint32_t  num_keys 
)
static

Definition at line 129 of file msgfmt.c.

References BLI_ghashIterator_getKey(), GHASH_ITER, MEM_mallocN, and qsort_str_cmp().

Referenced by generate().

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 441 of file msgfmt.c.

References make().

◆ make()

static int make ( const char *  input_file_name,
const char *  output_file_name 
)
static

◆ msg_to_bytes()

BLI_INLINE size_t msg_to_bytes ( char *  msg,
char *  bytes,
uint32_t  size 
)

Definition at line 155 of file msgfmt.c.

References NULLSEP_CHR, and size().

Referenced by generate().

◆ qsort_str_cmp()

static int qsort_str_cmp ( const void a,
const void b 
)
static

Definition at line 124 of file msgfmt.c.

References Freestyle::a, and usdtokens::b().

Referenced by get_keys_sorted().

◆ trim()

static char* trim ( char *  str)
static

◆ uint32_to_bytes()

BLI_INLINE size_t uint32_to_bytes ( const int  value,
char *  bytes 
)

Definition at line 146 of file msgfmt.c.

Referenced by generate().

◆ unescape()

static char* unescape ( char *  str)
static

Definition at line 83 of file msgfmt.c.

References next, and str.

Referenced by make().