#!/usr/local/bin/ruby -w if ! ARGV[0] print < :all } # # # # -- ... #print "doc.whitespace: ", doc.whitespace #print "doc.version: ", doc.version #print "doc.encoding: ", doc.encoding #print "doc.standalone: ", doc.standalone? # Input: # # # # int # smtp_open # # mailer_t # mailer # # # int # flags # # # Open an SMTP mailer. # # # An SMTP mailer must be opened before any messages can be sent. Parameters: mailerthe mailer created by smtp_create() # flagsthe mailer flags # # # # # - Why do I always get XML, even for undocumented functions and macros? # - Why is # there no markup that I can use to determine that the function # was undocumented? # - Why sometimes declname, sometimes defname, in param? # - why is the parameter list jammed into the last paragraph of the # detailed description? # - Why is there always a detailed description, even when there isn't? # - Why the duplication beteen the beginning list of (which is # lacking the , and the ? # - Why is parameterlist just an alternating list of names and descriptions, # with no markup to bind a name to a description? # Overall: this appears to be half visual markup, and half logical. If # it was entirely visual, there would be the one-line summary of the # documented functions, followed by the details. # If it was entirely markup, then the # parameter info wouldn't be split into two different locations. # Output: # # @deftypefun int smtp_open ( # mailer_t @var{mailer}, # int @var{flags}) # Open an SMTP mailer. # An SMTP mailer must be opened before any messages can be sent. # # Parameters: # @itemize # @item @code{mailer} - the mailer created by smtp_create() # @item @code{flags} - the mailer flags # @end itemize # @end deftypefun doc.elements.each("*/*/sectiondef[@kind='func']") { |e| print "section: ", e.name, "/", e.attributes["kind"] e.elements.each("memberdef") { |m| # If there is no brief description, don't document this member. next unless m.elements["briefdescription"].elements["para"] $\ = "" print "@deftypefun " if m.elements["type"].text print m.elements["type"].text, " " else print "int " end print m.elements["name"].text, " (\n " first = true m.elements.each("param") { |p| if(first) first = false else print ",\n " end p.elements["type"].each { |c| if c.kind_of? Text print c, " " else c.each { |c2| if c2.kind_of? Text print c2, " " end } end } name = p.elements["declname"]; if ! name name = p.elements["defname"]; end if name print "@var{", name.text, "}" end } print ")\n" print m.elements["briefdescription"].elements["para"].text dd = m.elements["detaileddescription"] if dd print "\n" dd.each do |dde| if dde.kind_of? Text # Top level Text is empty. else # We should have a string of "para" elements, the last of which # has the parameter list. printPara dde end end print "Parameters:\n" print "@itemize\n" dd.elements.each("*/parameterlist/*") do |pl| if pl.name == "title" # ignore elsif pl.name == "parametername" print "@item @code{", pl.text, "}" elsif pl.name == "parameterdescription" if pl.elements["para"] print " - ", pl.elements["para"].text, "\n" end end end print "@end itemize\n" end print "@end deftypefun\n" print "\n" } }