CGI C Program Compiler for Apache
ApacheのC言語CGI作成支援プログラムです。
Revision | 55ab7ca99c5a26d65b866ea0f2f3d3852c424e94 (tree) |
---|---|
Zeit | 2010-02-25 00:51:57 |
Autor | Hidetaka Sakai <sakaihdt@d2.d...> |
Commiter | Hidetaka Sakai |
add option ( -t -n )
Changes to be committed:
modified: README_ja.txt
modified: cgigenerator.pl
@@ -58,6 +58,10 @@ CGIジェネレータでは、以下のコマンドオプションを使用で | ||
58 | 58 | 通常、.cの拡張子になるでしょう |
59 | 59 | -f <printf関数名> |
60 | 60 | printfでなく、異なる関数を指定したい場合、指定します。 |
61 | +-t <タブ数> | |
62 | + printf 行頭に<タブ数>個のタブを挿入します | |
63 | +-n | |
64 | + コンパイラ用のタグを出力しません | |
61 | 65 | |
62 | 66 | |
63 | 67 | == 簡単なサンプル |
@@ -2,7 +2,9 @@ | ||
2 | 2 | # |
3 | 3 | # cgigenerator.pl |
4 | 4 | # |
5 | -# Copyright (C) 2009 Hidetaka Sakai | |
5 | +# Ver 0.0.3 | |
6 | +# | |
7 | +# Copyright (C) 2009-2010 Hidetaka Sakai | |
6 | 8 | # |
7 | 9 | # This library is free software; you can redistribute it and/or |
8 | 10 | # modify it under the terms of the GNU Lesser General Public |
@@ -35,6 +37,10 @@ | ||
35 | 37 | # - printf change |
36 | 38 | # ./cgigenerator.pl -f samprintf -i <srcfile> -o <dstfile> |
37 | 39 | # |
40 | +# - othre option | |
41 | +# -t <num> printf tab number | |
42 | +# -n not output LINE information | |
43 | +# | |
38 | 44 | # can use tags: |
39 | 45 | # - C progaram |
40 | 46 | # <% |
@@ -71,6 +77,9 @@ print( "\n"); | ||
71 | 77 | print( " - printf change\n"); |
72 | 78 | print( " ./cgigenerator.pl -f samprintf -i <srcfile> -o <dstfile>\n"); |
73 | 79 | print( "\n"); |
80 | +print( " - othre option\n" ); | |
81 | +print( " -t <num> printf tab number\n" ); | |
82 | +print( " -n not output LINE information\n" ); | |
74 | 83 | print( " can use tags:\n"); |
75 | 84 | print( " - C progaram \n"); |
76 | 85 | print( " <% \n"); |
@@ -107,13 +116,15 @@ my $INPUTFILENM = "STDIN"; | ||
107 | 116 | my $OUTPUTFILENM = "STDOUT"; |
108 | 117 | my $mode = $MODE_HTML; |
109 | 118 | my @lines ; |
119 | +my $TABNUM = 0; | |
120 | +my $NOTLILNENUM = 0; | |
110 | 121 | |
111 | 122 | my %opts = (); |
112 | 123 | |
113 | 124 | ################################ |
114 | 125 | # option parse |
115 | 126 | ################################ |
116 | -getopts ("i:o:f:h", \%opts); | |
127 | +getopts ("i:o:f:t:hn", \%opts); | |
117 | 128 | # foreach $key(keys %opts ) { |
118 | 129 | # print "$key = $opts{$key}\n"; |
119 | 130 | #} |
@@ -143,6 +154,20 @@ if( exists $opts{"i"} ) { | ||
143 | 154 | @lines = <STDIN>; |
144 | 155 | } |
145 | 156 | |
157 | +if( exists $opts{"t"} ) { | |
158 | + $TABNUM = $opts{"t"} ; | |
159 | + my $tab = ""; | |
160 | + for( my $i=0; $i<$TABNUM; $i++ ){ | |
161 | + $tab = "\t$tab"; | |
162 | + } | |
163 | + $PRINTFUNC_ST = "$tab$PRINTFUNC_ST" ; | |
164 | +} | |
165 | + | |
166 | +if( exists $opts{"n"} ) { | |
167 | + $NOTLILNENUM = 1; | |
168 | +} | |
169 | + | |
170 | + | |
146 | 171 | |
147 | 172 | |
148 | 173 | ################################ |
@@ -190,7 +215,9 @@ foreach $linestr (@lines) { | ||
190 | 215 | if( length( $printstr ) != 0 ){ |
191 | 216 | print( "$PRINTFUNC_ST \"$printstr\" $PRINTFUNC_ED;\n" ); |
192 | 217 | } |
193 | - print( "#line $linecnt \"$INPUTFILENM\"\n" ); | |
218 | + if( $NOTLILNENUM == 0 ){ | |
219 | + print( "#line $linecnt \"$INPUTFILENM\"\n" ); | |
220 | + } | |
194 | 221 | next; |
195 | 222 | } else { |
196 | 223 | # mode C |