Commit be595534 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wmc: Remove struct and enum typedefs.

This has the side effect of fixing the build on macOS after commit 2c1b8153. Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 87e4c289
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* *
* MUST be sorting ascending on language ID * MUST be sorting ascending on language ID
*/ */
static const language_t languages[] = { static const struct language languages[] = {
{0x0000, 437, "Neutral", NULL}, {0x0000, 437, "Neutral", NULL},
{0x0002, 866, "Bulgarian", NULL}, {0x0002, 866, "Bulgarian", NULL},
...@@ -177,11 +177,11 @@ void show_languages(void) ...@@ -177,11 +177,11 @@ void show_languages(void)
static int langcmp(const void *p1, const void *p2) static int langcmp(const void *p1, const void *p2)
{ {
return *(const unsigned *)p1 - ((const language_t *)p2)->id; return *(const unsigned *)p1 - ((const struct language *)p2)->id;
} }
const language_t *find_language(unsigned id) const struct language *find_language(unsigned id)
{ {
return (const language_t *)bsearch(&id, languages, ARRAY_SIZE(languages), return (const struct language *)bsearch(&id, languages, ARRAY_SIZE(languages),
sizeof(languages[0]), langcmp); sizeof(languages[0]), langcmp);
} }
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
#include "winnls.h" #include "winnls.h"
typedef struct language { struct language {
unsigned id; unsigned id;
unsigned doscp; unsigned doscp;
const char *name; const char *name;
const char *country; const char *country;
} language_t; };
void show_languages(void); void show_languages(void);
const language_t *find_language(unsigned id); const struct language *find_language(unsigned id);
#endif #endif
...@@ -486,21 +486,21 @@ static void newline(void) ...@@ -486,21 +486,21 @@ static void newline(void)
static int unisort(const void *p1, const void *p2) static int unisort(const void *p1, const void *p2)
{ {
return unistricmp(((const token_t *)p1)->name, ((const token_t *)p2)->name); return unistricmp(((const struct token *)p1)->name, ((const struct token *)p2)->name);
} }
static token_t *tokentable = NULL; static struct token *tokentable = NULL;
static int ntokentable = 0; static int ntokentable = 0;
token_t *lookup_token(const WCHAR *s) struct token *lookup_token(const WCHAR *s)
{ {
token_t tok; struct token tok;
tok.name = s; tok.name = s;
return (token_t *)bsearch(&tok, tokentable, ntokentable, sizeof(*tokentable), unisort); return (struct token *)bsearch(&tok, tokentable, ntokentable, sizeof(*tokentable), unisort);
} }
void add_token(tok_e type, const WCHAR *name, int tok, int cp, const WCHAR *alias, int fix) void add_token(enum tok_enum type, const WCHAR *name, int tok, int cp, const WCHAR *alias, int fix)
{ {
ntokentable++; ntokentable++;
tokentable = xrealloc(tokentable, ntokentable * sizeof(*tokentable)); tokentable = xrealloc(tokentable, ntokentable * sizeof(*tokentable));
...@@ -513,7 +513,7 @@ void add_token(tok_e type, const WCHAR *name, int tok, int cp, const WCHAR *alia ...@@ -513,7 +513,7 @@ void add_token(tok_e type, const WCHAR *name, int tok, int cp, const WCHAR *alia
qsort(tokentable, ntokentable, sizeof(*tokentable), unisort); qsort(tokentable, ntokentable, sizeof(*tokentable), unisort);
} }
void get_tokentable(token_t **tab, int *len) void get_tokentable(struct token **tab, int *len)
{ {
assert(tab != NULL); assert(tab != NULL);
assert(len != NULL); assert(len != NULL);
...@@ -624,7 +624,7 @@ int mcy_lex(void) ...@@ -624,7 +624,7 @@ int mcy_lex(void)
if(char_table[ch] & CH_IDENT) if(char_table[ch] & CH_IDENT)
{ {
token_t *tok; struct token *tok;
while(isisochar(ch) && (char_table[ch] & (CH_IDENT|CH_NUMBER))) while(isisochar(ch) && (char_table[ch] & (CH_IDENT|CH_NUMBER)))
{ {
push_unichar(ch); push_unichar(ch);
......
...@@ -62,9 +62,9 @@ int want_nl = 0; /* Request next newlinw */ ...@@ -62,9 +62,9 @@ int want_nl = 0; /* Request next newlinw */
int want_line = 0; /* Request next complete line */ int want_line = 0; /* Request next complete line */
int want_file = 0; /* Request next ident as filename */ int want_file = 0; /* Request next ident as filename */
node_t *nodehead = NULL; /* The list of all parsed elements */ struct node *nodehead = NULL; /* The list of all parsed elements */
static node_t *nodetail = NULL; static struct node *nodetail;
lan_blk_t *lanblockhead; /* List of parsed elements transposed */ struct lan_blk *lanblockhead; /* List of parsed elements transposed */
static int base = 16; /* Current printout base to use (8, 10 or 16) */ static int base = 16; /* Current printout base to use (8, 10 or 16) */
static WCHAR *cast = NULL; /* Current typecast to use */ static WCHAR *cast = NULL; /* Current typecast to use */
...@@ -77,31 +77,31 @@ static int have_sev; /* Set if severity parsed for current message */ ...@@ -77,31 +77,31 @@ static int have_sev; /* Set if severity parsed for current message */
static int have_fac; /* Set if facility parsed for current message */ static int have_fac; /* Set if facility parsed for current message */
static int have_sym; /* Set is symbol parsed for current message */ static int have_sym; /* Set is symbol parsed for current message */
static cp_xlat_t *cpxlattab = NULL; /* Codepage translation table */ static struct cp_xlat *cpxlattab = NULL; /* Codepage translation table */
static int ncpxlattab = 0; static int ncpxlattab = 0;
/* Prototypes */ /* Prototypes */
static WCHAR *merge(WCHAR *s1, WCHAR *s2); static WCHAR *merge(WCHAR *s1, WCHAR *s2);
static lanmsg_t *new_lanmsg(lan_cp_t *lcp, WCHAR *msg); static struct lanmsg *new_lanmsg(struct lan_cp *lcp, WCHAR *msg);
static msg_t *add_lanmsg(msg_t *msg, lanmsg_t *lanmsg); static struct msg *add_lanmsg(struct msg *msg, struct lanmsg *lanmsg);
static msg_t *complete_msg(msg_t *msg, int id); static struct msg *complete_msg(struct msg *msg, int id);
static void add_node(node_e type, void *p); static void add_node(enum node_type type, void *p);
static void do_add_token(tok_e type, token_t *tok, const char *code); static void do_add_token(enum tok_enum type, struct token *tok, const char *code);
static void test_id(int id); static void test_id(int id);
static int check_languages(node_t *head); static int check_languages(struct node *head);
static lan_blk_t *block_messages(node_t *head); static struct lan_blk *block_messages(struct node *head);
static void add_cpxlat(int lan, int cpin, int cpout); static void add_cpxlat(int lan, int cpin, int cpout);
static cp_xlat_t *find_cpxlat(int lan); static struct cp_xlat *find_cpxlat(int lan);
%} %}
%union { %union {
WCHAR *str; WCHAR *str;
unsigned num; unsigned num;
token_t *tok; struct token *tok;
lanmsg_t *lmp; struct lanmsg *lmp;
msg_t *msg; struct msg *msg;
lan_cp_t lcp; struct lan_cp lcp;
} }
...@@ -306,7 +306,7 @@ sym : tSYMNAME '=' tIDENT { last_sym = $3; } ...@@ -306,7 +306,7 @@ sym : tSYMNAME '=' tIDENT { last_sym = $3; }
; ;
sev : tSEVERITY '=' token { sev : tSEVERITY '=' token {
token_t *tok = lookup_token($3->name); struct token *tok = lookup_token($3->name);
if(!tok) if(!tok)
xyyerror("Undefined severityname\n"); xyyerror("Undefined severityname\n");
if(tok->type != tok_severity) if(tok->type != tok_severity)
...@@ -318,7 +318,7 @@ sev : tSEVERITY '=' token { ...@@ -318,7 +318,7 @@ sev : tSEVERITY '=' token {
; ;
fac : tFACILITY '=' token { fac : tFACILITY '=' token {
token_t *tok = lookup_token($3->name); struct token *tok = lookup_token($3->name);
if(!tok) if(!tok)
xyyerror("Undefined facilityname\n"); xyyerror("Undefined facilityname\n");
if(tok->type != tok_facility) if(tok->type != tok_facility)
...@@ -346,8 +346,8 @@ body : lang setline lines tMSGEND { $$ = new_lanmsg(&$1, $3); } ...@@ -346,8 +346,8 @@ body : lang setline lines tMSGEND { $$ = new_lanmsg(&$1, $3); }
* message to be parsed. * message to be parsed.
*/ */
lang : tLANGUAGE setnl '=' token tNL { lang : tLANGUAGE setnl '=' token tNL {
token_t *tok = lookup_token($4->name); struct token *tok = lookup_token($4->name);
cp_xlat_t *cpx; struct cp_xlat *cpx;
if(!tok) if(!tok)
xyyerror("Undefined language\n"); xyyerror("Undefined language\n");
if(tok->type != tok_language) if(tok->type != tok_language)
...@@ -358,7 +358,7 @@ lang : tLANGUAGE setnl '=' token tNL { ...@@ -358,7 +358,7 @@ lang : tLANGUAGE setnl '=' token tNL {
} }
else if(!tok->codepage) else if(!tok->codepage)
{ {
const language_t *lan = find_language(tok->token); const struct language *lan = find_language(tok->token);
if(!lan) if(!lan)
{ {
/* Just set default; warning was given while parsing languagenames */ /* Just set default; warning was given while parsing languagenames */
...@@ -388,7 +388,7 @@ lines : tLINE { $$ = $1; } ...@@ -388,7 +388,7 @@ lines : tLINE { $$ = $1; }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
* Helper rules * Helper rules
*/ */
token : tIDENT { $$ = xmalloc(sizeof(token_t)); memset($$,0,sizeof(*$$)); $$->name = $1; } token : tIDENT { $$ = xmalloc(sizeof(struct token)); memset($$,0,sizeof(*$$)); $$->name = $1; }
| tTOKEN { $$ = $1; } | tTOKEN { $$ = $1; }
; ;
...@@ -413,9 +413,9 @@ static WCHAR *merge(WCHAR *s1, WCHAR *s2) ...@@ -413,9 +413,9 @@ static WCHAR *merge(WCHAR *s1, WCHAR *s2)
return s1; return s1;
} }
static void do_add_token(tok_e type, token_t *tok, const char *code) static void do_add_token(enum tok_enum type, struct token *tok, const char *code)
{ {
token_t *tp = lookup_token(tok->name); struct token *tp = lookup_token(tok->name);
if(tp) if(tp)
{ {
if(tok->type != type) if(tok->type != type)
...@@ -434,9 +434,9 @@ static void do_add_token(tok_e type, token_t *tok, const char *code) ...@@ -434,9 +434,9 @@ static void do_add_token(tok_e type, token_t *tok, const char *code)
} }
} }
static lanmsg_t *new_lanmsg(lan_cp_t *lcp, WCHAR *msg) static struct lanmsg *new_lanmsg(struct lan_cp *lcp, WCHAR *msg)
{ {
lanmsg_t *lmp = xmalloc(sizeof(lanmsg_t)); struct lanmsg *lmp = xmalloc(sizeof(*lmp));
lmp->lan = lcp->language; lmp->lan = lcp->language;
lmp->cp = lcp->codepage; lmp->cp = lcp->codepage;
lmp->msg = msg; lmp->msg = msg;
...@@ -448,12 +448,12 @@ static lanmsg_t *new_lanmsg(lan_cp_t *lcp, WCHAR *msg) ...@@ -448,12 +448,12 @@ static lanmsg_t *new_lanmsg(lan_cp_t *lcp, WCHAR *msg)
return lmp; return lmp;
} }
static msg_t *add_lanmsg(msg_t *msg, lanmsg_t *lanmsg) static struct msg *add_lanmsg(struct msg *msg, struct lanmsg *lanmsg)
{ {
int i; int i;
if(!msg) if(!msg)
{ {
msg = xmalloc(sizeof(msg_t)); msg = xmalloc(sizeof(*msg));
memset( msg, 0, sizeof(*msg) ); memset( msg, 0, sizeof(*msg) );
} }
msg->msgs = xrealloc(msg->msgs, (msg->nmsgs+1) * sizeof(*(msg->msgs))); msg->msgs = xrealloc(msg->msgs, (msg->nmsgs+1) * sizeof(*(msg->msgs)));
...@@ -469,10 +469,10 @@ static msg_t *add_lanmsg(msg_t *msg, lanmsg_t *lanmsg) ...@@ -469,10 +469,10 @@ static msg_t *add_lanmsg(msg_t *msg, lanmsg_t *lanmsg)
static int sort_lanmsg(const void *p1, const void *p2) static int sort_lanmsg(const void *p1, const void *p2)
{ {
return (*(const lanmsg_t * const *)p1)->lan - (*(const lanmsg_t * const*)p2)->lan; return (*(const struct lanmsg * const *)p1)->lan - (*(const struct lanmsg * const*)p2)->lan;
} }
static msg_t *complete_msg(msg_t *mp, int id) static struct msg *complete_msg(struct msg *mp, int id)
{ {
assert(mp != NULL); assert(mp != NULL);
mp->id = id; mp->id = id;
...@@ -491,9 +491,9 @@ static msg_t *complete_msg(msg_t *mp, int id) ...@@ -491,9 +491,9 @@ static msg_t *complete_msg(msg_t *mp, int id)
return mp; return mp;
} }
static void add_node(node_e type, void *p) static void add_node(enum node_type type, void *p)
{ {
node_t *ndp = xmalloc(sizeof(node_t)); struct node *ndp = xmalloc(sizeof(*ndp));
memset( ndp, 0, sizeof(*ndp) ); memset( ndp, 0, sizeof(*ndp) );
ndp->type = type; ndp->type = type;
ndp->u.all = p; ndp->u.all = p;
...@@ -512,7 +512,7 @@ static void add_node(node_e type, void *p) ...@@ -512,7 +512,7 @@ static void add_node(node_e type, void *p)
static void test_id(int id) static void test_id(int id)
{ {
node_t *ndp; struct node *ndp;
for(ndp = nodehead; ndp; ndp = ndp->next) for(ndp = nodehead; ndp; ndp = ndp->next)
{ {
if(ndp->type != nd_msg) if(ndp->type != nd_msg)
...@@ -522,12 +522,12 @@ static void test_id(int id) ...@@ -522,12 +522,12 @@ static void test_id(int id)
} }
} }
static int check_languages(node_t *head) static int check_languages(struct node *head)
{ {
static const char err_missing[] = "Missing definition for language 0x%x; MessageID %d, facility 0x%x, severity 0x%x\n"; static const char err_missing[] = "Missing definition for language 0x%x; MessageID %d, facility 0x%x, severity 0x%x\n";
node_t *ndp; struct node *ndp;
int nm = 0; int nm = 0;
msg_t *msg = NULL; struct msg *msg = NULL;
for(ndp = head; ndp; ndp = ndp->next) for(ndp = head; ndp; ndp = ndp->next)
{ {
...@@ -540,8 +540,8 @@ static int check_languages(node_t *head) ...@@ -540,8 +540,8 @@ static int check_languages(node_t *head)
else else
{ {
int i; int i;
msg_t *m1; struct msg *m1;
msg_t *m2; struct msg *m2;
if(ndp->u.msg->nmsgs > msg->nmsgs) if(ndp->u.msg->nmsgs > msg->nmsgs)
{ {
m1 = ndp->u.msg; m1 = ndp->u.msg;
...@@ -568,11 +568,10 @@ static int check_languages(node_t *head) ...@@ -568,11 +568,10 @@ static int check_languages(node_t *head)
return nm; return nm;
} }
#define MSGRID(x) ((*(const msg_t * const*)(x))->realid) #define MSGRID(x) ((*(const struct msg * const*)(x))->realid)
static int sort_msg(const void *p1, const void *p2) static int sort_msg(const void *p1, const void *p2)
{ {
return MSGRID(p1) > MSGRID(p2) ? 1 : (MSGRID(p1) == MSGRID(p2) ? 0 : -1); return MSGRID(p1) > MSGRID(p2) ? 1 : (MSGRID(p1) == MSGRID(p2) ? 0 : -1);
/* return (*(msg_t **)p1)->realid - (*(msg_t **)p1)->realid; */
} }
/* /*
...@@ -580,13 +579,13 @@ static int sort_msg(const void *p1, const void *p2) ...@@ -580,13 +579,13 @@ static int sort_msg(const void *p1, const void *p2)
* from ID/language based list to a language/ID * from ID/language based list to a language/ID
* based list. * based list.
*/ */
static lan_blk_t *block_messages(node_t *head) static struct lan_blk *block_messages(struct node *head)
{ {
lan_blk_t *lbp; struct lan_blk *lbp;
lan_blk_t *lblktail = NULL; struct lan_blk *lblktail = NULL;
lan_blk_t *lblkhead = NULL; struct lan_blk *lblkhead = NULL;
msg_t **msgtab = NULL; struct msg **msgtab = NULL;
node_t *ndp; struct node *ndp;
int nmsg = 0; int nmsg = 0;
int i; int i;
int nl; int nl;
...@@ -605,7 +604,7 @@ static lan_blk_t *block_messages(node_t *head) ...@@ -605,7 +604,7 @@ static lan_blk_t *block_messages(node_t *head)
for(nl = 0; nl < msgtab[0]->nmsgs; nl++) /* This should be equal for all after check_languages() */ for(nl = 0; nl < msgtab[0]->nmsgs; nl++) /* This should be equal for all after check_languages() */
{ {
lbp = xmalloc(sizeof(lan_blk_t)); lbp = xmalloc(sizeof(*lbp));
memset( lbp, 0, sizeof(*lbp) ); memset( lbp, 0, sizeof(*lbp) );
if(!lblktail) if(!lblktail)
{ {
...@@ -630,7 +629,7 @@ static lan_blk_t *block_messages(node_t *head) ...@@ -630,7 +629,7 @@ static lan_blk_t *block_messages(node_t *head)
for(i = 1; i < nmsg; i++) for(i = 1; i < nmsg; i++)
{ {
block_t *blk = &(lbp->blks[lbp->nblk-1]); struct block *blk = &(lbp->blks[lbp->nblk-1]);
if(msgtab[i]->realid == blk->idhi+1) if(msgtab[i]->realid == blk->idhi+1)
{ {
blk->size += ((factor * msgtab[i]->msgs[nl]->len + 3) & ~3) + 4; blk->size += ((factor * msgtab[i]->msgs[nl]->len + 3) & ~3) + 4;
...@@ -658,7 +657,7 @@ static lan_blk_t *block_messages(node_t *head) ...@@ -658,7 +657,7 @@ static lan_blk_t *block_messages(node_t *head)
static int sc_xlat(const void *p1, const void *p2) static int sc_xlat(const void *p1, const void *p2)
{ {
return ((const cp_xlat_t *)p1)->lan - ((const cp_xlat_t *)p2)->lan; return ((const struct cp_xlat *)p1)->lan - ((const struct cp_xlat *)p2)->lan;
} }
static void add_cpxlat(int lan, int cpin, int cpout) static void add_cpxlat(int lan, int cpin, int cpout)
...@@ -671,12 +670,12 @@ static void add_cpxlat(int lan, int cpin, int cpout) ...@@ -671,12 +670,12 @@ static void add_cpxlat(int lan, int cpin, int cpout)
qsort(cpxlattab, ncpxlattab, sizeof(*cpxlattab), sc_xlat); qsort(cpxlattab, ncpxlattab, sizeof(*cpxlattab), sc_xlat);
} }
static cp_xlat_t *find_cpxlat(int lan) static struct cp_xlat *find_cpxlat(int lan)
{ {
cp_xlat_t t; struct cp_xlat t;
if(!cpxlattab) return NULL; if(!cpxlattab) return NULL;
t.lan = lan; t.lan = lan;
return (cp_xlat_t *)bsearch(&t, cpxlattab, ncpxlattab, sizeof(*cpxlattab), sc_xlat); return (struct cp_xlat *)bsearch(&t, cpxlattab, ncpxlattab, sizeof(*cpxlattab), sc_xlat);
} }
...@@ -46,7 +46,7 @@ struct mo_file ...@@ -46,7 +46,7 @@ struct mo_file
/* ... rest of file data here */ /* ... rest of file data here */
}; };
static lan_blk_t *new_top, *new_tail; static struct lan_blk *new_top, *new_tail;
static const struct static const struct
{ {
...@@ -365,7 +365,7 @@ static BOOL is_english( int lan ) ...@@ -365,7 +365,7 @@ static BOOL is_english( int lan )
return lan == MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ); return lan == MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT );
} }
static char *convert_msgid_ascii( const lanmsg_t *msg, int error_on_invalid_char ) static char *convert_msgid_ascii( const struct lanmsg *msg, int error_on_invalid_char )
{ {
int i; int i;
char *buffer = xmalloc( msg->len * 4 + 1 ); char *buffer = xmalloc( msg->len * 4 + 1 );
...@@ -445,7 +445,7 @@ static void po_xerror2( int severity, po_message_t message1, ...@@ -445,7 +445,7 @@ static void po_xerror2( int severity, po_message_t message1,
static const struct po_xerror_handler po_xerror_handler = { po_xerror, po_xerror2 }; static const struct po_xerror_handler po_xerror_handler = { po_xerror, po_xerror2 };
static void add_po_string( po_file_t po, const lanmsg_t *msgid, const lanmsg_t *msgstr ) static void add_po_string( po_file_t po, const struct lanmsg *msgid, const struct lanmsg *msgstr )
{ {
po_message_t msg; po_message_t msg;
po_message_iterator_t iterator; po_message_iterator_t iterator;
...@@ -504,7 +504,7 @@ static po_file_t create_po_file(void) ...@@ -504,7 +504,7 @@ static po_file_t create_po_file(void)
void write_pot_file( const char *outname ) void write_pot_file( const char *outname )
{ {
int i, j; int i, j;
lan_blk_t *lbp; struct lan_blk *lbp;
po_file_t po = create_po_file(); po_file_t po = create_po_file();
for (lbp = lanblockhead; lbp; lbp = lbp->next) for (lbp = lanblockhead; lbp; lbp = lbp->next)
...@@ -512,7 +512,7 @@ void write_pot_file( const char *outname ) ...@@ -512,7 +512,7 @@ void write_pot_file( const char *outname )
if (!is_english( lbp->lan )) continue; if (!is_english( lbp->lan )) continue;
for (i = 0; i < lbp->nblk; i++) for (i = 0; i < lbp->nblk; i++)
{ {
block_t *blk = &lbp->blks[i]; struct block *blk = &lbp->blks[i];
for (j = 0; j < blk->nmsg; j++) add_po_string( po, blk->msgs[j], NULL ); for (j = 0; j < blk->nmsg; j++) add_po_string( po, blk->msgs[j], NULL );
} }
} }
...@@ -632,9 +632,9 @@ static const char *get_msgstr( const char *msgid, const char *context, int *foun ...@@ -632,9 +632,9 @@ static const char *get_msgstr( const char *msgid, const char *context, int *foun
return ret; return ret;
} }
static lanmsg_t *translate_string( lanmsg_t *str, int lang, int *found ) static struct lanmsg *translate_string( struct lanmsg *str, int lang, int *found )
{ {
lanmsg_t *new; struct lanmsg *new;
const char *transl; const char *transl;
char *buffer, *msgid, *context; char *buffer, *msgid, *context;
...@@ -654,7 +654,7 @@ static lanmsg_t *translate_string( lanmsg_t *str, int lang, int *found ) ...@@ -654,7 +654,7 @@ static lanmsg_t *translate_string( lanmsg_t *str, int lang, int *found )
return new; return new;
} }
static void translate_block( block_t *blk, block_t *new, int lang, int *found ) static void translate_block( struct block *blk, struct block *new, int lang, int *found )
{ {
int i; int i;
...@@ -673,7 +673,7 @@ static void translate_block( block_t *blk, block_t *new, int lang, int *found ) ...@@ -673,7 +673,7 @@ static void translate_block( block_t *blk, block_t *new, int lang, int *found )
static void translate_messages( int lang ) static void translate_messages( int lang )
{ {
int i, found; int i, found;
lan_blk_t *lbp, *new; struct lan_blk *lbp, *new;
for (lbp = lanblockhead; lbp; lbp = lbp->next) for (lbp = lanblockhead; lbp; lbp = lbp->next)
{ {
...@@ -705,7 +705,7 @@ static void translate_messages( int lang ) ...@@ -705,7 +705,7 @@ static void translate_messages( int lang )
void add_translations( const char *po_dir ) void add_translations( const char *po_dir )
{ {
lan_blk_t *lbp; struct lan_blk *lbp;
char buffer[256]; char buffer[256];
char *p, *tok, *name; char *p, *tok, *name;
unsigned int i; unsigned int i;
......
...@@ -60,15 +60,15 @@ extern int mcy_debug; ...@@ -60,15 +60,15 @@ extern int mcy_debug;
extern int want_nl; extern int want_nl;
extern int want_line; extern int want_line;
extern int want_file; extern int want_file;
extern node_t *nodehead; extern struct node *nodehead;
extern lan_blk_t *lanblockhead; extern struct lan_blk *lanblockhead;
int mcy_lex(void); int mcy_lex(void);
extern FILE *yyin; extern FILE *yyin;
void set_codepage(int cp); void set_codepage(int cp);
void add_token(tok_e type, const WCHAR *name, int tok, int cp, const WCHAR *alias, int fix); void add_token(enum tok_enum type, const WCHAR *name, int tok, int cp, const WCHAR *alias, int fix);
token_t *lookup_token(const WCHAR *s); struct token *lookup_token(const WCHAR *s);
void get_tokentable(token_t **tab, int *len); void get_tokentable(struct token **tab, int *len);
#endif #endif
...@@ -40,86 +40,86 @@ ...@@ -40,86 +40,86 @@
/* /*
* Tokenizer types * Tokenizer types
*/ */
typedef enum tok_enum { enum tok_enum {
tok_null = 0, tok_null = 0,
tok_keyword, tok_keyword,
tok_severity, tok_severity,
tok_facility, tok_facility,
tok_language tok_language
} tok_e; };
typedef struct token { struct token {
tok_e type; enum tok_enum type;
const WCHAR *name; /* Parsed name of token */ const WCHAR *name; /* Parsed name of token */
int token; /* Tokenvalue or language code */ int token; /* Tokenvalue or language code */
int codepage; int codepage;
const WCHAR *alias; /* Alias or filename */ const WCHAR *alias; /* Alias or filename */
int fixed; /* Cleared if token may change */ int fixed; /* Cleared if token may change */
} token_t; };
typedef struct lan_cp { struct lan_cp {
int language; int language;
int codepage; int codepage;
} lan_cp_t; };
typedef struct cp_xlat { struct cp_xlat {
int lan; int lan;
int cpin; int cpin;
int cpout; int cpout;
} cp_xlat_t; };
typedef struct lanmsg { struct lanmsg {
int lan; /* Language code of message */ int lan; /* Language code of message */
int cp; /* Codepage of message */ int cp; /* Codepage of message */
WCHAR *msg; /* Message text */ WCHAR *msg; /* Message text */
int len; /* Message length including trailing '\0' */ int len; /* Message length including trailing '\0' */
const char *file; /* File location for definition */ const char *file; /* File location for definition */
int line; int line;
} lanmsg_t; };
typedef struct msg { struct msg {
int id; /* Message ID */ int id; /* Message ID */
unsigned realid; /* Combined message ID */ unsigned realid; /* Combined message ID */
WCHAR *sym; /* Symbolic name */ WCHAR *sym; /* Symbolic name */
int sev; /* Severity code */ int sev; /* Severity code */
int fac; /* Facility code */ int fac; /* Facility code */
lanmsg_t **msgs; /* Array message texts */ struct lanmsg **msgs; /* Array message texts */
int nmsgs; /* Number of message texts in array */ int nmsgs; /* Number of message texts in array */
int base; /* Base of number to print */ int base; /* Base of number to print */
WCHAR *cast; /* Typecase to use */ WCHAR *cast; /* Typecase to use */
} msg_t; };
typedef enum { enum node_type {
nd_msg, nd_msg,
nd_comment nd_comment
} node_e; };
typedef struct node { struct node {
struct node *next; struct node *next;
struct node *prev; struct node *prev;
node_e type; enum node_type type;
union { union {
void *all; void *all;
WCHAR *comment; WCHAR *comment;
msg_t *msg; struct msg *msg;
} u; } u;
} node_t; };
typedef struct block { struct block {
unsigned idlo; /* Lowest ID in this set */ unsigned idlo; /* Lowest ID in this set */
unsigned idhi; /* Highest ID in this set */ unsigned idhi; /* Highest ID in this set */
int size; /* Size of this set */ int size; /* Size of this set */
lanmsg_t **msgs; /* Array of messages in this set */ struct lanmsg **msgs; /* Array of messages in this set */
int nmsg; /* Number of array entries */ int nmsg; /* Number of array entries */
} block_t; };
typedef struct lan_blk { struct lan_blk {
struct lan_blk *next; /* Linkage for languages */ struct lan_blk *next; /* Linkage for languages */
struct lan_blk *prev; struct lan_blk *prev;
int lan; /* The language of this block */ int lan; /* The language of this block */
int version; /* The resource version for auto-translated resources */ int version; /* The resource version for auto-translated resources */
block_t *blks; /* Array of blocks for this language */ struct block *blks; /* Array of blocks for this language */
int nblk; /* Nr of blocks in array */ int nblk; /* Nr of blocks in array */
} lan_blk_t; };
#endif #endif
...@@ -150,11 +150,11 @@ static int killcomment(char *s) ...@@ -150,11 +150,11 @@ static int killcomment(char *s)
void write_h_file(const char *fname) void write_h_file(const char *fname)
{ {
node_t *ndp; struct node *ndp;
char *cptr; char *cptr;
char *cast; char *cast;
FILE *fp; FILE *fp;
token_t *ttab; struct token *ttab;
int ntab; int ntab;
int i; int i;
int once = 0; int once = 0;
...@@ -278,8 +278,8 @@ void write_h_file(const char *fname) ...@@ -278,8 +278,8 @@ void write_h_file(const char *fname)
static void write_rcbin(FILE *fp) static void write_rcbin(FILE *fp)
{ {
lan_blk_t *lbp; struct lan_blk *lbp;
token_t *ttab; struct token *ttab;
int ntab; int ntab;
int i; int i;
...@@ -370,7 +370,7 @@ static char *make_string(WCHAR *uc, int len) ...@@ -370,7 +370,7 @@ static char *make_string(WCHAR *uc, int len)
static void write_rcinline(FILE *fp) static void write_rcinline(FILE *fp)
{ {
lan_blk_t *lbp; struct lan_blk *lbp;
int i; int i;
int j; int j;
...@@ -391,7 +391,7 @@ static void write_rcinline(FILE *fp) ...@@ -391,7 +391,7 @@ static void write_rcinline(FILE *fp)
} }
for(i = 0; i < lbp->nblk; i++) for(i = 0; i < lbp->nblk; i++)
{ {
block_t *blk = &lbp->blks[i]; struct block *blk = &lbp->blks[i];
for(j = 0; j < blk->nmsg; j++) for(j = 0; j < blk->nmsg; j++)
{ {
char *cptr; char *cptr;
...@@ -426,7 +426,7 @@ void write_rc_file(const char *fname) ...@@ -426,7 +426,7 @@ void write_rc_file(const char *fname)
fclose(fp); fclose(fp);
} }
static void output_bin_data( lan_blk_t *lbp ) static void output_bin_data( struct lan_blk *lbp )
{ {
unsigned int offs = 4 * (lbp->nblk * 3 + 1); unsigned int offs = 4 * (lbp->nblk * 3 + 1);
int i, j, k; int i, j, k;
...@@ -441,7 +441,7 @@ static void output_bin_data( lan_blk_t *lbp ) ...@@ -441,7 +441,7 @@ static void output_bin_data( lan_blk_t *lbp )
} }
for (i = 0; i < lbp->nblk; i++) for (i = 0; i < lbp->nblk; i++)
{ {
block_t *blk = &lbp->blks[i]; struct block *blk = &lbp->blks[i];
for (j = 0; j < blk->nmsg; j++) for (j = 0; j < blk->nmsg; j++)
{ {
int len = (2 * blk->msgs[j]->len + 3) & ~3; int len = (2 * blk->msgs[j]->len + 3) & ~3;
...@@ -455,8 +455,8 @@ static void output_bin_data( lan_blk_t *lbp ) ...@@ -455,8 +455,8 @@ static void output_bin_data( lan_blk_t *lbp )
void write_bin_files(void) void write_bin_files(void)
{ {
lan_blk_t *lbp; struct lan_blk *lbp;
token_t *ttab; struct token *ttab;
int ntab; int ntab;
int i; int i;
...@@ -487,7 +487,7 @@ void write_bin_files(void) ...@@ -487,7 +487,7 @@ void write_bin_files(void)
void write_res_file( const char *name ) void write_res_file( const char *name )
{ {
lan_blk_t *lbp; struct lan_blk *lbp;
int i, j; int i, j;
init_output_buffer(); init_output_buffer();
...@@ -511,7 +511,7 @@ void write_res_file( const char *name ) ...@@ -511,7 +511,7 @@ void write_res_file( const char *name )
for (i = 0; i < lbp->nblk; i++) for (i = 0; i < lbp->nblk; i++)
{ {
block_t *blk = &lbp->blks[i]; struct block *blk = &lbp->blks[i];
for (j = 0; j < blk->nmsg; j++) data_size += 4 + ((blk->msgs[j]->len * 2 + 3) & ~3); for (j = 0; j < blk->nmsg; j++) data_size += 4 + ((blk->msgs[j]->len * 2 + 3) & ~3);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment