> > > 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
#!/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";
}
/*
* Don't even try to compile
*/
/**
* ## Description ##
* Documentation
* ## Arguments ##
* None
* ## Argument Types ##
* None
**/
/***
* This function just exists.
**/
BEGIN_METHOD_VOID(func)
asm("nop;");
END_METHOD
/**
* ## Description ##
* Something's missing
**/
/**
* ## Description ##
* Another function
**/
BEGIN_METHOD(func2, int this_is_a_long_argument_name,
int yet_another_long_argument_name,
char third_one_for_multiple_lines)
asm("finit;");
END_METHOD
/*
* This function just exits.
*/
int main()
{
exit(0);
}
/**
* ## Description ##
* Last one of its kind
* ## Arguments ##
* What format?
**/
BEGIN_METHOD(funcX, int i)
asm("syscall;" :: "a" (i));
END_METHOD
/** One final comment **/
------------------------------------------------------------------------------
Keep yourself connected to Go Parallel:
TUNE You got it built. Now make it sing. Tune shows you how.
http://goparallel.sourceforge.net
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user