aboutsummaryrefslogtreecommitdiff
blob: 31596e6f473073f11f79726324aeacec24c04c25 (plain)
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
 src/ElmerPost.c          | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/modules/matctcl.c    |  8 ++++++++
 src/modules/readfile.c   |  4 ++++
 src/modules/transforms.c | 40 ++++++++++++++++++++++++++++++++++++++++
 src/screensave.c         | 12 ++++++++++++
 5 files changed, 112 insertions(+)

diff --git a/src/ElmerPost.c b/src/ElmerPost.c
index 2a238b0..b9e8df5 100644
--- a/src/ElmerPost.c
+++ b/src/ElmerPost.c
@@ -183,7 +183,11 @@ static int SetParentObject( ClientData cl,Tcl_Interp *interp,int argc,char **arg
    obj = (object_t *)obj_find( &VisualObject,argv[1] );
    if ( !obj )
    {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
       sprintf( interp->result, "parent: no such object [%s]", argv[1] );
+#else
+      sprintf( Tcl_GetStringResult(interp), "parent: no such object [%s]", argv[1] );
+#endif
       return TCL_ERROR;
    }
 
@@ -346,13 +350,21 @@ static int ClipPlane( ClientData cl,Tcl_Interp *interp,int argc,char **argv)
     int i,id;
 
     if ( argc != 6 ) {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "clip: Wrong number of arguments.\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "clip: Wrong number of arguments.\n" );
+#endif
         return TCL_ERROR;
     }
 
     sscanf( argv[1], "%d",  &id );
     if ( id < 0 || id > 5 ) {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "clip: Plane argument should be from a int from 0..5.\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "clip: Plane argument should be from a int from 0..5.\n" );
+#endif
         return TCL_ERROR;
     }
     CurrentObject->ClipPlane[id] = id;
@@ -779,7 +791,11 @@ static int TimeStep(ClientData cl,Tcl_Interp *interp,int argc,char **argv)
 
     if ( argc != 2 )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "c_TimeStep: wrong number of parameters.\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "c_TimeStep: wrong number of parameters.\n" );
+#endif
         return TCL_ERROR;
     }
 
@@ -790,7 +806,11 @@ static int TimeStep(ClientData cl,Tcl_Interp *interp,int argc,char **argv)
 
     if ( n < 0  || n >= ElementModel->NofTimesteps )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "c_TimeStep: Invalid timestep.\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "c_TimeStep: Invalid timestep.\n" );
+#endif
         return TCL_ERROR;
     }
 
@@ -1028,7 +1048,11 @@ static int CurrentCamera(ClientData cl,Tcl_Interp *interp,int argc,char **argv)
 
     if ( argc != 2 )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "camera: wrong number of arguments\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "camera: wrong number of arguments\n" );
+#endif
         return TCL_ERROR;
     }
 
@@ -1038,7 +1062,11 @@ static int CurrentCamera(ClientData cl,Tcl_Interp *interp,int argc,char **argv)
         if ( strcmp( cam->Name, argv[1] ) == 0 )
         {
             cam_set_current( cam );
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
             sprintf( interp->result, "%d", i );
+#else
+            sprintf( Tcl_GetStringResult(interp), "%d", i );
+#endif
             return TCL_OK;
         }
     }
@@ -1548,7 +1576,11 @@ static int ShowString( ClientData cl,Tcl_Interp *interp,int argc,char **argv )
 
     if ( argc < 5 )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "string: Wrong number of arguments.\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "string: Wrong number of arguments.\n" );
+#endif
         return TCL_ERROR;
     }
 
@@ -1587,7 +1619,11 @@ static int SetFont( ClientData cl,Tcl_Interp *interp,int argc,char **argv )
   int i;
     if ( argc < 1 )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "Set font: Wrong number of arguments.\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "Set font: Wrong number of arguments.\n" );
+#endif
         return TCL_ERROR;
     }
 
