# Build library and binaries
env.Library("libtide.a", glob("src/lib/**/*.c"))
- (glob("src/*.c") - ["src/term.c"]).each do |src|
+ (glob("src/*.c") - ["src/term.c", "src/tsed.c"]).each do |src|
bin = File.basename(src).sub(/\.[^\.]$/,'')
env.Program("bin/#{bin}", [src, "libtide.a"])
end
}
function close_function(){
- if (nreturns > 1)
- {
- error("functions should have a maximum of one return statement")
- }
-
- if ((FNR - linenum) > MAXLINES)
- {
- warn("function is " (FNR - linenum) " lines long. blocks larger than 50 lines are considered too complex")
- }
+ if (nreturns > 1)
+ {
+ error("functions should have a maximum of one return statement")
+ }
- if (level < 0)
- {
- error("too many closing braces detected")
- }
+ if ((FNR - linenum) > MAXLINES)
+ {
+ warn("function is " (FNR - linenum) " lines long. blocks larger than 50 lines are considered too complex")
+ }
- if (!privatefn && (nasserts == 0))
- {
- warn("public function has no assertions")
- }
+ if (level < 0)
+ {
+ error("too many closing braces detected")
+ }
- privatefn = 0
- nasserts = 0
- nreturns = 0
- infunc = 0
+ if (!privatefn && (nasserts == 0))
+ {
+ warn("public function has no assertions")
}
+}
# if we're in a comment block, look for the end
(incomment && match(\$0, /\*\//)) {
closing = gsub(/}/, "")
get_syms(\$0, M);
- # reset state if not in a function
if (level == 0)
{
linenum = FNR + 1
- privatefn = 0
- nasserts = 0
- nreturns = 0
- infunc = 0
}
- if (!level && paren && opening)
+ # reset state when we potentially encounter a new function
+ if (level == 0 && paren)
{
- warn("function braces should be on their own lines")
+ privatefn = 0
+ nasserts = 0
+ nreturns = 0
+ if (opening)
+ {
+ warn("function braces should be on their own lines")
+ }
}
process_idents(opening, closing)