OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: DOCBOOK-APPS: Need help including c source


Hi,
I'm trying to include C source into docbook but I'm having problems with 
the #include <stdio.h>. I really would like to have the source compile 
as is and include as is into the document.

I did something like this but then the entity doesn't get included.

<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
          "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY myfunc SYSTEM "myfunc.c">
]>
  <chapter>
     <title>Exceptions</title>

     <programlisting>
       <![CDATA[&myfunc;]]>
     </programlisting>

   </chapter>

If I leave out the CDATA then it won't parse.

Thanks for any help,
Eric

myfunc.c
#include <stdio.h>

int myfunc(int value) {
     if (value == 4) {
         return 0;
     }
     return 1;
}

int main() {
     int error = myfunc(4);
     if (error != 0) {
         /* handle problem */
         printf("myfunc problem\n");
     }
     /* continue */
     printf("myfunc okay\n");
     error = myfunc(3);
     if (error != 0) {
         printf("myfunc problem\n");
     }
     return 0;
}



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC