0 votes
by Bruno Degazio (310 points)

I'm having trouble getting clean output from the XML parser in XML.FTH 

It compiles without trouble (except for flagging a redefinition of -WHITE) but the output I get  appears to be mis-parsed. There are a lot of partial words noted as tags (e.g.  

Unknown :erty:  Status 0000:0000

Contents:        :

Tag Text:erty name="name"ion":

The Tag Text 'erty' should actually be "Property" and the name text  "name"ion"  should actually be "GtkAction" 

There are also frequent sections of corrupted output such as:

Unknown :child:  Status 0000:0000

Contents:        :

Tag Text:child:

  Attribute=class Value=GtkAction

  Attribute=id Value=save_menu_item

  Attribute= Value=ac

  Attribute=<?ꀀ?4@??????N?????????????\H???????N???????G?????@

6??????U???????;??????????????;???????\N??????????????;???????0?????@

@????? /??????@+????????f???????5??????\U????? C?????P???????

                                                             PeH??????????????@?????p?^?????6???????P??????#??????>?????PeG????? ???????  (continues for several screens) 

Looking through the code I could see a number of words that needed to be updated to 64-bit VFX Forth (e.g. the output word ?i had to be redefined to use L@ instead of @)  but fixing those seems to have no effect on the problematic output. 

Has anyone been through this and perhaps fixed it for 64-bit? 

thanks

Bruno Degazio

Toronto

1 Answer

0 votes
by Bruno Degazio (310 points)

I seem to have bumbled my way through to fixing it. AS I suspected it was  a problem with the change to 64-bit. There were a number of small changes needed throughout the file (mostly in details of 64 bit fetch and store) , but I think the critical bug was this on line 536 of ZML.FTH: 

: -align \ caddr -- addr'

\ *G Align a byte address to the previous cell boundary.

\ ** N.B. This word assumes a byte addressed 32 bit Forth.

  -4 and               <=======================  should be -8 AND

;

The -4 should be a -8 for 64 bit. As this word is part if the machinery for the multiple string-stacks, an error here would have lots of opportunity to mess things up. 
Fortunately, due to Stephen's foresight and good programming practice, the comment preceding the above definition flagged it as being specific to 32-bit, so it caught my eye fairly quickly. 
Bruno Degazio

by Stephen Pelc (4.2k points)
Greetings from EuroForth 2024. Well done for finding me guilty! Please email me your amended version and I will immediately put it in the source tree. Note also that -4 or -8 can be replaced by CELL NEGATE.
by Bruno Degazio (310 points)
Thanks Stephen! I'll do that shortly. Looking forward to browsing the latest docs from EuroForth when they're ready. I've actually been looking over your paper from 2005 on the XML code.

I think I've got the basic machinery working, but I don't understand how to customize it to my application. Is it via DoTags, DoContents, etc as you state in the docs, or via SERVANT words (as implied in your paper and in the Jenny Brown original paper?

A demo example would clarify a lot. I searched through the VFX Lib's for something suitable but to no avail.
...