[XML-SIG] FW: pyexpat compilation errors - Python 2.0b1

Mark Favas m.favas@per.dem.csiro.au
Fri, 14 Jul 2000 05:09:18 +0800


Sorry for the delay in replying, Paul - work intervened <grin>, and some
changes to Python killed the build on my machine.

Anyway - no, this doesn't work for me, because we're left with the same
problem. In initpyexpat, the compiler still needs to know the type of
handler_info_array, and it doesn't at this time...

cc: Error: ./pyexpat.c, line 857: In this statement,
"handler_info_array" is not declared. (undeclared)
    handler_info = handler_info_array;
-------------------^

The only solution to this is to move the initpyexpat() function to the
end of the file (moving the definition of handler_info_array to before
initpyexpat doesn't work, because the definition of handler_info_array
requires some declarations that appear after initpyexpat()...

So this approach would work if the code were re-arranged.

BTW, the current Python 2.0b1 CVS version of pyexpat.c will not compile
on my machine without the patch below:

The problem is (basically):
cc: Error: ./pyexpat.c, line 427: An unexpected newline character is
present in a string literal. (nlstring)
"Parse(data[, isfinal])
cc: Error: ./pyexpat.c, line 428: An unexpected newline character is
present in a character constant. (nlchar)
Parse XML data.  `isfinal' should be true at end of input.";
-------------------------^
cc: Warning: ./pyexpat.c, line 428: A character constant value requires
more than sizeof(int) bytes of storage. (charoverfl)
Parse XML data.  `isfinal' should be true at end of input.";
-------------------------^
^

Same around lines 503-504, 558-559 and 576-577

Patch is:  

*** pyexpat.c.orig      Thu Jul 13 19:02:16 2000
--- pyexpat.c.compiles  Thu Jul 13 04:30:23 2000
***************
*** 424,430 ****
  /* ---------------------------------------------------------------- */
  
  static char xmlparse_Parse__doc__[] = 
! "Parse(data[, isfinal])
  Parse XML data.  `isfinal' should be true at end of input.";
  
  static PyObject *
--- 424,430 ----
  /* ---------------------------------------------------------------- */
  
  static char xmlparse_Parse__doc__[] = 
! "Parse(data[, isfinal])\n\
  Parse XML data.  `isfinal' should be true at end of input.";
  
  static PyObject *
***************
*** 500,506 ****
  }
  
  static char xmlparse_ParseFile__doc__[] = 
! "ParseFile(file)
  Parse XML data from file-like object.";
  
  static PyObject *
--- 500,506 ----
  }
  
  static char xmlparse_ParseFile__doc__[] = 
! "ParseFile(file)\n\
  Parse XML data from file-like object.";
  
  static PyObject *
***************
*** 555,561 ****
  }
  
  static char xmlparse_SetBase__doc__[] = 
! "SetBase(base_url)
  Set the base URL for the parser.";
  
  static PyObject *
--- 555,561 ----
  }
  
  static char xmlparse_SetBase__doc__[] = 
! "SetBase(base_url)\n\
  Set the base URL for the parser.";
  
  static PyObject *
***************
*** 573,579 ****
  }
  
  static char xmlparse_GetBase__doc__[] = 
! "GetBase() -> url
  Return base URL string for the parser.";
  
  static PyObject *
--- 573,579 ----
  }
  
  static char xmlparse_GetBase__doc__[] = 
! "GetBase() -> url\n\
  Return base URL string for the parser.";
  
  static PyObject *

Paul Prescod wrote:
> 
> I like this solution. Work for you Mark?
> 
> Juergen Hermann wrote:
> >
> > statichere struct HandlerInfo* handler_info = 0;
> >
> > ...
> >
> > statichere struct HandlerInfo handler_info_array[]=
> > {{"StartElementHandler",
> > ...
> > };
> >
> > void
> > initpyexpat(){
> >         handler_info = handler_info_array;
> > ...
> > }
> 
> --
>  Paul Prescod - Not encumbered by corporate consensus
> The distinction between the real twentieth century (1914-1999) and the
> calenderical one (1900-2000) is based on the convincing idea that the
> century's bouts of unprecented violence, both within nations and between
> them, possess a definite historical coherence -- that they constitute,
> to
> put it simply, a single story.
>         - The Unfinished Twentieth Century, Jonathan Schell
>                 Harper's Magazine, January 2000

-- 
Email  - m.favas@per.dem.csiro.au        Mark C Favas
Phone  - +61 8 9333 6268, 0418 926 074   CSIRO Exploration & Mining
Fax    - +61 8 9383 9891                 Private Bag No 5, Wembley
WGS84  - 31.95 S, 115.80 E               Western Australia 6913