summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/mendexk/ChangeLog5
-rw-r--r--Build/source/texk/mendexk/fwrite.c26
-rw-r--r--Build/source/texk/upmendex/ChangeLog5
-rw-r--r--Build/source/texk/upmendex/fwrite.c26
4 files changed, 38 insertions, 24 deletions
diff --git a/Build/source/texk/mendexk/ChangeLog b/Build/source/texk/mendexk/ChangeLog
index da3b5bf7624..4d2f0216383 100644
--- a/Build/source/texk/mendexk/ChangeLog
+++ b/Build/source/texk/mendexk/ChangeLog
@@ -1,3 +1,8 @@
+2022-03-07 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * fwrite.c: output to file instead of accumulating too much.
+ https://github.com/texjporg/tex-jp-build/issues/137
+
2022-01-22 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
* fread.c: Adapt to arguments of input_line2() in ptexenc-1.4.0.
diff --git a/Build/source/texk/mendexk/fwrite.c b/Build/source/texk/mendexk/fwrite.c
index ef97d0c87a3..883dffd6e01 100644
--- a/Build/source/texk/mendexk/fwrite.c
+++ b/Build/source/texk/mendexk/fwrite.c
@@ -13,8 +13,8 @@
int line_length=0;
static void printpage(struct index *ind, FILE *fp, int num, char *lbuff);
-static int range_check(struct index ind, int count, char *lbuff);
-static void linecheck(char *lbuff, char *tmpbuff, int force);
+static int range_check(struct index ind, int count, char *lbuff, FILE *fp);
+static void linecheck(char *lbuff, char *tmpbuff, FILE *fp, int force);
static void crcheck(char *lbuff, FILE *fp);
/* All buffers have size BUFFERLEN. */
@@ -362,7 +362,7 @@ static void printpage(struct index *ind, FILE *fp, int num, char *lbuff)
line_length=strlen(lbuff);
for(j=0;j<ind[num].num;j++) {
- cc=range_check(ind[num],j,lbuff);
+ cc=range_check(ind[num],j,lbuff,fp);
if (cc>j) {
int epage = pnumconv2(&ind[num].p[cc]);
int bpage = pnumconv2(&ind[num].p[j]);
@@ -397,14 +397,14 @@ static void printpage(struct index *ind, FILE *fp, int num, char *lbuff)
if (strlen(ind[num].p[j].enc)>0) {
SAPPENDF(tmpbuff,"%s",encap_suffix);
}
- linecheck(lbuff,tmpbuff, FALSE);
+ linecheck(lbuff,tmpbuff,fp, FALSE);
j=cc;
if (j==ind[num].num) {
goto PRINT;
}
else {
SAPPENDF(tmpbuff,"%s",delim_n);
- linecheck(lbuff,tmpbuff, TRUE);
+ linecheck(lbuff,tmpbuff,fp, TRUE);
}
}
else if (strlen(ind[num].p[j].enc)>0) {
@@ -425,19 +425,19 @@ static void printpage(struct index *ind, FILE *fp, int num, char *lbuff)
SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
SAPPENDF(tmpbuff,"%s",encap_suffix);
SAPPENDF(tmpbuff,"%s",delim_n);
- linecheck(lbuff,tmpbuff, FALSE);
+ linecheck(lbuff,tmpbuff,fp, FALSE);
}
else {
SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
SAPPENDF(tmpbuff,"%s",delim_n);
- linecheck(lbuff,tmpbuff, FALSE);
+ linecheck(lbuff,tmpbuff,fp, FALSE);
}
}
else {
/* no encap */
SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
SAPPENDF(tmpbuff,"%s",delim_n);
- linecheck(lbuff,tmpbuff, FALSE);
+ linecheck(lbuff,tmpbuff,fp, FALSE);
}
}
@@ -469,7 +469,7 @@ static void printpage(struct index *ind, FILE *fp, int num, char *lbuff)
else {
SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
}
- linecheck(lbuff,tmpbuff, FALSE);
+ linecheck(lbuff,tmpbuff,fp, FALSE);
PRINT:
fputs(lbuff,fp);
@@ -477,7 +477,7 @@ PRINT:
lbuff[0]='\0';
}
-static int range_check(struct index ind, int count, char *lbuff)
+static int range_check(struct index ind, int count, char *lbuff, FILE *fp)
{
int i,j,k,cc1,cc2,start,force=0;
char tmpbuff[BUFFERLEN],errbuff[BUFFERLEN];
@@ -513,7 +513,7 @@ static int range_check(struct index ind, int count, char *lbuff)
if (strlen(ind.p[j].enc)>0) {
SPRINTF(tmpbuff,"%s%s%s%s%s%s",encap_prefix,ind.p[j].enc,encap_infix
,ind.p[j].page,encap_suffix,delim_n);
- linecheck(lbuff,tmpbuff, FALSE);
+ linecheck(lbuff,tmpbuff,fp, FALSE);
}
}
}
@@ -551,10 +551,12 @@ static int range_check(struct index ind, int count, char *lbuff)
}
/* check line length */
-static void linecheck(char *lbuff, char *tmpbuff, int force)
+static void linecheck(char *lbuff, char *tmpbuff, FILE *fp, int force)
{
if (line_length+strlen(tmpbuff)>line_max && !force) {
SAPPENDF(lbuff,"\n");
+ fputs(lbuff,fp);
+ lbuff[0]='\0';
SAPPENDF(lbuff,"%s",indent_space);
SAPPENDF(lbuff,"%s",tmpbuff);
line_length=indent_length+strlen(tmpbuff);
diff --git a/Build/source/texk/upmendex/ChangeLog b/Build/source/texk/upmendex/ChangeLog
index de3bf426556..a85de2463e9 100644
--- a/Build/source/texk/upmendex/ChangeLog
+++ b/Build/source/texk/upmendex/ChangeLog
@@ -1,3 +1,8 @@
+2022-03-07 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * fwrite.c: output to file instead of accumulating too much.
+ https://github.com/texjporg/tex-jp-build/issues/137
+
2022-01-18 Karl Berry <karl@freefriends.org>
* COPYRIGHT,
diff --git a/Build/source/texk/upmendex/fwrite.c b/Build/source/texk/upmendex/fwrite.c
index 9ce382589e0..bfbc14dbb9d 100644
--- a/Build/source/texk/upmendex/fwrite.c
+++ b/Build/source/texk/upmendex/fwrite.c
@@ -12,8 +12,8 @@
int line_length=0;
static void printpage(struct index *ind, FILE *fp, int num, char *lbuff);
-static int range_check(struct index ind, int count, char *lbuff);
-static void linecheck(char *lbuff, char *tmpbuff, int force);
+static int range_check(struct index ind, int count, char *lbuff, FILE *fp);
+static void linecheck(char *lbuff, char *tmpbuff, FILE *fp, int force);
static void crcheck(char *lbuff, FILE *fp);
static void index_normalize(UChar *istr, UChar *ini, int *chset);
static int initial_cmp_char(UChar *ini, UChar ch);
@@ -541,7 +541,7 @@ static void printpage(struct index *ind, FILE *fp, int num, char *lbuff)
line_length=strlen(lbuff);
for(j=0;j<ind[num].num;j++) {
- cc=range_check(ind[num],j,lbuff);
+ cc=range_check(ind[num],j,lbuff,fp);
if (cc>j) {
int epage = pnumconv2(&ind[num].p[cc]);
int bpage = pnumconv2(&ind[num].p[j]);
@@ -576,14 +576,14 @@ static void printpage(struct index *ind, FILE *fp, int num, char *lbuff)
if (strlen(ind[num].p[j].enc)>0) {
SAPPENDF(tmpbuff,"%s",encap_suffix);
}
- linecheck(lbuff,tmpbuff, FALSE);
+ linecheck(lbuff,tmpbuff,fp, FALSE);
j=cc;
if (j==ind[num].num) {
goto PRINT;
}
else {
SAPPENDF(tmpbuff,"%s",delim_n);
- linecheck(lbuff,tmpbuff, TRUE);
+ linecheck(lbuff,tmpbuff,fp, TRUE);
}
}
else if (strlen(ind[num].p[j].enc)>0) {
@@ -605,19 +605,19 @@ static void printpage(struct index *ind, FILE *fp, int num, char *lbuff)
SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
SAPPENDF(tmpbuff,"%s",encap_suffix);
SAPPENDF(tmpbuff,"%s",delim_n);
- linecheck(lbuff,tmpbuff, FALSE);
+ linecheck(lbuff,tmpbuff,fp, FALSE);
}
else {
SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
SAPPENDF(tmpbuff,"%s",delim_n);
- linecheck(lbuff,tmpbuff, FALSE);
+ linecheck(lbuff,tmpbuff,fp, FALSE);
}
}
else {
/* no encap */
SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
SAPPENDF(tmpbuff,"%s",delim_n);
- linecheck(lbuff,tmpbuff, FALSE);
+ linecheck(lbuff,tmpbuff,fp, FALSE);
}
}
@@ -651,7 +651,7 @@ static void printpage(struct index *ind, FILE *fp, int num, char *lbuff)
else {
SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
}
- linecheck(lbuff,tmpbuff, FALSE);
+ linecheck(lbuff,tmpbuff,fp, FALSE);
PRINT:
fputs(lbuff,fp);
@@ -659,7 +659,7 @@ PRINT:
lbuff[0]='\0';
}
-static int range_check(struct index ind, int count, char *lbuff)
+static int range_check(struct index ind, int count, char *lbuff, FILE *fp)
{
int i,j,k,cc1,cc2,start,force=0;
char tmpbuff[BUFFERLEN],errbuff[BUFFERLEN],obuff[BUFFERLEN];
@@ -697,7 +697,7 @@ static int range_check(struct index ind, int count, char *lbuff)
if (strlen(ind.p[j].enc)>0) {
SPRINTF(tmpbuff,"%s%s%s%s%s%s",encap_prefix,ind.p[j].enc,encap_infix
,ind.p[j].page,encap_suffix,delim_n);
- linecheck(lbuff,tmpbuff, FALSE);
+ linecheck(lbuff,tmpbuff,fp, FALSE);
}
}
}
@@ -736,10 +736,12 @@ static int range_check(struct index ind, int count, char *lbuff)
}
/* check line length */
-static void linecheck(char *lbuff, char *tmpbuff, int force)
+static void linecheck(char *lbuff, char *tmpbuff, FILE *fp, int force)
{
if (line_length+strlen(tmpbuff)>line_max && !force) {
SAPPENDF(lbuff,"\n");
+ fputs(lbuff,fp);
+ lbuff[0]='\0';
SAPPENDF(lbuff,"%s",indent_space);
SAPPENDF(lbuff,"%s",tmpbuff);
line_length=indent_length+strlen(tmpbuff);