apm_callback_has_valid_args (public)

 apm_callback_has_valid_args -type type -proc_name proc_name

Defined in packages/acs-tcl/tcl/apm-procs.tcl

Returns 1 if the specified callback proc of a certain type has a valid argument list in its definition and 0 otherwise. Assumes that the callback proc is defined with ad_proc.

Switches:
-type (required)
-proc_name (required)
Author:
Peter Marklund

Testcases:
No testcase defined.
Source code:

    if { [namespace which ::$proc_name] eq "" } {
        return 0
    }

    set test_arg_list ""
    set test_arg_list_spec ""
    foreach arg_name [apm_arg_names_for_callback_type -type $type] {
        lappend test_arg_list -$arg_name value
        lappend test_arg_list_spec -${arg_name}:required
    }

    if { $test_arg_list eq "" } {
        # The callback proc should take no args
        return [expr {[info args ::$proc_name] eq ""}]
    }

    if {[namespace which ::nsf::cmd::info] ne ""} {
        #
        # We can compare the signature of via nsf procs
        #
        return [expr {[::nsf::cmd::info parameter ::$proc_name] eq $test_arg_list_spec}]

    }

    # The callback proc should have required arg switches. Check
    # that the ad_proc arg parser doesn't throw an error with
    # test arg list
    if { [catch {
        set args $test_arg_list
        ::${proc_name}__arg_parser
    } errmsg] } {
        return 0
    } else {
        return 1
    }
Generic XQL file:
packages/acs-tcl/tcl/apm-procs.xql

PostgreSQL XQL file:
packages/acs-tcl/tcl/apm-procs-postgresql.xql

Oracle XQL file:
packages/acs-tcl/tcl/apm-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: