Re: parsing input

2009-04-25 Thread Alexander Burger
On Sat, Apr 25, 2009 at 07:41:43AM +0200, Alexander Burger wrote:
(filter prog (split (line)  ))

Actually,

   (extract pack (split (line)  ))

would have produced the original output, but keeping unpacked character
lists is usually more convenient for further processing.
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe


Re: parsing input

2009-04-25 Thread Randall Dow
Hi Alex,

Thanks, will try it, now going to pick up Francesca.

- Rand


On Sat, Apr 25, 2009 at 7:41 AM, Alexander Burger a...@software-lab.de wro=
te:
 Hi Tomas,

  01/02/2009 =C2=A0 30.00 =C2=A0 =C2=A0400.00 =C2=A0 =C2=A0t =C2=A0 =C2=
=A0Randall Dow
 ...
 (use (@A @B @C @D @E)
 =C2=A0 =C2=A0(when (match '(@A   @B   @C   @D   @E) (line))
 =C2=A0 =C2=A0 =C2=A0 (mapcar clip (list @A @B @C @D @E)) ) )

 While this is an elegant solution, it does not work as expected, because
 the '@X' symbols do not necessarily match non-white characters.

 I would stick with Randall's solution, just a little simplified:

 =C2=A0 (filter prog (split (line)  ))

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

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


Re: parsing input

2009-04-25 Thread Randall Dow
Thanks all!

(let L (mapcar pack (filter prog (split (line)  )))

converts:
01/02/2009   30.00400.00tRandall Dow
to
(01/02/2009 30.00 400.00 t Randall Dow)

which is just what I want. I could have left out the '(mapcar pack'
and left it as a char list, which would still produce a more efficient
program overall.

Thanks Alex!

Rand


On Sat, Apr 25, 2009 at 10:51 AM, Tomas Hlavaty t...@logand.com wrote:
 Hi Randal  Alex,

 While this is an elegant solution, it does not work as expected,
 because the '@X' symbols do not necessarily match non-white
 characters.

 I see, I should have tried that first;-)

 Cheers,

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

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


postscript utf8

2009-04-25 Thread Tomas Hlavaty
Hi Alex,

current @lib/ps.l does not deal with utf well enough and comes with a
workaround involving bin/lat1.

Bellow is a prototype code for displaying utf characters in poscript
insired by
https://mailman.research.att.com/pipermail/graphviz-interest/2004q2/001407.html

# *PsGlyph

(in glyphlist.txt
   (until (eof)
  (let L (line)
 (unless (= # (car L))
(let (I (index ; L)
  G (pack (head (- I 1) L))
  H (hex (pack (tail (- I) L))) )
   (let A (assoc H *PsGlyph)
  (if A
 (con A (cons G (cdr A)))
 (push '*PsGlyph (list H G)) ) ) ) ) ) ) )

(de psString (S)
   (prin ()
   (for X (if (atom S) (chop S) S)
  (let C (char X)
 (cond
(( C 32) # control char
   (case X
  (^M (prin \\r))
  (^J (prin \\n))
  (^I (prin \\t)) ) )
((= 32 C 126) # ascii
   (prin (case X
(\\ )
(( \\()
() \\))
(T X) ) ) )
((= 130 C) # utf
   (let? L (cdr (assoc C *PsGlyph))
  (prinl ))
  (prin [)
  (for G L
 (prin  / G) )
  (prinl ] {glyphshow} forall)
  (prin () ) )
(T
   (prinl ))
   (prinl /.notdef glyphshow)
   (prin () ) ) ) )
   (prinl )) )

(de psLabel (X Y Text Center)
   (if Center
  (prog # http://www.postscript.org/FAQs/language/node67.html
 (prinl X   Y  moveto)
 (psString Text)
 (prinl dup stringwidth pop 2 div neg 0 rmoveto show) )
  (prinl newpath  X   Y  moveto)
  (psString Text)
  (prinl show) ) )

glyphlist.txt from adobe
http://www.adobe.com/devnet/opentype/archives/glyphlist.txt is needed
and has to be converted to utf8.

I am not sure about Japanese but it works with Czech;-)

However, centering unicode/non-ascii characters does not work.  Any
ideas how to achieve that?

Thank you,

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