Author: coke
Date: Wed Jan 24 18:27:13 2007
New Revision: 16786

Modified:
   trunk/   (props changed)
   trunk/languages/tcl/runtime/builtin/info.pir
   trunk/languages/tcl/runtime/tcllib.pir
   trunk/languages/tcl/t/cmd_info.t

Log:
[tcl] -
Resolve ticket #36277 ([TODO] Tcl's [info nameofexecutable])



Modified: trunk/languages/tcl/runtime/builtin/info.pir
==============================================================================
--- trunk/languages/tcl/runtime/builtin/info.pir        (original)
+++ trunk/languages/tcl/runtime/builtin/info.pir        Wed Jan 24 18:27:13 2007
@@ -520,7 +520,13 @@
 # RT#40741: stub
 .sub 'nameofexecutable'
   .param pmc argv
-  .return('parrot tcl.pbc')
+  .local int argc
+  argc = argv
+  if argc goto bad_args
+  $P1 = get_root_global ['_tcl'], 'nameofexecutable'
+  .return($P1)
+bad_args:
+  tcl_error 'wrong # args: should be "info nameofexecutable"'
 .end
 
 # RT#40742: stub

Modified: trunk/languages/tcl/runtime/tcllib.pir
==============================================================================
--- trunk/languages/tcl/runtime/tcllib.pir      (original)
+++ trunk/languages/tcl/runtime/tcllib.pir      Wed Jan 24 18:27:13 2007
@@ -113,6 +113,10 @@
   tcl_library = $S0
   set_root_global ['tcl'], '$tcl_library', tcl_library
 
+  # get the name of the executable
+  $P1 = interp[.IGLOBALS_EXECUTABLE]
+  set_root_global [ '_tcl' ], 'nameofexecutable', $P1
+
   # set tcl_platform
   $P1 = new 'TclArray'
   $P1['platform'] = 'parrot'

Modified: trunk/languages/tcl/t/cmd_info.t
==============================================================================
--- trunk/languages/tcl/t/cmd_info.t    (original)
+++ trunk/languages/tcl/t/cmd_info.t    Wed Jan 24 18:27:13 2007
@@ -7,7 +7,7 @@
 __DATA__
 
 source lib/test_more.tcl
-plan 50
+plan 52
 
 eval_is {info} \
   {wrong # args: should be "info option ?arg arg ...?"} \
@@ -213,3 +213,8 @@
   catch {unset x}
   list [info default defaults1 a x] $x
 } {0 {}} {something without a default}
+
+like [info nameofexecutable] parrot {basic exec name}
+eval_is {info nameofexecutable 1} \
+  {wrong # args: should be "info nameofexecutable"} {too many args}
+

Reply via email to