|
Subject: Re: DocBook function synopsis From: "Mitch C. Amiano" <amiamc@xxxxxxxxxxxxxxx> Date: Thu, 09 Jul 1998 16:59:54 -0400 |
Frank A. Christoph wrote:
> I added three attributes to FuncDef in the declaration subset, "Class" which
> indicates what class the function is a member of (I'm not using it, but it
> seems potentially useful); "Dispatch" which would be "pure" for pure virtual
> functions, "virtual" for regular dynamically dispatched functions, and
> "static" for statically dispatched functions; and finally "Const" which is
> "const" for functions that don't modify the state, or "mutable" for those
> that do.
>
> <!-- customizations -->
> <!ENTITY % local.funcdef.attrib "
> Class CDATA #IMPLIED
> Dispatch (pure|virtual|static) static
> Const (const|mutable) mutable" >
Not to go into too much C++ detail for the DSSSL list, I'd suggest youchange the default for Displatch to #IMPLIED. "static" has its own
meaning which has nothing to do with the default dispatch method
used for unqualified method declarations (which are sensitive to
the context). An implied value would mean "unknown, let the compiler
figure it out," which is probably a more accurate representation of
real life.
Also, what about "inline"?
If this is all you need to know, that's great. I wonder though, because
there is so much Stuff (with a capital S) in C++ syntax that you could
easily become swamped trying to handle the gOofY rules.
> And here is the modified formatting code. These are based on the
> definitions in docbook/print/dbsynop.dsl; I haven't looked at the HTML
> code...
>
> ;changes to support C++ member functions and Docbook customizations
> (element funcprototype
> (let* ((paramdefs (select-elements (children (current-node))
> (normalize "paramdef")))
> (funcdef (node-list-first (children (current-node))))
> (dispatch-val (attribute-string (normalize "dispatch") funcdef)))
> (make sequence
> (make paragraph
> font-family-name: %mono-font-family%
> (if (or (string=? dispatch-val (normalize "virtual"))
> (string=? dispatch-val (normalize "pure")))
> (literal "virtual ")
> (empty-sosofo))
> (process-children)
> (if (string=? (attribute-string (normalize "const") funcdef)
> (normalize "const"))
> (literal " const")
> (empty-sosofo))
> (if (string=? dispatch-val (normalize "pure"))
> (literal " = 0")
> (empty-sosofo))
> (literal ";"))
> (if (equal? %funcsynopsis-style% 'kr)
> (with-mode kr-funcsynopsis-mode
> (process-node-list paramdefs))
> (empty-sosofo)))))
>
> (element void
> (if (equal? %funcsynopsis-style% 'ansi)
> (literal "(void)")
> (literal "()")))
>
> (element varargs (literal "(...)"))
>
> (element paramdef
> (let ((param (select-elements (children (current-node)) (normalize
> "parameter"))))
> (make sequence
> (if (equal? (child-number (current-node)) 1)
> (literal "(")
> (empty-sosofo))
> (if (equal? %funcsynopsis-style% 'ansi)
> (process-children)
> (process-node-list param))
> (if (equal? (gi (ifollow (current-node))) (normalize "paramdef"))
> (literal ", ")
> (literal ")")))))
>
> With these changes, you can format things like
>
> <funcsynopsis>
> <funcprototype>
> <funcdef pure const>int <function/foo/</funcdef>
> <paramdef/Bar */
> </funcprototype>
> </funcsynopsis>
>
> to look like
>
> virtual int foo(Bar *) const = 0;
>
> Note: I don't think formatting for K&R is correctly preserved by these
> changes, although a slight change looks like it would be sufficient.
>
> Comments/improvements welcome.
>
> --FC
>
> DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
--
Mitch C. Amiano amiamc@xxxxxxxxxxxxxxx
Technical Staff Member Advanced Design Process Group Alcatel Network Systems
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: DocBook function synopsis, Lionel Mallet | Thread | RE: DocBook function synopsis, Frank A. Christoph |
| DSSSL -> Adept Screen FOSI, Chuck Darney | Date | RE: DocBook function synopsis, Frank A. Christoph |
| Month |