🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text
Article #7015

Need groff equivalent to C's strlen()

#7015
From: Jhon Honce
Date: Wed, 20 May 1992 17:29
25 lines
1846 bytes
I'm writing a set of special macros to handle a small data dictionary.
One of the fields is the number of characters in a keyword.  I thought
it would be nice to make the computer count this instead of the person
filling in the form.

This has turned out to be much more painful than I thought and I would
like some new ideas.  Assuming someone has some to give away.  ;-)

Using the \w function I can get a number that is the numerical width of
the string in basic units, eg.

	.nr keywrdlen (+\\w'\\$1')

I'm now at a cliff, do I try and sum the basic units in each character
to determine how many characters?  Or, is there some function I've
missed?  Or, do I just make the user expend a gray cell or two?

Thanks for any help you can spare.

Thanks to FSF for Groff!

-- 

/jwh
jhon honce -- honce@spso.gsfc.nasa.gov
Technical Details
Message-ID: <honce.706382992@spso>
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!mips!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!usenet.coe.montana.edu!mintaka.lcs.mit.edu!ai-lab!ai.mit.edu!gnulists

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 101a3e,76aa88559285e04f,start
X-Google-Attributes: gid101a3e,public
X-Google-Thread: 10bba1,76aa88559285e04f,start
X-Google-Attributes: gid10bba1,public
X-Google-ArrivalTime: 1992-05-20 06:50:40 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!mips!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!usenet.coe.montana.edu!mintaka.lcs.mit.edu!ai-lab!ai.mit.edu!gnulists
From: honce@spso.gsfc.nasa.gov (Jhon Honce)
Newsgroups: comp.text,gnu.groff.bug
Subject: Need groff equivalent to C's strlen()
Summary: how to determine number of characters in a macro argument
Keywords: troff
Message-ID: <honce.706382992@spso>
Date: 20 May 92 17:29:52 GMT
Reply-To: honce@spso.gsfc.nasa.gov (Jhon Honce)
Followup-To: comp.text,gnu.groff.bug
Organization: NASA Goddard Space Flight Center, Greenbelt, Maryland
Lines: 25
Approved: info-gnu@prep.ai.mit.edu
Nntp-Posting-Host: spso.gsfc.nasa.gov
Apparently-To: gnu-groff-bug@ames.arc.nasa.gov