@@ -2146,7 +2182,11 @@ static int WindowSize( ClientData cl,Tcl_Interp *interp,int argc,char **argv )
 
 
    if ( argc < 3 ) {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
       sprintf( interp->result, "Usage: winsize width height" );
+#else
+      sprintf( Tcl_GetStringResult(interp), "Usage: winsize width height" );
+#endif
       return TCL_ERROR;
    }
 
@@ -2184,7 +2224,11 @@ static int WindowSize( ClientData cl,Tcl_Interp *interp,int argc,char **argv )
 static int WindowPosition( ClientData cl,Tcl_Interp *interp,int argc,char **argv )
 {
    if ( argc < 3 ) {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
       sprintf( interp->result, "Usage: winpos xpos ypos" );
+#else
+      sprintf( Tcl_GetStringResult(interp), "Usage: winpos xpos ypos" );
+#endif
       return TCL_ERROR;
    }
 
@@ -2210,7 +2254,11 @@ static int MPlayer( ClientData cl, Tcl_Interp *interp, int argc, char **argv )
 #else
 
   if( argc < 2 ) {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
     sprintf( interp->result, "Usage: mplayer filename");
+#else
+    sprintf( Tcl_GetStringResult(interp), "Usage: mplayer filename");
+#endif
     return TCL_ERROR;
   }
 
diff --git a/src/modules/matctcl.c b/src/modules/matctcl.c
index 4d6b64f..b69f9ba 100755
--- a/src/modules/matctcl.c
+++ b/src/modules/matctcl.c
@@ -79,11 +79,19 @@ static VARIABLE *matc_tcl( VARIABLE *ptr )
 
    FREEMEM( command );
 
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
    if ( TCLInterp->result && (n=strlen(TCLInterp->result))>0 )
    {
        res = var_temp_new( TYPE_STRING,1,n );
        for( i=0; i<n; i++ ) M( res,0,i ) = TCLInterp->result[i];
    }
+#else
+   if ( Tcl_GetStringResult(TCLInterp) && (n=strlen(Tcl_GetStringResult(TCLInterp)))>0 )
+   {
+       res = var_temp_new( TYPE_STRING,1,n );
+       for( i=0; i<n; i++ ) M( res,0,i ) = Tcl_GetStringResult(TCLInterp)[i];
+   }
+#endif
 
    return res;
 }
diff --git a/src/modules/readfile.c b/src/modules/readfile.c
index 254601c..0bcc8f7 100755
--- a/src/modules/readfile.c
+++ b/src/modules/readfile.c
@@ -90,7 +90,11 @@ static int epReadFile( ClientData cl,Tcl_Interp *interp,int argc,char **argv )
     fp = fopen( argv[1], "r" ); 
     if ( !fp )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
        sprintf( interp->result, "ReadModel: can't open file [%s]\n",argv[1] );
+#else
+       sprintf( Tcl_GetStringResult(interp), "ReadModel: can't open file [%s]\n",argv[1] );
+#endif
        return TCL_ERROR;
     }
 
diff --git a/src/modules/transforms.c b/src/modules/transforms.c
index 19808ff..4038210 100755
--- a/src/modules/transforms.c
+++ b/src/modules/transforms.c
@@ -72,7 +72,11 @@ static int TrnPriority(ClientData cl,Tcl_Interp *interp,int argc,char **argv)
 
     if ( argc != 2 )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "cTrnPriority: wrong number of parameters\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "cTrnPriority: wrong number of parameters\n" );
+#endif
         return TCL_ERROR;
     }
 
@@ -80,7 +84,11 @@ static int TrnPriority(ClientData cl,Tcl_Interp *interp,int argc,char **argv)
 
     if ( n <= 0 )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "cTrnPriority: wrong number of parameters\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "cTrnPriority: wrong number of parameters\n" );
+#endif
         return TCL_ERROR;
     }
 
@@ -96,7 +104,11 @@ static int RotPriority(ClientData cl,Tcl_Interp *interp,int argc,char **argv)
 
     if ( argc != 2 )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "cRotPrioryty: wrong number of parameters\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "cRotPrioryty: wrong number of parameters\n" );
