diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-09-27 13:01:55 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-09-27 13:01:55 +0000 |
commit | 34463adde84855ce10ceecdd8a683129d6f29c9d (patch) | |
tree | 85bfaa6052855102c64d3d749f676a498d817e55 /Build/source/utils/xindy/xindy-2.4/tex2xindy | |
parent | 3606fd6b9703514c7ca6c7f5ec4e92059934c9f6 (diff) |
xindy: Changes for WIN32 from Akira
git-svn-id: svn://tug.org/texlive/trunk@27827 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/xindy/xindy-2.4/tex2xindy')
-rw-r--r-- | Build/source/utils/xindy/xindy-2.4/tex2xindy/tex2xindy.c | 111 | ||||
-rw-r--r-- | Build/source/utils/xindy/xindy-2.4/tex2xindy/tex2xindy.l | 22 |
2 files changed, 84 insertions, 49 deletions
diff --git a/Build/source/utils/xindy/xindy-2.4/tex2xindy/tex2xindy.c b/Build/source/utils/xindy/xindy-2.4/tex2xindy/tex2xindy.c index 158f0a9480b..0bbe8720602 100644 --- a/Build/source/utils/xindy/xindy-2.4/tex2xindy/tex2xindy.c +++ b/Build/source/utils/xindy/xindy-2.4/tex2xindy/tex2xindy.c @@ -1,5 +1,20 @@ +#line 95 "tex2xindy.l" +#include <stdio.h> +#include <stdlib.h> +#ifdef WIN32 +# include <kpathsea/getopt.h> +# include <fcntl.h> +# define YY_NO_UNISTD_H 1 +# ifdef W32TeX +# define __STDC_VERSION__ 199901L +# endif +#else +# include <unistd.h> +#endif -#line 3 "tex2xindy.c" + + +#line 18 "tex2xindy.c" #define YY_INT_ALIGNED short int @@ -640,10 +655,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - +#line 110 "tex2xindy.l" #define QUOTE_ECHO qs(yytext) FILE* attrfd = NULL; @@ -736,7 +748,7 @@ static void omega_output_utf8 ( int width ) } -#line 740 "tex2xindy.c" +#line 752 "tex2xindy.c" #define INITIAL 0 #define key 1 @@ -926,10 +938,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 209 "tex2xindy.l" +#line 222 "tex2xindy.l" -#line 933 "tex2xindy.c" +#line 945 "tex2xindy.c" if ( !(yy_init) ) { @@ -1010,7 +1022,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 211 "tex2xindy.l" +#line 224 "tex2xindy.l" { printf("(indexentry :tkey ((\""); xref_mode = 0; @@ -1020,7 +1032,7 @@ YY_RULE_SETUP YY_BREAK case 2: YY_RULE_SETUP -#line 218 "tex2xindy.l" +#line 231 "tex2xindy.l" { printf("(indexentry :tkey ((\""); xref_mode = 0; @@ -1030,23 +1042,23 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 225 "tex2xindy.l" +#line 238 "tex2xindy.l" { QUOTE_ECHO; } YY_BREAK case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 226 "tex2xindy.l" +#line 239 "tex2xindy.l" { qc(yytext[1]); lineno++; } YY_BREAK case 5: YY_RULE_SETUP -#line 227 "tex2xindy.l" +#line 240 "tex2xindy.l" { qc(yytext[1]); } YY_BREAK case 6: YY_RULE_SETUP -#line 228 "tex2xindy.l" +#line 241 "tex2xindy.l" { printf("\")) :attr \""); range = NO_RANGE; @@ -1055,7 +1067,7 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 233 "tex2xindy.l" +#line 246 "tex2xindy.l" { if ( glos_mode ) { printf("\")) :attr \"is\" :xref (\""); @@ -1069,22 +1081,22 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 243 "tex2xindy.l" +#line 256 "tex2xindy.l" { printf("\") (\""); } YY_BREAK case 9: YY_RULE_SETUP -#line 244 "tex2xindy.l" +#line 257 "tex2xindy.l" { printf("\") (\""); BEGIN(key); } YY_BREAK case 10: YY_RULE_SETUP -#line 245 "tex2xindy.l" +#line 258 "tex2xindy.l" { ECHO; braces++; } YY_BREAK case 11: YY_RULE_SETUP -#line 246 "tex2xindy.l" +#line 259 "tex2xindy.l" { if ( braces > 0 ) { ECHO; @@ -1097,32 +1109,32 @@ YY_RULE_SETUP YY_BREAK case 12: YY_RULE_SETUP -#line 256 "tex2xindy.l" +#line 269 "tex2xindy.l" { printf("\" \""); BEGIN(print); } YY_BREAK case 13: YY_RULE_SETUP -#line 257 "tex2xindy.l" +#line 270 "tex2xindy.l" { multiple_err; } YY_BREAK case 14: YY_RULE_SETUP -#line 259 "tex2xindy.l" +#line 272 "tex2xindy.l" { multiple_err; } YY_BREAK case 15: YY_RULE_SETUP -#line 260 "tex2xindy.l" +#line 273 "tex2xindy.l" { range = OPEN_RANGE; } YY_BREAK case 16: YY_RULE_SETUP -#line 261 "tex2xindy.l" +#line 274 "tex2xindy.l" { range = CLOSE_RANGE; } YY_BREAK case 17: YY_RULE_SETUP -#line 262 "tex2xindy.l" +#line 275 "tex2xindy.l" { /* close :attr "... */ printf("\" :xref (\""); if (attrfd) fprintf(attrfd, "\txref\n"); @@ -1132,7 +1144,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 268 "tex2xindy.l" +#line 281 "tex2xindy.l" { if ( braces > 0 ) { ECHO; @@ -1155,7 +1167,7 @@ YY_RULE_SETUP case 19: /* rule 19 can match eol */ YY_RULE_SETUP -#line 286 "tex2xindy.l" +#line 299 "tex2xindy.l" { QUOTE_ECHO; if (attrfd) fwrite(yytext, sizeof(char), 1, attrfd); @@ -1164,17 +1176,17 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 294 "tex2xindy.l" +#line 307 "tex2xindy.l" { printf("\" \""); } YY_BREAK case 21: YY_RULE_SETUP -#line 295 "tex2xindy.l" +#line 308 "tex2xindy.l" { ECHO; braces++; } YY_BREAK case 22: YY_RULE_SETUP -#line 296 "tex2xindy.l" +#line 309 "tex2xindy.l" { if ( braces > 1 ) { ECHO; @@ -1190,7 +1202,7 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 308 "tex2xindy.l" +#line 321 "tex2xindy.l" { if ( braces > 0 ) { ECHO; @@ -1204,7 +1216,7 @@ YY_RULE_SETUP YY_BREAK case 24: YY_RULE_SETUP -#line 319 "tex2xindy.l" +#line 332 "tex2xindy.l" { if (xref_mode) { BEGIN(skiplocation); @@ -1216,22 +1228,22 @@ YY_RULE_SETUP YY_BREAK case 25: YY_RULE_SETUP -#line 327 "tex2xindy.l" +#line 340 "tex2xindy.l" { printf("\")\n"); BEGIN(0); } YY_BREAK case 26: YY_RULE_SETUP -#line 329 "tex2xindy.l" +#line 342 "tex2xindy.l" { printf(")\n"); BEGIN(0); } YY_BREAK case 27: YY_RULE_SETUP -#line 330 "tex2xindy.l" +#line 343 "tex2xindy.l" { ; } YY_BREAK case 28: YY_RULE_SETUP -#line 332 "tex2xindy.l" +#line 345 "tex2xindy.l" { if ( omega_mode ) { omega_output_utf8(2); @@ -1242,7 +1254,7 @@ YY_RULE_SETUP YY_BREAK case 29: YY_RULE_SETUP -#line 339 "tex2xindy.l" +#line 352 "tex2xindy.l" { if ( omega_mode ) { omega_output_utf8(4); @@ -1253,7 +1265,7 @@ YY_RULE_SETUP YY_BREAK case 30: YY_RULE_SETUP -#line 346 "tex2xindy.l" +#line 359 "tex2xindy.l" { if ( omega_mode ) { omega_output_utf8(8); @@ -1265,28 +1277,28 @@ YY_RULE_SETUP case 31: /* rule 31 can match eol */ YY_RULE_SETUP -#line 354 "tex2xindy.l" +#line 367 "tex2xindy.l" { ECHO; lineno++; } YY_BREAK case 32: YY_RULE_SETUP -#line 355 "tex2xindy.l" +#line 368 "tex2xindy.l" { QUOTE_ECHO; } YY_BREAK case 33: /* rule 33 can match eol */ YY_RULE_SETUP -#line 357 "tex2xindy.l" +#line 370 "tex2xindy.l" { lineno++; } YY_BREAK case 34: YY_RULE_SETUP -#line 358 "tex2xindy.l" +#line 371 "tex2xindy.l" { ; } YY_BREAK case 35: YY_RULE_SETUP -#line 359 "tex2xindy.l" +#line 372 "tex2xindy.l" { fprintf(stderr, "Encountered unexpected char '%c' on line %d\n", @@ -1295,10 +1307,10 @@ YY_RULE_SETUP YY_BREAK case 36: YY_RULE_SETUP -#line 365 "tex2xindy.l" +#line 378 "tex2xindy.l" ECHO; YY_BREAK -#line 1302 "tex2xindy.c" +#line 1314 "tex2xindy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(key): case YY_STATE_EOF(print): @@ -2301,7 +2313,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 365 "tex2xindy.l" +#line 378 "tex2xindy.l" @@ -2316,8 +2328,13 @@ int main(int argc, char* argv[]) { int option; + +#ifdef WIN32 + setmode (fileno(stdout), _O_BINARY); +#else extern char *optarg; extern int optind, optopt; +#endif while ( (option=getopt(argc, argv, ":o")) != -1 ) { switch (option) { @@ -2339,7 +2356,7 @@ main(int argc, char* argv[]) if ( optind == argc - 1 ) { fprintf(stderr, "Writing attribute names to file \"%s\".\n", argv[optind]); - if ( (attrfd = fopen(argv[optind], "w")) == NULL ) { + if ( (attrfd = fopen(argv[optind], "wb")) == NULL ) { perror (argv[optind]); exit (1); } diff --git a/Build/source/utils/xindy/xindy-2.4/tex2xindy/tex2xindy.l b/Build/source/utils/xindy/xindy-2.4/tex2xindy/tex2xindy.l index b13be608a1f..dd3ef7ee7e6 100644 --- a/Build/source/utils/xindy/xindy-2.4/tex2xindy/tex2xindy.l +++ b/Build/source/utils/xindy/xindy-2.4/tex2xindy/tex2xindy.l @@ -89,11 +89,24 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. =cut */ +%} +%top{ #include <stdio.h> #include <stdlib.h> -#include <unistd.h> +#ifdef WIN32 +# include <kpathsea/getopt.h> +# include <fcntl.h> +# define YY_NO_UNISTD_H 1 +# ifdef W32TeX +# define __STDC_VERSION__ 199901L +# endif +#else +# include <unistd.h> +#endif +} +%{ #define QUOTE_ECHO qs(yytext) FILE* attrfd = NULL; @@ -375,8 +388,13 @@ int main(int argc, char* argv[]) { int option; + +#ifdef WIN32 + setmode (fileno(stdout), _O_BINARY); +#else extern char *optarg; extern int optind, optopt; +#endif while ( (option=getopt(argc, argv, ":o")) != -1 ) { switch (option) { @@ -398,7 +416,7 @@ main(int argc, char* argv[]) if ( optind == argc - 1 ) { fprintf(stderr, "Writing attribute names to file \"%s\".\n", argv[optind]); - if ( (attrfd = fopen(argv[optind], "w")) == NULL ) { + if ( (attrfd = fopen(argv[optind], "wb")) == NULL ) { perror (argv[optind]); exit (1); } |