Index: openacs-4/packages/acs-api-browser/acs-api-browser.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/acs-api-browser.info,v diff -u -r1.40.2.1 -r1.40.2.2 --- openacs-4/packages/acs-api-browser/acs-api-browser.info 29 Sep 2019 16:07:19 -0000 1.40.2.1 +++ openacs-4/packages/acs-api-browser/acs-api-browser.info 27 Feb 2021 22:25:31 -0000 1.40.2.2 @@ -7,7 +7,7 @@ t t - + OpenACS Interactive documentation for the Tcl and SQL APIs. 2017-08-06 @@ -17,9 +17,9 @@ 3 On line interactive documentation for the locally installed Tcl and SQL APIs. Links to the Tcl core and NaviServer/AOLServer online documentation as well. - - - + + + Index: openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl,v diff -u -r1.72.2.28 -r1.72.2.29 --- openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 22 Feb 2021 16:56:53 -0000 1.72.2.28 +++ openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 27 Feb 2021 22:25:31 -0000 1.72.2.29 @@ -360,6 +360,33 @@ return $out } + +ad_proc -private api_proc_format_switch {xotclArgs flags switch} { + if {$xotclArgs} { + if {"boolean" in $flags} { + set value "on|off " + } elseif {"switch" in $flags} { + set value "" + } else { + set value "$switch " + } + if {"required" in $flags} { + set result "-$switch $value" + } else { + set result "\[ -$switch $value\]" + } + } else { + if {"boolean" in $flags} { + set result "\[ -$switch \]" + } elseif {"required" in $flags} { + set result "-$switch $switch" + } else { + set result "\[ -$switch $switch \]" + } + } + return $result +} + ad_proc -public api_proc_documentation { -format -script:boolean @@ -397,7 +424,8 @@ array set doc_elements { flags "" default_values "" - switches "" + switches0 "" + switches1 "" positionals "" varargs_p 0 script "" @@ -459,29 +487,8 @@ } lappend command_line $pretty_proc_name - foreach switch $doc_elements(switches) { - if {$xotclArgs} { - if {"boolean" in $flags($switch)} { - set value "on|off " - } elseif {"switch" in $flags($switch)} { - set value "" - } else { - set value "$switch " - } - if {"required" in $flags($switch)} { - lappend command_line "-$switch $value" - } else { - lappend command_line "\[ -$switch $value\]" - } - } else { - if {"boolean" in $flags($switch)} { - lappend command_line "\[ -$switch \]" - } elseif {"required" in $flags($switch)} { - lappend command_line "-$switch $switch" - } else { - lappend command_line "\[ -$switch $switch \]" - } - } + foreach switch $doc_elements(switches0) { + lappend command_line [api_proc_format_switch $xotclArgs $flags($switch) $switch] } set counter 0 @@ -495,6 +502,10 @@ if { $doc_elements(varargs_p) } { lappend command_line "\[ args... \]" } + foreach switch $doc_elements(switches1) { + lappend command_line [api_proc_format_switch $xotclArgs $flags($switch) $switch] + } + append out [util_wrap_list $command_line] set intro_out "" @@ -527,9 +538,10 @@ } } - if { [llength $doc_elements(switches)] > 0 } { + set switches [concat $doc_elements(switches0) $doc_elements(switches1)] + if { [llength $switches] > 0 } { append blocks_out "
Switches:
\n" - foreach switch $doc_elements(switches) { + foreach switch $switches { append blocks_out "
-$switch" if {"boolean" in $flags($switch)} { append blocks_out " (boolean)" Index: openacs-4/packages/acs-bootstrap-installer/acs-bootstrap-installer.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/acs-bootstrap-installer.info,v diff -u -r1.45.2.3 -r1.45.2.4 --- openacs-4/packages/acs-bootstrap-installer/acs-bootstrap-installer.info 27 Feb 2021 17:48:35 -0000 1.45.2.3 +++ openacs-4/packages/acs-bootstrap-installer/acs-bootstrap-installer.info 27 Feb 2021 22:25:31 -0000 1.45.2.4 @@ -9,7 +9,7 @@ f t - + Don Baccus Bootstraps an OpenACS installation. 2017-08-06 @@ -18,7 +18,7 @@ GPL 3 - + Index: openacs-4/packages/acs-bootstrap-installer/tcl/00-proc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/tcl/00-proc-procs.tcl,v diff -u -r1.66.2.20 -r1.66.2.21 --- openacs-4/packages/acs-bootstrap-installer/tcl/00-proc-procs.tcl 27 Feb 2021 18:03:38 -0000 1.66.2.20 +++ openacs-4/packages/acs-bootstrap-installer/tcl/00-proc-procs.tcl 27 Feb 2021 22:25:31 -0000 1.66.2.21 @@ -349,7 +349,8 @@ # ##### - set switches [list] + set switches0 {} + set switches1 {} set positionals [list] set seen_positional_with_default_p 0 set n_positionals_with_defaults 0 @@ -424,13 +425,19 @@ } if {[string index $arg 0] eq "-"} { - if { [llength $positionals] > 0 } { - return -code error "Switch -$arg specified after positional parameter" + if { [llength $positionals] > 0} { + if {$::acs::useNsfProc} { + set trailing_nonpos_p 1 + } else { + return -code error "Switch -$arg specified after positional parameter" + } + } else { + set trailing_nonpos_p 0 } set switch_p 1 set arg [string range $arg 1 end] - lappend switches $arg + lappend switches$trailing_nonpos_p $arg if {"boolean" in $arg_flags} { set default_values(${arg}_p) 0 @@ -478,7 +485,7 @@ } } - foreach element { protection deprecated_p warn_p varargs_p arg_list switches positionals } { + foreach element { protection deprecated_p warn_p varargs_p arg_list switches0 positionals switches1} { set doc_elements($element) [set $element] } foreach element { default_values flags } { @@ -572,7 +579,9 @@ " ::callback::${callback}::contract__arg_parser\n${log_code}$code_block"] } - } elseif { $callback eq "" && [llength $switches] == 0 && !$seen_arg_checkers_p} { + } elseif { $callback eq "" + && [llength $switches0] + [llength $switches1] == 0 + && !$seen_arg_checkers_p} { # # Nothing special is used in the argument definition, create a # plain proc Index: openacs-4/packages/acs-tcl/acs-tcl.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/acs-tcl.info,v diff -u -r1.95.2.19 -r1.95.2.20 --- openacs-4/packages/acs-tcl/acs-tcl.info 27 Feb 2021 17:48:35 -0000 1.95.2.19 +++ openacs-4/packages/acs-tcl/acs-tcl.info 27 Feb 2021 22:25:31 -0000 1.95.2.20 @@ -9,7 +9,7 @@ f t - + OpenACS The Kernel Tcl API library. 2017-08-06 @@ -18,8 +18,8 @@ GPL version 2 3 - - + + Index: openacs-4/packages/acs-tcl/tcl/01-database-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/01-database-procs.tcl,v diff -u -r1.1.2.24 -r1.1.2.25 --- openacs-4/packages/acs-tcl/tcl/01-database-procs.tcl 27 Feb 2021 17:48:35 -0000 1.1.2.24 +++ openacs-4/packages/acs-tcl/tcl/01-database-procs.tcl 27 Feb 2021 22:25:31 -0000 1.1.2.25 @@ -1361,23 +1361,22 @@ {-subst all} statement_name sql - args + -default + -bind } { - Usage: db_string statement-name sql [ -default default ] [ -bind bind_set_id | -bind bind_value_list ] - @return the first column of the result of the SQL query sql. If the query doesn't return a row, returns default or raises an error if no default is provided. @param dbn The database name to use. If empty_string, uses the default database. @param cache_key Cache the result using given value as the key. Default is to not cache. @param cache_pool Override the default db_cache_pool @param subst Perform Tcl substitution in xql-files. Possible values: all, none, vars, commands + @param default Return value in case the SQL query returns no value + @param bind Either an ns_set id, or bind value list } { # Query Dispatcher (OpenACS - ben) set full_name [db_qd_get_fullname $statement_name] - ad_arg_parser { default bind } $args - set code { db_with_handle -dbn $dbn db { set selection [db_exec -subst $subst 0or1row $db $full_name $sql] Index: openacs-4/packages/acs-tcl/tcl/form-processing-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/form-processing-procs.tcl,v diff -u -r1.87.2.10 -r1.87.2.11 --- openacs-4/packages/acs-tcl/tcl/form-processing-procs.tcl 18 Feb 2021 14:50:20 -0000 1.87.2.10 +++ openacs-4/packages/acs-tcl/tcl/form-processing-procs.tcl 27 Feb 2021 22:25:31 -0000 1.87.2.11 @@ -585,7 +585,7 @@ # persist flags which where specified in previous calls # (e.g. these global variables). global af_parts - set valid_args [dict get [nsv_get api_proc_doc [lindex [info level 0] 0]] switches] + set valid_args [dict get [nsv_get api_proc_doc [lindex [info level 0] 0]] switches0] foreach valid_arg $valid_args { if { [info exists $valid_arg] } { if { [info exists af_parts(${form_name}__$valid_arg)] Index: openacs-4/packages/acs-tcl/tcl/test/doc-check-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/doc-check-procs.tcl,v diff -u -r1.20.2.15 -r1.20.2.16 --- openacs-4/packages/acs-tcl/tcl/test/doc-check-procs.tcl 15 Feb 2021 17:53:27 -0000 1.20.2.15 +++ openacs-4/packages/acs-tcl/tcl/test/doc-check-procs.tcl 27 Feb 2021 22:25:32 -0000 1.20.2.16 @@ -248,9 +248,12 @@ # # Build the real parameters list # + ns_log notice "check args for '$p'" set real_params [list \ - {*}[dict get $proc_doc switches] \ - {*}[dict get $proc_doc positionals]] + {*}[dict get $proc_doc switches0] \ + {*}[dict get $proc_doc positionals] \ + {*}[dict get $proc_doc switches1] \ + ] # # Check if the last parameter is 'args', as it is not included into # 'switches' or 'positionals', and add it to the real parameter list @@ -265,8 +268,9 @@ set param [lindex [string map $ignorechars $param_doc] 0] # Allow boolean parameter name with appended '_p' regsub -- _p$ $param "" param_trim_p - if {"$param" ni $real_params && "$param_trim_p" ni $real_params} { + if {$param ni $real_params && $param_trim_p ni $real_params} { # Nonexistent @param found! + #ns_log notice "param_docs '$param_doc' real_params '$real_params'" incr param_unknown aa_log_result fail "Unknown parameter '$param' in documentation of proc '$p'" }