~ubuntu-branches/debian/sid/bc/sid

« back to all changes in this revision

Viewing changes to dc/stack.c

  • Committer: Bazaar Package Importer
  • Author(s): Francois Marier
  • Date: 2009-04-16 10:23:39 UTC
  • Revision ID: james.westby@ubuntu.com-20090416102339-l7970sr667eekbvw
Tags: 1.06.94-3.1
* Non-maintainer upload with John's permission.
* Apply patch to restore the .dcrc config file (closes: #472250)
* Merge patch from Ubuntu to notice read and write errors on
  input and output (closes: #488735)
* Include the bc manual (HTML) in the bc binary package

* Bump Standards Version to 3.8.1
* Bump debhelper compatibility to 7
* debian/rules: replace "dh_clean -k" with "dh_prep"
* debian/control: Add homepage field
* Fix hyphens in the bc and dc manpages
* Add a watch file
* debian/dc.doc-base: Remove leading whitespace
* debian/dc.doc-base: Move to section Science/Mathematics

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
#include "dc-regdef.h"
39
39
 
40
40
/* an oft-used error message: */
41
 
#define Empty_Stack     fprintf(stderr, "%s: stack empty\n", progname)
 
41
#define Empty_Stack do{                                 \
 
42
    fprintf(stderr, "%s: stack empty\n", progname);     \
 
43
    checkferror_output(stderr);                         \
 
44
  }while(0)
42
45
 
43
46
 
44
47
/* simple linked-list implementation suffices: */
94
97
        if (dc_stack->value.dc_type!=DC_NUMBER
95
98
                        || dc_stack->link->value.dc_type!=DC_NUMBER){
96
99
                fprintf(stderr, "%s: non-numeric value\n", progname);
 
100
                checkferror_output(stderr);
97
101
                return;
98
102
        }
99
103
        (void)dc_pop(&b);
134
138
        if (dc_stack->value.dc_type!=DC_NUMBER
135
139
                        || dc_stack->link->value.dc_type!=DC_NUMBER){
136
140
                fprintf(stderr, "%s: non-numeric value\n", progname);
 
141
                checkferror_output(stderr);
137
142
                return;
138
143
        }
139
144
        (void)dc_pop(&b);
172
177
        if (dc_stack->value.dc_type!=DC_NUMBER
173
178
                        || dc_stack->link->value.dc_type!=DC_NUMBER){
174
179
                fprintf(stderr, "%s: non-numeric value\n", progname);
 
180
                checkferror_output(stderr);
175
181
                return 0;
176
182
        }
177
183
        (void)dc_pop(&b);
209
215
                        || dc_stack->link->value.dc_type!=DC_NUMBER
210
216
                        || dc_stack->link->link->value.dc_type!=DC_NUMBER){
211
217
                fprintf(stderr, "%s: non-numeric value\n", progname);
 
218
                checkferror_output(stderr);
212
219
                return;
213
220
        }
214
221
        (void)dc_pop(&c);
327
334
        r = dc_register[regid];
328
335
        if (r==NULL || r->value.dc_type==DC_UNINITIALIZED){
329
336
                fprintf(stderr, "%s: register ", progname);
 
337
                checkferror_output(stderr);
330
338
                dc_show_id(stderr, regid, " is empty\n");
331
339
                return DC_FAIL;
332
340
        }
401
409
        r = dc_register[stackid];
402
410
        if (r == NULL){
403
411
                fprintf(stderr, "%s: stack register ", progname);
 
412
                checkferror_output(stderr);
404
413
                dc_show_id(stderr, stackid, " is empty\n");
405
414
                return DC_FAIL;
406
415
        }