Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 1064 → Rev 1115

/svarlang.lib/trunk/history.txt
1,4 → 1,7
 
20220314
- added support for flaggin strings as being "dirty", eg: ?1.1:Hello, World
 
20220309
- static lib buffer is sized to fit the largest lang block +5% of margin
(was: twice the size of the reference language)
/svarlang.lib/trunk/svarlang.txt
41,6 → 41,17
Read svarlang.h for more information about available functions.
 
 
### DIRTY STRINGS ###
 
In the CATS-style source translation, lines may be prefixed with a '?' sign:
 
?1.1:Hello, World!
 
Such string is used by tlumacz like any other, but it is also reported on the
command-line with a warning about the line being "dirty" (that is, requiring
to be reviewed by a translator).
 
 
### ENVIRONMENT ###
 
The program translation file should be named "PROGNAME.LNG", where PROGNAME
/svarlang.lib/trunk/tlumacz.c
66,12 → 66,15
}
 
 
/* parse a line in format "1.50:somestring". fills id and returns a pointer to
/* parse a line in format "[?]1.50:somestring". fills id and returns a pointer to
* the actual string part on success, or NULL on error */
static char *parseline(unsigned short *id, char *s) {
static const char *parseline(unsigned short *id, const char *s) {
int i;
int dotpos = 0, colpos = 0, gotdigits = 0;
 
/* strings prefixed by '?' are flagged as "dirty": ignore this flag here */
if (*s == '?') s++;
 
/* I must have a . and a : in the first 9 bytes */
for (i = 0;; i++) {
if (s[i] == '.') {
131,7 → 134,7
FILE *fd;
char fname[] = "XX.TXT";
static char linebuf[8192];
char *ptr;
const char *ptr;
unsigned short id, linecount;
 
bitmap_init(b);
162,6 → 165,11
break;
}
 
/* warn about dirty lines */
if (linebuf[0] == '?') {
printf("WARNING: %s[#%u] string id %u.%u is flagged as 'dirty'\r\n", fname, linecount, id >> 8, id & 0xff);
}
 
/* write string into block (II LL S) */
memcpy(buff + len, &id, 2);
len += 2;