diff -r -u treecc-0.3.10/ChangeLog treecc/ChangeLog --- treecc-0.3.10/ChangeLog 2007-03-02 20:12:49.000000000 +0100 +++ treecc/ChangeLog 2009-09-02 11:05:29.000000000 +0200 @@ -1,8 +1,59 @@ +2009-06-07 Rhys Weatherley + + * INSTALL, doc/texinfo.tex: Remove auto-generated files from + repository. + +2009-06-06 Klaus Treichel + + * .gitignore: Add more autogenerated files and compiler results. + +2009-06-04 Rhys Weatherley + + * etc/c_skel.c, etc/cpp_skel.cc: make the C and C++ skeleton + files 64-bit safe. + + * tests/output*.out: Update test output files after 64-bit changes. + +2008-10-01 Klaus Treichel + + * auto_gen.sh: Simply call autoreconf -fi now. + + * configure.in: Remove and replace by configure.ac. + + * configure.ac: Add updated version of configure.in. + +2008-09-29 Andreas Färber + + * Makefile.am: Fix VPATH support for building skels.c. (patch #6415) + +2008-02-03 Andreas Färber + + * examples/Makefile.am: Remove explicit linking with libm to fix build on + system without libm. Linking with libm is handled by configure. + (patch #6399) + +2007-06-04 Klaus Treichel + + * configure.in: Add support for multi os archs (like x86_64 which + supports 64bit and 32bit apps). + +2007-06-04 Rhys Weatherley + + * Makefile.am, gen.c, gen.h, gen_python.c, info.h, main.c, options.c, + stream.c, stream.h, doc/treecc.texi: add Python language binding to treecc. + + * examples/expr_python.tc, examples/README: add Python example. + +2007-06-03 Rhys Weatherley + + * tests/test_input.c: fix 32bit-ism that gave a warning on amd64. 2007-03-03 Klaus Treichel * configure.in, NEWS: update version for the 0.3.10 release. + * configure.in: update version to the new 0.3.11 development version. + 2007-02-11 Klaus Treichel * configure.in: Readd the AM_MAINTAINER_MODE as suggested by Robert Only in treecc-0.3.10: INSTALL diff -r -u treecc-0.3.10/Makefile.am treecc/Makefile.am --- treecc-0.3.10/Makefile.am 2007-01-22 07:58:42.000000000 +0100 +++ treecc/Makefile.am 2009-09-02 11:05:29.000000000 +0200 @@ -21,6 +21,7 @@ gen_ruby.c \ gen_java.c \ gen_php.c \ + gen_python.c \ info.h \ input.c \ input.h \ @@ -46,8 +47,8 @@ $(top_srcdir)/etc/cpp_gc_skel.h \ $(top_srcdir)/etc/cpp_gc_skel.cc -skels.c: $(SKELETON_FILES) mkskel-sh - $(SHELL) mkskel-sh $(SKELETON_FILES) >skels.c +skels.c: $(SKELETON_FILES) $(top_srcdir)/mkskel-sh + $(SHELL) $(top_srcdir)/mkskel-sh $(SKELETON_FILES) >skels.c CLEANFILES = skels.c Only in treecc-0.3.10: Makefile.in Only in treecc-0.3.10: aclocal.m4 Only in treecc: auto_gen.sh Only in treecc: build-debian-packages.conf Only in treecc: build-debian-packages.sh Only in treecc-0.3.10: config.guess Only in treecc-0.3.10: config.h.in Only in treecc-0.3.10: config.sub Only in treecc-0.3.10: configure Only in treecc: configure.ac Only in treecc-0.3.10: configure.in Only in treecc: debian Only in treecc-0.3.10/doc: Makefile.in Only in treecc-0.3.10/doc: texinfo.tex Only in treecc-0.3.10/doc: treecc.info diff -r -u treecc-0.3.10/doc/treecc.texi treecc/doc/treecc.texi --- treecc-0.3.10/doc/treecc.texi 2004-03-11 01:12:53.000000000 +0100 +++ treecc/doc/treecc.texi 2009-09-02 11:05:29.000000000 +0200 @@ -1120,7 +1120,8 @@ @item %option lang = LANGUAGE @cindex lang option Specify the output language. Must be one of @code{"C"}, @code{"C++"}, -@code{"Java"}, or @code{"C#"}. The default is @code{"C"}. +@code{"Java"}, @code{"C#"}, @code{"Ruby"}, @code{"PHP"}, or @code{"Python"}. +The default is @code{"C"}. @item %option block_size = NUM @cindex block_size option @@ -1346,11 +1347,12 @@ for each of the output languages. @menu -* C Language:: C Language API's -* C++ Language:: C++ Language API's -* Java Language:: Java Language API's -* C# Language:: C# Language API's -* Ruby Language:: Ruby Language API's +* C Language:: C Language API's +* C++ Language:: C++ Language API's +* Java Language:: Java Language API's +* C# Language:: C# Language API's +* Ruby Language:: Ruby Language API's +* Python Language:: Python Language API's @end menu @c ----------------------------------------------------------------------- @@ -2405,7 +2407,7 @@ @c ----------------------------------------------------------------------- -@node Ruby Language, Full Expression Example, C# Language, Output APIs +@node Ruby Language, Python Language, C# Language, Output APIs @section Ruby Language APIs @cindex Ruby APIs @@ -2682,7 +2684,145 @@ @c ----------------------------------------------------------------------- -@node Full Expression Example, EBNF Syntax, Ruby Language, Top +@node Python Language, Full Expression Example, Ruby Language, Output APIs +@section Python Language APIs +@cindex Python APIs + +In the Python output language, each node type is converted into a +@samp{class} that contains the node's fields, operations, and other +house-keeping definitions. The following example demonstrates how +treecc node declarations are converted into Python source code: + +@example +%node expression %abstract %typedef = +@{ + %nocreate type_code type; +@} +%node binary expression %abstract = +@{ + expression expr1; + expression expr2; +@} +%node plus binary +@end example + +becomes: + +@example +class expression: + KIND = 1 + def __init__(self): + self.kind = 1 + self.filename = yycurrfilename() + self.linenum = yycurrlinenum() + + def getKindName(self): + return self.__class__.__name__ + +class binary (expression): + KIND = 2 + def __init__(self, expr1, expr2): + expression.__init__(self) + self.kind = 2 + self.expr1 = expr1 + self.expr2 = expr2 + +class plus (binary): + KIND = 3 + def __init__(self, expr1, expr2): + binary.__init__(self, expr1, expr2) + self.kind = 3 +@end example + +The following standard members are available on every node type: + +@table @code +@item KIND +@cindex KIND field (Python) +The kind value for the node type corresponding to this class. +The kind value for node type @samp{NAME} is called @samp{NAME.KIND}. + +@item kind +@cindex kind field (Python) +Gets the numeric kind value associated with a particular node. +The kind value for node type @samp{NAME} is called @samp{NAME.KIND}. + +@item getKindName() +@cindex getKindName method (Python) +The name of the node kind associated with a particular node. This may +be helpful for debugging and logging code. + +@item filename +@cindex filename field (Python) +The filename corresponding to where the node was created during parsing. +This field is only initialized if @samp{%option track_lines} was +specified. + +@item linenum +@cindex linenum field (Python) +The line number corresponding to where the node was created during +parsing. This field is only initialized if @samp{%option track_lines} +was specified. +@end table + +The @code{isA()} method from the other output languages is not present +in the Python binding. Use the standard Python @code{isinstance} +function instead. + +Enumerated types are converted into a Python @samp{class} definition: + +@example +%enum JavaType = +@{ + JT_BYTE, + JT_SHORT, + JT_CHAR, + JT_INT, + JT_LONG, + JT_FLOAT, + JT_DOUBLE, + JT_OBJECT_REF +@} +@end example + +becomes: + +@example +class JavaType: + JT_BYTE = 0 + JT_SHORT = 1 + JT_CHAR = 2 + JT_INT = 3 + JT_LONG = 4 + JT_FLOAT = 5 + JT_DOUBLE = 6 + JT_OBJECT_REF = 7 +@end example + +Virtual operations are converted into public methods on the Python +node classes. Non-virtual operations are converted into a global +method within the generated Python module. + +If @samp{%option track_lines} is specified, then the generated Python +module is assumed to contain the following global methods to provide line +tracking information: + +@table @code +@item yycurrfilename() +@cindex yycurrfilename method (Python) +The name of the current input file from the parser. + +@item yycurrlinenum() +@cindex yycurrlinenum method (Ruby) +The number of the current input line from the parser. +@end table + +The programmer will typically provide a literal @code{%end} block to +define these methods. + +@c ----------------------------------------------------------------------- + +@node Full Expression Example, EBNF Syntax, Python Language, Top @appendix Full expression example code @cindex Full expression example Only in treecc-0.3.10/etc: Makefile.in diff -r -u treecc-0.3.10/etc/c_skel.c treecc/etc/c_skel.c --- treecc-0.3.10/etc/c_skel.c 2001-12-11 00:59:12.000000000 +0100 +++ treecc/etc/c_skel.c 2009-09-02 11:05:29.000000000 +0200 @@ -60,7 +60,7 @@ type field; \ } #define YYNODESTATE_ALIGN_FOR_TYPE(type) \ - ((unsigned)(&(((struct _YYNODESTATE_align_##type *)0)->field))) + ((unsigned)(unsigned long)(&(((struct _YYNODESTATE_align_##type *)0)->field))) #define YYNODESTATE_ALIGN_MAX(a,b) \ ((a) > (b) ? (a) : (b)) #define YYNODESTATE_ALIGN_MAX3(a,b,c) \ diff -r -u treecc-0.3.10/etc/cpp_skel.cc treecc/etc/cpp_skel.cc --- treecc-0.3.10/etc/cpp_skel.cc 2003-03-29 05:04:45.000000000 +0100 +++ treecc/etc/cpp_skel.cc 2009-09-02 11:05:29.000000000 +0200 @@ -58,7 +58,7 @@ type field; \ } #define YYNODESTATE_ALIGN_FOR_TYPE(type) \ - ((unsigned)(&(((struct _YYNODESTATE_align_##type *)0)->field))) + ((unsigned)(unsigned long)(&(((struct _YYNODESTATE_align_##type *)0)->field))) #define YYNODESTATE_ALIGN_MAX(a,b) \ ((a) > (b) ? (a) : (b)) #define YYNODESTATE_ALIGN_MAX3(a,b,c) \ diff -r -u treecc-0.3.10/examples/Makefile.am treecc/examples/Makefile.am --- treecc-0.3.10/examples/Makefile.am 2007-01-22 07:58:43.000000000 +0100 +++ treecc/examples/Makefile.am 2009-09-02 11:05:29.000000000 +0200 @@ -12,7 +12,6 @@ expr_c_SOURCES = gram_c.y scan_c.l nodist_expr_c_SOURCES = expr_c.c expr_c.h -expr_c_LDADD = -lm expr_c.c expr_c.h: $(srcdir)/expr_c.tc $(top_builddir)/treecc -o expr_c.c -h expr_c.h $(srcdir)/expr_c.tc Only in treecc-0.3.10/examples: Makefile.in diff -r -u treecc-0.3.10/examples/README treecc/examples/README --- treecc-0.3.10/examples/README 2002-11-02 05:38:21.000000000 +0100 +++ treecc/examples/README 2009-09-02 11:05:29.000000000 +0200 @@ -20,6 +20,8 @@ expr_ruby.tc Treecc input file for the Ruby version of the example +expr_python.tc Treecc input file for the Python version of the example + The C++ example demonstrates creating a reentrant system. The Java and C# versions build and compile, but cannot run because Only in treecc/examples: eval_value.java Only in treecc/examples: expr_cpp.tc Only in treecc/examples: expr_cs.tc Only in treecc/examples: expr_java.tc Only in treecc/examples: expr_python.tc Only in treecc/examples: expr_ruby.tc Only in treecc-0.3.10/examples: gram_c.c Only in treecc-0.3.10/examples: gram_c.h Only in treecc/examples: gram_cpp.yy Only in treecc/examples: mkcsharp Only in treecc/examples: mkjava Only in treecc-0.3.10/examples: scan_c.c Only in treecc/examples: scan_cpp.ll diff -r -u treecc-0.3.10/gen.c treecc/gen.c --- treecc-0.3.10/gen.c 2003-01-10 23:13:37.000000000 +0100 +++ treecc/gen.c 2009-09-02 11:05:29.000000000 +0200 @@ -1,7 +1,7 @@ /* * gen.c - Generate code to "treecc" output files. * - * Copyright (C) 2001 Southern Storm Software, Pty Ltd. + * Copyright (C) 2001, 2007 Southern Storm Software, Pty Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -68,6 +68,11 @@ } break; + case TREECC_LANG_PYTHON: + { + abort(); + } + break; } } diff -r -u treecc-0.3.10/info.h treecc/info.h --- treecc-0.3.10/info.h 2003-11-20 01:16:09.000000000 +0100 +++ treecc/info.h 2009-09-02 11:05:29.000000000 +0200 @@ -1,7 +1,7 @@ /* * info.h - Store information about parsed "treecc" input files. * - * Copyright (C) 2001 Southern Storm Software, Pty Ltd. + * Copyright (C) 2001, 2007 Southern Storm Software, Pty Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,6 +75,7 @@ #define TREECC_LANG_CSHARP 3 #define TREECC_LANG_RUBY 4 #define TREECC_LANG_PHP 5 +#define TREECC_LANG_PYTHON 6 /* * Information that is stored about a field. Only in treecc-0.3.10: install-sh diff -r -u treecc-0.3.10/main.c treecc/main.c --- treecc-0.3.10/main.c 2003-01-29 01:46:54.000000000 +0100 +++ treecc/main.c 2009-09-02 11:05:29.000000000 +0200 @@ -1,7 +1,7 @@ /* * main.c - Main program entry point for "treecc". * - * Copyright (C) 2001, 2002 Southern Storm Software, Pty Ltd. + * Copyright (C) 2001, 2002, 2007 Southern Storm Software, Pty Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -471,7 +471,7 @@ static void Usage(char *progname) { fprintf(stderr, "TREECC " VERSION " - Tree Compiler-Compiler\n"); - fprintf(stderr, "Copyright (c) 2001, 2002 Southern Storm Software, Pty Ltd.\n"); + fprintf(stderr, "Copyright (c) 2001, 2002, 2007 Southern Storm Software, Pty Ltd.\n"); fprintf(stderr, "\n"); fprintf(stderr, "Usage: %s [options] input ...\n", progname); fprintf(stderr, "\n"); Only in treecc: make-zip.sh Only in treecc-0.3.10: missing Only in treecc: mkrelease diff -r -u treecc-0.3.10/options.c treecc/options.c --- treecc-0.3.10/options.c 2003-11-20 01:16:09.000000000 +0100 +++ treecc/options.c 2009-09-02 11:05:29.000000000 +0200 @@ -1,7 +1,7 @@ /* * options.c - Process options from "treecc" input files. * - * Copyright (C) 2001 Southern Storm Software, Pty Ltd. + * Copyright (C) 2001, 2007 Southern Storm Software, Pty Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -259,6 +259,10 @@ { context->language = TREECC_LANG_PHP; } + else if(!strcmp(value, "python") || !strcmp(value, "Python")) + { + context->language = TREECC_LANG_PYTHON; + } else { return TREECC_OPT_INVALID_VALUE; Only in treecc-0.3.10: skels.c Only in treecc: stamp-h.in diff -r -u treecc-0.3.10/stream.c treecc/stream.c --- treecc-0.3.10/stream.c 2003-01-27 01:25:25.000000000 +0100 +++ treecc/stream.c 2009-09-02 11:05:29.000000000 +0200 @@ -1,7 +1,7 @@ /* * stream.c - Stream handling for writing source code. * - * Copyright (C) 2001 Southern Storm Software, Pty Ltd. + * Copyright (C) 2001, 2007 Southern Storm Software, Pty Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -523,6 +523,92 @@ } } +void TreeCCStreamCodeIndentPython(TreeCCStream *stream, char *code, int indent) +{ + int temp; + int startline = 1; + int spaces = -1; + int len; + + /* Strip off the first and last blank lines, as they are probably + due to formatting in the treecc file, and not part of the actual + Python code that we need to output */ + temp = 0; + while(code[temp] != '\0' && code[temp] != '\n') + { + if(code[temp] != ' ' && code[temp] != '\t') + break; + ++temp; + } + if(code[temp] == '\n') + { + code += temp + 1; + } + len = strlen(code); + if(len > 0) + { + --len; + while(len > 0 && (code[len - 1] == ' ' || code[len - 1] == '\t')) + --len; + if(len > 0 && code[len - 1] != '\n') + { + /* Last line is not completely blank */ + len = strlen(code); + } + } + + /* Bail out if no code to output at all */ + if(!len) + return; + + /* Output the remaining code */ + while(len > 0) + { + if(*code == '\n') + { + StreamPut(*code, stream); + ++(stream->linenum); + startline = 1; + ++code; + --len; + } + else if(startline) + { + /* Expand white space at the start of a line */ + spaces = 0; + while(len > 0 && (*code == ' ' || *code == '\t')) + { + if(*code++ == ' ') + ++spaces; + else + spaces = (spaces + 8) & ~7; + --len; + } + startline = 0; + } + else + { + if(spaces >= 0) + { + temp = indent * 4 + spaces; + while(temp-- > 0) + { + StreamPut(' ', stream); + } + spaces = -1; + } + StreamPut(*code, stream); + ++code; + --len; + startline = 0; + } + } + if(!startline) + { + /* Make sure that the last line is terminated */ + StreamPut('\n', stream); + } +} void TreeCCStreamFixLine(TreeCCStream *stream) { @@ -647,6 +733,13 @@ OutputDefns(stream, 0); } +void TreeCCStreamSourceTopSpecial(TreeCCStream *stream, int ch) +{ + TreeCCStreamPrint(stream, "%c %s. Generated automatically by treecc\n", + ch, stream->embedName); + OutputDefns(stream, 0); +} + void TreeCCStreamSourceTopCS(TreeCCStream *stream) { OutputDefns(stream, 0); diff -r -u treecc-0.3.10/stream.h treecc/stream.h --- treecc-0.3.10/stream.h 2002-11-09 12:36:26.000000000 +0100 +++ treecc/stream.h 2009-09-02 11:05:29.000000000 +0200 @@ -1,7 +1,7 @@ /* * stream.h - Stream handling for writing source code. * - * Copyright (C) 2001 Southern Storm Software, Pty Ltd. + * Copyright (C) 2001, 2007 Southern Storm Software, Pty Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -154,6 +154,14 @@ char indentchar, int indent); /* + * Output a block of literal code to a stream which is indented. + * The code is normalized to remove leading TAB's and replace + * them with spaces, as per Python's conventions. Each indent + * level corresponds to four spaces. + */ +void TreeCCStreamCodeIndentPython(TreeCCStream *stream, char *code, int indent); + +/* * Fix the line number information in the output stream * after outputting a block of code. */ @@ -187,6 +195,12 @@ void TreeCCStreamSourceTopCS(TreeCCStream *stream); /* + * Output extra information that is needed at the top of a source file, + * using a special comment character. + */ +void TreeCCStreamSourceTopSpecial(TreeCCStream *stream, int ch); + +/* * Output extra information that is needed at the bottom of a source file. */ void TreeCCStreamSourceBottom(TreeCCStream *stream); Only in treecc-0.3.10/tests: Makefile.in diff -r -u treecc-0.3.10/tests/output1.out treecc/tests/output1.out --- treecc-0.3.10/tests/output1.out 2002-12-15 05:03:27.000000000 +0100 +++ treecc/tests/output1.out 2009-09-02 11:05:29.000000000 +0200 @@ -359,7 +359,7 @@ type field; \ } #define YYNODESTATE_ALIGN_FOR_TYPE(type) \ - ((unsigned)(&(((struct _YYNODESTATE_align_##type *)0)->field))) + ((unsigned)(unsigned long)(&(((struct _YYNODESTATE_align_##type *)0)->field))) #define YYNODESTATE_ALIGN_MAX(a,b) \ ((a) > (b) ? (a) : (b)) #define YYNODESTATE_ALIGN_MAX3(a,b,c) \ diff -r -u treecc-0.3.10/tests/output12.out treecc/tests/output12.out --- treecc-0.3.10/tests/output12.out 2002-12-15 05:03:27.000000000 +0100 +++ treecc/tests/output12.out 2009-09-02 11:05:30.000000000 +0200 @@ -151,7 +151,7 @@ type field; \ } #define YYNODESTATE_ALIGN_FOR_TYPE(type) \ - ((unsigned)(&(((struct _YYNODESTATE_align_##type *)0)->field))) + ((unsigned)(unsigned long)(&(((struct _YYNODESTATE_align_##type *)0)->field))) #define YYNODESTATE_ALIGN_MAX(a,b) \ ((a) > (b) ? (a) : (b)) #define YYNODESTATE_ALIGN_MAX3(a,b,c) \ diff -r -u treecc-0.3.10/tests/output13.out treecc/tests/output13.out --- treecc-0.3.10/tests/output13.out 2002-12-15 05:03:27.000000000 +0100 +++ treecc/tests/output13.out 2009-09-02 11:05:30.000000000 +0200 @@ -350,7 +350,7 @@ type field; \ } #define YYNODESTATE_ALIGN_FOR_TYPE(type) \ - ((unsigned)(&(((struct _YYNODESTATE_align_##type *)0)->field))) + ((unsigned)(unsigned long)(&(((struct _YYNODESTATE_align_##type *)0)->field))) #define YYNODESTATE_ALIGN_MAX(a,b) \ ((a) > (b) ? (a) : (b)) #define YYNODESTATE_ALIGN_MAX3(a,b,c) \ diff -r -u treecc-0.3.10/tests/output14.out treecc/tests/output14.out --- treecc-0.3.10/tests/output14.out 2002-12-15 05:03:27.000000000 +0100 +++ treecc/tests/output14.out 2009-09-02 11:05:30.000000000 +0200 @@ -161,7 +161,7 @@ type field; \ } #define YYNODESTATE_ALIGN_FOR_TYPE(type) \ - ((unsigned)(&(((struct _YYNODESTATE_align_##type *)0)->field))) + ((unsigned)(unsigned long)(&(((struct _YYNODESTATE_align_##type *)0)->field))) #define YYNODESTATE_ALIGN_MAX(a,b) \ ((a) > (b) ? (a) : (b)) #define YYNODESTATE_ALIGN_MAX3(a,b,c) \ diff -r -u treecc-0.3.10/tests/output15.out treecc/tests/output15.out --- treecc-0.3.10/tests/output15.out 2003-12-03 00:16:47.000000000 +0100 +++ treecc/tests/output15.out 2009-09-02 11:05:30.000000000 +0200 @@ -161,7 +161,7 @@ type field; \ } #define YYNODESTATE_ALIGN_FOR_TYPE(type) \ - ((unsigned)(&(((struct _YYNODESTATE_align_##type *)0)->field))) + ((unsigned)(unsigned long)(&(((struct _YYNODESTATE_align_##type *)0)->field))) #define YYNODESTATE_ALIGN_MAX(a,b) \ ((a) > (b) ? (a) : (b)) #define YYNODESTATE_ALIGN_MAX3(a,b,c) \ diff -r -u treecc-0.3.10/tests/output2.out treecc/tests/output2.out --- treecc-0.3.10/tests/output2.out 2002-12-15 05:03:27.000000000 +0100 +++ treecc/tests/output2.out 2009-09-02 11:05:30.000000000 +0200 @@ -388,7 +388,7 @@ type field; \ } #define YYNODESTATE_ALIGN_FOR_TYPE(type) \ - ((unsigned)(&(((struct _YYNODESTATE_align_##type *)0)->field))) + ((unsigned)(unsigned long)(&(((struct _YYNODESTATE_align_##type *)0)->field))) #define YYNODESTATE_ALIGN_MAX(a,b) \ ((a) > (b) ? (a) : (b)) #define YYNODESTATE_ALIGN_MAX3(a,b,c) \ diff -r -u treecc-0.3.10/tests/output3.out treecc/tests/output3.out --- treecc-0.3.10/tests/output3.out 2002-12-15 05:03:27.000000000 +0100 +++ treecc/tests/output3.out 2009-09-02 11:05:30.000000000 +0200 @@ -366,7 +366,7 @@ type field; \ } #define YYNODESTATE_ALIGN_FOR_TYPE(type) \ - ((unsigned)(&(((struct _YYNODESTATE_align_##type *)0)->field))) + ((unsigned)(unsigned long)(&(((struct _YYNODESTATE_align_##type *)0)->field))) #define YYNODESTATE_ALIGN_MAX(a,b) \ ((a) > (b) ? (a) : (b)) #define YYNODESTATE_ALIGN_MAX3(a,b,c) \ diff -r -u treecc-0.3.10/tests/output4.out treecc/tests/output4.out --- treecc-0.3.10/tests/output4.out 2002-12-15 05:03:27.000000000 +0100 +++ treecc/tests/output4.out 2009-09-02 11:05:30.000000000 +0200 @@ -367,7 +367,7 @@ type field; \ } #define GlobalState_ALIGN_FOR_TYPE(type) \ - ((unsigned)(&(((struct _GlobalState_align_##type *)0)->field))) + ((unsigned)(unsigned long)(&(((struct _GlobalState_align_##type *)0)->field))) #define GlobalState_ALIGN_MAX(a,b) \ ((a) > (b) ? (a) : (b)) #define GlobalState_ALIGN_MAX3(a,b,c) \ diff -r -u treecc-0.3.10/tests/output5.out treecc/tests/output5.out --- treecc-0.3.10/tests/output5.out 2003-03-29 05:11:04.000000000 +0100 +++ treecc/tests/output5.out 2009-09-02 11:05:30.000000000 +0200 @@ -384,7 +384,7 @@ type field; \ } #define YYNODESTATE_ALIGN_FOR_TYPE(type) \ - ((unsigned)(&(((struct _YYNODESTATE_align_##type *)0)->field))) + ((unsigned)(unsigned long)(&(((struct _YYNODESTATE_align_##type *)0)->field))) #define YYNODESTATE_ALIGN_MAX(a,b) \ ((a) > (b) ? (a) : (b)) #define YYNODESTATE_ALIGN_MAX3(a,b,c) \ diff -r -u treecc-0.3.10/tests/output6.out treecc/tests/output6.out --- treecc-0.3.10/tests/output6.out 2003-03-29 05:11:04.000000000 +0100 +++ treecc/tests/output6.out 2009-09-02 11:05:30.000000000 +0200 @@ -363,7 +363,7 @@ type field; \ } #define YYNODESTATE_ALIGN_FOR_TYPE(type) \ - ((unsigned)(&(((struct _YYNODESTATE_align_##type *)0)->field))) + ((unsigned)(unsigned long)(&(((struct _YYNODESTATE_align_##type *)0)->field))) #define YYNODESTATE_ALIGN_MAX(a,b) \ ((a) > (b) ? (a) : (b)) #define YYNODESTATE_ALIGN_MAX3(a,b,c) \ diff -r -u treecc-0.3.10/tests/output7.out treecc/tests/output7.out --- treecc-0.3.10/tests/output7.out 2003-12-03 00:16:47.000000000 +0100 +++ treecc/tests/output7.out 2009-09-02 11:05:30.000000000 +0200 @@ -154,7 +154,7 @@ type field; \ } #define YYNODESTATE_ALIGN_FOR_TYPE(type) \ - ((unsigned)(&(((struct _YYNODESTATE_align_##type *)0)->field))) + ((unsigned)(unsigned long)(&(((struct _YYNODESTATE_align_##type *)0)->field))) #define YYNODESTATE_ALIGN_MAX(a,b) \ ((a) > (b) ? (a) : (b)) #define YYNODESTATE_ALIGN_MAX3(a,b,c) \ diff -r -u treecc-0.3.10/tests/output8.out treecc/tests/output8.out --- treecc-0.3.10/tests/output8.out 2003-12-03 00:16:47.000000000 +0100 +++ treecc/tests/output8.out 2009-09-02 11:05:30.000000000 +0200 @@ -169,7 +169,7 @@ type field; \ } #define YYNODESTATE_ALIGN_FOR_TYPE(type) \ - ((unsigned)(&(((struct _YYNODESTATE_align_##type *)0)->field))) + ((unsigned)(unsigned long)(&(((struct _YYNODESTATE_align_##type *)0)->field))) #define YYNODESTATE_ALIGN_MAX(a,b) \ ((a) > (b) ? (a) : (b)) #define YYNODESTATE_ALIGN_MAX3(a,b,c) \ diff -r -u treecc-0.3.10/tests/output9.out treecc/tests/output9.out --- treecc-0.3.10/tests/output9.out 2003-03-29 05:11:04.000000000 +0100 +++ treecc/tests/output9.out 2009-09-02 11:05:30.000000000 +0200 @@ -369,7 +369,7 @@ type field; \ } #define YYNODESTATE_ALIGN_FOR_TYPE(type) \ - ((unsigned)(&(((struct _YYNODESTATE_align_##type *)0)->field))) + ((unsigned)(unsigned long)(&(((struct _YYNODESTATE_align_##type *)0)->field))) #define YYNODESTATE_ALIGN_MAX(a,b) \ ((a) > (b) ? (a) : (b)) #define YYNODESTATE_ALIGN_MAX3(a,b,c) \ diff -r -u treecc-0.3.10/tests/test_input.c treecc/tests/test_input.c --- treecc-0.3.10/tests/test_input.c 2002-12-15 14:17:08.000000000 +0100 +++ treecc/tests/test_input.c 2009-09-02 11:05:30.000000000 +0200 @@ -71,7 +71,7 @@ case TREECC_TOKEN_IDENTIFIER: { TreeCCDebug(input.linenum, "identifier (len = %d): %s", - strlen(input.text), input.text); + (int)strlen(input.text), input.text); if(!strcmp(input.text, "parse_literal")) { input.parseLiteral = 1;