Gmail Kalender Dokumenter Leser Nett mer »
Sist besøkte grupper | Hjelp | Logg på
Hjemmesiden for Google Grupper
Melding fra diskusjonen How to pass a list from C to Common Lisp
Gruppen du sender innlegg til, er en Usenet-gruppe. E-postadressen til forfatteren av meldinger som legges inn i denne gruppen, vil vises for alle på Internett.
Svarmeldingen ble ikke sendt.
Meldingen ble sendt
 
Fra:
Til:
Kopi:
Oppfølging til:
Legg til kopi | Legg til oppfølging til | Rediger emne
Emne:
Godkjenning:
Skriv tegnene i bildet nedenfor eller tallene du hører ved å klikke på tilgjengelighetsikonet. Dette er en sikkerhetsprosedyre. Hør etter, og skriv inn tallene du hører
 
Madhu  
Vis profil   Oversett til Oversatt (vis original)
 Flere alternativer 4 Jun 2009, 06:27
Nyhetsgrupper: comp.lang.lisp
Fra: Madhu <enom...@meer.net>
Dato: Thu, 04 Jun 2009 09:57:02 +0530
Lokal: Tors 4 Jun 2009 06:27
Emne: Re: How to pass a list from C to Common Lisp

* Kaz Kylheku <20090615105137....@gmail.com> :
Wrote on Wed, 3 Jun 2009 20:09:22 +0000 (UTC):

| On 2009-06-03, N. Raghavendra <ra...@mri.ernet.in> wrote:

|> I have written a basic C wrapper for libmxl2, which parses an XML
|> document, and prints a list containing the parsed data.  At the moment,
|> I save the printed sexp to a file, and READ it from Lisp.  I am thinking
|> it may be better to avoid the intermediate printing and READing, and
|> instead save the parsed data to a C struct; I can then try to use Lisp
|> to get the sexp from the C struct, using an FFI.  What is a good way to
|> store a sexp in C?  Is it common practice to pass through an
|> intermediate file like I am doing now?
|
| Why don't you just use an XML processing library for Common Lisp?

I'm sure there would be valid reasons to avoid depending on the recent
offerings of the free-common-lisp-library vendors in this department.

| It seems like your wrapper is a waste of effort.

If you looked at his posted example carefully. libxml2 has done extra
processing on his document: libxml2 has expanded this directive

  <xi:include href="urn:publicid:-:EXAMPLE:DOCUMENT+Section:EN"/>

and the results were included in the sexp output.

I'd imagine the OP would prefer to use libxml2 for its features.

To answer the OP, I'd expect that it may not be worth the effort to
construct lisp sexps directly from C code.

The next easiest thing would be to prepare a stream in C which lisp
could call READ on directly. But CL:READ would be likely be the slowest
step; I noticed you are dealing with UTF-8 strings and so any clever
speedups from munging 8bit-clean character arrays between C and lisp
will not be possible and you'd go through the extra copying/stream
layers in your lisp.

Are there any other characterestics of your XML data that you want to
avoid a file layer?

--
Madhu


    Videresend  
Du må logge deg på før du kan legge inn meldinger.
For å kunne legge inn meldinger må du først bli med i denne gruppen.
Oppdater kallenavnet på siden for abonnementsinnstillinger før du legger inn meldinger.
Du har ikke tillatelse til å legge inn meldinger.

Opprett en gruppe - Google Grupper - Googles hjemmeside - Vilkår for bruk - Retningslinjer for personvern
©2010 Google