+#endif
         return TCL_ERROR;
     }
 
@@ -104,7 +116,11 @@ static int RotPriority(ClientData cl,Tcl_Interp *interp,int argc,char **argv)
 
     if ( n <= 0 )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "cRotPriority: wrong number of parameters\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "cRotPriority: wrong number of parameters\n" );
+#endif
         return TCL_ERROR;
     }
 
@@ -130,7 +146,11 @@ static int Rotate(ClientData cl,Tcl_Interp *interp,int argc,char **argv)
 
     if ( argc != 4 )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "cRotate: wrong number of parameters\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "cRotate: wrong number of parameters\n" );
+#endif
         return TCL_ERROR;
     }
 
@@ -138,7 +158,11 @@ static int Rotate(ClientData cl,Tcl_Interp *interp,int argc,char **argv)
 
     if ( n <= 0 )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "cRotate: wrong number of parameters\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "cRotate: wrong number of parameters\n" );
+#endif
         return TCL_ERROR;
     }
 
@@ -156,7 +180,11 @@ static int Scale(ClientData cl,Tcl_Interp *interp,int argc,char **argv)
 
     if ( argc != 4 )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "cScale: wrong number of parameters\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "cScale: wrong number of parameters\n" );
+#endif
         return TCL_ERROR;
     }
 
@@ -164,7 +192,11 @@ static int Scale(ClientData cl,Tcl_Interp *interp,int argc,char **argv)
 
     if ( n <= 0 )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "cScale: wrong number of parameters\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "cScale: wrong number of parameters\n" );
+#endif
         return TCL_ERROR;
     }
 
@@ -182,13 +214,21 @@ static int Translate(ClientData cl,Tcl_Interp *interp,int argc,char **argv)
 
     if ( argc != 4 )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "cScale: wrong number of parameters\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "cScale: wrong number of parameters\n" );
+#endif
         return TCL_ERROR;
     }
 
     if ( (n = sscanf( argv[3], "%lf %lf %lf", &x,&y,&z ) ) <= 0 )
     {
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
         sprintf( interp->result, "cScale: wrong number of parameters\n" );
+#else
+        sprintf( Tcl_GetStringResult(interp), "cScale: wrong number of parameters\n" );
+#endif
         return TCL_ERROR;
     }
 
diff --git a/src/screensave.c b/src/screensave.c
index ae4f577..703fe24 100755
--- a/src/screensave.c
+++ b/src/screensave.c
@@ -56,7 +56,11 @@ static int ScreenSave( ClientData cl,Tcl_Interp *interp,int argc,char **argv )
       sprintf( interp->result, 
        "screensave: can't open [%s] for writing!\n", argv[1] );
 #else
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
       sprintf( interp->result, 
+#else
+      sprintf( Tcl_GetStringResult(interp), 
+#endif
         "screensave: can't open [%s] for writing:\n%s\n", 
               argv[1], strerror(errno) );
 #endif
@@ -76,7 +80,11 @@ static int ScreenSave( ClientData cl,Tcl_Interp *interp,int argc,char **argv )
       sprintf( interp->result,
             "screensave: can't allocate enough memory!\n" );
 #else
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
       sprintf( interp->result,
+#else
+      sprintf( Tcl_GetStringResult(interp),
+#endif
         "screensave: can't allocate enough memory:\n%s\n",
             strerror(errno) );
 #endif
@@ -100,7 +108,11 @@ static int ScreenSave( ClientData cl,Tcl_Interp *interp,int argc,char **argv )
          sprintf( interp->result,
            "screensave: error writing to [%s]!\n", argv[1] );
 #else
+#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6
          sprintf( interp->result,
+#else
+         sprintf( Tcl_GetStringResult(interp),
+#endif
            "screensave: error writing to [%s]:\n%s\n",
                argv[1], strerror(errno) );
 #endif