summaryrefslogtreecommitdiff
path: root/indexing/upmendex/source/styfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'indexing/upmendex/source/styfile.c')
-rw-r--r--indexing/upmendex/source/styfile.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/indexing/upmendex/source/styfile.c b/indexing/upmendex/source/styfile.c
index 1c94c90077..619e4a5625 100644
--- a/indexing/upmendex/source/styfile.c
+++ b/indexing/upmendex/source/styfile.c
@@ -47,8 +47,9 @@ void styread(const char *filename)
fp=NULL;
if (fp==NULL) {
fprintf(stderr,"%s does not exist.\n",filename);
- exit(0);
+ exit(255);
}
+ verb_printf(efp,"Scanning style file %s.",filename);
for (i=0;;i++) {
if (fgets(buff,4095,fp)==NULL) break;
@@ -64,6 +65,8 @@ void styread(const char *filename)
if (getparachar(buff,"escape",&escape)) continue;
if (getparam(buff,"preamble",preamble)) continue;
if (getparam(buff,"postamble",postamble)) continue;
+ if (getparam(buff,"setpage_prefix",setpage_prefix)) continue;
+ if (getparam(buff,"setpage_suffix",setpage_suffix)) continue;
if (getparam(buff,"group_skip",group_skip)) continue;
if (getparam(buff,"lethead_prefix",lethead_prefix)) continue;
if (getparam(buff,"heading_prefix",lethead_prefix)) continue;
@@ -91,7 +94,6 @@ void styread(const char *filename)
if (getparam(buff,"item_0",item_0)) continue;
if (getparam(buff,"item_1",item_1)) continue;
if (getparam(buff,"item_2",item_2)) continue;
- if (getparam(buff,"item_2",item_2)) continue;
if (getparam(buff,"item_01",item_01)) continue;
if (getparam(buff,"item_x1",item_x1)) continue;
if (getparam(buff,"item_12",item_12)) continue;
@@ -130,18 +132,26 @@ void styread(const char *filename)
letter_head=atoi(&buff[cc]);
continue;
}
- if (getparam(buff,"atama",tmp)) {
- multibyte_to_widechar(atama,STYBUFSIZE,tmp);
+ if (getparam(buff,"kana_head",tmp)) {
+ multibyte_to_widechar(kana_head,STYBUFSIZE,tmp);
continue;
}
- if (getparam(buff,"tumunja",tmp)) {
- multibyte_to_widechar(tumunja,STYBUFSIZE,tmp);
+ if (getparam(buff,"hangul_head",tmp) || getparam(buff,"tumunja",tmp)) {
+ multibyte_to_widechar(hangul_head,STYBUFSIZE,tmp);
continue;
}
if (getparam(buff,"hanzi_head",tmp)) {
multibyte_to_widechar(hanzi_head,STYBUFSIZE,tmp);
continue;
}
+ if (getparam(buff,"thai_head",tmp)) {
+ multibyte_to_widechar(thai_head,STYBUFSIZE,tmp);
+ continue;
+ }
+ if (getparam(buff,"devanagari_head",tmp)) {
+ multibyte_to_widechar(devanagari_head,STYBUFSIZE,tmp);
+ continue;
+ }
if (getparam(buff,"page_compositor",page_compositor)) continue;
if (getparam(buff,"page_precedence",page_precedence)) continue;
if (getparam(buff,"character_order",character_order)) continue;
@@ -156,6 +166,8 @@ void styread(const char *filename)
if (getparam(buff,"icu_attributes", icu_attr_str )) continue;
}
fclose(fp);
+
+ verb_printf(efp,"...done.\n");
}
/* analize string parameter of style file */
@@ -164,6 +176,10 @@ static void convline(char *buff1, int start, char *buff2)
int i,j,cc;
for (i=start,j=cc=0;;i++) {
+ if (j==STYBUFSIZE-1) {
+ buff2[j]='\0';
+ break;
+ }
if (buff1[i]=='\"') {
if (cc==0) {
cc=1;
@@ -191,6 +207,10 @@ static void convline(char *buff1, int start, char *buff2)
verb_printf(efp,"\nWarning: Illegal input of lead byte 0x%x in UTF-8.", (unsigned char)buff1[i]);
continue;
}
+ else if (j+len>STYBUFSIZE-1) {
+ buff2[j]='\0';
+ break;
+ }
while(len--) {
buff2[j++]=buff1[i++];
}
@@ -340,4 +360,10 @@ void set_icu_attributes(void)
else if (strstr(pos,"off")) icu_attributes[attr]=UCOL_OFF;
else verb_printf(efp,"\nWarning: Illegal input for icu_attributes (normalization-mode).");
}
+ if ((pos=strstr(tmp,"numeric-ordering:"))>0) {
+ pos+=17; attr=UCOL_NUMERIC_COLLATION;
+ if (strstr(pos,"on")) icu_attributes[attr]=UCOL_ON;
+ else if (strstr(pos,"off")) icu_attributes[attr]=UCOL_OFF;
+ else verb_printf(efp,"\nWarning: Illegal input for icu_attributes (numeric-ordering).");
+ }
}