ad_proc

one of the documented procedures in this installation of the ACS
Usage:
ad_proc   args
What it does:
Use just like proc, but first argument must be a named argument description. A named argument description is a list of flag/default value pairs: {-arg1 arg1default -arg2 arg2default} By jsc@arsdigita.com Now supports default arguments and varargs ("args"). Now supports the -prefix switch to have all argument variable names prefixed by a string, e.g., ad_proc -prefix T my_proc { { -foo bar } arg1 arg2 } { ns_write "foo is $Tfoo
\n" ns_write "arg1 is $Targ1
\n" ns_write "arg2 is $Targ2
\n" } This is useful when you don't want set_variables_after_query hosing arguments (e.g., ad_table).
Defined in: /web/philip/packages/acs-core/00-proc-procs.tcl

Source code:


    if { [lindex $args 0] == "-prefix" } {
	set prefix [lindex $args 1]
	set args [lrange $args 2 end]
    } else {
	set prefix ""
    }

    set proc_name [lindex $args 0]
    set ad_args [lindex $args 1]

    nsv_set ad_proc_args $proc_name $ad_args

    generate_argument_parser $proc_name $ad_args $prefix

    # Four argument version indicates use of proc_doc instead of proc.
    if { [llength $args] == 4 } {
        set doc_string [lindex $args 2]
        set body [lindex $args 3]
        proc_doc $proc_name args $doc_string "arg_parser_for_$proc_name \$args\n$body"
    } else {
        set body [lindex $args 2]
        proc $proc_name args "arg_parser_for_$proc_name \$args\n$body"
    }


philg@mit.edu