home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d6xx
/
d676
/
fbm.lha
/
FBM
/
fbm10ami.zoo
/
fbm.diffs
< prev
next >
Wrap
Text File
|
1992-05-08
|
11KB
|
385 lines
diff -a -d +context fbm/fbext.c dh1:fbm10/fbext.c
*** fbm/fbext.c Mon Jun 25 04:17:50 1990
--- dh1:fbm10/fbext.c Wed Apr 08 23:26:14 1992
***************
*** 32,40 ****
* Created.
*****************************************************************/
! # include <stdio.h>
! # include <math.h>
! # include "fbm.h"
int allowrot = 0;
--- 32,48 ----
* Created.
*****************************************************************/
! #include <stdio.h>
! #include <math.h>
! #ifdef LATTICE_50
! #ifdef MFFP
! #include <mffp.h>
! #endif
! #ifdef M881
! #include <m68881.h>
! #endif
! #endif
! #include "fbm.h"
int allowrot = 0;
***************
*** 55,62 ****
{ int xo = -1, yo = -1, w = -1, h = -1, ow = -1, oh = -1, size = -1;
int mh = -1, mw = -1;
double aspect = -1.0;
! char title[FBM_MAX_TITLE], credits[FBM_MAX_TITLE];
! FBM input, rotated, output, *image = &input;
int outtype = FMT_FBM;
/* Clear the memory pointers so alloc_fbm won't be confused */
--- 63,70 ----
{ int xo = -1, yo = -1, w = -1, h = -1, ow = -1, oh = -1, size = -1;
int mh = -1, mw = -1;
double aspect = -1.0;
! static char title[FBM_MAX_TITLE], credits[FBM_MAX_TITLE];
! static FBM input, rotated, output, *image = &input;
int outtype = FMT_FBM;
/* Clear the memory pointers so alloc_fbm won't be confused */
diff -a -d +context fbm/fbinfo.c dh1:fbm10/fbinfo.c
*** fbm/fbinfo.c Mon Jun 25 04:19:08 1990
--- dh1:fbm10/fbinfo.c Tue Dec 11 17:01:36 1990
***************
*** 46,68 ****
FILE *infile;
char name[128], cmd[256];
! if (argc == 1)
! { binfo ((char *) NULL, stdin); }
! else
! { for (i=1; i<argc; i++)
! { strcpy (name, argv[i]);
! if (strcmp (name + strlen (name) - 2, ".Z") == 0)
! { sprintf (cmd, "(uncompress < %s | select 0 255) 2> /dev/null", name);
! if (infile = popen (cmd, "r"))
! { binfo (name, infile); pclose (infile); }
! else
! { perror (cmd); }
}
! else if (infile = fopen (argv[i], "r"))
! { binfo (argv[i], infile); fclose (infile); }
! else
! { perror (argv[i]); }
}
}
}
--- 46,75 ----
FILE *infile;
char name[128], cmd[256];
! if (argc == 1) {
! binfo ((char *) NULL, stdin);
! }
! else {
! for (i=1; i<argc; i++) {
! strcpy (name, argv[i]);
! if (strcmp (name + strlen (name) - 2, ".Z") == 0) {
! #ifndef AMIGA
! sprintf (cmd, "(uncompress < %s | select 0 255) 2> /dev/null", name);
! if (infile = popen (cmd, "r")) {
! binfo (name, infile);
! pclose (infile);
! }
! else perror (cmd);
! #else
! fprintf(stderr,"error: File is compressed\n");
! perror("aborted");
! #endif
}
! else if (infile = fopen (argv[i], "r")) {
! binfo (argv[i], infile); fclose (infile);
! }
! else perror (argv[i]);
}
}
}
diff -a -d +context fbm/fbm.h dh1:fbm10/fbm.h
*** fbm/fbm.h Mon Jun 25 04:19:08 1990
--- dh1:fbm10/fbm.h Fri Dec 14 11:08:13 1990
***************
*** 107,112 ****
--- 107,113 ----
unsigned char *bm; /* Pointer to raw bits */
} FBM;
+ #ifndef ANSI_C
/* Functions */
double atof ();
char *strcpy();
***************
*** 118,123 ****
--- 119,137 ----
long time (), get_long ();
int get_short ();
+ #else
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <time.h>
+
+ long get_long ();
+ int get_short ();
+ #endif
+
+ #ifdef LATTICE_50
+ double atof(const char *s);
+ #endif
/* Macro for getting next magic char */
# define NEXTMCH(F,S,L) (((L) > 0) ? ((L)--, *(S)++) : getc (F))
diff -a -d +context fbm/fbps.c dh1:fbm10/fbps.c
*** fbm/fbps.c Mon Jun 25 04:19:50 1990
--- dh1:fbm10/fbps.c Tue Dec 11 17:12:20 1990
***************
*** 38,43 ****
--- 38,47 ----
# include <math.h>
# include "fbm.h"
+ #ifdef ANSI_C
+ #define index(a,b) strchr(a,b)
+ #endif
+
# define PAPERWIDTH 8.5 /* inches */
# define BIGPAPERWIDTH 11 /* inches */
# define PAPERHEIGHT 11 /* inches */
***************
*** 270,277 ****
char *txt;
{ static char buf[512];
register char *s = buf;
char *index ();
!
for (; *txt; txt++)
{ if (index ("()\\", *txt))
{ *s++ = '\\'; *s++ = *txt; }
--- 274,283 ----
char *txt;
{ static char buf[512];
register char *s = buf;
+ #ifndef ANSI_C
char *index ();
! #endif
!
for (; *txt; txt++)
{ if (index ("()\\", *txt))
{ *s++ = '\\'; *s++ = *txt; }
diff -a -d +context fbm/fbquant.c dh1:fbm10/fbquant.c
*** fbm/fbquant.c Mon Jun 25 04:19:56 1990
--- dh1:fbm10/fbquant.c Fri Dec 14 12:50:49 1990
***************
*** 109,114 ****
--- 109,122 ----
short color;
} PIXEL;
+ #ifdef ANSI_C
+ sample_image (FBM *image, int *hist);
+ build_colormap (int *hist, COLOR *cmap, int colors);
+ split_box (PIXEL *box, int boxlen, int clr, int numclr, COLOR *cmap);
+ box_weight (PIXEL *box, int boxlen);
+ clr_quantize (FBM *input, FBM *output, COLOR *cmap, int colors);
+ #endif
+
int debug=0, verbose=0, colors=256, showcolor=0, dither=1;
int resbits = -1, resmask = 0xff;
double flesh = 1.0, atof();
***************
*** 131,137 ****
main (argc, argv)
char *argv[];
{ FBM input, output, mapimage; /* Images */
! int hist[CUBSIZ]; /* Color cube 32x32x32 for histogram */
int outtype = DEF_8BIT; /* Output format desired */
char *mapfile = NULL; /* Name of file to copy map from */
register int c;
--- 139,145 ----
main (argc, argv)
char *argv[];
{ FBM input, output, mapimage; /* Images */
! static int hist[CUBSIZ]; /* Color cube 32x32x32 for histogram */
int outtype = DEF_8BIT; /* Output format desired */
char *mapfile = NULL; /* Name of file to copy map from */
register int c;
***************
*** 142,173 ****
mapimage.bm = mapimage.cm = (unsigned char *) NULL;
/* Get the options */
! while (--argc > 0 && (*++argv)[0] == '-')
! { while (*++(*argv))
! { switch (**argv)
! { case 'c': colors = atoi (*argv+1); SKIPARG; break;
case 'f': flesh = atof (*argv+1); SKIPARG; break;
case 'r': resbits = atoi (*argv+1); SKIPARG; break;
case 'm': mapfile = *argv+1; SKIPARG; break;
! case 'n': dither = 0; break;
! case 'd': debug++; break;
! case 'D': showcolor++; break;
! case 'v': verbose++; break;
! case 'A': outtype = FMT_ATK; break;
! case 'B': outtype = FMT_FACE; break;
! case 'F': outtype = FMT_FBM; break;
! case 'G': outtype = FMT_GIF; break;
! case 'I': outtype = FMT_IFF; break;
! case 'L': outtype = FMT_LEAF; break;
! case 'M': outtype = FMT_MCP; break;
! case 'P': outtype = FMT_PBM; break;
! case 'R': outtype = FMT_RLE; break;
! case 'S': outtype = FMT_SUN; break;
! case 'T': outtype = FMT_TIFF; break;
! case 'X': outtype = FMT_X11; break;
! case 'Z': outtype = FMT_PCX; break;
! default: fprintf (stderr, "%s\n", USAGE);
! exit (1);
}
}
}
--- 150,181 ----
mapimage.bm = mapimage.cm = (unsigned char *) NULL;
/* Get the options */
! while (--argc > 0 && (*++argv)[0] == '-') {
! while (*++(*argv)) {
! switch (**argv) {
! case 'c': colors = atoi (*argv+1); SKIPARG; break;
case 'f': flesh = atof (*argv+1); SKIPARG; break;
case 'r': resbits = atoi (*argv+1); SKIPARG; break;
case 'm': mapfile = *argv+1; SKIPARG; break;
! case 'n': dither = 0; break;
! case 'd': debug++; break;
! case 'D': showcolor++; break;
! case 'v': verbose++; break;
! case 'A': outtype = FMT_ATK; break;
! case 'B': outtype = FMT_FACE; break;
! case 'F': outtype = FMT_FBM; break;
! case 'G': outtype = FMT_GIF; break;
! case 'I': outtype = FMT_IFF; break;
! case 'L': outtype = FMT_LEAF; break;
! case 'M': outtype = FMT_MCP; break;
! case 'P': outtype = FMT_PBM; break;
! case 'R': outtype = FMT_RLE; break;
! case 'S': outtype = FMT_SUN; break;
! case 'T': outtype = FMT_TIFF; break;
! case 'X': outtype = FMT_X11; break;
! case 'Z': outtype = FMT_PCX; break;
! default: fprintf (stderr, "%s\n", USAGE);
! exit (1);
}
}
}
***************
*** 338,344 ****
COLOR *cmap;
int colors;
{ register int i, k;
! PIXEL box[CUBSIZ];
register PIXEL *b;
int used=0, t;
--- 346,352 ----
COLOR *cmap;
int colors;
{ register int i, k;
! static PIXEL box[CUBSIZ];
register PIXEL *b;
int used=0, t;
diff -a -d +context fbm/flread.c dh1:fbm10/flread.c
*** fbm/flread.c Mon Jun 25 03:19:06 1990
--- dh1:fbm10/flread.c Tue Dec 11 16:05:03 1990
***************
*** 71,88 ****
peekch = fgetc (rfile);
/* If the image is compressed, uncompress it while reading */
! if (peekch == COMPRESSED_CHAR)
! { if (rfile == stdin)
! { if (lseek (fileno (rfile), 0L, 0) < 0) perror ("lseek");
rfile = popen ("uncompress", "r");
}
! else
! { fclose (rfile);
sprintf (cmd, "uncompress < %s", fname);
rfile = popen (cmd, "r");
! }
do_pclose++;
!
peekch = fgetc (rfile);
}
--- 71,92 ----
peekch = fgetc (rfile);
/* If the image is compressed, uncompress it while reading */
! if (peekch == COMPRESSED_CHAR) {
! #ifndef AMIGA
! if (rfile == stdin) {
! if (lseek (fileno (rfile), 0L, 0) < 0) perror ("lseek");
rfile = popen ("uncompress", "r");
}
! else {
! fclose (rfile);
sprintf (cmd, "uncompress < %s", fname);
rfile = popen (cmd, "r");
! };
do_pclose++;
! #else
! fprintf(stderr,"error: File is in compressed format\n");
! exit(1);
! #endif
peekch = fgetc (rfile);
}
***************
*** 106,113 ****
--- 110,121 ----
default: fprintf (stderr, "Unknown magic char %03o\n", peekch);
}
+ #ifndef AMIGA
if (do_pclose) pclose (rfile);
else fclose (rfile);
+ #else
+ fclose (rfile);
+ #endif
return (result);
}
diff -a -d +context fbm/tiff2fbm.c dh1:fbm10/tiff2fbm.c
*** fbm/tiff2fbm.c Mon Jun 25 04:20:28 1990
--- dh1:fbm10/tiff2fbm.c Thu Apr 09 01:44:58 1992
***************
*** 85,91 ****
case 'a': aspect = atof (*argv+1); SKIPARG; break;
case 't': title = *argv+1; SKIPARG; break;
case 'c': credits = *argv+1; SKIPARG; break;
! default: if (!isdigit (argv[0][1]))
{ fprintf (stderr, "%s\n", USAGE);
exit (1);
}
--- 85,91 ----
case 'a': aspect = atof (*argv+1); SKIPARG; break;
case 't': title = *argv+1; SKIPARG; break;
case 'c': credits = *argv+1; SKIPARG; break;
! default: if (!isdigit (argv[0][0]))
{ fprintf (stderr, "%s\n", USAGE);
exit (1);
}