++ed by:
CAC ASB

2 PAUSE users
2 non-PAUSE users.

Author image Alexander Becker
and 1 contributors

NAME

perlPort.pod - Notes on Porting tkTable from tcl to perltk

DESCRIPTION

file notes

  • tkTableInitScript.h

    This contains a TCL script that is run when table is loaded. This will probably have to be completly converted to perl. Excluded.

  • conf* Files

    Used by gnu autoconfigure in the TCL scripts. Excluded.

  • mac_* Files

    Used for mac port. Don't worry about for now.

  • mm.h

    Command structure lookup definitions. Called out by tkTable.h

  • tkAppInit.c

    TCL application Init. A similar file is excluded in ../tclUnix, ../tclWin, etc. Excluded.

  • tkTable.c/h

    Main tkTable code/header file.

  • tkTableCell.c

    Functions for the tkTable Cells

  • tkTableCmd.c

    Implements general commands of the table widget

  • tkTableEdit.c

    Implements editing functions for the table widget.

  • tkTablePs.c

    Implements postscript output for table widgets.

  • tkTableTag.c

    Implements tags for table widgets.

  • tkTableWin.c

    Implements embedded windows for table widgets

Top Level perlTk Calling Notes

As an example, Scale.xs references Tk_ScaleCmd, which is defined in tkScale.c. Should the top leved Table.xs do a similar thing?

Conversion from Native tcl/tk notes:

These notes are taken from looking at the difference between the tkScale.h and tkScale.c files in the stock tk8.0.5 distribution and the Tk800.022/pTk/mTk distribution.

.h files

  • Add tkVMacro.h to include

    Also add:

     #include "tkPort.h"
     #include "tkInt.h"
     #include "tkVMacro.h"
  • Remove UID type references?

    Or change to Tk_State type?

  • Change name of variables from char type to Var type

  • Change command variables from char type to LangCallback type.

.c files

  • Change any tclMath refs to <math.h>

  • Add #include "tkVMacro.h"

    Before "tkScale.h" or equivalent.

  • Change Tk_ConfigSpec table

    Tk_CONFIG_STRINGS for commands to TK_CONFIG_CALLBACK.

    Removed/Change UID type variables

    Change TK_CONFIG_STRING to TK_CONFIG_SCALAR_VAR for -variable type entries.

  • Change XXXVarProc items

    From char * name to Var name where appropriate.

  • Change tkNormalUID states to TK_STATE_NORMAL

    Also for disabled (TK_STATE_DISABLED)

  • Change Tk_SetClass call to TkClassOption calls (Not Needed?)

  • Change any numeric conversions.

    Anything like value = strtod(stringValue, &end) should be converted to a Arg stringValue; type and a (Tcl_GetDouble(interp, stringValue, &value) call.

  • Change name of variables from char type to Var type

  • Change any calls to Tcl_CreateCommand to Lang_CreateWidget

    Similar to the way this was changed in the tkCanvas.c file in the main tk distribution.

  • Modify the command routine to return a value like tkCanvas

    Replace Tcl_SetStringObj with Tcl_ArgResult similar to what is in tkCanvas.c

  • Tcl_VarEval Conversion

    Any calls to Tcl_VarEval are converted to LangDoCallback

  • Tcl_SplitList Conversion

    Any calls to Tcl_SplitList are changed to Tcl_ListObjGetElements.

  • Tcl_Merge Conversion

    Any calls to Tcl_Merge are changed to Tcl_NewListObj.

  • Tcl_GetStringResult Conversion

    Any calls to Tcl_GetStringResult are changed to Tcl_GetResult. Tcl_GetStringResult wasn't provided as part of the tkGlue.c parkage and Tcl_GetResult appeared to do the same thing.

  • Tcl_GlobalEval/ExpandPercents Conversion

    The original tktable widget accepts TCL scripts (text) to be used as callbacks (Like for -browsecommand, and the -command options). The tcl/tk code takes the TCL script and performs Expand Percents on it, and then evals it, using Tcl_GlobalEval. To work with perltk, this sequence was changed to a LangDoCallBack.

.tcl files

Files in the lib directory (tkTable.tcl) are equivalent to the .pm files for the widget, so the tkTable.tcl file has to be converted to perl. See the various .pm files in the Tk distribution for examples.

Note the tcl2perl script in the Tk distribution can provided a starting point for the translation. Much hand-editing is still required however.