Lines 48-68
Link Here
|
48 |
typedef struct { |
48 |
typedef struct { |
49 |
double *stack; |
49 |
double *stack; |
50 |
int sp; |
50 |
int sp; |
51 |
} stack_t; |
51 |
} MyStack_t; |
52 |
|
52 |
|
53 |
|
53 |
|
54 |
static stack_t * |
54 |
static MyStack_t * |
55 |
new_stack(unsigned int nuf_push) |
55 |
new_stack(unsigned int nuf_push) |
56 |
{ |
56 |
{ |
57 |
const int extra_stack_size = 10; |
57 |
const int extra_stack_size = 10; |
58 |
stack_t *s; |
58 |
MyStack_t *s; |
59 |
|
59 |
|
60 |
s = (stack_t *)malloc(sizeof(stack_t)); |
60 |
s = (MyStack_t *)malloc(sizeof(MyStack_t)); |
61 |
if (!s) { |
61 |
if (!s) { |
62 |
free(s); |
62 |
free(s); |
63 |
return NULL; |
63 |
return NULL; |
64 |
} |
64 |
} |
65 |
memset(s, 0, sizeof(stack_t)); |
65 |
memset(s, 0, sizeof(MyStack_t)); |
66 |
|
66 |
|
67 |
s->stack = (double *)malloc(sizeof(double) * (nuf_push + extra_stack_size)); |
67 |
s->stack = (double *)malloc(sizeof(double) * (nuf_push + extra_stack_size)); |
68 |
if (!s->stack) { |
68 |
if (!s->stack) { |
Lines 78-84
Link Here
|
78 |
|
78 |
|
79 |
|
79 |
|
80 |
static void |
80 |
static void |
81 |
free_stack(stack_t *s) |
81 |
free_stack(MyStack_t *s) |
82 |
{ |
82 |
{ |
83 |
if (s && s->stack) |
83 |
if (s && s->stack) |
84 |
free(s->stack); |
84 |
free(s->stack); |
Lines 91-97
Link Here
|
91 |
|
91 |
|
92 |
|
92 |
|
93 |
static void |
93 |
static void |
94 |
push(stack_t *s, double val) |
94 |
push(MyStack_t *s, double val) |
95 |
{ |
95 |
{ |
96 |
s->stack[s->sp++] = val; |
96 |
s->stack[s->sp++] = val; |
97 |
return; |
97 |
return; |
Lines 99-105
Link Here
|
99 |
|
99 |
|
100 |
|
100 |
|
101 |
static double |
101 |
static double |
102 |
pop(stack_t *s) |
102 |
pop(MyStack_t *s) |
103 |
{ |
103 |
{ |
104 |
return s->stack[--s->sp]; |
104 |
return s->stack[--s->sp]; |
105 |
} /* pop */ |
105 |
} /* pop */ |
Lines 140-146
Link Here
|
140 |
* Doesn't handle explicit x,y yet |
140 |
* Doesn't handle explicit x,y yet |
141 |
*/ |
141 |
*/ |
142 |
static void |
142 |
static void |
143 |
gerbv_draw_prim1(GdkPixmap *pixmap, GdkGC *gc, stack_t *s, int scale, |
143 |
gerbv_draw_prim1(GdkPixmap *pixmap, GdkGC *gc, MyStack_t *s, int scale, |
144 |
gint x, gint y) |
144 |
gint x, gint y) |
145 |
{ |
145 |
{ |
146 |
const int exposure_idx = 0; |
146 |
const int exposure_idx = 0; |
Lines 185-191
Link Here
|
185 |
* - how thick is the outline? |
185 |
* - how thick is the outline? |
186 |
*/ |
186 |
*/ |
187 |
static void |
187 |
static void |
188 |
gerbv_draw_prim4(GdkPixmap *pixmap, GdkGC *gc, stack_t *s, int scale, |
188 |
gerbv_draw_prim4(GdkPixmap *pixmap, GdkGC *gc, MyStack_t *s, int scale, |
189 |
gint x, gint y) |
189 |
gint x, gint y) |
190 |
{ |
190 |
{ |
191 |
const int exposure_idx = 0; |
191 |
const int exposure_idx = 0; |
Lines 252-258
Link Here
|
252 |
* Doesn't handle explicit x,y yet |
252 |
* Doesn't handle explicit x,y yet |
253 |
*/ |
253 |
*/ |
254 |
static void |
254 |
static void |
255 |
gerbv_draw_prim5(GdkPixmap *pixmap, GdkGC *gc, stack_t *s, int scale, |
255 |
gerbv_draw_prim5(GdkPixmap *pixmap, GdkGC *gc, MyStack_t *s, int scale, |
256 |
gint x, gint y) |
256 |
gint x, gint y) |
257 |
{ |
257 |
{ |
258 |
const int exposure_idx = 0; |
258 |
const int exposure_idx = 0; |
Lines 308-314
Link Here
|
308 |
* center of line of circle? |
308 |
* center of line of circle? |
309 |
*/ |
309 |
*/ |
310 |
static void |
310 |
static void |
311 |
gerbv_draw_prim6(GdkPixmap *pixmap, GdkGC *gc, stack_t *s, int scale, |
311 |
gerbv_draw_prim6(GdkPixmap *pixmap, GdkGC *gc, MyStack_t *s, int scale, |
312 |
gint x, gint y) |
312 |
gint x, gint y) |
313 |
{ |
313 |
{ |
314 |
const int outside_dia_idx = 2; |
314 |
const int outside_dia_idx = 2; |
Lines 385-391
Link Here
|
385 |
|
385 |
|
386 |
|
386 |
|
387 |
static void |
387 |
static void |
388 |
gerbv_draw_prim7(GdkPixmap *pixmap, GdkGC *gc, stack_t *s, int scale, |
388 |
gerbv_draw_prim7(GdkPixmap *pixmap, GdkGC *gc, MyStack_t *s, int scale, |
389 |
gint x, gint y) |
389 |
gint x, gint y) |
390 |
{ |
390 |
{ |
391 |
const int outside_dia_idx = 2; |
391 |
const int outside_dia_idx = 2; |
Lines 459-465
Link Here
|
459 |
* Doesn't handle and explicit x,y yet |
459 |
* Doesn't handle and explicit x,y yet |
460 |
*/ |
460 |
*/ |
461 |
static void |
461 |
static void |
462 |
gerbv_draw_prim20(GdkPixmap *pixmap, GdkGC *gc, stack_t *s, int scale, |
462 |
gerbv_draw_prim20(GdkPixmap *pixmap, GdkGC *gc, MyStack_t *s, int scale, |
463 |
gint x, gint y) |
463 |
gint x, gint y) |
464 |
{ |
464 |
{ |
465 |
const int exposure_idx = 0; |
465 |
const int exposure_idx = 0; |
Lines 514-520
Link Here
|
514 |
* Doesn't handle explicit x,y yet |
514 |
* Doesn't handle explicit x,y yet |
515 |
*/ |
515 |
*/ |
516 |
static void |
516 |
static void |
517 |
gerbv_draw_prim21(GdkPixmap *pixmap, GdkGC *gc, stack_t *s, int scale, |
517 |
gerbv_draw_prim21(GdkPixmap *pixmap, GdkGC *gc, MyStack_t *s, int scale, |
518 |
gint x, gint y) |
518 |
gint x, gint y) |
519 |
{ |
519 |
{ |
520 |
const int exposure_idx = 0; |
520 |
const int exposure_idx = 0; |
Lines 569-575
Link Here
|
569 |
* Doesn't handle explicit x,y yet |
569 |
* Doesn't handle explicit x,y yet |
570 |
*/ |
570 |
*/ |
571 |
static void |
571 |
static void |
572 |
gerbv_draw_prim22(GdkPixmap *pixmap, GdkGC *gc, stack_t *s, int scale, |
572 |
gerbv_draw_prim22(GdkPixmap *pixmap, GdkGC *gc, MyStack_t *s, int scale, |
573 |
gint x, gint y) |
573 |
gint x, gint y) |
574 |
{ |
574 |
{ |
575 |
const int exposure_idx = 0; |
575 |
const int exposure_idx = 0; |
Lines 627-633
Link Here
|
627 |
instruction_t *program, unsigned int nuf_push, |
627 |
instruction_t *program, unsigned int nuf_push, |
628 |
double *parameters, int scale, gint x, gint y) |
628 |
double *parameters, int scale, gint x, gint y) |
629 |
{ |
629 |
{ |
630 |
stack_t *s = new_stack(nuf_push); |
630 |
MyStack_t *s = new_stack(nuf_push); |
631 |
instruction_t *ip; |
631 |
instruction_t *ip; |
632 |
int handled = 1; |
632 |
int handled = 1; |
633 |
|
633 |
|