work on document

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@75 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-09-30 11:11:30 +00:00
parent 32d013241a
commit 31d01d3b79
7 changed files with 153 additions and 0 deletions

26
doc/index.html Normal file
View File

@@ -0,0 +1,26 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Milsko GUI Toolkit Documentation</title>
</head>
<body>
<h1 align="center">Milsko GUI Toolkit Documentation</h1>
<hr>
<h2>Mw/Button.h</h2>
<p>
Button widget.
</p>
<dt>
<code>MWDECL MwClass MwButtonClass;</code>
</dt>
<dd>
Button class.
</dd>
<br>
<hr>
<h2>Mw/Core.h</h2>
<p>
Core.
</p>
</body>
</html>

BIN
doc/note.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

BIN
doc/unsure.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

BIN
doc/warning.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

View File

@@ -1,4 +1,8 @@
/* $Id$ */
/*!
* %file Mw/Button.h
* %brief Button widget
*/
#ifndef __MW_BUTTON_H__
#define __MW_BUTTON_H__
@@ -9,6 +13,9 @@
extern "C" {
#endif
/*!
* %brief Button class
*/
MWDECL MwClass MwButtonClass;
#ifdef __cplusplus

View File

@@ -1,4 +1,8 @@
/* $Id$ */
/*!
* %file Mw/Core.h
* %brief Core
*/
#ifndef __MW_CORE_H__
#define __MW_CORE_H__

116
tools/doc.pl Executable file
View File

@@ -0,0 +1,116 @@
#!/usr/bin/env perl
# $Id$
our $html = "";
our $title = "Milsko GUI Toolkit Documentation";
our @pathlist = ("include");
our @notes = ("warning", "unsure", "note");
sub out {
$html = $html . "$_[0]\n";
}
sub scan_dir {
my ($first, $path) = @_;
$path =~ s/\/+$//g;
if(opendir(my $dh, $path)){
print(STDERR "Scanning $path\n");
my @paths = sort(readdir($dh));
foreach my $p (@paths){
if($p eq '.' || $p eq '..'){
next;
}
scan_dir($first, $path . "/" . $p);
}
closedir($dh);
}else{
my $spaces = "";
my $in = 0;
my $out = 0;
my $file = 0;
my $has_file = 0;
my %kv = ();
print(STDERR "$path is a file\n");
open(IN, "<", "$path");
while(my $l = <IN>){
$l =~ s/[\r\n]+$//g;
if($out){
my $para = "p";
my $brief = $kv{brief} or "";
$brief =~ s/([^\.])$/\1./g;
$out = 0;
if(!$has_file){
print(STDERR "Warning: missing comment with %file, ignoring\n");
next;
}
if(!$file && defined($kv{brief})){
$para = "dd";
$l =~ s/[ \t]*(?:;|\{.+)[ \t]*$//g;
out("<dt>");
out(" <code>$l;</code>");
out("</dt>");
}
out("<$para>");
out(" $brief");
out("</$para>");
foreach my $note (@notes){
if(defined($kv{$note})){
out("<dt>");
out(" <img src=\"$note.gif\" alt=\"$note\">");
out("</dt>");
out("<dd>");
out(" $kv{$note}");
out("</dd>");
}
}
if(!$file){
out("<br>");
}
}elsif($l =~ /^([ \t]*)\/\*\!/){
$spaces = $1;
$in = 1;
$file = 0;
%kv = ();
}elsif($in && ($l =~ /^$spaces \*\//)){
$in = 0;
$out = 1;
}elsif($in && ($l =~ /^$spaces \*[ \t]+%([^ ]+)(?:[ \t]+(.+))?$/)){
$kv{$1} = $2;
if($1 eq "file"){
if(!$has_file){
out("<hr>");
out("<h2>$2</h2>");
}
$file = 1;
$has_file = 1;
}
}
}
close(IN);
}
}
out("<html>");
out(" <head>");
out(" <meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">");
out(" <title>$title</title>");
out(" </head>");
out(" <body>");
out(" <h1 align=\"center\">$title</h1>");
foreach my $f (@pathlist){
scan_dir($f, $f);
}
out(" </body>");
out("</html>");
print($html);