summaryrefslogtreecommitdiff
path: root/sci-visualization/xd3d/files/xd3d-8.3.1-c99.patch
blob: feb55ecbc8ff5e165343da1b05b0bd6162e184a7 (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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
Fix implicit function declarations: remove all underscore redefines, ask gfortran not
to append underscores to function names it tries to call, add some type definitions,
missing include for library function.
Clean up K&R style decls when we have perfectly fine modern declarations
https://bugs.gentoo.org/944746
https://bugs.gentoo.org/886609
https://bugs.gentoo.org/875236
Folded sed -i -e 's:"zutil.h":<zlib.h>:g' src/qlib/timestuff.c into patch
diff '--color=auto' -ru xd3d-8.3.1.old/src/qlib/perfide.c xd3d-8.3.1/src/qlib/perfide.c
--- xd3d-8.3.1.old/src/qlib/perfide.c	2025-03-15 21:14:08.508332791 +0300
+++ xd3d-8.3.1/src/qlib/perfide.c	2025-03-15 21:15:03.043870607 +0300
@@ -4,10 +4,6 @@
 #include <unistd.h>
 #include <stdlib.h>
 
-#ifndef F77_NO_UNDER_SCORE
-#define perfide perfide_
-#endif
-
 int LANG,DEBUG;
 
 #ifdef ENGLISH
@@ -23,7 +19,7 @@
 #endif
 
 
-perfide(ilang,idebug)
+int perfide(ilang,idebug)
 int *ilang,*idebug;
 {
     *ilang=LANG;
diff '--color=auto' -ru xd3d-8.3.1.old/src/qlib/timestuff.c xd3d-8.3.1/src/qlib/timestuff.c
--- xd3d-8.3.1.old/src/qlib/timestuff.c	2025-03-15 21:14:08.508332791 +0300
+++ xd3d-8.3.1/src/qlib/timestuff.c	2025-03-15 21:15:03.046444412 +0300
@@ -7,50 +7,10 @@
 #include <math.h>
 #include <string.h>
 #include <stdlib.h>
-#include "zutil.h"
+#include <zlib.h>
 
 FILE *fichin[99];
 
-#ifndef F77_NO_UNDER_SCORE
-#define datefichier datefichier_
-#define timec timec_
-#define timeprecisc timeprecisc_
-#define etimec etimec_
-#define idatec idatec_
-#define ctimec ctimec_
-#define fflushc fflushc_
-#define testtypebin testtypebin_
-#define ouvrebin ouvrebin_
-#define fermebin fermebin_
-#define litduncoup litduncoup_
-#define ecritduncoup ecritduncoup_
-#define litrecbin litrecbin_
-#define litrecbinspeed litrecbinspeed_
-#define ecritrecbin ecritrecbin_
-#define ecritrecbinspeed ecritrecbinspeed_
-#define fnaninf4 fnaninf4_
-#define fnaninf8 fnaninf8_
-#define fmemcpy fmemcpy_
-#define fmalloc fmalloc_
-#define fcalloc fcalloc_
-#define ffree ffree_
-#define frealloc frealloc_
-#define zouvrel zouvrel_
-#define zouvree zouvree_
-#define zferme zferme_
-#define zlit zlit_
-#define zliti zliti_
-#define zecrit zecrit_
-#define zlitrec zlitrec_
-#define zecritrec zecritrec_
-#define zlitrecbin zlitrecbin_
-#define zlitrecshortbin zlitrecshortbin_
-#define ztesttypebin ztesttypebin_
-#define zlitrecvbin zlitrecvbin_
-#define zcompress zcompress_
-#define zdecompress zdecompress_
-#endif
-
 /* 
 sur HP compiler avec : cc +O3 -DF77_NO_UNDER_SCORE -c timestuff.c
 */
diff '--color=auto' -ru xd3d-8.3.1.old/src/X/getenvc.c xd3d-8.3.1/src/X/getenvc.c
--- xd3d-8.3.1.old/src/X/getenvc.c	2025-03-15 21:14:08.505568877 +0300
+++ xd3d-8.3.1/src/X/getenvc.c	2025-03-15 21:15:03.044048075 +0300
@@ -8,16 +8,11 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 
-#ifndef F77_NO_UNDER_SCORE
-#define getenvc getenvc_
-#endif
-
-void getenvc(nom, val, lval_admis, lval_trouve)
-char *nom, *val ;
-int  *lval_admis, *lval_trouve ;
+void getenvc(char *nom, char *val, int *lval_admis, int *lval_trouve)
 {
-   char *ptenv, *getenv() ;
+   char *ptenv ;
    int i ;
 
    ptenv = getenv(nom) ;
diff '--color=auto' -ru xd3d-8.3.1.old/src/X/rotated.c xd3d-8.3.1/src/X/rotated.c
--- xd3d-8.3.1.old/src/X/rotated.c	2025-03-15 21:14:08.507568863 +0300
+++ xd3d-8.3.1/src/X/rotated.c	2025-03-15 21:15:03.044289517 +0300
@@ -133,26 +133,16 @@
 /* ---------------------------------------------------------------------- */
 
 
-static char            *my_strdup();
-static char            *my_strtok();
-
-float                   XRotVersion();
-void                    XRotSetMagnification();
-void                    XRotSetBoundingBoxPad();
-int                     XRotDrawString();
-int                     XRotDrawImageString();
-int                     XRotDrawAlignedString();
-int                     XRotDrawAlignedImageString();
-XPoint                 *XRotTextExtents();
-
-static XImage          *MakeXImage();
-static int              XRotPaintAlignedString();
-static int              XRotDrawHorizontalString();
-static RotatedTextItem *XRotRetrieveFromCache();
-static RotatedTextItem *XRotCreateTextItem();
-static void             XRotAddToLinkedList();
-static void             XRotFreeTextItem();
-static XImage          *XRotMagnifyImage();
+static XImage          *MakeXImage(Display *dpy, int w, int h);
+static int              XRotPaintAlignedString(Display *dpy, XFontStruct *font, float angle, Drawable drawable, GC gc, int x, int y, char *text,
+                                  int align, int bg);
+static int              XRotDrawHorizontalString(Display *dpy, XFontStruct *font, Drawable drawable, GC gc, int x, int y, char *text, 
+                             int align, int bg);
+static RotatedTextItem *XRotRetrieveFromCache(Display *dpy, XFontStruct *font, float angle, char *text, int align);
+static RotatedTextItem *XRotCreateTextItem(Display *dpy, XFontStruct *font, float angle, char *text, int align);
+static void             XRotAddToLinkedList(Display *dpy, RotatedTextItem *item);
+static void             XRotFreeTextItem(Display *dpy, RotatedTextItem *item);
+static XImage          *XRotMagnifyImage(Display *dpy, XImage *ximage);
 
 
 /* ---------------------------------------------------------------------- */
@@ -284,9 +274,7 @@
 /*  Create an XImage structure and allocate memory for it                 */
 /**************************************************************************/
 
-static XImage *MakeXImage(dpy, w, h)
-    Display *dpy;
-    int w, h;
+static XImage *MakeXImage(Display *dpy, int w, int h)
 {
     XImage *I;
     char *data;
@@ -405,17 +393,8 @@
 /*  Aligns and paints a rotated string                                    */
 /**************************************************************************/
 
-static int XRotPaintAlignedString(dpy, font, angle, drawable, gc, x, y, text,
-				  align, bg)
-    Display *dpy;
-    XFontStruct *font;
-    float angle;
-    Drawable drawable;
-    GC gc;
-    int x, y;
-    char *text;
-    int align;
-    int bg;
+static int XRotPaintAlignedString(Display *dpy, XFontStruct *font, float angle, Drawable drawable, GC gc, int x, int y, char *text,
+				  int align, int bg)
 {
     int i;
     GC my_gc;
@@ -647,16 +626,8 @@
 /*  Draw a horizontal string in a quick fashion                           */
 /**************************************************************************/
 
-static int XRotDrawHorizontalString(dpy, font, drawable, gc, x, y, text, 
-			     align, bg)
-    Display *dpy;
-    XFontStruct *font;
-    Drawable drawable;
-    GC gc;
-    int x, y;
-    char *text;
-    int align;
-    int bg;
+static int XRotDrawHorizontalString(Display *dpy, XFontStruct *font, Drawable drawable, GC gc, int x, int y, char *text,
+			     int align, int bg)
 {
     GC my_gc;
     int nl=1, i;
@@ -748,12 +719,7 @@
 /*       request, otherwise arrange for its creation                      */
 /**************************************************************************/
 
-static RotatedTextItem *XRotRetrieveFromCache(dpy, font, angle, text, align)
-    Display *dpy;
-    XFontStruct *font;
-    float angle;
-    char *text;
-    int align;
+static RotatedTextItem *XRotRetrieveFromCache(Display *dpy, XFontStruct *font, float angle, char *text, int align)
 {
     Font fid;
     char *font_name=NULL;
@@ -897,12 +863,7 @@
 /*  Create a rotated text item                                            */
 /**************************************************************************/
 
-static RotatedTextItem *XRotCreateTextItem(dpy, font, angle, text, align)
-    Display *dpy;
-    XFontStruct *font;
-    float angle;
-    char *text;
-    int align;
+static RotatedTextItem *XRotCreateTextItem(Display *dpy, XFontStruct *font, float angle, char *text, int align)
 {
     RotatedTextItem *item=NULL;
     Pixmap canvas;
@@ -1195,9 +1156,7 @@
 /*      from the front as required to keep cache size below limit         */
 /**************************************************************************/
 
-static void XRotAddToLinkedList(dpy, item)
-    Display *dpy;
-    RotatedTextItem *item;
+static void XRotAddToLinkedList(Display *dpy, RotatedTextItem *item)
 {
     
     static long int current_size=0;
@@ -1305,9 +1264,7 @@
 /*  Free the resources used by a text item                                */
 /**************************************************************************/
 
-static void XRotFreeTextItem(dpy, item)
-    Display *dpy;
-    RotatedTextItem *item;
+static void XRotFreeTextItem(Display *dpy, RotatedTextItem *item)
 {
     free(item->text);
 
@@ -1334,9 +1291,7 @@
 /* Magnify an XImage using bilinear interpolation                         */
 /**************************************************************************/
 
-static XImage *XRotMagnifyImage(dpy, ximage)
-    Display *dpy;
-    XImage *ximage;
+static XImage *XRotMagnifyImage(Display *dpy, XImage *ximage)
 {
     int i, j;
     float x, y;
diff '--color=auto' -ru xd3d-8.3.1.old/src/X/rotated.h xd3d-8.3.1/src/X/rotated.h
--- xd3d-8.3.1.old/src/X/rotated.h	2025-03-15 21:14:08.506568870 +0300
+++ xd3d-8.3.1/src/X/rotated.h	2025-03-15 21:15:03.044845038 +0300
@@ -40,8 +40,8 @@
      vlp@latina.inesc.pt (Vasco Lopes Paulo) */
 
 #if defined(__cplusplus) || defined(c_plusplus)
-
 extern "C" {
+#endif
 float   XRotVersion(char*, int);
 void    XRotSetMagnification(float);
 void    XRotSetBoundingBoxPad(int);
@@ -55,20 +55,9 @@
                                    Drawable, GC, int, int, char*, int);
 XPoint *XRotTextExtents(Display*, XFontStruct*, float,
 			int, int, char*, int);
+#if defined(__cplusplus) || defined(c_plusplus)
 }
-
-#else
-
-extern float   XRotVersion();
-extern void    XRotSetMagnification();
-extern void    XRotSetBoundingBoxPad();
-extern int     XRotDrawString();
-extern int     XRotDrawImageString();
-extern int     XRotDrawAlignedString();
-extern int     XRotDrawAlignedImageString();
-extern XPoint *XRotTextExtents();
-
-#endif /* __cplusplus */
+#endif
 
 /* ---------------------------------------------------------------------- */
 
diff '--color=auto' -ru xd3d-8.3.1.old/src/X/x11device.c xd3d-8.3.1/src/X/x11device.c
--- xd3d-8.3.1.old/src/X/x11device.c	2025-03-15 21:14:08.505568877 +0300
+++ xd3d-8.3.1/src/X/x11device.c	2025-03-15 21:15:03.045827221 +0300
@@ -33,97 +33,6 @@
 #define X_POS 100
 #define Y_POS 50
 
-#ifndef F77_NO_UNDER_SCORE
-#define drawarc drawarc_
-#define drawfilledarc drawfilledarc_
-#define getbuttonrelease getbuttonrelease_
-#define getxycx11 getxycx11_
-#define getxycx11b getxycx11b_
-#define getxycx11c getxycx11c_
-#define getxycx11d getxycx11d_
-#define getxycx11e getxycx11e_
-#define mybackingput mybackingput_
-#define mybackingput2 mybackingput2_
-#define mybackingsave mybackingsave_
-#define mybackingsave2 mybackingsave2_
-#define mybackingsaveloc mybackingsaveloc_
-#define myusleep myusleep_
-#define myusleep2 myusleep2_
-#define seldialog seldialog_
-#define selgraphix11 selgraphix11_
-#define viderbuff viderbuff_
-#define viderbuff2 viderbuff2_
-#define viderbuff3 viderbuff3_
-#define x11ColormapRVB x11ColormapRVB_
-#define x11allevents x11allevents_
-#define x11alleventsvraiment x11alleventsvraiment_
-#define x11askbacking x11askbacking_
-#define x11blackwhite x11blackwhite_
-#define x11bord x11bord_
-#define x11changecolormap x11changecolormap_
-#define x11changecurseur x11changecurseur_
-#define x11clean x11clean_
-#define x11clearrect x11clearrect_
-#define x11clip x11clip_
-#define x11cloche x11cloche_
-#define x11detruitpop x11detruitpop_
-#define x11device x11device_
-#define x11draw3 x11draw3_
-#define x11ecran x11ecran_
-#define x11effacepix x11effacepix_
-#define x11enddev x11enddev_
-#define x11etoudessin x11etoudessin_
-#define x11facette x11facette_
-#define x11facette2 x11facette2_
-#define x11garderect x11garderect_
-#define x11garderect2 x11garderect2_
-#define x11key x11key_
-#define x11linsrn x11linsrn_
-#define x11loadcolor x11loadcolor_
-#define x11loadcolorback x11loadcolorback_
-#define x11loadcolorbackold x11loadcolorbackold_
-#define x11loadcolorold x11loadcolorold_
-#define x11loadfont x11loadfont_
-#define x11loadfont2 x11loadfont2_
-#define x11magfont x11magfont_
-#define x11makecolormap x11makecolormap_
-#define x11makecolors x11makecolors_
-#define x11mark x11mark_
-#define x11meticone x11meticone_
-#define x11metrect x11metrect_
-#define x11metrect2 x11metrect2_
-#define x11nomfenetre x11nomfenetre_
-#define x11nomicone x11nomicone_
-#define x11opendisplay x11opendisplay_
-#define x11polyconvex x11polyconvex_
-#define x11polyligne x11polyligne_
-#define x11pop x11pop_
-#define x11popup x11popup_
-#define x11press x11press_
-#define x11progressif x11progressif_
-#define x11release x11release_
-#define x11sauvecolormap x11sauvecolormap_
-#define x11sauvepix x11sauvepix_
-#define x11sauvexpm x11sauvexpm_
-#define x11setcurs x11setcurs_
-#define x11szscrn x11szscrn_
-#define x11szwin x11szwin_
-#define x11taillefen x11taillefen_
-#define x11textextend x11textextend_
-#define x11textextendall x11textextendall_
-#define x11thermoini x11thermoini_
-#define x11thick x11thick_
-#define x11trouvecouleur x11trouvecouleur_
-#define x11txtsrn x11txtsrn_
-#define x11txtsrn2 x11txtsrn2_
-#define x11txtsrnrot x11txtsrnrot_
-#define x11txtsrnrot2 x11txtsrnrot2_
-#define x11txtsrnrot3 x11txtsrnrot3_
-#define x11unclip x11unclip_
-#define x11videqueue x11videqueue_
-#define zcolor zcolor_
-#endif
-
 Drawable drawable;
 Pixmap pixsauve, pixbacking, pixbacking2;
 Pixmap pixpoursauvegarde;
@@ -168,6 +77,23 @@
 
 Time timeclick0=0, timeclick1=0;
 
+static int x11ColormapRVB(Colormap color_maploc, float redloc[], float greenloc[], float blueloc[], int nbcolor);
+static int x11makecolors(float redloc[], float greenloc[], float blueloc[]);
+static int x11makecolormap(float redloc[], float greenloc[], float blueloc[], Colormap color_maploc, int nbcells);
+static int MyXSelectInput(Display *dpyloc, Window w, int mask);
+static int x11meticone();
+static int mybackingput();
+static int mybackingput2();
+
+int myusleep(int *microsecond);
+int mybackingsave();
+void mybackingsave2();
+int viderbuff2();
+int viderbuff3();
+int x11allevents();
+
+extern int zcolor(float redloc[], float greenloc[], float blueloc[], int *nbcolor);
+
 /*------------------------------------------------------------------*/
 void x11opendisplay(char *string)
 {
@@ -657,7 +583,7 @@
   XMapWindow(dpy, window2);
   XRaiseWindow(dpy, window2);
 
-  MyXSelectInput(dpy, window, NULL);
+  MyXSelectInput(dpy, window, 0);
   MyXSelectInput(dpy, window2, ExposureMask |
                                KeyPressMask |
                                ButtonPressMask |
@@ -801,10 +727,7 @@
     }
 }
 /*------------------------------------------------------------------*/
-int x11ColormapRVB(color_maploc, redloc, greenloc, blueloc, nbcolor)
-Colormap color_maploc;
-float redloc[], greenloc[], blueloc[];
-int nbcolor;
+int x11ColormapRVB(Colormap color_maploc, float redloc[], float greenloc[], float blueloc[], int nbcolor)
 {
   XColor rgb_def, hardware_def, colorcell_defs;
   unsigned short maxvalue;
@@ -824,8 +747,7 @@
   }
 }
 /*------------------------------------------------------------------*/
-int x11makecolors(redloc, greenloc, blueloc)
-float redloc[], greenloc[], blueloc[];
+int x11makecolors(float redloc[], float greenloc[], float blueloc[])
 {
   int index, size=16;
   int i,jtable;
@@ -871,10 +793,7 @@
   tabledirect[jtable] = coulproche.pixel;
 }
 /*------------------------------------------------------------------*/
-int x11makecolormap(redloc, greenloc, blueloc, color_maploc, nbcells)
-Colormap color_maploc;
-float redloc[], greenloc[], blueloc[];
-int nbcells;
+int x11makecolormap(float redloc[], float greenloc[], float blueloc[], Colormap color_maploc, int nbcells)
 {
   int index;
   XColor colorcell_defs[256];