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 >
Internet Message Format  |  1990-12-28  |  3KB

  1. From: ajcd@cs.ed.ac.uk (Angus Duggan)
  2. Newsgroups: alt.sources
  3. Subject: pbmtopk/patch03
  4. Message-ID: <430@skye.cs.ed.ac.uk>
  5. Date: 21 Sep 90 17:31:40 GMT
  6.  
  7. Here's patch #3 for PBMtoPK. This removes the dependency on the "aint"
  8. function, which some maths libraries don't seem to have. A test for failed
  9. malloc of the bitcount array is also made.
  10.  
  11. ==
  12. Angus Duggan, Department of Computer Science,    | I'm pink, therefore I'm Spam.
  13. University of Edinburgh, JCMB,            |
  14. The King's Buildings, Mayfield Road,        | JANET:  ajcd@uk.ac.ed.lfcs
  15. Edinburgh, EH9 3JZ, Scotland.    | OR:  ajcd%lfcs.ed.ac.uk@nsfnet-relay.ac.uk
  16.  
  17. *** pbmtopk.c.~1~    Tue Sep  4 17:00:16 1990
  18. --- pbmtopk.c    Fri Sep 21 18:03:46 1990
  19. ***************
  20. *** 6,14 ****
  21.   
  22.   #include <stdio.h>
  23.   #include <pbm.h>
  24. - #include <math.h>
  25.   #include <ctype.h>
  26.   
  27.   #define MAXPKCHAR 256
  28.   #define MAXOPTLINE 200
  29.   #define MAXWIDTHTAB 256
  30. --- 6,15 ----
  31.   
  32.   #include <stdio.h>
  33.   #include <pbm.h>
  34.   #include <ctype.h>
  35.   
  36. + extern double atof();
  37.   #define MAXPKCHAR 256
  38.   #define MAXOPTLINE 200
  39.   #define MAXWIDTHTAB 256
  40. ***************
  41. *** 23,29 ****
  42.   #define chr(a) a
  43.     
  44.   #define round(a) ((int)(a+.5))
  45. ! #define fixword(d) ((int)aint((double)((d)*1048576)))
  46.   #define unfixword(f) ((double)(f) / 1048576)
  47.   #define fixrange(f) ((f) < 16777216 && (f) > -16777216)
  48.   #define designunits(p) ((p)*72.27/(double)resolution/unfixword(designsize))
  49. --- 24,30 ----
  50.   #define chr(a) a
  51.     
  52.   #define round(a) ((int)(a+.5))
  53. ! #define fixword(d) ((int)((double)(d)*1048576))
  54.   #define unfixword(f) ((double)(f) / 1048576)
  55.   #define fixrange(f) ((f) < 16777216 && (f) > -16777216)
  56.   #define designunits(p) ((p)*72.27/(double)resolution/unfixword(designsize))
  57. ***************
  58. *** 539,544 ****
  59. --- 540,549 ----
  60.       (integer *)malloc((unsigned int)((height+1)*sizeof(integer))) ;
  61.     bitcounts =
  62.       (integer *)malloc((unsigned int)((height*width)*sizeof(integer))) ;
  63. +   if (repeatptr == NULL || bitcounts == NULL) {
  64. +      fprintf(stderr, " Out of memory while allocating bit counts!\n");
  65. +      jumpout() ;
  66. +   }
  67.     for (i = 0 ; i < width ; i++) {
  68.       zerorow[i] = PBM_WHITE ;
  69.       onesrow[i] = PBM_BLACK ;
  70. *** Makefile.~1~    Tue Aug 14 11:35:05 1990
  71. --- Makefile        Fri Sep 21 18:16:33 1990
  72. ***************
  73. *** 9,15 ****
  74.   test: test.dvi test.pbm
  75.   
  76.   pbmtopk: pbmtopk.c
  77. !     $(CC) $(CFLAGS) -o pbmtopk pbmtopk.c -lm -lpbm
  78.   
  79.   pktopbm: pktopbm.c
  80.       $(CC) $(CFLAGS) -o pktopbm pktopbm.c -lpbm
  81. --- 9,15 ----
  82.   test: test.dvi test.pbm
  83.   
  84.   pbmtopk: pbmtopk.c
  85. !     $(CC) $(CFLAGS) -o pbmtopk pbmtopk.c -lpbm
  86.   
  87.   pktopbm: pktopbm.c
  88.       $(CC) $(CFLAGS) -o pktopbm pktopbm.c -lpbm
  89.