home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
1
/
1849
< prev
next >
Wrap
Internet Message Format
|
1990-12-28
|
3KB
From: ajcd@cs.ed.ac.uk (Angus Duggan)
Newsgroups: alt.sources
Subject: pbmtopk/patch03
Message-ID: <430@skye.cs.ed.ac.uk>
Date: 21 Sep 90 17:31:40 GMT
Here's patch #3 for PBMtoPK. This removes the dependency on the "aint"
function, which some maths libraries don't seem to have. A test for failed
malloc of the bitcount array is also made.
==
Angus Duggan, Department of Computer Science, | I'm pink, therefore I'm Spam.
University of Edinburgh, JCMB, |
The King's Buildings, Mayfield Road, | JANET: ajcd@uk.ac.ed.lfcs
Edinburgh, EH9 3JZ, Scotland. | OR: ajcd%lfcs.ed.ac.uk@nsfnet-relay.ac.uk
*** pbmtopk.c.~1~ Tue Sep 4 17:00:16 1990
--- pbmtopk.c Fri Sep 21 18:03:46 1990
***************
*** 6,14 ****
#include <stdio.h>
#include <pbm.h>
- #include <math.h>
#include <ctype.h>
#define MAXPKCHAR 256
#define MAXOPTLINE 200
#define MAXWIDTHTAB 256
--- 6,15 ----
#include <stdio.h>
#include <pbm.h>
#include <ctype.h>
+ extern double atof();
+
#define MAXPKCHAR 256
#define MAXOPTLINE 200
#define MAXWIDTHTAB 256
***************
*** 23,29 ****
#define chr(a) a
#define round(a) ((int)(a+.5))
! #define fixword(d) ((int)aint((double)((d)*1048576)))
#define unfixword(f) ((double)(f) / 1048576)
#define fixrange(f) ((f) < 16777216 && (f) > -16777216)
#define designunits(p) ((p)*72.27/(double)resolution/unfixword(designsize))
--- 24,30 ----
#define chr(a) a
#define round(a) ((int)(a+.5))
! #define fixword(d) ((int)((double)(d)*1048576))
#define unfixword(f) ((double)(f) / 1048576)
#define fixrange(f) ((f) < 16777216 && (f) > -16777216)
#define designunits(p) ((p)*72.27/(double)resolution/unfixword(designsize))
***************
*** 539,544 ****
--- 540,549 ----
(integer *)malloc((unsigned int)((height+1)*sizeof(integer))) ;
bitcounts =
(integer *)malloc((unsigned int)((height*width)*sizeof(integer))) ;
+ if (repeatptr == NULL || bitcounts == NULL) {
+ fprintf(stderr, " Out of memory while allocating bit counts!\n");
+ jumpout() ;
+ }
for (i = 0 ; i < width ; i++) {
zerorow[i] = PBM_WHITE ;
onesrow[i] = PBM_BLACK ;
*** Makefile.~1~ Tue Aug 14 11:35:05 1990
--- Makefile Fri Sep 21 18:16:33 1990
***************
*** 9,15 ****
test: test.dvi test.pbm
pbmtopk: pbmtopk.c
! $(CC) $(CFLAGS) -o pbmtopk pbmtopk.c -lm -lpbm
pktopbm: pktopbm.c
$(CC) $(CFLAGS) -o pktopbm pktopbm.c -lpbm
--- 9,15 ----
test: test.dvi test.pbm
pbmtopk: pbmtopk.c
! $(CC) $(CFLAGS) -o pbmtopk pbmtopk.c -lpbm
pktopbm: pktopbm.c
$(CC) $(CFLAGS) -o pktopbm pktopbm.c -lpbm