can be used.
@node TCL scripting API
-@chapter TCL scripting API
+@chapter TCL scripts
@cindex TCL scripting API
-API rules
+@cindex TCL scripts
+@section API Rules
The commands are stateless. E.g. the telnet command line has a concept
of currently active target, the Tcl API proc's take this sort of state
Lists returned must be relatively small. Otherwise a range
should be passed in to the proc in question.
-Low level commands are prefixed with "openocd_", e.g. openocd_flash_banks
+@section Internal Low Level Commands
+
+By Low level, the intent is a human would not directly use these commands.
+
+Low level commands are (should be) prefixed with "openocd_", e.g. openocd_flash_banks
is the low level API upon which "flash banks" is implemented.
@itemize @bullet
startup.tcl "unknown" proc will translate this into a tcl proc
called "flash_banks".
+@section OpenOCD specific Global Variables
+
+@subsection HostOS
+
+Real TCL has ::tcl_platform(), and platform::identify, and many other
+variables. JimTCL, as implimented in OpenOCD creates $HostOS which
+holds one of the following values.
+
+@itemize bullet
+@item @b{winxx} Built using Microsoft Visual Studio
+@item @b{linux} Linux is the underlying operating sytem
+@item @b{darwin} Darwin (mac-os) is the underlying operating sytem.
+@item @b{cygwin} Running under Cygwin
+@item @b{mingw32} Running under MingW32
+@item @b{other} Unknown, none of the above.
+@end itemize
+
+Note: 'winxx' was choosen because today (March-2009) no distinction is made between Win32 and Win64.
@node Upgrading
@chapter Deprecated/Removed Commands
{
command_context_t* context = malloc(sizeof(command_context_t));
extern const char startup_tcl[];
+ const char *HostOs;
context->mode = COMMAND_EXEC;
context->commands = NULL;
Jim_RegisterCoreCommands(interp);
#endif
+#if defined( _MSC_VER )
+ /* WinXX - is generic, the forward
+ * looking problem is this:
+ *
+ * "win32" or "win64"
+ *
+ * "winxx" is generic.
+ */
+ HostOs = "winxx";
+#elif defined( __LINUX__)
+ HostOs = "linux";
+#elif defined( __DARWIN__ )
+ HostOs = "darwin";
+#elif defined( __CYGWIN__ )
+ HostOs = "cygwin";
+#elif defined( __MINGW32__ )
+ HostOs = "mingw32";
+#else
+ HostOs = "other";
+#endif
+ Jim_SetGlobalVariableStr( interp, "ocd_HOSTOS", Jim_NewStringObj( interp, HostOs , strlen(HostOs)) );
+
Jim_CreateCommand(interp, "ocd_find", jim_find, NULL, NULL);
Jim_CreateCommand(interp, "echo", jim_echo, NULL, NULL);
Jim_CreateCommand(interp, "capture", jim_capture, NULL, NULL);