pdf-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pdf-devel] pdf_function.c


From: jemarch
Subject: Re: [pdf-devel] pdf_function.c
Date: Tue, 23 Oct 2007 21:58:38 +0200
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/23.0.50 (powerpc-unknown-linux-gnu) MULE/5.0 (SAKAKI)

   Type 4 functions are working now.

Nice. Thanks :)

   Some remarks:
   1.   there seems to be a bug in pdf_stm_mem_readpeek_char().
           c = data->data[data->current];
           if (!peek_p)    /* HF missing negation ? */ 
           {
                   data->current++;
           }
           return c;

Yes, it is a missing negation. Fixed in CVS now.

   2. pdf_reference_1-7.pdf lists ascii nul as a whitespace 
   character. No sane C programmer would write a type 4 function 
   with this delimiter, but the current pdf_stm_read_char() does 
   not allow it. 
   Why deviate from   "int fgetc(FILE*)"? 
   PDF_EOF is defined as -1.

Maybe I am missing something, but I think that the following code
should work in order to read a NULL character.

int i;
char c;

i = pdf_stm_read_char();
if ((i != PDF_EOF) && ((char) i == 0))
{
 /* it is a NULL character, ASCII 0 */
}

Both backends should support it.

   3. The test-function program is a bit complex.
   It has to exercise many special cases. 
   example calls:
           test-function --type 4 --code " { dup 1 lt { 0.1 mul } 
           { 1 index mul } ifelse }"  -n 1 -m 1 
   tests a function R -> R .
           test-function --type 4 --code " { dup 1 lt { 0.1 mul } 
           {  mul } ifelse }"  -n 1 -m 1 would produce a stack underflow 
          on output.

We could document its internals (including a list of these special
cases) in the wiki. 

That program could be included as a library utility in utils/ as
`pdf_function'. Does it have a standard --help output? I expect to
automatically generate the manpages for all utilities using the
help2man program.

   4. Error reporting.
       Right now, the code returns 0 on success.
       It would be easy to add better error reporting later on.
       Example:
           case  OPC_pop :
                   if ( sp < 0 ) goto stack_underflow ;
                   sp--

address@hidden is working in an error management module for the
library. We will be able to address this using that module, when
available.

   5. gperf usage.
       I don't know how to use gperf with automake, so I've
      embedded some 120 lines of gperf output into pdf_function.c .

   6. indentation .
       Is gnu indent with defaults enough? I use vim exclusively.

According to the GNU Software Standards the indent options are:

     -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2
     -ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob

I have not tried it, since I use Emacs exclusively :)

   Looking forward to a patch day :-)     

Thanks for your hard work.

-- 
Jose E. Marchesi  <address@hidden>
                  <address@hidden>

GNU Spain         http://es.gnu.org
GNU Project       http://www.gnu.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]