[Gambas-devel] expat and XML trial report of R.O.

ron ronstk at ...124...
Tue Sep 14 15:17:21 CEST 2004


Thanks Christian, Daniel,

I managed to get Daniels work in the build tree of gambas.
The expatc was compiling and working, last week.
In the weekend I updated KDE from 3.2 to 3.3

But still some questions.
I'm standing alone, only Win... users arround me. :(
---------------
My system:
SuSE 8.2
cc --version:cc (GCC) 3.3 20030226 (prerelease) (SuSE Linux) 
automake --version:automake (GNU automake) 1.7.6
autoconf --version:autoconf (GNU Autoconf) 2.57

gambas 0.99 :=)

The lib for expat is /usr/lib/libexpat.*
The include is  /usr/include/expat.h 
Version ?.?.? (not in file)

The lib for xml is /usr/lib/libxml2.*
The include is in  /usr/include/libxml2/libxml/* 
version 2.5.11
----------------
First what I did to paste it in. 
Despite expat and lib xml now discused as one I did the expat only
and it worked before.
I did follow the basic instruction Benoit posted here before.
Then the fresh compile instructions.
  reconf/configure/make and make install
After adding the gbxml part as xml I did
  make clean/reconf/configure/make and make install
At this time the binaries of expat is gone?
expat does not compile now.
------------------
('** lines' are not in file but my comment now)

** configure.in: Add after
dnl ---- Check for threading

GB_THREAD()
** this section 
dnl ---- Check for expath library

GB_COMPONENT(
  expatc,
  EXPATC,
  [expatc component],
  [GB_FIND(expat.h, /usr/local /usr, include )],
  [GB_FIND(libexpat.$SHLIBEXT, /usr/local /usr, lib)], 
  [$C_LIB -lexpatc]) ** <-- not sure this is right 

dnl ---- Check for libxml library

GB_COMPONENT(
  xml,
  XML,
  [XML component],
dnl  [GB_FIND(xmlversion.h, /usr/local /usr, include )],
dnl  [GB_FIND(libxml2.$SHLIBEXT, /usr/local /usr, lib)], 
  [$C_LIB -lxml]) ** <-- not sure this is right 

** I had to add the 2 dnl to get gbxml get in (gbxml is changed to xml)

** In the AC_OUTPUT I add at the end before ')'
src/lib/expatc/Makefile \
src/lib/xml/Makefile \

** in Makefile.am in the src/lib directory
SUBDIRS = debug eval db compress @QT_DIR@ @NET_DIR@ @SDL_DIR@ @VB_DIR@
** to
SUBDIRS = debug eval db compress @QT_DIR@ @NET_DIR@ @SDL_DIR@ @VB_DIR@ @EXPATC_DIR@ @XML_DIR@

** for expat no other changes.

** The expat problems just started after the make clean was done. 

static void XMLCALL 
startElement(void *_object, const char *name, const char **atts)
{
    int i;  
    GB_COLLECTION col;
    GB_STRING v;
    //GB_VALUE v;

** gives me a error for line 24 now
  DPIC -o expatc.lo
  expatc.c:24: error: parse error before "startElement"
  expatc.c:25: warning: return type defaults to `int'
  expatc.c: In function `startElement':
** and is gone when i change to

static void XMLCALL startElement(void *_object, const char *name, const char **atts)
{

** All procedure lines made in 2 lines give this error so and 
** is gone after merge together them as above.
** The warning on line 25 is found on more lines and can be true
** or is due the cc(3.3) from suse8.2
------------------------
The major diff between the orginal and fresh make for Makefile is many lines.
I add then as Makefile.org and Mafefile.ron just in case.
Same for the Makefile.in, and I understand they should/could be but I belive here to much.

For the gbxml of Daniel the changes are as above and the rename of 'gbxml' to 'xml'
in files and for filenames. I used the gbxml-1.tar.bz2 (70kb)


** in the src/lib/xml/Makefile.am 
INCLUDES = -I$(top_srcdir)/src/share -I/usr/include/libxml2
EXTRA_DIST = *.component

pkglib_LTLIBRARIES = lib.gb.gbxml.la

lib_gb_gbxml_la_LIBADD = 
lib_gb_gbxml_la_LDFLAGS = -lxml2 -lz -lpthread -lm

lib_gb_gbxml_la_SOURCES = main.h main.c XMLTree.h XMLTree.c

** changed to 
INCLUDES = -I$(top_srcdir)/src/share -I/usr/include/libxml2 @XML_INC@
EXTRA_DIST = *.component

pkglib_LTLIBRARIES = lib.gb.xml.la

lib_gb_xml_la_LIBADD = @XML_INC@ ** <-- example instuction say this 
lib_gb_xml_la_LDFLAGS = -lxml2 -lz -lpthread -lm

lib_gb_xml_la_SOURCES = main.h main.c XMLTree.h XMLTree.c

** sofar gbxml as xml
I belive the problem with xml is mainly in the GB_COMPONENT and 
the src/lib/makefile.in.

Because I wish to go on I did now the following.
I know it is may be the wrong way but works.
add dnl to the lines of the expat component.
add dnl to the line src/lib/expatc/Makefile \ in AC_OUTPUT
In the makefile.am in src/lib made a copy of the SUBDIRS line
Put a # in front for the first line and removed the @EXPATH_DIR@ in the second one
the reconf/configure and make
expath is gone Ready to go for xml.
Without fatal errors now, only warnings.

XMLTree.c: In function `CXMLDOC_Save':
XMLTree.c:76: warning: unused variable `_p'
XMLTree.c: In function `XML_Unparent_Children':
XMLTree.c:317: warning: int format, pointer arg (arg 2)
XMLTree.c:318: warning: int format, long int arg (arg 2)
XMLTree.c:324: warning: int format, pointer arg (arg 2)
XMLTree.c:325: warning: passing arg 1 of pointer to function from incompatible pointer type

do the 'make install'
Start gambas and found xml. :) The expath still there, leftover i asume.

My main question is de declaration for the GB_COMPONENT.
How should it be really?
special the   [$C_LIB -lexpatc]) line
 
For the makefile.am the line with
lib_gb_xml_la_LIBADD = @XML_INC@ ** <-- example instuction say this 
because the line for expat is still empty.
lib_gb_expat_la_LIBADD =  
and works(ed)

The simple test for the xml made by Daniel:

' Gambas class file
'STATIC PUBLIC xmld AS XMLDoc
PUBLIC xmln AS XMLNode

PUBLIC SUB btnOK_Click()
 textbox1.Text="./channels.xml"
 'textbox1.Text="./test.xml"
 'xmld = NEW XMLDoc '(textbox1.Text) 'static error :)
 'xmln = NEW XMLNode
 xmln=xmldoc.Load(textbox1.text)
 PRINT "name="; xmln.Name 'ok is kwintv
 PRINT "children="; xmln.HasChildren 'ok
 'PRINT "count="; childcount(xmln)
 PRINT "parent="; xmln.HasParent 
'? says true but at start I should at root and can't have parents ??

 ' ME.Close(TRUE)
END


channels.xml
<?xml version="1.0" encoding="UTF-8"?>
<kwintv version="1" >
 <tvregion>
  <info>

I feel good with it, the basic start is there.
 







-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile.org
Type: text/x-makefile
Size: 10500 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20040914/af5902b2/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile.ron
Type: text/x-makefile
Size: 14533 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20040914/af5902b2/attachment-0001.bin>


More information about the Devel mailing list