navi homePPSaboutscreenshotsdownloaddevelopmentforum

Opened 12 years ago

Closed 12 years ago

#336 closed enhancement (fixed)

Remove Tcl library from media

Reported by: landauf Owned by: landauf
Priority: critical Milestone: Version 0.2 Codename: Bellatrix
Component: ScriptEngine Version: 0.2.0
Keywords: tcl Cc:
Referenced By: References:

Description (last modified by landauf)

Tcl comes with a large library of Tcl files providing several features, most of them being crucial for the common use of the language (especially since Tcl doesn't know any keywords, just functions). Usually those files come together with the Tcl library and are installed somewhere on the system (there's a path pointing to this location which is known inside Tcl and can also be read and manipulated by the user when creating language extensions - this might be useful for future changes like #314).

Now let me briefly introduce the concept of the console command execution in Orxonox:

  1. It starts with the user's input (containing Orxonox and/or Tcl commands)
  2. This is sent to a Tcl interpreter (to parse the Tcl commands)
  3. Every unknown command is assumed to be an Orxonox command and is sent back to the Command Executor? in Orxonox (it could also be an unknown or misspelled Tcl command, but that doesn't matter)
  4. The Orxonox command is executed by the Command Executor (if it really was an Orxonox command - otherwise an error is shown)

To achieve this, we manipulate the unknown function of Tcl. This function gets called automatically if someone tries to execute an unknown command in Tcl (language feature). Usually this function would display an error, but we change the function to send the command back to the Command Executor instead.

The unknown function is defined in "init.tcl" - a file that belongs to the Tcl library. And because of this change, we currently have to add the whole Tcl library to our media repository. And even worse, those files change with every release of Tcl and have to be updated.

Therefore we should try to use the standard Tcl library and manipulate the unknown function in Orxonox after the Tcl interpreter was loaded, instead of providing our own version. Unfortunately this isn't that easy, because the change in init.tcl looks more or less like this:

   proc unknown args {
       ... (almost 200 lines of code)
-      return -code error "invalid command name \"$name\""
+      return [query $args]

Maybe we can catch the returned error code and then send the query to Orxonox, but there are other locations in the unknown function which return also an error (because the whole unknown function is basically just one big error handler).

Task: Find a clean and fast way to send unknown commands back to Orxonox without manipulating init.tcl. After you succeeded, let Tcl load the standard library files instead of our own version. Change the Tcl library path so Tcl will still find our own scripts and packets (see also #314).

Change History (2)

comment:1 Changed 12 years ago by landauf

  • Description modified (diff)

comment:2 Changed 12 years ago by landauf

  • Resolution set to fixed
  • Status changed from new to closed

fixed in r3344 / r3345 (resource branch)

Note: See TracTickets for help on using tickets.