[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Groff-commit] groff ./ChangeLog src/preproc/preconv/preconv.cpp
From: |
Werner LEMBERG |
Subject: |
[Groff-commit] groff ./ChangeLog src/preproc/preconv/preconv.cpp |
Date: |
Thu, 05 Jan 2006 13:22:56 +0000 |
CVSROOT: /cvsroot/groff
Module name: groff
Branch:
Changes by: Werner LEMBERG <address@hidden> 06/01/05 13:22:56
Modified files:
. : ChangeLog
src/preproc/preconv: preconv.cpp
Log message:
* src/preproc/preconv/preconv.cpp: s/debug/debug_flag/.
(raw_flag): New global variable.
(do_file): Use .lf to set file name (if `raw_flag' isn't set).
(usage): Updated.
(main): Handle `-r' command line switch to set `raw_flag'.
(get_BOM): Fix encodings in `BOM_table'.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/groff/groff/ChangeLog.diff?tr1=1.876&tr2=1.877&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/groff/groff/src/preproc/preconv/preconv.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
Patches:
Index: groff/ChangeLog
diff -u groff/ChangeLog:1.876 groff/ChangeLog:1.877
--- groff/ChangeLog:1.876 Thu Jan 5 07:45:27 2006
+++ groff/ChangeLog Thu Jan 5 13:22:56 2006
@@ -1,3 +1,12 @@
+2006-01-05 Werner LEMBERG <address@hidden>
+
+ * src/preproc/preconv/preconv.cpp: s/debug/debug_flag/.
+ (raw_flag): New global variable.
+ (do_file): Use .lf to set file name (if `raw_flag' isn't set).
+ (usage): Updated.
+ (main): Handle `-r' command line switch to set `raw_flag'.
+ (get_BOM): Fix encodings in `BOM_table'.
+
2006-01-04 Werner LEMBERG <address@hidden>
* src/preproc/preconv/preconv.cpp (emacs_to_mime): As suggested by
Index: groff/src/preproc/preconv/preconv.cpp
diff -u groff/src/preproc/preconv/preconv.cpp:1.5
groff/src/preproc/preconv/preconv.cpp:1.6
--- groff/src/preproc/preconv/preconv.cpp:1.5 Thu Jan 5 07:45:27 2006
+++ groff/src/preproc/preconv/preconv.cpp Thu Jan 5 13:22:56 2006
@@ -51,7 +51,8 @@
const char *default_encoding;
char user_encoding[MAX_VAR_LEN];
char encoding_string[MAX_VAR_LEN];
-int debug = 0;
+int debug_flag = 0;
+int raw_flag = 0;
struct conversion {
const char *from;
@@ -559,7 +560,7 @@
void
utf8::invalid()
{
- if (debug && invalid_warning) {
+ if (debug_flag && invalid_warning) {
fprintf(stderr, " invalid byte(s) found in input stream --\n"
" each such sequence replaced with 0xFFFD\n");
invalid_warning = 0;
@@ -571,7 +572,7 @@
void
utf8::incomplete()
{
- if (debug && incomplete_warning) {
+ if (debug_flag && incomplete_warning) {
fprintf(stderr, " incomplete sequence(s) found in input stream --\n"
" each such sequence replaced with 0xFFFD\n");
incomplete_warning = 0;
@@ -758,11 +759,11 @@
const char *str;
const char *name;
} BOM_table[] = {
- {4, "\x00\x00\xFE\xFF", "UTF-32BE"},
- {4, "\xFF\xFE\x00\x00", "UTF-32LE"},
+ {4, "\x00\x00\xFE\xFF", "UTF-32"},
+ {4, "\xFF\xFE\x00\x00", "UTF-32"},
{3, "\xEF\xBB\xBF", "UTF-8"},
- {2, "\xFE\xFF", "UTF-16BE"},
- {2, "\xFF\xFE", "UTF-16LE"},
+ {2, "\xFE\xFF", "UTF-16"},
+ {2, "\xFF\xFE", "UTF-16"},
};
const int BOM_table_len = sizeof (BOM_table) / sizeof (BOM_table[0]);
char BOM_string[4];
@@ -817,7 +818,7 @@
int emit_warning = 1;
for (int lines = newline_count; lines < 2; lines++) {
while ((c = getc(fp)) != EOF) {
- if (c == '\0' && debug && emit_warning) {
+ if (c == '\0' && debug_flag && emit_warning) {
fprintf(stderr,
" null byte(s) found in input stream --\n"
" search for coding tag might return false result\n");
@@ -992,7 +993,7 @@
FILE *fp;
string BOM, data;
if (strcmp(filename, "-")) {
- if (debug)
+ if (debug_flag)
fprintf(stderr, "file `%s':\n", filename);
fp = fopen(filename, FOPEN_RB);
if (!fp) {
@@ -1001,7 +1002,7 @@
}
}
else {
- if (debug)
+ if (debug_flag)
fprintf(stderr, "standard input:\n");
SET_BINARY(fileno(stdin));
fp = stdin;
@@ -1010,7 +1011,7 @@
// Determine the encoding.
char *encoding;
if (user_encoding[0]) {
- if (debug) {
+ if (debug_flag) {
fprintf(stderr, " user-specified encoding `%s', "
"no search for coding tag\n",
user_encoding);
@@ -1021,7 +1022,7 @@
encoding = (char *)user_encoding;
}
else if (BOM_encoding) {
- if (debug)
+ if (debug_flag)
fprintf(stderr, " found BOM, no search for coding tag\n");
encoding = (char *)BOM_encoding;
}
@@ -1029,12 +1030,12 @@
// `check_coding_tag' returns a pointer to a static array (or NULL).
char *file_encoding = check_coding_tag(fp, data);
if (!file_encoding) {
- if (debug)
+ if (debug_flag)
fprintf(stderr, " no file encoding\n");
file_encoding = (char *)default_encoding;
}
else
- if (debug)
+ if (debug_flag)
fprintf(stderr, " file encoding: `%s'\n", file_encoding);
encoding = file_encoding;
}
@@ -1048,9 +1049,11 @@
encoding_string);
return 0;
}
- if (debug)
+ if (debug_flag)
fprintf(stderr, " encoding used: `%s'\n", encoding);
data = BOM + data;
+ if (!raw_flag)
+ printf(".lf 1 %s\n", filename);
int success = 1;
// Call converter (converters write to stdout).
if (!strcasecmp(encoding, "ISO-8859-1"))
@@ -1083,6 +1086,7 @@
"-d show debugging messages\n"
"-e encoding specify input encoding\n"
"-h print this message\n"
+ "-r don't add .lf requests\n"
"-v print version number\n"
"\n"
"The default encoding is `%s'.\n",
@@ -1120,7 +1124,8 @@
{ NULL, 0, 0, 0 }
};
// Parse the command line options.
- while ((opt = getopt_long(argc, argv, "de:hv", long_options, NULL)) != EOF)
+ while ((opt = getopt_long(argc, argv,
+ "de:hrv", long_options, NULL)) != EOF)
switch (opt) {
case 'v':
printf("GNU preconv (groff) version %s %s iconv support\n",
@@ -1134,7 +1139,7 @@
exit(0);
break;
case 'd':
- debug = 1;
+ debug_flag = 1;
break;
case 'e':
if (optarg) {
@@ -1144,6 +1149,9 @@
else
user_encoding[0] = 0;
break;
+ case 'r':
+ raw_flag = 1;
+ break;
case CHAR_MAX + 1: // --help
usage(stdout);
exit(0);
@@ -1156,7 +1164,7 @@
assert(0);
}
int nbad = 0;
- if (debug)
+ if (debug_flag)
fprintf(stderr, "default encoding: `%s'\n", default_encoding);
if (optind >= argc)
nbad += !do_file("-");