[Gambas-user] Wiki documentation batch
Tobias Boege
taboege at ...626...
Fri Nov 30 23:47:02 CET 2012
> > > That way, at least components written in Gambas could be first
> > > documented inside the source code.
> > >
> > > For the components written in C/C++, we need a tool that extracts the
> > > help comments from the source code and put them in the *.info file the
> > > same way the Gambas compiler does.
>
> Concerning that tool, wouldn't a simple sed or awk script suffice? Is there
> any reference for this markdown derivate for Gambas (found nothing obvious
> in the wiki)? I imagine that this tool can be done completely in some hours,
> at most.
Oh, I had a look again at the thread where you introduced that new syntax
and someone pointed to an example of this documentation syntax in the IDE.
I have looked into a .info file made by the compiler out of a documented
component and wrote an awk script that does similar things for C/C++ Gambas
sources. You just get the output, I don't know what to do with it further,
especially in what concrete format the information has to be (like the .info
files with name, type of symbol, documentation?)
However, I set down some rules for the C/C++ documentation (feel free to
object):
- Those comments must begin with "/**" on a single line
- They must end with " **/" on a line of itself
- They must relate to the next line beginning with "BEGIN_"
I grep'd for the /** and **/ patterns in the whole source tree. The latter
was never found, the former sometimes.
Let me know if you are interested/I can improve/reformat/...
Regards,
Tobi
-------------- next part --------------
#!/usr/bin/awk -f
BEGIN {
do_record = do_search = do_expect = 0;
FS="";
}
/^\/\*\*$/ {
if (do_search)
print "DUMMY\n";
do_record = 1;
}
{
if (do_record || do_expect)
print $0;
}
/^ \*\*\/$/ {
do_record = 0;
do_search = 1;
}
# One-liners
/^BEGIN\_.*\(.*\)$/ {
if (do_search) {
print $0 "\n";
do_search = 0;
}
}
# Multi-liners
/^BEGIN\_.*\(/ {
if (do_search) {
do_expect = 1;
print $0;
}
}
/\)$/ {
if (do_search && do_expect) {
do_search = do_expect = 0;
print "";
}
}
END {
if (do_search)
print "DUMMY\n";
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: markup_test.c
Type: text/x-c
Size: 770 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20121130/43529c07/attachment.bin>
More information about the User
mailing list