This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Need help including c source


 <!ENTITY myfunc SYSTEM "myfunc.c">

should be:

 <!ENTITY % myfunc SYSTEM "myfunc.c">

Perhaps you can ommit CDATA.

Regards

Juan R.Migoya
SPAIN

Eric Richardson wrote:
> 
> 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;
> }
> 
> ----------------------------------------------------------------
> To subscribe or unsubscribe from this elist use the subscription
> manager: <http://lists.oasis-open.org/ob/adm.pl>

----------------------------------------------------------------
To subscribe or unsubscribe from this elist use the subscription
manager: <http://lists.oasis-open.org/ob/adm.pl>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]