~ubuntu-branches/ubuntu/intrepid/plplot/intrepid

« back to all changes in this revision

Viewing changes to doc/docbook/src/tcl-extension.html

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2006-11-04 10:19:34 UTC
  • mfrom: (2.1.8 edgy)
  • Revision ID: james.westby@ubuntu.com-20061104101934-mlirvdg4gpwi6i5q
Tags: 5.6.1-10
* Orphaning the package
* debian/control: Changed the maintainer to the Debian QA Group

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
2
2
<HTML
3
3
><HEAD
4
4
><TITLE
5
5
>The PLplot Tcl Matrix Extension</TITLE
6
6
><META
7
7
NAME="GENERATOR"
8
 
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
 
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
9
9
REL="HOME"
10
10
TITLE="The PLplot Plotting Library"
11
11
HREF="index.html"><LINK
56
56
WIDTH="80%"
57
57
ALIGN="center"
58
58
VALIGN="bottom"
59
 
>Chapter 10. Using PLplot from Tcl</TD
 
59
>Chapter 11. Using PLplot from Tcl</TD
60
60
><TD
61
61
WIDTH="10%"
62
62
ALIGN="right"
104
104
>Using Tcl Matrices from Tcl</A
105
105
></H2
106
106
><P
107
 
>Much like the Tk widget creation commands, the Tcl <VAR
 
107
>Much like the Tk widget creation commands, the Tcl <TT
108
108
CLASS="literal"
109
 
>matrix</VAR
 
109
>matrix</TT
110
110
>
111
111
command considers its first argument to be the name of a new command
112
112
to be created, and the rest of the arguments to be modifiers.  After
113
 
the name, the next argument can be <VAR
 
113
the name, the next argument can be <TT
114
114
CLASS="literal"
115
 
>float</VAR
 
115
>float</TT
116
116
> or
117
 
<VAR
 
117
<TT
118
118
CLASS="literal"
119
 
>int</VAR
 
119
>int</TT
120
120
> or
121
121
contractions thereof.  Next follow a variable number of size arguments
122
122
which determine the size of the matrix in each of its dimensions.  For
135
135
></TR
136
136
></TABLE
137
137
><P
138
 
>constructs two matrices.  <VAR
 
138
>constructs two matrices.  <TT
139
139
CLASS="literal"
140
 
>x</VAR
 
140
>x</TT
141
141
> is a float matrix, with one
142
 
dimension and 100 elements.  <VAR
 
142
dimension and 100 elements.  <TT
143
143
CLASS="literal"
144
 
>y</VAR
 
144
>y</TT
145
145
> is an integer matrix, and has 2
146
146
dimensions each of size 64.
147
147
</P
174
174
form.  The proc which launches the Tk megawidget will complete, but
175
175
the megawidget, and the associated Tcl matrix are supposed to hang
176
176
around until they are explicitly destroyed.  To achieve this effect,
177
 
create the Tcl matrix with the <VAR
 
177
create the Tcl matrix with the <TT
178
178
CLASS="literal"
179
 
>-persist</VAR
 
179
>-persist</TT
180
180
> flag.  If present
181
181
(can be anywhere on the line), the matrix is not automatically deleted
182
182
when the scope of the current proc (method) ends.  Instead, you must
268
268
>However this has not been implemented yet...
269
269
</P
270
270
><P
271
 
>In any event, the <VAR
 
271
>In any event, the <TT
272
272
CLASS="literal"
273
 
>matrix</VAR
 
273
>matrix</TT
274
274
> command also supports an
275
 
<VAR
 
275
<TT
276
276
CLASS="literal"
277
 
>info</VAR
 
277
>info</TT
278
278
>
279
279
subcommand which reports the number of elements in each dimension:
280
280
</P
311
311
CLASS="filename"
312
312
>tclMatrix.h</TT
313
313
>, which has a definition for the
314
 
<VAR
 
314
<TT
315
315
CLASS="literal"
316
 
>tclMatrix</VAR
 
316
>tclMatrix</TT
317
317
> structure.  You fetch a pointer to the
318
 
<VAR
 
318
<TT
319
319
CLASS="literal"
320
 
>tclMatrix</VAR
 
320
>tclMatrix</TT
321
321
> structure using the
322
 
<VAR
 
322
<TT
323
323
CLASS="literal"
324
 
>Tcl_GetMatrixPtr</VAR
 
324
>Tcl_GetMatrixPtr</TT
325
325
> function.
326
326
</P
327
327
><P
365
365
CLASS="filename"
366
366
>tclMatrix.h</TT
367
367
> to learn the definition of the
368
 
<VAR
 
368
<TT
369
369
CLASS="literal"
370
 
>tclMatrix</VAR
 
370
>tclMatrix</TT
371
371
> structure, and see the examples in files like
372
372
<TT
373
373
CLASS="filename"
422
422
></TABLE
423
423
><P
424
424
>There are other things you can do too, see the definitions of the
425
 
<VAR
426
 
CLASS="literal"
427
 
>TclMatFloat</VAR
428
 
> and <VAR
429
 
CLASS="literal"
430
 
>TclMatInt</VAR
 
425
<TT
 
426
CLASS="literal"
 
427
>TclMatFloat</TT
 
428
> and <TT
 
429
CLASS="literal"
 
430
>TclMatInt</TT
431
431
> classes in
432
432
<TT
433
433
CLASS="filename"
464
464
</P
465
465
><P
466
466
>The way to register matrix extension subcommands is to call
467
 
<VAR
 
467
<TT
468
468
CLASS="literal"
469
 
>Tcl_MatrixInstallXtnsn</VAR
 
469
>Tcl_MatrixInstallXtnsn</TT
470
470
>: 
471
471
</P
472
472
><TABLE
486
486
><P
487
487
>In other words, make a function for handling the matrix extension
488
488
subcommand, with the same function signature (prototype) as
489
 
<VAR
 
489
<TT
490
490
CLASS="literal"
491
 
>tclMatrixXtnsnProc</VAR
 
491
>tclMatrixXtnsnProc</TT
492
492
>, and register the subcommand name along with
493
493
the function pointer.  For example, xtk04.c has:
494
494
</P
529
529
></TABLE
530
530
><P
531
531
>Then, inside the application initialization function
532
 
(<VAR
 
532
(<TT
533
533
CLASS="literal"
534
 
>Tcl_AppInit()</VAR
 
534
>Tcl_AppInit()</TT
535
535
> to long time Tcl users):
536
536
</P
537
537
><TABLE