Skip to content

Commit 11e6535

Browse files
committed
* scanpo.c, main.c, misc: implemented a VERSION/N and REVISION/N option to
allow to override the catalog version and revision numbers. This is e.g. the case if the ct/po files don't contain parseable $Id$ specifiers in case git is used as revision control. For these cases the revision can now be specified on the command-line as well.
1 parent 54db5a8 commit 11e6535

19 files changed

+165
-46
lines changed

.gitignore

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1-
.dep_*/
2-
.obj_*/
1+
src/.dep_*/
2+
src/.obj_*/
3+
src/bin_*/
4+
src/locale/*.catalog
5+
release/
6+
/*.lha
7+
/*.readme

ChangeLog

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
FlexCat Open Source - Changelog
33
-------------------------------
44

5-
$Id$
6-
$URL$
5+
2016-04-27 Jens Maus <[email protected]>
6+
7+
* scanpo.c, main.c, misc: implemented a VERSION/N and REVISION/N option to
8+
allow to override the catalog version and revision numbers. This is e.g.
9+
the case if the ct/po files don't contain parseable $Id$ specifiers in case
10+
git is used as revision control. For these cases the revision can now be
11+
specified on the command-line as well.
712

813
2015-07-12 Thore B�ckelmann <[email protected]>
914

src/FlexCat_cat.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
/****************************************************************
33
4-
This file was created automatically by `FlexCat 2.15'
4+
This file was created automatically by `FlexCat 2.18'
55
from "locale/FlexCat.pot".
66
77
Do NOT edit by hand!
@@ -168,5 +168,7 @@ extern struct FC_String FlexCat_Strings[];
168168
#define _MSG_ERR_ICONV_FAILED 68
169169
#define MSG_ERR_ICONV_OPEN_FAILED (FlexCat_Strings[69].Str)
170170
#define _MSG_ERR_ICONV_OPEN_FAILED 69
171+
#define MSG_ERR_NO_CAT_VERSION (FlexCat_Strings[70].Str)
172+
#define _MSG_ERR_NO_CAT_VERSION 70
171173

172174
#endif

src/FlexCat_cat_other.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
/****************************************************************
33
4-
This file was created automatically by `FlexCat 2.15'
4+
This file was created automatically by `FlexCat 2.18'
55
from "locale/FlexCat.pot".
66
77
Do NOT edit by hand!
@@ -97,5 +97,6 @@ void CloseFlexCatCatalog( void );
9797
#define MSG_ERR_INVALID_CHARS_FOUND FlexCat_Strings[67]
9898
#define MSG_ERR_ICONV_FAILED FlexCat_Strings[68]
9999
#define MSG_ERR_ICONV_OPEN_FAILED FlexCat_Strings[69]
100+
#define MSG_ERR_NO_CAT_VERSION FlexCat_Strings[70]
100101

101102
#endif

src/Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ CC = gcc
124124
STRIP = strip
125125
OBJDUMP = objdump
126126
MAKEINFO= makeinfo
127+
TX = tx
127128

128129
# path definitions
129130
CDUP = /
@@ -519,10 +520,19 @@ FlexCat_cat_other.h: locale/FlexCat.pot sd/Hardcode_h.sd
519520

520521
locale/%.catalog: locale/%.po
521522
@echo " MK $@"
522-
@$(FLEXCAT) POFILE $< CATALOG $@
523+
@$(FLEXCAT) REVISION $(shell git rev-list --all --count $<) POFILE $< CATALOG $@
523524

524-
.IGNORE: $(CATALOGS)
525+
## TRANSIFEX ##########################
526+
527+
.PHONY: txpull
528+
txpull:
529+
@$(TX) pull -a -f
525530

531+
.PHONY: txpush
532+
txpush:
533+
@$(TX) push -t
534+
535+
.IGNORE: $(CATALOGS)
526536
catalogs: $(CATALOGS)
527537

528538
.PHONY: clean

src/createcat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ void CreateCat(char *CatFile)
260260
name = (char *)"";
261261
}
262262

263-
if(asprintf(&verStr, "%cVER: %s %d.%d(%d.%d.%d)", '$', name, version, revision, day, month, year) != -1)
263+
if(asprintf(&verStr, "%cVER: %s %d.%d (%d.%d.%d)", '$', name, version, revision, day, month, year) != -1)
264264
{
265265
verChunk.ID = MAKE_ID('F', 'V', 'E', 'R');
266266
verChunk.ID = SwapLong(verChunk.ID);

src/createct.c

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,39 @@ void CreateCTFile(char *NewCTFile)
118118
t = localtime(&tim);
119119
strftime(dateStr, 12, "%d.%m.%Y", t);
120120

121-
if(CatVersion != 0L)
121+
if(CatVersion != -1)
122122
{
123-
if(BaseName != NULL)
124-
fprintf(fp, "## version %cVER: %s.catalog %d.<rev> (%s)\n", '$', BaseName, CatVersion, dateStr);
123+
if(CatRevision != -1)
124+
{
125+
if(BaseName != NULL)
126+
fprintf(fp, "## version %cVER: %s.catalog %d.%d (%s)\n", '$', BaseName, CatVersion, CatRevision, dateStr);
127+
else
128+
fprintf(fp, "## version %cVER: <name>.catalog %d.%d (%s)\n", '$', CatVersion, CatRevision, dateStr);
129+
}
125130
else
126-
fprintf(fp, "## version %cVER: <name>.catalog %d.<rev> (%s)\n", '$', CatVersion, dateStr);
131+
{
132+
if(BaseName != NULL)
133+
fprintf(fp, "## version %cVER: %s.catalog %d.<rev> (%s)\n", '$', BaseName, CatVersion, dateStr);
134+
else
135+
fprintf(fp, "## version %cVER: <name>.catalog %d.<rev> (%s)\n", '$', CatVersion, dateStr);
136+
}
127137
}
128138
else
129139
{
130-
if(BaseName != NULL)
131-
fprintf(fp, "## version %cVER: %s.catalog <ver>.0 (%s)\n", '$', BaseName, dateStr);
140+
if(CatRevision != -1)
141+
{
142+
if(BaseName != NULL)
143+
fprintf(fp, "## version %cVER: %s.catalog <ver>.%d (%s)\n", '$', BaseName, CatRevision, dateStr);
144+
else
145+
fprintf(fp, "## version %cVER: <name>.catalog <ver>.%d (%s)\n", '$', dateStr, CatRevision);
146+
}
132147
else
133-
fprintf(fp, "## version %cVER: <name>.catalog <ver>.0 (%s)\n", '$', dateStr);
148+
{
149+
if(BaseName != NULL)
150+
fprintf(fp, "## version %cVER: %s.catalog <ver>.<rev> (%s)\n", '$', BaseName, dateStr);
151+
else
152+
fprintf(fp, "## version %cVER: <name>.catalog <ver>.<rev> (%s)\n", '$', dateStr);
153+
}
134154
}
135155

136156
free(dateStr);

src/globals.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
/// Globals
2727
char *BaseName = NULL; /* Basename of catalog description */
2828
const char *Language = "english"; /* Language of catalog description */
29-
int CatVersion = 0; /* Version of catalog to be opened */
30-
int CatRevision = 0; /* Revision of catalog to be opened */
29+
int CatVersion = -1; /* Version of catalog to be opened */
30+
int CatRevision = -1; /* Revision of catalog to be opened */
3131
int NumStrings = 0; /* Number of catalog strings */
3232
char *ScanFile; /* File currently scanned */
3333
int ScanLine; /* Line currently scanned */

