summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/sift/src/matlab/sift_gendoc.pl
diff options
context:
space:
mode:
authorleochanj105 <leochanj@live.unc.edu>2020-10-19 23:09:30 -0400
committerleochanj105 <leochanj@live.unc.edu>2020-10-20 02:40:39 -0400
commitf618466c25d43f3bae9e40920273bf77de1e1149 (patch)
tree460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/benchmarks/sift/src/matlab/sift_gendoc.pl
parent47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff)
initial sd-vbs
initial sd-vbs add sd-vbs sd-vbs
Diffstat (limited to 'SD-VBS/benchmarks/sift/src/matlab/sift_gendoc.pl')
-rwxr-xr-xSD-VBS/benchmarks/sift/src/matlab/sift_gendoc.pl296
1 files changed, 296 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/sift/src/matlab/sift_gendoc.pl b/SD-VBS/benchmarks/sift/src/matlab/sift_gendoc.pl
new file mode 100755
index 0000000..6bc0b5e
--- /dev/null
+++ b/SD-VBS/benchmarks/sift/src/matlab/sift_gendoc.pl
@@ -0,0 +1,296 @@
1#!/usr/bin/perl -w
2## file: sift_gendoc.pl
3## author: Andrea Vedaldi
4## description: Summarize MATLAB M-Files docs
5
6# AUTORIGHTS
7# Copyright (c) 2006 The Regents of the University of California.
8# All Rights Reserved.
9#
10# Created by Andrea Vedaldi
11# UCLA Vision Lab - Department of Computer Science
12#
13# Permission to use, copy, modify, and distribute this software and its
14# documentation for educational, research and non-profit purposes,
15# without fee, and without a written agreement is hereby granted,
16# provided that the above copyright notice, this paragraph and the
17# following three paragraphs appear in all copies.
18#
19# This software program and documentation are copyrighted by The Regents
20# of the University of California. The software program and
21# documentation are supplied "as is", without any accompanying services
22# from The Regents. The Regents does not warrant that the operation of
23# the program will be uninterrupted or error-free. The end-user
24# understands that the program was developed for research purposes and
25# is advised not to rely exclusively on the program for any reason.
26#
27# This software embodies a method for which the following patent has
28# been issued: "Method and apparatus for identifying scale invariant
29# features in an image and use of same for locating an object in an
30# image," David G. Lowe, US Patent 6,711,293 (March 23,
31# 2004). Provisional application filed March 8, 1999. Asignee: The
32# University of British Columbia.
33#
34# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
35# FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
36# INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND
37# ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN
38# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE UNIVERSITY OF
39# CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
40# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
41# A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
42# BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE
43# MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
44
45# Debugging level
46$verb = 0 ;
47
48# PDF document location
49$pdfdoc = 'sift.pdf' ;
50
51# This is the queue of directories to process.
52# It gets filled recursively.
53@dir_fifo = ('.') ;
54
55# This will hold an entry for each m-file found
56%mfiles = () ;
57
58# This will hold an entry for each module found
59%modules = () ;
60
61# #ARGV is the index of the last element, which is 0
62if ($#ARGV == 0) {
63 open(FOUT,">$ARGV[0]") ;
64 print STDERR "Writing to file '$ARGV[0]'.\n" if $verb ;
65} else {
66 *FOUT= *STDOUT;
67 print STDERR "Using standard output.\n" if $verb ;
68}
69
70# Each module is a subdirectory. The subdirectory is used
71# as the module ID.
72
73while ($module_path = shift(@dir_fifo)) {
74 print STDERR "=> '$module_path'\n" if $verb ;
75
76 # get a first version of the module name
77 $module_path =~ m/.*\/([^\\]+)$/ ;
78 $module_name = $1 ;
79
80 # start a new module
81 $module = {
82 'id' => $module_path,
83 'path' => $module_path,
84 'name' => $module_name,
85 'mfiles' => [],
86 'description' => ""
87 } ;
88
89 # .................................................................
90 opendir(DIRHANDLE, $module->{'path'}) ;
91 FILE: foreach (sort readdir(DIRHANDLE)) {
92 $name = $_ ;
93 $path = $module->{'path'} . "/" . $_ ;
94
95 # push if a directory
96 $_ = $path ;
97 if (-d) {
98 next FILE if /(\.$|\.\.$)/ ;
99 push( @dir_fifo, "$_" ) ;
100 next FILE ;
101 }
102
103 # parse if .m and not test_
104 next FILE unless (/.+\.m$/) ;
105 next FILE if (/test_.x*/) ;
106 $name =~ m/(.*).m/ ;
107 $name = $1 ;
108 print STDERR " . m-file '$name'\n" if $verb ;
109 my ($brief,$description) = get_comment($path) ;
110
111 # topic description?
112 if (/overview/) {
113 print STDERR " * module description\n" if $verb ;
114 $module->{'id'} = $name ;
115 $module->{'name'} = $brief ;
116 $module->{'description'} = $description ;
117 next FILE ;
118 }
119
120 # use names as IDs
121 $id = $name ;
122 $id =~ tr/A-Z/a-z/ ;
123
124 # create a new mfile object
125 $mfile = {
126 'id' => $id,
127 'path' => $path,
128 'name' => $name,
129 'brief' => $brief,
130 'module' => $module,
131 'description' => $description
132 } ;
133
134 # add a reference to this mfile
135 # object to the global mfile list
136 $mfiles{$id} = $mfile ;
137
138 # add a reference to this mfile
139 # object to the current module
140 push( @{$module->{'mfiles'}}, $mfile) ;
141 }
142 closedir(DIRHANDLE) ;
143 # ................................................................
144
145 # add a reference to the current module to the global
146 # module list
147 $modules{$module->{'id'}} = $module ;
148}
149
150# ....................................................................
151# write documentation
152# ....................................................................
153
154print FOUT <<EOF;
155<html>
156 <head>
157 <link href="default.css" rel="stylesheet" type="text/css"/>
158 </head>
159 <body>
160EOF
161
162# sort modules by path
163sub criterion { $modules{$a}->{'path'} cmp $modules{$b}->{'path'} ; }
164
165MODULE:
166foreach $id ( sort criterion keys %modules ) {
167 my $module = $modules{$id} ;
168 my $rich_description = make_rich($module->{'description'}) ;
169
170 next MODULE if $#{$module->{'mfiles'}} < 0 and length($rich_description) == 0;
171
172 print FOUT <<EOF;
173 <div class='module' id='$module->{"id"}'>
174 <h1>$module->{'name'}</h1>
175 <div class='index'>
176 <h1>Module contents</h1>
177 <ul>
178EOF
179 foreach( @{$module->{'mfiles'}} ) {
180 print FOUT " <li><a href='#$_->{'id'}'>"
181 . "$_->{'name'}</a></li>\n" ;
182 }
183 print FOUT <<EOF;
184 </ul>