Re: [Monetdb-developers] [Monetdb-pf-checkins] pathfinder/src/sqlhelpers/xmlshred xmlshred.c, , 1.2, 1.3
When printing a value of type size_t, use SZFMT. When printing a value of type ssize_t, use SSZFMT. The format needed to print these values varies from system to system, so that difference is hidden in a macro. Manuel Mayr wrote:
Update of /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13392
Modified Files: xmlshred.c Log Message:
Thx for noting.
Index: xmlshred.c =================================================================== RCS file: /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred/xmlshred.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- xmlshred.c 9 Sep 2007 08:27:39 -0000 1.2 +++ xmlshred.c 10 Sep 2007 06:55:38 -0000 1.3 @@ -51,8 +51,7 @@
#define NAME_ID 0
-typedef long unsigned int nat; -typedef int pre_t; +typedef ssize_t nat;
enum kind_t { elem @@ -138,8 +137,8 @@
typedef struct node_t node_t; struct node_t { - pre_t pre; - pre_t apre; + nat pre; + nat apre; nat post; nat pre_stretched; nat post_stretched; @@ -155,7 +154,7 @@ static node_t stack[STACK_MAX]; static int level; static int max_level; -static pre_t pre; +static nat pre; static nat post; static nat rank; static nat att_id; @@ -346,7 +345,7 @@ attr_guide_node = insert_guide_node((char*)atts_back[0], current_guide_node, attr);
- fprintf (out_attr, "%lu, %i, \"%s\", \"%s\", %lu\n", + fprintf (out_attr, "%i, %i, \"%s\", \"%s\", %i\n", att_id++, pre, (char*)atts[0], (char*)atts[1], attr_guide_node->guide);
atts += 2; @@ -602,10 +601,10 @@ case 'e': if(tuple.pre != -1) fprintf (out, "%i", tuple.pre); break; - case 'o': fprintf (out, "%lu", tuple.post); break; - case 'E': fprintf (out, "%lu", tuple.pre_stretched); break; - case 'O': fprintf (out, "%lu", tuple.post_stretched); break; - case 's': fprintf (out, "%lu", tuple.size); break; + case 'o': fprintf (out, "%i", tuple.post); break; + case 'E': fprintf (out, "%i", tuple.pre_stretched); break; + case 'O': fprintf (out, "%i", tuple.post_stretched); break; + case 's': fprintf (out, "%i", tuple.size); break; case 'l': fprintf (out, "%u", tuple.level); break;
case 'p': @@ -616,7 +615,7 @@ break; case 'P': if (tuple.parent) - fprintf (out, "%lu",tuple.parent->pre_stretched); + fprintf (out, "%i",tuple.parent->pre_stretched); else fprintf (out, "NULL"); break; @@ -653,7 +652,7 @@ fprintf(out, "NULL"); } break; - case 'g': fprintf (out, "%lu", tuple.guide); break; + case 'g': fprintf (out, "%i", tuple.guide); break;
default: putc (format[i], out); break; } @@ -966,7 +965,7 @@ /* print the node self */ fprintf ( guide_out, - "
guide, root->count); print_kind (guide_out, root->kind); ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Monetdb-pf-checkins mailing list Monetdb-pf-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins
-- Sjoerd Mullender
Thx for the suggestion, I see SSZFMT to be defined in monet_utils.h. Is it possible to use SSZFMT without creating a dependency to monet? Best regards, Manuel Sjoerd Mullender wrote:
When printing a value of type size_t, use SZFMT. When printing a value of type ssize_t, use SSZFMT. The format needed to print these values varies from system to system, so that difference is hidden in a macro.
Manuel Mayr wrote:
Update of /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13392
Modified Files: xmlshred.c Log Message:
Thx for noting.
Index: xmlshred.c =================================================================== RCS file: /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred/xmlshred.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- xmlshred.c 9 Sep 2007 08:27:39 -0000 1.2 +++ xmlshred.c 10 Sep 2007 06:55:38 -0000 1.3 @@ -51,8 +51,7 @@
#define NAME_ID 0
-typedef long unsigned int nat; -typedef int pre_t; +typedef ssize_t nat;
enum kind_t { elem @@ -138,8 +137,8 @@
typedef struct node_t node_t; struct node_t { - pre_t pre; - pre_t apre; + nat pre; + nat apre; nat post; nat pre_stretched; nat post_stretched; @@ -155,7 +154,7 @@ static node_t stack[STACK_MAX]; static int level; static int max_level; -static pre_t pre; +static nat pre; static nat post; static nat rank; static nat att_id; @@ -346,7 +345,7 @@ attr_guide_node = insert_guide_node((char*)atts_back[0], current_guide_node, attr);
- fprintf (out_attr, "%lu, %i, \"%s\", \"%s\", %lu\n", + fprintf (out_attr, "%i, %i, \"%s\", \"%s\", %i\n", att_id++, pre, (char*)atts[0], (char*)atts[1], attr_guide_node->guide);
atts += 2; @@ -602,10 +601,10 @@ case 'e': if(tuple.pre != -1) fprintf (out, "%i", tuple.pre); break; - case 'o': fprintf (out, "%lu", tuple.post); break; - case 'E': fprintf (out, "%lu", tuple.pre_stretched); break; - case 'O': fprintf (out, "%lu", tuple.post_stretched); break; - case 's': fprintf (out, "%lu", tuple.size); break; + case 'o': fprintf (out, "%i", tuple.post); break; + case 'E': fprintf (out, "%i", tuple.pre_stretched); break; + case 'O': fprintf (out, "%i", tuple.post_stretched); break; + case 's': fprintf (out, "%i", tuple.size); break; case 'l': fprintf (out, "%u", tuple.level); break;
case 'p': @@ -616,7 +615,7 @@ break; case 'P': if (tuple.parent) - fprintf (out, "%lu",tuple.parent->pre_stretched); + fprintf (out, "%i",tuple.parent->pre_stretched); else fprintf (out, "NULL"); break; @@ -653,7 +652,7 @@ fprintf(out, "NULL"); } break; - case 'g': fprintf (out, "%lu", tuple.guide); break; + case 'g': fprintf (out, "%i", tuple.guide); break;
default: putc (format[i], out); break; } @@ -966,7 +965,7 @@ /* print the node self */ fprintf ( guide_out, - "
guide, root->count); print_kind (guide_out, root->kind); ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Monetdb-pf-checkins mailing list Monetdb-pf-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins
------------------------------------------------------------------------
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ------------------------------------------------------------------------
_______________________________________________ Monetdb-pf-checkins mailing list Monetdb-pf-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins
-- Manuel Mayr, Dipl. Inf. Institut fuer Informatik, TU Muenchen Tel.: +49 89 289-17259
It took a while for your mail to get here... On 2007-09-10 13:25, Manuel Mayr wrote:
Thx for the suggestion, I see SSZFMT to be defined in monet_utils.h. Is it possible to use SSZFMT without creating a dependency to monet?
You could do what we've done ourselves: make a copy of the definitions. See for instance also MonetDB/src/common/stream.mx and MonetDB/src/gdk/gdk.mx.
Best regards, Manuel
Sjoerd Mullender wrote:
When printing a value of type size_t, use SZFMT. When printing a value of type ssize_t, use SSZFMT. The format needed to print these values varies from system to system, so that difference is hidden in a macro.
Manuel Mayr wrote:
Update of /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13392
Modified Files: xmlshred.c Log Message:
Thx for noting.
Index: xmlshred.c =================================================================== RCS file: /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred/xmlshred.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- xmlshred.c 9 Sep 2007 08:27:39 -0000 1.2 +++ xmlshred.c 10 Sep 2007 06:55:38 -0000 1.3 @@ -51,8 +51,7 @@
#define NAME_ID 0
-typedef long unsigned int nat; -typedef int pre_t; +typedef ssize_t nat;
enum kind_t { elem @@ -138,8 +137,8 @@
typedef struct node_t node_t; struct node_t { - pre_t pre; - pre_t apre; + nat pre; + nat apre; nat post; nat pre_stretched; nat post_stretched; @@ -155,7 +154,7 @@ static node_t stack[STACK_MAX]; static int level; static int max_level; -static pre_t pre; +static nat pre; static nat post; static nat rank; static nat att_id; @@ -346,7 +345,7 @@ attr_guide_node = insert_guide_node((char*)atts_back[0], current_guide_node, attr);
- fprintf (out_attr, "%lu, %i, \"%s\", \"%s\", %lu\n", + fprintf (out_attr, "%i, %i, \"%s\", \"%s\", %i\n", att_id++, pre, (char*)atts[0], (char*)atts[1], attr_guide_node->guide);
atts += 2; @@ -602,10 +601,10 @@ case 'e': if(tuple.pre != -1) fprintf (out, "%i", tuple.pre); break; - case 'o': fprintf (out, "%lu", tuple.post); break; - case 'E': fprintf (out, "%lu", tuple.pre_stretched); break; - case 'O': fprintf (out, "%lu", tuple.post_stretched); break; - case 's': fprintf (out, "%lu", tuple.size); break; + case 'o': fprintf (out, "%i", tuple.post); break; + case 'E': fprintf (out, "%i", tuple.pre_stretched); break; + case 'O': fprintf (out, "%i", tuple.post_stretched); break; + case 's': fprintf (out, "%i", tuple.size); break; case 'l': fprintf (out, "%u", tuple.level); break;
case 'p': @@ -616,7 +615,7 @@ break; case 'P': if (tuple.parent) - fprintf (out, "%lu",tuple.parent->pre_stretched); + fprintf (out, "%i",tuple.parent->pre_stretched); else fprintf (out, "NULL"); break; @@ -653,7 +652,7 @@ fprintf(out, "NULL"); } break; - case 'g': fprintf (out, "%lu", tuple.guide); break; + case 'g': fprintf (out, "%i", tuple.guide); break;
default: putc (format[i], out); break; } @@ -966,7 +965,7 @@ /* print the node self */ fprintf ( guide_out, - "
guide, root->count); print_kind (guide_out, root->kind); ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Monetdb-pf-checkins mailing list Monetdb-pf-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins
------------------------------------------------------------------------
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ------------------------------------------------------------------------
_______________________________________________ Monetdb-pf-checkins mailing list Monetdb-pf-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins
-- Sjoerd Mullender
On Mon, Sep 10, 2007 at 01:25:54PM +0200, Manuel Mayr wrote:
Thx for the suggestion, I see SSZFMT to be defined in monet_utils.h. Is it possible to use SSZFMT without creating a dependency to monet?
Since xmlshred is in the pathfinder tree (which inherently depends on MonetDB), and as long as there are no plans to distribute xmlshred separately and make it compile stand-alone, what't the problem of using monet_utils.h? id does not create any new dependency. Obviously, the (discouraged) alternative is to copy the (required) functionality of monet_utils.h to some local file (and double-check, whether pathfinder's configure does the required checks). Stefan
Best regards, Manuel
Sjoerd Mullender wrote:
When printing a value of type size_t, use SZFMT. When printing a value of type ssize_t, use SSZFMT. The format needed to print these values varies from system to system, so that difference is hidden in a macro.
-- | Dr. Stefan Manegold | mailto:Stefan.Manegold@cwi.nl | | CWI, P.O.Box 94079 | http://www.cwi.nl/~manegold/ | | 1090 GB Amsterdam | Tel.: +31 (20) 592-4212 | | The Netherlands | Fax : +31 (20) 592-4312 |
Hi Stefan,
thanks for your feedback.
'xmlshred' — or what it will soon become, rather — will be primarily
used in a context
where Pathfinder will generate SQL code only. Such setups consist of modules
'buildtools' and 'pathfinder' only, no 'MonetDB'.
Cheers,
--Teggy
On 9/10/07, Stefan Manegold
[...] Since xmlshred is in the pathfinder tree (which inherently depends on MonetDB), and as long as there are no plans to distribute xmlshred separately and make it compile stand-alone, what't the problem of using monet_utils.h? id does not create any new dependency.
-- | Torsten "Teggy" Grust | Torsten.Grust@gmail.com
Hi Teggy, Hi Manuel, thanks for the clarification! In that case, Sjoerd's suggestion of copying the definition of SSZFMT (and possibly more if required) seems to be the best solution. Stefan On Mon, Sep 10, 2007 at 10:56:15PM +0200, Torsten Grust wrote:
Hi Stefan,
thanks for your feedback.
'xmlshred' — or what it will soon become, rather — will be primarily used in a context where Pathfinder will generate SQL code only. Such setups consist of modules 'buildtools' and 'pathfinder' only, no 'MonetDB'.
Cheers, --Teggy
On 9/10/07, Stefan Manegold
wrote: [...] Since xmlshred is in the pathfinder tree (which inherently depends on MonetDB), and as long as there are no plans to distribute xmlshred separately and make it compile stand-alone, what't the problem of using monet_utils.h? id does not create any new dependency.
-- | Torsten "Teggy" Grust | Torsten.Grust@gmail.com
-- | Dr. Stefan Manegold | mailto:Stefan.Manegold@cwi.nl | | CWI, P.O.Box 94079 | http://www.cwi.nl/~manegold/ | | 1090 GB Amsterdam | Tel.: +31 (20) 592-4212 | | The Netherlands | Fax : +31 (20) 592-4312 |
participants (4)
-
Manuel Mayr
-
Sjoerd Mullender
-
Stefan Manegold
-
Torsten Grust