Re: pdf generator

2009-05-07 Thread Alexander Burger
Hi Tomas,

  Alex, I need to call 'lseek' function.  How could I get hold of the

Hmm, I deliberately omitted 'lseek' from the standard system, as I think
it is useful only for very special cases.

For the PicoLisp I/O system it does not make much sense, as reading and
writing is buffered, so that an 'lseek' on the Lisp level will give
rather unpredictable results.

Also, mixing Lisp I/O functions like 'read', 'write', 'line', 'char'
etc. with the low-level functions 'rd', 'wr' and 'pr' might give
unexpected results, as the Lisp functions use, for example, a
single-char read-ahead buffer.

In fact, in cases where I needed low-level binary file I/O, I used calls
to the external 'dd' program. But this is rather clumsy.

I think it is wiser and much easier to write a separate C library for
specialized I/O.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe


Re: pdf generator

2009-05-07 Thread Tomas Hlavaty
Hi Alex,

 I think it is wiser and much easier to write a separate C library
 for specialized I/O.

you convinced me:-)

Thanks,

Tomas
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe


Re: pdf generator

2009-05-04 Thread Alexander Burger
Hi Tomas,

 I have attached a prototype pdf generator pdf.l.  It can be used to
 generate pdf files directly without going through @lib/ps.l.  It is

Great! This is another thing I would have liked to do, but never found
the time. The procedure with going through PostScript is a mess (but, on
the other hand, sometimes necessary e.g. when directly printing to a
PostScript printer as we do for some customers).

Let me look at it in more detail later. To your question:

 Alex, I need to call 'lseek' function.  How could I get hold of the
 current input and output file descriptors?  I want to feed it to the
 ...

(fpos (ifd) 123) # set current position to 123rd byte from start of the 
 file
(fpos (ifd) 0 1) # get current position

Yep, implementing 'ifd' and 'ofd' (analog to 'ipid' and 'opid') would be
the right way.

For a quick solution, you can directly access the file descriptors from
within your function, via the globals 'InFile' and 'OutFile':

 ...
off_t z = lseek(InFile-fd, offset, whence);
 ...

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe