File: perlPort.pod

package info (click to toggle)
libtk-tablematrix-perl 1.23-6
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 1,788 kB
  • sloc: ansic: 15,026; perl: 3,389; makefile: 120; sh: 16
file content (184 lines) | stat: -rwxr-xr-x 4,223 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184

=head1 NAME

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


=head1 DESCRIPTION



=head1 file notes


=over 1

=item * tkTableInitScript.h

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

=item * conf* Files

Used by gnu autoconfigure in the TCL scripts. B<Excluded>.

=item * mac_* Files

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

=item * mm.h

Command structure lookup definitions. Called out by tkTable.h

=item * tkAppInit.c

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

=item * tkTable.c/h

Main tkTable code/header file.

=item * tkTableCell.c

Functions for the tkTable Cells

=item * tkTableCmd.c

Implements general commands of the table widget

=item * tkTableEdit.c

Implements editing functions for the table widget.

=item * tkTablePs.c

Implements postscript output for table widgets.

=item * tkTableTag.c

Implements tags for table widgets.

=item * tkTableWin.c

Implements embedded windows for table widgets


=back

=head1 Top Level perlTk Calling Notes

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

=head1 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.

=head2 .h files

=over 1

=item * Add tkVMacro.h to include

Also add:

 #include "tkPort.h"
 #include "tkInt.h"
 #include "tkVMacro.h"

=item * Remove UID type references?

Or change to Tk_State type?

=item * Change name of variables from char type to Var type

=item * Change command variables from char type to LangCallback type.

=back

=head2 .c files

=over

=item * Change any tclMath refs to <math.h> 

=item * Add #include "tkVMacro.h"

Before "tkScale.h" or equivalent.

=item * Change Tk_ConfigSpec table

C<Tk_CONFIG_STRINGS> for commands to C<TK_CONFIG_CALLBACK>.

Removed/Change UID type variables

Change TK_CONFIG_STRING to TK_CONFIG_SCALAR_VAR for -variable type
entries.

=item * Change XXXVarProc items

From char * name to Var name where appropriate.

=item * Change tkNormalUID states to TK_STATE_NORMAL

Also for disabled (TK_STATE_DISABLED)

=item * Change Tk_SetClass call to TkClassOption calls (Not Needed?)

=item * Change any numeric conversions.

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

=item * Change name of variables from char type to Var type

=item * 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.

=item * Modify the command routine to return a value like tkCanvas

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

=item * Tcl_VarEval Conversion

Any calls to Tcl_VarEval are converted to LangDoCallback

=item * Tcl_SplitList Conversion

Any calls to Tcl_SplitList are changed to Tcl_ListObjGetElements.

=item * Tcl_Merge Conversion

Any calls to Tcl_Merge are changed to Tcl_NewListObj.

=item * 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.

=item * 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.

=back

=head2 .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.