The Artima Developer Community
Sponsored Link

Agile Buzz Forum
LibXSLT #2

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
LibXSLT #2 Posted: Feb 12, 2004 9:45 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: LibXSLT #2
Feed Title: Michael Lucas-Smith
Feed URL: http://www.michaellucassmith.com/site.atom
Feed Description: Smalltalk and my misinterpretations of life
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Michael Lucas-Smith

Advertisement

To continue on from where I left off. I've published a new version of LibXSLT to the public store, this is version 1.1, which includes proper error reporting and real character encoding handling based on the output from the stylesheet object itself.

All of this work was harder than it should have been, for a couple of reasons. The main one is that C really stinks. Yes, you heard me - in Smalltalk I never have to care about the encoding of strings. They are encoded in an encoding, end of story. Objects are objects. In C, I have to care about the encoding - which means when I'm interfacing to C I have to care about the encodings.

*shrug* That aside, the real pain was in DLLCC - typecasting of all things!

Since it refused to let me use a struct* as a return type of a procedure, nor would it let me make a typedef for the struct*, I had to resort to using typecasting. To type cast in DLLCC, one has to perform the following sort of dance:

(type := CPointerType defaultPointer) referentType: self myStructureType.
(newVariable := CCompositePointer new)
	referentAddress: currentVariable referentAddress;
	type: type.
^newVariable

That's a mouthful consider C's answer to this is newVariable = (myStructureType*) currentVariable.

To make a long story short - all is possible, but it's not as straight forward as it should be. This is Smalltalk after all, the language of flexibility and descriptiveness, yet I'm bending over backwards to achieve a relatively simple job.

Perhaps the reason there are so few C library wrappers in VW is not because those libraries "would have to be xplatform" (which many Linux ones are these days!) but because using DLLCC is a complete pain in the ...

Now, back to complaining about C. Because of C the LibXSLT package has memory leaks. Enough said - if you can fix it for me, then thanks go to you!

Read: LibXSLT #2

Topic: Dueling career ladders Previous Topic   Next Topic Topic: Up to Here

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use