groff
[Top][All Lists]
Advanced

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

RE: [Groff] String editing?


From: Konovalov, Vadim
Subject: RE: [Groff] String editing?
Date: Fri, 11 Feb 2000 19:10:32 +0300

> I will also soon include a `length' macro which computes the length of
> a string.
> 
> > Not as powerful as Perl string editing functions are, but ....  I am
> > thinking about merging Perl and Groff together to get really
> > powerful string manipulation in groff, even search/replace regexes
> > will be made easily in this case.  Is anyone intresting on this, or
> > I am alone on this?  Should I really do this work?  (I tested Perl
> > and groff coexistence, first tests were Ok, but I'm not sure it is
> > really useful)
> 
> What do you mean with `merging'?  Adding Perl's string functions to
> groff?  This is a good thing, I think -- the only question is to which
> extent...

I don't know exactly yet:) I tried to embed perl into troff.exe's core and
it was successfull. I think of it as a request that will load perl core
(e.g.from dll file) and do something usefull. Also make perl will access
groff's strings through $G:: package and groff will access Perlish scalar
through, for example, special name, such as \*[P:$scalar]. Or may be
\*P[any_perl_expression].

My dream is to have possibility to write, for example
.ds str \*[P:join ' ', reverse split / +/,$G::str]
to reverse all words in the string str
:)

It is may be implemented in theory and I know how, but I'm afraid to make
troff processor much much slower...
OTOH you may not use it if it will be slow :)

> 
> Or do you mean writing a macro package to access Perl's string
> manipulation functions from within groff?  This is also very nice, but
> somewhat limited since you have to use groff's `-U' switch.

Probably not.

One thing that disappointed me is following:
I wanted to implement Perlish request(s) for troff in separate file (for
conditional linking of it if required or something), but it seems that it's
impossible. input.cc file contains declaration of many c++ classes important
for processing and therefore they will not be seen from outside.

Good luck,
Vadim Konovalov.
use strict;%;=qw;. @ @ .;,;$;=q;@;,$,=qq>\n>=>print
unpack q,A28,x6,join q,,,map{;$;=$;{$;};$;x$_;}split q,,,q
<13321523136131112131213171212121312131711524355111113121613132111316431322>



reply via email to

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