src/locale.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
/****************************************************************
33
4-
This file was created automatically by `FlexCat 2.15'
4+
This file was created automatically by `FlexCat 2.18'
55
from "locale/FlexCat.pot".
66
77
Do NOT edit by hand!
@@ -19,7 +19,7 @@
1919
struct FC_String FlexCat_Strings[] =
2020
{
2121
{ "Usage:", 0 },
22-
{ " CDFILE Catalog description file to scan\n CTFILE Catalog translation file to scan\n POFILE Catalog translation in PO-style format\n CATALOG Catalog file to create\n NEWCTFILE Catalog translation file to create\n SOURCES Sources to create; must be something like SFILE=SDFILE,\n where SFILE is a source file and SDFILE is a source\n description file\n WARNCTGAPS Warn about identifiers missing in translation\n NOOPTIM Do not skip unchanged strings in translation/description\n FILL Fill missing identifiers with original text\n FLUSH Flush memory after the catalog is created\n NOBEEP No DisplayBeep() on errors and warnings\n QUIET No warnings\n NOLANGTOLOWER Prevent #language name from being lowercased\n NOBUFFEREDIO Disable I/O buffers\n MODIFIED Create catalog only if description/translation have changed\n COPYMSGNEW Copy ***NEW*** markers over from old translation\n OLDMSGNEW Custom marker in old translation\n CODESET Codeset to force in output file (e.g. 'UTF-8')\n NOAUTODATE no operation - kept for compatibility\n NOSPACES no operation - kept for compatibility", 1 },
22+
{ " CDFILE Catalog description file to scan\n CTFILE Catalog translation file to scan\n POFILE Catalog translation in PO-style format\n CATALOG Catalog file to create\n NEWCTFILE Catalog translation file to create\n SOURCES Sources to create; must be something like SFILE=SDFILE,\n where SFILE is a source file and SDFILE is a source\n description file\n WARNCTGAPS Warn about identifiers missing in translation\n NOOPTIM Do not skip unchanged strings in translation/description\n FILL Fill missing identifiers with original text\n FLUSH Flush memory after the catalog is created\n NOBEEP No DisplayBeep() on errors and warnings\n QUIET No warnings\n NOLANGTOLOWER Prevent #language name from being lowercased\n NOBUFFEREDIO Disable I/O buffers\n MODIFIED Create catalog only if description/translation have changed\n COPYMSGNEW Copy ***NEW*** markers over from old translation\n OLDMSGNEW Custom marker in old translation\n CODESET Codeset to force in output file (e.g. 'UTF-8')\n VERSION Force a certain version to be used during catalog generation\n REVISION Force a certain revision to be used during catalog generation\n NOAUTODATE no operation - kept for compatibility\n NOSPACES no operation - kept for compatibility", 1 },
2323
{ "File '%s' is up to date", 2 },
2424
{ "%s, line %d - warning:", 100 },
2525
{ "%s, line %d - ERROR:", 101 },
@@ -88,6 +88,7 @@ struct FC_String FlexCat_Strings[] =
8888
{ "ERROR in CodesetsConvertStr(): %d invalid characters found", 181 },
8989
{ "ERROR in iconv(): %s", 182 },
9090
{ "ERROR in iconv_open(): %s", 183 },
91+
{ "no catalog version information found, using version 0", 184 },
9192
{ NULL, 0 }
9293
};
9394

src/locale/FlexCat.pot

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Translation catalog description file (pot-style)
2-
# $Id$
32
#
43
# version 3
54
msgid ""
@@ -43,9 +42,11 @@ msgid ""
4342
" COPYMSGNEW Copy ***NEW*** markers over from old translation\n"
4443
" OLDMSGNEW Custom marker in old translation\n"
4544
" CODESET Codeset to force in output file (e.g. 'UTF-8')\n"
45+
" VERSION Force a certain version to be used during catalog generation\n"
46+
" REVISION Force a certain revision to be used during catalog generation\n"
4647
" NOAUTODATE no operation - kept for compatibility\n"
4748
" NOSPACES no operation - kept for compatibility"
48-
msgstr " CDFILE Catalog description file to scan\n CTFILE Catalog translation file to scan\n POFILE Catalog translation in PO-style format\n CATALOG Catalog file to create\n NEWCTFILE Catalog translation file to create\n SOURCES Sources to create; must be something like SFILE=SDFILE,\n where SFILE is a source file and SDFILE is a source\n description file\n WARNCTGAPS Warn about identifiers missing in translation\n NOOPTIM Do not skip unchanged strings in translation/description\n FILL Fill missing identifiers with original text\n FLUSH Flush memory after the catalog is created\n NOBEEP No DisplayBeep() on errors and warnings\n QUIET No warnings\n NOLANGTOLOWER Prevent #language name from being lowercased\n NOBUFFEREDIO Disable I/O buffers\n MODIFIED Create catalog only if description/translation have changed\n COPYMSGNEW Copy ***NEW*** markers over from old translation\n OLDMSGNEW Custom marker in old translation\n CODESET Codeset to force in output file (e.g. 'UTF-8')\n NOAUTODATE no operation - kept for compatibility\n NOSPACES no operation - kept for compatibility"
49+
msgstr " CDFILE Catalog description file to scan\n CTFILE Catalog translation file to scan\n POFILE Catalog translation in PO-style format\n CATALOG Catalog file to create\n NEWCTFILE Catalog translation file to create\n SOURCES Sources to create; must be something like SFILE=SDFILE,\n where SFILE is a source file and SDFILE is a source\n description file\n WARNCTGAPS Warn about identifiers missing in translation\n NOOPTIM Do not skip unchanged strings in translation/description\n FILL Fill missing identifiers with original text\n FLUSH Flush memory after the catalog is created\n NOBEEP No DisplayBeep() on errors and warnings\n QUIET No warnings\n NOLANGTOLOWER Prevent #language name from being lowercased\n NOBUFFEREDIO Disable I/O buffers\n MODIFIED Create catalog only if description/translation have changed\n COPYMSGNEW Copy ***NEW*** markers over from old translation\n OLDMSGNEW Custom marker in old translation\n CODESET Codeset to force in output file (e.g. 'UTF-8')\n VERSION Force a certain version to be used during catalog generation\n REVISION Force a certain revision to be used during catalog generation\n NOAUTODATE no operation - kept for compatibility\n NOSPACES no operation - kept for compatibility"
4950

5051
msgctxt "MSG_FILEUPTODATE (2//)"
5152
msgid "File '%s' is up to date"
@@ -335,3 +336,7 @@ msgstr "ERROR in iconv(): %s"
335336
msgctxt "MSG_ERR_ICONV_OPEN_FAILED (183//)"
336337
msgid "ERROR in iconv_open(): %s"
337338
msgstr "ERROR in iconv_open(): %s"
339+
340+
msgctxt "MSG_ERR_NO_CAT_VERSION (184//)"
341+
msgid "no catalog version information found, using version 0"
342+
msgstr "no catalog version information found, using version 0"

0 commit comments

Comments
 (0)