Author: mdiep Date: Sat Aug 6 10:17:57 2005 New Revision: 8846 Modified: trunk/languages/tcl/lib/commands/linsert.pir Log: tcl: Check for the right number of args in [linsert]
Modified: trunk/languages/tcl/lib/commands/linsert.pir ============================================================================== --- trunk/languages/tcl/lib/commands/linsert.pir (original) +++ trunk/languages/tcl/lib/commands/linsert.pir Sat Aug 6 10:17:57 2005 @@ -9,7 +9,9 @@ .local pmc argv argv = foldup - # XXX need error handling. + # make sure we have the right # of args + $I0 = argv + if $I0 < 3 goto wrong_args .local pmc __list __list = find_global "_Tcl", "__list" @@ -72,6 +74,11 @@ LOOP2: DONE2: .return (TCL_OK,retval) +wrong_args: + $I0 = TCL_ERROR + $P0 = new TclString + $P0 = "wrong # args: should be \"linsert list index element ?element ...?\"" + error: .return($I0,$P0) .end
