o) Patch reverse compface part to faces 1.6.1 port

- Missing uncompface -X option used in exmh
   - Missing filter programs to generate ikon file
   - I will try communicate the necessary add ons to the
     new developers of faces.
This commit is contained in:
Lars Koeller 2003-01-19 19:07:23 +00:00
parent c93140c837
commit d60b460b03
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=73506
19 changed files with 2675 additions and 8 deletions

View file

@ -8,7 +8,7 @@
PORTNAME= faces
PORTVERSION= 1.7.7
#PORTREVISION= 1
PORTREVISION= 1
CATEGORIES= mail
MASTER_SITES= ftp://ftp.cs.indiana.edu/pub/faces/faces/
@ -101,7 +101,12 @@ post-install:
.if !defined(NOPORTDOCS)
if [ ! -e ${PREFIX}/share/doc/${PORTNAME} ]; then \
${MKDIR} ${PREFIX}/share/doc/${PORTNAME}; \
${CP} -f ${WRKSRC}/README ${PREFIX}/share/doc/${PORTNAME};
${CP} -f ${WRKSRC}/README ${PREFIX}/share/doc/${PORTNAME}; \
fi
.endif
${INSTALL_SCRIPT} ${FILESDIR}/ikon2xbm ${PREFIX}/bin
${INSTALL_SCRIPT} ${FILESDIR}/xbm2ikon ${PREFIX}/bin
${INSTALL_SCRIPT} ${FILESDIR}/xbmcut48 ${PREFIX}/bin
${INSTALL_SCRIPT} ${FILESDIR}/xbmsize48 ${PREFIX}/bin
.include <bsd.port.mk>

View file

@ -6,7 +6,7 @@
# Written 11th November 1989.
#
# Permission is given to distribute these sources, as long as the
# copyright messages are not removed, and no monies are exchanged.
# copyright messages are not removed, and no monies are exchanged.
#
# No responsibility is taken for any errors on inaccuracies inherent
# either to the comments or the code of this program, but if reported
@ -22,10 +22,10 @@
# BINDIR, LIBDIR, INCDIR and MANDIR are expected to be overridden by the
# calling Makefile
BINDIR = ${PREFIX}/bin
LIBDIR = ${PREFIX}/lib
INCDIR = ${PREFIX}/include
MANDIR = ${PREFIX}/man
BINDIR = /usr/local/bin
LIBDIR = /usr/local/lib
INCDIR = /usr/local/include
MANDIR = /usr/local/man
NAME = compface
UNNAME = uncompface
@ -55,7 +55,7 @@ CC ?= cc
CDEFS = $(SYSV)
CFLAGS += $(CDEFS) $(CCOMP)
all: lib$(NAME).a $(SOLIB) $(NAME) $(UNNAME)
all: lib$(NAME).a $(SOLIB) $(NAME) $(UNNAME)
$(NAME) : cmain.o compface.o
$(CC) $(CFLAGS) -o $(NAME) cmain.o compface.o -L./ -lcompface

38
mail/faces/files/ikon2xbm Normal file
View file

@ -0,0 +1,38 @@
#!/bin/sh
#
# @(#)ikon2xbm 1.4 91/05/06
#
# Copyright (c) Steve Kinzler - March 1991.
#
# Permission is given to distribute these sources, as long as the
# copyright messages are not removed, and no monies are exchanged.
#
# No responsibility is taken for any errors on inaccuracies inherent
# either to the comments or the code of this program, but if reported
# to me, then an attempt will be made to fix them.
PATH=$PATH:/usr/bin/X11; export PATH
# ikon2xbm - convert a square Blit ikon bitmap to an X11 bitmap
# stdin/stdout filter
# requires some bitmap filters from the pbmplus package
# assumes 16 valid data bits per item, 1 depth bit, and width = height
# kludge by kinzler@cs.indiana.edu
tmp=/tmp/ikon2xbm$$
trap "rm -f $tmp; exit" 0 1 2 13 15
sed -e 's/\(0x....\),\(0x....\),\(0x....\),/\1\
\2\
\3/' > $tmp
dim=`wc -l < $tmp | awk '{ print 4 * sqrt(144) }'`
pr -l1 -t -8 -s, < $tmp |
(cat << EOF
/* Format_version=1, Width=$dim, Height=$dim, Depth=1, Valid_bits_per_item=16
*/
EOF
sed -e 's/^/ /' -e 's/$/,/' -e '$s/,$//') |
icontopbm |
pbmtoxbm

469
mail/faces/files/patch-ca Normal file
View file

@ -0,0 +1,469 @@
*** compface/arith.c Tue Jan 15 23:58:46 2002
--- /home/lkoeller/tmp/ports/mail/faces/work/faces/compface/arith.c Thu Oct 24 03:28:07 1991
***************
*** 1,10 ****
-
/*
- * $Header: /cvs/faces/faces/compface/arith.c,v 1.2 2002/01/15 22:58:46 devface Exp $
- *
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) 1990-2002 James Ashton - Sydney University
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
--- 1,9 ----
/*
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) James Ashton - Sydney University - June 1990.
! *
! * Written 11th November 1989.
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
***************
*** 17,33 ****
#include "compface.h"
void
! RevPush(Prob *p)
{
! if (NumProbs >= PIXELS * 2 - 1) {
longjmp(comp_env, ERR_INTERNAL);
- }
ProbBuf[NumProbs++] = p;
}
-
void
! BigPush(Prob *p)
{
static WORD tmp;
--- 16,32 ----
#include "compface.h"
void
! RevPush(p)
! Prob *p;
{
! if (NumProbs >= PIXELS * 2 - 1)
longjmp(comp_env, ERR_INTERNAL);
ProbBuf[NumProbs++] = p;
}
void
! BigPush(p)
! Prob *p;
{
static WORD tmp;
***************
*** 36,76 ****
BigAdd(tmp + p->p_offset);
}
-
int
! BigPop(Prob *p)
{
static WORD tmp;
! int i;
BigDiv(0, &tmp);
i = 0;
! while ((tmp < p->p_offset) || (tmp >= p->p_range + p->p_offset)) {
p++;
i++;
}
BigMul(p->p_range);
BigAdd(tmp - p->p_offset);
! return(i);
}
-
#ifdef DEBUG
void
! BigPrint() /* Print a BigInt in HexaDecimal. */
{
! int i, c, count;
! WORD *w;
count = 0;
w = B.b_word + (i = B.b_words);
! while (i--) {
w--;
c = *((*w >> 4) + HexDigits);
putc(c, stderr);
c = *((*w & 0xf) + HexDigits);
putc(c, stderr);
! if (++count >= 36) {
putc('\\', stderr);
putc('\n', stderr);
count = 0;
--- 35,79 ----
BigAdd(tmp + p->p_offset);
}
int
! BigPop(p)
! register Prob *p;
{
static WORD tmp;
! register int i;
BigDiv(0, &tmp);
i = 0;
! while ((tmp < p->p_offset) || (tmp >= p->p_range + p->p_offset))
! {
p++;
i++;
}
BigMul(p->p_range);
BigAdd(tmp - p->p_offset);
! return i;
}
#ifdef DEBUG
+ /* Print a BigInt in HexaDecimal
+ */
void
! BigPrint()
{
! register int i, c, count;
! register WORD *w;
count = 0;
w = B.b_word + (i = B.b_words);
! while (i--)
! {
w--;
c = *((*w >> 4) + HexDigits);
putc(c, stderr);
c = *((*w & 0xf) + HexDigits);
putc(c, stderr);
! if (++count >= 36)
! {
putc('\\', stderr);
putc('\n', stderr);
count = 0;
***************
*** 78,110 ****
}
putc('\n', stderr);
}
! #endif /*DEBUG*/
!
/* Divide B by a storing the result in B and the remainder in the word
! * pointer to by r.
*/
-
void
! BigDiv(WORD a, WORD *r)
{
! int i;
! WORD *w;
! COMP c, d;
a &= WORDMASK;
! if ((a == 1) || (B.b_words == 0)) {
*r = 0;
return;
}
!
! /* Treat this as a == WORDCARRY and just shift everything right a WORD */
!
! if (a == 0) {
i = --B.b_words;
w = B.b_word;
*r = *w;
! while (i--) {
*w = *(w + 1);
w++;
}
--- 81,112 ----
}
putc('\n', stderr);
}
! #endif
/* Divide B by a storing the result in B and the remainder in the word
! * pointer to by r
*/
void
! BigDiv(a, r)
! register WORD a, *r;
{
! register int i;
! register WORD *w;
! register COMP c, d;
a &= WORDMASK;
! if ((a == 1) || (B.b_words == 0))
! {
*r = 0;
return;
}
! if (a == 0) /* treat this as a == WORDCARRY */
! { /* and just shift everything right a WORD */
i = --B.b_words;
w = B.b_word;
*r = *w;
! while (i--)
! {
*w = *(w + 1);
w++;
}
***************
*** 113,154 ****
}
w = B.b_word + (i = B.b_words);
c = 0;
! while (i--) {
c <<= BITSPERWORD;
! c += (COMP) *--w;
! d = c / (COMP) a;
! c = c % (COMP) a;
! *w = (WORD) (d & WORDMASK);
}
*r = c;
! if (B.b_word[B.b_words - 1] == 0) {
B.b_words--;
- }
}
!
! /* Multiply a by B storing the result in B. */
!
void
! BigMul(WORD a)
{
! int i;
! WORD *w;
! COMP c;
a &= WORDMASK;
! if ((a == 1) || (B.b_words == 0)) {
return;
! }
!
! /* Treat this as a == WORDCARRY and just shift everything left a WORD */
!
! if (a == 0) {
! if ((i = B.b_words++) >= MAXWORDS - 1) {
longjmp(comp_env, ERR_INTERNAL);
- }
w = B.b_word + i;
! while (i--) {
*w = *(w - 1);
w--;
}
--- 115,153 ----
}
w = B.b_word + (i = B.b_words);
c = 0;
! while (i--)
! {
c <<= BITSPERWORD;
! c += (COMP)*--w;
! d = c / (COMP)a;
! c = c % (COMP)a;
! *w = (WORD)(d & WORDMASK);
}
*r = c;
! if (B.b_word[B.b_words - 1] == 0)
B.b_words--;
}
! /* Multiply a by B storing the result in B
! */
void
! BigMul(a)
! register WORD a;
{
! register int i;
! register WORD *w;
! register COMP c;
a &= WORDMASK;
! if ((a == 1) || (B.b_words == 0))
return;
! if (a == 0) /* treat this as a == WORDCARRY */
! { /* and just shift everything left a WORD */
! if ((i = B.b_words++) >= MAXWORDS - 1)
longjmp(comp_env, ERR_INTERNAL);
w = B.b_word + i;
! while (i--)
! {
*w = *(w - 1);
w--;
}
***************
*** 158,239 ****
i = B.b_words;
w = B.b_word;
c = 0;
! while (i--) {
c += (COMP)*w * (COMP)a;
*(w++) = (WORD)(c & WORDMASK);
c >>= BITSPERWORD;
}
! if (c) {
! if (B.b_words++ >= MAXWORDS) {
longjmp(comp_env, ERR_INTERNAL);
- }
*w = (COMP)(c & WORDMASK);
}
}
!
! /* Subtract a from B storing the result in B. */
!
void
! BigSub(WORD a)
{
! int i;
! WORD *w;
! COMP c;
a &= WORDMASK;
! if (a == 0) {
return;
- }
i = 1;
w = B.b_word;
! c = (COMP) *w - (COMP) a;
! *w = (WORD) (c & WORDMASK);
! while (c & WORDCARRY) {
! if (i >= B.b_words) {
longjmp(comp_env, ERR_INTERNAL);
! }
! c = (COMP) *++w - 1;
! *w = (WORD) (c & WORDMASK);
i++;
}
! if ((i == B.b_words) && (*w == 0) && (i > 0)) {
B.b_words--;
- }
}
!
! /* Add to a to B storing the result in B. */
!
void
! BigAdd(WORD a)
{
! int i;
! WORD *w;
! COMP c;
a &= WORDMASK;
! if (a == 0) {
return;
- }
i = 0;
w = B.b_word;
c = a;
! while ((i < B.b_words) && c) {
! c += (COMP) *w;
! *w++ = (WORD) (c & WORDMASK);
c >>= BITSPERWORD;
i++;
}
! if ((i == B.b_words) && c) {
! if (B.b_words++ >= MAXWORDS) {
longjmp(comp_env, ERR_INTERNAL);
! }
! *w = (COMP) (c & WORDMASK);
}
}
-
void
BigClear()
{
--- 157,238 ----
i = B.b_words;
w = B.b_word;
c = 0;
! while (i--)
! {
c += (COMP)*w * (COMP)a;
*(w++) = (WORD)(c & WORDMASK);
c >>= BITSPERWORD;
}
! if (c)
! {
! if (B.b_words++ >= MAXWORDS)
longjmp(comp_env, ERR_INTERNAL);
*w = (COMP)(c & WORDMASK);
}
}
! #if 0
! /* Subtract a from B storing the result in B
! */
void
! BigSub(a)
! WORD a;
{
! register int i;
! register WORD *w;
! register COMP c;
a &= WORDMASK;
! if (a == 0)
return;
i = 1;
w = B.b_word;
! c = (COMP)*w - (COMP)a;
! *w = (WORD)(c & WORDMASK);
! while (c & WORDCARRY)
! {
! if (i >= B.b_words)
longjmp(comp_env, ERR_INTERNAL);
! c = (COMP)*++w - 1;
! *w = (WORD)(c & WORDMASK);
i++;
}
! if ((i == B.b_words) && (*w == 0) && (i > 0))
B.b_words--;
}
+ #endif
! /* Add to a to B storing the result in B
! */
void
! BigAdd(a)
! WORD a;
{
! register int i;
! register WORD *w;
! register COMP c;
a &= WORDMASK;
! if (a == 0)
return;
i = 0;
w = B.b_word;
c = a;
! while ((i < B.b_words) && c)
! {
! c += (COMP)*w;
! *w++ = (WORD)(c & WORDMASK);
c >>= BITSPERWORD;
i++;
}
! if ((i == B.b_words) && c)
! {
! if (B.b_words++ >= MAXWORDS)
longjmp(comp_env, ERR_INTERNAL);
! *w = (COMP)(c & WORDMASK);
}
}
void
BigClear()
{

315
mail/faces/files/patch-cb Normal file
View file

@ -0,0 +1,315 @@
*** compface/cmain.c Thu Feb 21 16:42:54 2002
--- /home/lkoeller/tmp/ports/mail/faces/work/faces/compface/cmain.c Thu Oct 24 03:28:07 1991
***************
*** 1,9 ****
! /* $Header: /cvs/faces/faces/compface/cmain.c,v 1.3 2002/02/21 15:42:54 devface Exp $
*
* Compface - 48x48x1 image compression.
*
! * Copyright (c) 1990-2002 James Ashton - Sydney University
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
--- 1,11 ----
! /* @(#)cmain.c 1.7 91/10/24
*
* Compface - 48x48x1 image compression.
*
! * Copyright (c) James Ashton - Sydney University - June 1990.
! *
! * Written 11th November 1889.
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
***************
*** 13,89 ****
* to me, then an attempt will be made to fix them.
*/
- #include <stdlib.h>
- #include <unistd.h>
#include <fcntl.h>
#include "compface.h"
! #define STRCAT (void) strcat
! #define STRCPY (void) strcpy
! #define WRITE (void) write
!
! /* The buffer is longer than needed to handle sparse input formats */
!
#define FACEBUFLEN 2048
char fbuf[FACEBUFLEN];
/* IO file descriptors and their names */
-
int infile = 0;
char *inname = "<stdin>";
int outfile = 1;
char *outname = "<stdout>";
! char *cmdname; /* Basename of executable */
! /* Error handling definitions follow */
extern int errno, sys_nerr;
extern char *sys_errlist[];
#define ERR ((errno < sys_nerr) ? sys_errlist[errno] : "")
! #define INITERR(s) { \
! STRCPY(fbuf, cmdname); \
! STRCAT(fbuf, ": "); \
! STRCAT(fbuf, (s));\
! }
! #define ADDERR(s) STRCAT(fbuf, (s));
! #define ERROR { \
! STRCAT(fbuf, "\n"); \
! WRITE(2, fbuf, strlen(fbuf)); \
! exit(1); \
! }
! #define INITWARN(s) { \
! STRCPY(fbuf, cmdname); \
! STRCAT(fbuf, ": (warning) "); \
! STRCAT(fbuf, (s)); \
! }
! #define ADDWARN(s) STRCAT(fbuf, (s));
! #define WARN { \
! STRCAT(fbuf, "\n"); \
! WRITE(2, fbuf, strlen(fbuf)); \
! }
int
! main(int argc, char *argv[])
{
cmdname = *argv;
! while (**argv) {
! if (*((*argv)++) == '/') {
! cmdname = *argv; /* Find the command's basename */
! }
! }
! if (argc > 3) {
INITERR("usage: ")
ADDERR(cmdname)
ADDERR(" [infile [outfile]]")
ERROR
}
! if ((argc > 1) && strcmp(*++argv, "-")) {
inname = *argv;
! if ((infile = open(inname, O_RDONLY)) == -1) {
INITERR(inname)
ADDERR(": ")
ADDERR(ERR)
--- 15,78 ----
* to me, then an attempt will be made to fix them.
*/
#include <fcntl.h>
#include "compface.h"
! /* the buffer is longer than needed to handle sparse input formats */
#define FACEBUFLEN 2048
char fbuf[FACEBUFLEN];
/* IO file descriptors and their names */
int infile = 0;
char *inname = "<stdin>";
int outfile = 1;
char *outname = "<stdout>";
! /* basename of executable */
! char *cmdname;
! /* error handling definitions follow */
extern int errno, sys_nerr;
extern char *sys_errlist[];
+ extern void exit P((int)) ;
+
#define ERR ((errno < sys_nerr) ? sys_errlist[errno] : "")
! #define INITERR(s) {(void)strcpy(fbuf, cmdname); (void)strcat(fbuf, ": ");\
! (void)strcat(fbuf, (s));}
! #define ADDERR(s) (void)strcat(fbuf, (s));
! #define ERROR {(void)strcat(fbuf, "\n");\
! (void)write(2, fbuf, strlen(fbuf)); exit(1);}
! #define INITWARN(s) {(void)strcpy(fbuf, cmdname);\
! (void)strcat(fbuf, ": (warning) ");\
! (void)strcat(fbuf, (s));}
! #define ADDWARN(s) (void)strcat(fbuf, (s));
! #define WARN {(void)strcat(fbuf, "\n"); (void)write(2, fbuf, strlen(fbuf));}
int
! main(argc, argv)
! int argc;
! char *argv[];
{
cmdname = *argv;
! while (**argv)
! if (*((*argv)++) == '/')
! cmdname = *argv; /* find the command's basename */
! if (argc > 3)
! {
INITERR("usage: ")
ADDERR(cmdname)
ADDERR(" [infile [outfile]]")
ERROR
}
! if ((argc > 1) && strcmp(*++argv, "-"))
! {
inname = *argv;
! if ((infile = open(inname, O_RDONLY)) == -1)
! {
INITERR(inname)
ADDERR(": ")
ADDERR(ERR)
***************
*** 91,100 ****
}
}
! if (argc > 2) {
outname = *++argv;
! if ((outfile = open(outname, O_WRONLY | O_CREAT |
! O_TRUNC, 0644)) == -1) {
INITERR(outname)
ADDERR(": ")
ADDERR(ERR)
--- 80,90 ----
}
}
! if (argc > 2)
! {
outname = *++argv;
! if ((outfile = open(outname, O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1)
! {
INITERR(outname)
ADDERR(": ")
ADDERR(ERR)
***************
*** 103,109 ****
}
(void) ReadBuf();
! switch (compface(fbuf)) {
case -2 : INITERR("internal error")
ERROR
case -1 : INITERR(inname)
--- 93,100 ----
}
(void) ReadBuf();
! switch (compface(fbuf))
! {
case -2 : INITERR("internal error")
ERROR
case -1 : INITERR(inname)
***************
*** 123,135 ****
int
WriteBuf()
{
! char *s, *t;
! int len;
s = fbuf;
t = s + strlen(s);
! while (s < t) {
! if ((len = write(outfile, s, t - s)) == -1) {
INITERR(outname)
ADDERR(": ")
ADDERR(ERR)
--- 114,128 ----
int
WriteBuf()
{
! register char *s, *t;
! register int len;
s = fbuf;
t = s + strlen(s);
! while (s < t)
! {
! if ((len = write(outfile, s, t - s)) == -1)
! {
INITERR(outname)
ADDERR(": ")
ADDERR(ERR)
***************
*** 137,163 ****
}
s += len;
}
! return(0);
}
int
ReadBuf()
{
! int count, len;
! char *t;
count = 0;
t = fbuf;
! while ((len = read(infile, t, FACEBUFLEN - count))) {
! if (len == -1) {
INITERR(inname)
ADDERR(": ")
ADDERR(ERR)
ERROR
}
t += len;
! if ((count += len) >= FACEBUFLEN) {
INITWARN(inname)
ADDWARN(" exceeds internal buffer size. Data may be lost")
WARN
--- 130,159 ----
}
s += len;
}
! return 0;
}
int
ReadBuf()
{
! register int count, len;
! register char *t;
count = 0;
t = fbuf;
! while (len = read(infile, t, FACEBUFLEN - count))
! {
! if (len == -1)
! {
INITERR(inname)
ADDERR(": ")
ADDERR(ERR)
ERROR
}
t += len;
! if ((count += len) >= FACEBUFLEN)
! {
INITWARN(inname)
ADDWARN(" exceeds internal buffer size. Data may be lost")
WARN
***************
*** 165,169 ****
}
}
*t = '\0';
! return(count);
}
--- 161,165 ----
}
}
*t = '\0';
! return count;
}

39
mail/faces/files/patch-cc Normal file
View file

@ -0,0 +1,39 @@
*** compface/compface.1 Tue Jan 15 23:58:46 2002
--- /home/lkoeller/tmp/ports/mail/faces/work/faces/compface/compface.1 Sun Jan 19 19:35:35 2003
***************
*** 1,4 ****
! .TH COMPFACE 1 "15 January 2002"
.SH NAME
compface, uncompface \- compress and expand 48x48x1 face image files
.SH SYNOPSIS
--- 1,4 ----
! .TH COMPFACE 1 "25 January 1990"
.SH NAME
compface, uncompface \- compress and expand 48x48x1 face image files
.SH SYNOPSIS
***************
*** 12,17 ****
--- 12,19 ----
.LP
.B uncompface
[
+ .B \-X
+ ] [
.I infile
[
.I outfile
***************
*** 56,61 ****
--- 58,69 ----
.I compface
averages less than 200 characters.
The average number of output lines is three.
+ .SH OPTIONS
+ .TP 12
+ .B \-X
+ The same as
+ .I uncompface
+ | ikon2xbm. Usefull for exmh!
.SH DIAGNOSTICS
Exit status is normally 0.
Possible errors include IO errors when opening, reading or writing

62
mail/faces/files/patch-cd Normal file
View file

@ -0,0 +1,62 @@
*** compface/compface.c Thu Feb 21 16:42:54 2002
--- /home/lkoeller/tmp/ports/mail/faces/work/faces/compface/compface.c Wed Jun 19 08:29:12 1991
***************
*** 1,10 ****
-
/*
- * $Header: /cvs/faces/faces/compface/compface.c,v 1.3 2002/02/21 15:42:54 devface Exp $
- *
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) 1990-2002 James Ashton - Sydney University
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
--- 1,9 ----
/*
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) James Ashton - Sydney University - June 1990.
! *
! * Written 11th November 1989.
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
***************
*** 14,29 ****
* to me, then an attempt will be made to fix them.
*/
#include "compface.h"
- #include "vars.h"
int
! compface(char *fbuf)
{
! if (!(status = setjmp(comp_env))) {
ReadFace(fbuf);
GenFace();
CompAll(fbuf);
}
! return(status);
}
--- 13,31 ----
* to me, then an attempt will be made to fix them.
*/
+ #define MAIN
+
#include "compface.h"
int
! compface(fbuf)
! char *fbuf;
{
! if (!(status = setjmp(comp_env)))
! {
ReadFace(fbuf);
GenFace();
CompAll(fbuf);
}
! return status;
}

328
mail/faces/files/patch-ce Normal file
View file

@ -0,0 +1,328 @@
*** compface/compface.h Thu Feb 21 16:42:54 2002
--- /home/lkoeller/tmp/ports/mail/faces/work/faces/compface/compface.h Thu Sep 5 07:24:42 1991
***************
*** 1,10 ****
-
/*
- * $Header: /cvs/faces/faces/compface/compface.h,v 1.3 2002/02/21 15:42:54 devface Exp $
- *
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) 1990-2002 James Ashton - Sydney University
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
--- 1,9 ----
/*
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) James Ashton - Sydney University - June 1990.
! *
! * Written 11th November 1989.
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
***************
*** 14,45 ****
* to me, then an attempt will be made to fix them.
*/
#include <string.h>
#include <fcntl.h>
#include <setjmp.h>
! /* Need to know how many bits per hexadecimal digit for io */
#define BITSPERDIG 4
! extern char HexDigits[];
! /* Define the face size - 48x48x1 */
#define WIDTH 48
#define HEIGHT WIDTH
! /* Total number of pixels and digits */
#define PIXELS (WIDTH * HEIGHT)
#define DIGITS (PIXELS / BITSPERDIG)
! extern char F[PIXELS];
! /* Output formatting word lengths and line lengths */
#define DIGSPERWORD 4
#define WORDSPERLINE (WIDTH / DIGSPERWORD / BITSPERDIG)
! /* Compressed output uses the full range of printable characters.
* in ascii these are in a contiguous block so we just need to know
! * the first and last. The total number of printables is needed too.
! */
#define FIRSTPRINT '!'
#define LASTPRINT '~'
#define NUMPRINTS (LASTPRINT - FIRSTPRINT + 1)
--- 13,64 ----
* to me, then an attempt will be made to fix them.
*/
+ #if defined(SYSV32) || defined(hpux)
#include <string.h>
+ #else
+ #include <strings.h>
+ #endif /* SYSV32 || hpux */
#include <fcntl.h>
#include <setjmp.h>
! /* For all function declarations, if ANSI then use a prototype. */
!
! #if defined(__STDC__)
! #define P(args) args
! #else /* ! __STDC__ */
! #define P(args) ()
! #endif /* STDC */
!
! #ifdef MAIN
! #define EXTERN
! #define INIT(x) = x
! #else
! #define EXTERN extern
! #define INIT(x)
! #endif
!
! /* need to know how many bits per hexadecimal digit for io */
#define BITSPERDIG 4
! EXTERN char HexDigits[] INIT("0123456789ABCDEF");
! /* define the face size - 48x48x1 */
#define WIDTH 48
#define HEIGHT WIDTH
! /* total number of pixels and digits */
#define PIXELS (WIDTH * HEIGHT)
#define DIGITS (PIXELS / BITSPERDIG)
! /* internal face representation - 1 char per pixel is faster */
! EXTERN char F[PIXELS];
! /* output formatting word lengths and line lengths */
#define DIGSPERWORD 4
#define WORDSPERLINE (WIDTH / DIGSPERWORD / BITSPERDIG)
! /* compressed output uses the full range of printable characters.
* in ascii these are in a contiguous block so we just need to know
! * the first and last. The total number of printables is needed too */
#define FIRSTPRINT '!'
#define LASTPRINT '~'
#define NUMPRINTS (LASTPRINT - FIRSTPRINT + 1)
***************
*** 49,56 ****
/* Portable, very large unsigned integer arithmetic is needed.
* Implementation uses arrays of WORDs. COMPs must have at least
! * twice as many bits as WORDs to handle intermediate results.
! */
#define WORD unsigned char
#define COMP unsigned long
#define BITSPERWORD 8
--- 68,74 ----
/* Portable, very large unsigned integer arithmetic is needed.
* Implementation uses arrays of WORDs. COMPs must have at least
! * twice as many bits as WORDs to handle intermediate results */
#define WORD unsigned char
#define COMP unsigned long
#define BITSPERWORD 8
***************
*** 64,76 ****
WORD b_word[MAXWORDS];
} BigInt;
! extern BigInt B;
/* This is the guess the next pixel table. Normally there are 12 neighbour
* pixels used to give 1<<12 cases but in the upper left corner lesser
! * numbers of neighbours are available, leading to 6231 different guesses.
! */
! typedef struct guesses {
char g_00[1<<12];
char g_01[1<<7];
char g_02[1<<2];
--- 82,94 ----
WORD b_word[MAXWORDS];
} BigInt;
! EXTERN BigInt B;
/* This is the guess the next pixel table. Normally there are 12 neighbour
* pixels used to give 1<<12 cases but in the upper left corner lesser
! * numbers of neighbours are available, leading to 6231 different guesses */
! typedef struct guesses
! {
char g_00[1<<12];
char g_01[1<<7];
char g_02[1<<2];
***************
*** 88,155 ****
char g_42[1<<2];
} Guesses;
! extern Guesses G;
/* Data of varying probabilities are encoded by a value in the range 0 - 255.
* The probability of the data determines the range of possible encodings.
! * Offset gives the first possible encoding of the range.
! */
! typedef struct prob {
WORD p_range;
WORD p_offset;
} Prob;
! extern Prob *ProbBuf[PIXELS * 2];
! extern int NumProbs;
/* Each face is encoded using 9 octrees of 16x16 each. Each level of the
* trees has varying probabilities of being white, grey or black.
! * The table below is based on sampling many faces.
! */
#define BLACK 0
#define GREY 1
#define WHITE 2
! extern Prob levels[4][3];
! extern Prob freqs[16];
#define ERR_OK 0 /* successful completion */
#define ERR_EXCESS 1 /* completed OK but some input was ignored */
#define ERR_INSUFF -1 /* insufficient input. Bad face format? */
#define ERR_INTERNAL -2 /* Arithmetic overflow or buffer overflow */
! extern int status;
! extern jmp_buf comp_env;
! int AllBlack(char *, int, int);
! int AllWhite(char *, int, int);
! int BigPop(Prob *);
! int compface(char *);
! int main(int, char *[]);
! int ReadBuf();
! int Same(char *, int, int);
! int uncompface(char *);
! int WriteBuf();
!
! void BigAdd(WORD);
! void BigClear();
! void BigDiv(WORD, WORD *);
! void BigMul(WORD);
! void BigPrint();
! void BigPush(Prob *);
! void BigRead(char *);
! void BigSub(WORD);
! void BigWrite(char *);
! void CompAll(char *);
! void Compress(char *, int, int, int);
! void GenFace();
! void PopGreys(char *, int, int);
! void PushGreys(char *, int, int);
! void ReadFace(char *);
! void RevPush(Prob *);
! void UnCompAll(char *);
! void UnCompress(char *, int, int, int);
! void UnGenFace();
! void WriteFace(char *);
--- 106,204 ----
char g_42[1<<2];
} Guesses;
! /* data.h was established by sampling over 1000 faces and icons */
! EXTERN Guesses G
! #ifdef MAIN
! =
! #include "data.h"
! #endif
! ;
/* Data of varying probabilities are encoded by a value in the range 0 - 255.
* The probability of the data determines the range of possible encodings.
! * Offset gives the first possible encoding of the range */
! typedef struct prob
! {
WORD p_range;
WORD p_offset;
} Prob;
! /* A stack of probability values */
! EXTERN Prob *ProbBuf[PIXELS * 2];
! EXTERN int NumProbs INIT(0);
/* Each face is encoded using 9 octrees of 16x16 each. Each level of the
* trees has varying probabilities of being white, grey or black.
! * The table below is based on sampling many faces */
#define BLACK 0
#define GREY 1
#define WHITE 2
! EXTERN Prob levels[4][3]
! #ifdef MAIN
! =
! {
! {{1, 255}, {251, 0}, {4, 251}}, /* Top of tree almost always grey */
! {{1, 255}, {200, 0}, {55, 200}},
! {{33, 223}, {159, 0}, {64, 159}},
! {{131, 0}, {0, 0}, {125, 131}} /* Grey disallowed at bottom */
! }
! #endif
! ;
!
! /* At the bottom of the octree 2x2 elements are considered black if any
! * pixel is black. The probabilities below give the distribution of the
! * 16 possible 2x2 patterns. All white is not really a possibility and
! * has a probability range of zero. Again, experimentally derived data */
! EXTERN Prob freqs[16]
! #ifdef MAIN
! =
! {
! {0, 0}, {38, 0}, {38, 38}, {13, 152},
! {38, 76}, {13, 165}, {13, 178}, {6, 230},
! {38, 114}, {13, 191}, {13, 204}, {6, 236},
! {13, 217}, {6, 242}, {5, 248}, {3, 253}
! }
! #endif
! ;
#define ERR_OK 0 /* successful completion */
#define ERR_EXCESS 1 /* completed OK but some input was ignored */
#define ERR_INSUFF -1 /* insufficient input. Bad face format? */
#define ERR_INTERNAL -2 /* Arithmetic overflow or buffer overflow */
! EXTERN int status;
! EXTERN jmp_buf comp_env;
! int AllBlack P((char *, int, int)) ;
! int AllWhite P((char *, int, int)) ;
! int BigPop P((Prob *)) ;
! int compface P((char *)) ;
! int main P((int, char *[])) ;
! int ReadBuf P(()) ;
! int Same P((char *, int, int)) ;
! int uncompface P((char *)) ;
! int WriteBuf P(()) ;
!
! void BigAdd P((unsigned char)) ;
! void BigClear P(()) ;
! void BigDiv P((unsigned char, unsigned char *)) ;
! void BigMul P((unsigned char)) ;
! void BigPrint P(()) ;
! void BigPush P((Prob *)) ;
! void BigRead P((char *)) ;
! void BigSub P((unsigned int)) ;
! void BigWrite P((char *)) ;
! void CompAll P((char *)) ;
! void Compress P((char *, int, int, int)) ;
! void GenFace P(()) ;
! void PopGreys P((char *, int, int)) ;
! void PushGreys P((char *, int, int)) ;
! void ReadFace P((char *)) ;
! void RevPush P((Prob *)) ;
! void UnCompAll P((char *)) ;
! void UnCompress P((char *, int, int, int)) ;
! void UnGenFace P(()) ;
! void WriteFace P((char *)) ;

336
mail/faces/files/patch-cf Normal file
View file

@ -0,0 +1,336 @@
*** compface/compress.c Tue Jan 15 23:58:46 2002
--- /home/lkoeller/tmp/ports/mail/faces/work/faces/compface/compress.c Wed Jun 19 08:29:13 1991
***************
*** 1,10 ****
-
/*
- * $Header: /cvs/faces/faces/compface/compress.c,v 1.2 2002/01/15 22:58:46 devface Exp $
- *
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) 1990-2002 James Ashton - Sydney University
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
--- 1,9 ----
/*
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) James Ashton - Sydney University - June 1990.
! *
! * Written 11th November 1989.
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
***************
*** 17,113 ****
#include "compface.h"
int
! Same(char *f, int wid, int hei)
{
! char val, *row;
! int x;
val = *f;
! while (hei--) {
row = f;
x = wid;
! while (x--) {
! if (*(row++) != val) {
return(0);
- }
- }
f += WIDTH;
}
! return(1);
}
-
int
! AllBlack(char *f, int wid, int hei)
{
! if (wid > 3) {
wid /= 2;
hei /= 2;
! return(AllBlack(f, wid, hei) && AllBlack(f + wid, wid, hei) &&
AllBlack(f + WIDTH * hei, wid, hei) &&
AllBlack(f + WIDTH * hei + wid, wid, hei));
- } else {
- return(*f || *(f + 1) || *(f + WIDTH) || *(f + WIDTH + 1));
}
}
-
int
! AllWhite(char *f, int wid, int hei)
{
! return((*f == 0) && Same(f, wid, hei));
}
-
void
! PopGreys(char *f, int wid, int hei)
{
! if (wid > 3) {
wid /= 2;
hei /= 2;
PopGreys(f, wid, hei);
PopGreys(f + wid, wid, hei);
PopGreys(f + WIDTH * hei, wid, hei);
PopGreys(f + WIDTH * hei + wid, wid, hei);
! } else {
wid = BigPop(freqs);
! if (wid & 1) {
*f = 1;
! }
! if (wid & 2) {
*(f + 1) = 1;
! }
! if (wid & 4) {
*(f + WIDTH) = 1;
! }
! if (wid & 8) {
*(f + WIDTH + 1) = 1;
}
- }
}
-
void
! PushGreys(char *f, int wid, int hei)
{
! if (wid > 3) {
wid /= 2;
hei /= 2;
PushGreys(f, wid, hei);
PushGreys(f + wid, wid, hei);
PushGreys(f + WIDTH * hei, wid, hei);
PushGreys(f + WIDTH * hei + wid, wid, hei);
- } else {
- RevPush(freqs + *f + 2 * *(f + 1) +
- 4 * *(f + WIDTH) + 8 * *(f + WIDTH + 1));
}
}
-
void
! UnCompress(char *f, int wid, int hei, int lev)
{
! switch (BigPop(&levels[lev][0])) {
case WHITE :
return;
case BLACK :
--- 16,120 ----
#include "compface.h"
int
! Same(f, wid, hei)
! register char *f;
! register int wid, hei;
{
! register char val, *row;
! register int x;
val = *f;
! while (hei--)
! {
row = f;
x = wid;
! while (x--)
! if (*(row++) != val)
return(0);
f += WIDTH;
}
! return 1;
}
int
! AllBlack(f, wid, hei)
! char *f;
! int wid, hei;
{
! if (wid > 3)
! {
wid /= 2;
hei /= 2;
! return (AllBlack(f, wid, hei) && AllBlack(f + wid, wid, hei) &&
AllBlack(f + WIDTH * hei, wid, hei) &&
AllBlack(f + WIDTH * hei + wid, wid, hei));
}
+ else
+ return (*f || *(f + 1) || *(f + WIDTH) || *(f + WIDTH + 1));
}
int
! AllWhite(f, wid, hei)
! char *f;
! int wid, hei;
{
! return ((*f == 0) && Same(f, wid, hei));
}
void
! PopGreys(f, wid, hei)
! char *f;
! int wid, hei;
{
! if (wid > 3)
! {
wid /= 2;
hei /= 2;
PopGreys(f, wid, hei);
PopGreys(f + wid, wid, hei);
PopGreys(f + WIDTH * hei, wid, hei);
PopGreys(f + WIDTH * hei + wid, wid, hei);
! }
! else
! {
wid = BigPop(freqs);
! if (wid & 1)
*f = 1;
! if (wid & 2)
*(f + 1) = 1;
! if (wid & 4)
*(f + WIDTH) = 1;
! if (wid & 8)
*(f + WIDTH + 1) = 1;
}
}
void
! PushGreys(f, wid, hei)
! char *f;
! int wid, hei;
{
! if (wid > 3)
! {
wid /= 2;
hei /= 2;
PushGreys(f, wid, hei);
PushGreys(f + wid, wid, hei);
PushGreys(f + WIDTH * hei, wid, hei);
PushGreys(f + WIDTH * hei + wid, wid, hei);
}
+ else
+ RevPush(freqs + *f + 2 * *(f + 1) + 4 * *(f + WIDTH) +
+ 8 * *(f + WIDTH + 1));
}
void
! UnCompress(f, wid, hei, lev)
! register char *f;
! register int wid, hei, lev;
{
! switch (BigPop(&levels[lev][0]))
! {
case WHITE :
return;
case BLACK :
***************
*** 125,139 ****
}
}
-
void
! Compress(char *f, int wid, int hei, int lev)
{
! if (AllWhite(f, wid, hei)) {
RevPush(&levels[lev][WHITE]);
return;
}
! if (AllBlack(f, wid, hei)) {
RevPush(&levels[lev][BLACK]);
PushGreys(f, wid, hei);
return;
--- 132,149 ----
}
}
void
! Compress(f, wid, hei, lev)
! register char *f;
! register int wid, hei, lev;
{
! if (AllWhite(f, wid, hei))
! {
RevPush(&levels[lev][WHITE]);
return;
}
! if (AllBlack(f, wid, hei))
! {
RevPush(&levels[lev][BLACK]);
PushGreys(f, wid, hei);
return;
***************
*** 149,164 ****
}
void
! UnCompAll(char *fbuf)
{
! char *p;
BigClear();
BigRead(fbuf);
p = F;
! while (p < F + PIXELS) {
*(p++) = 0;
- }
UnCompress(F, 16, 16, 0);
UnCompress(F + 16, 16, 16, 0);
UnCompress(F + 32, 16, 16, 0);
--- 159,174 ----
}
void
! UnCompAll(fbuf)
! char *fbuf;
{
! register char *p;
BigClear();
BigRead(fbuf);
p = F;
! while (p < F + PIXELS)
*(p++) = 0;
UnCompress(F, 16, 16, 0);
UnCompress(F + 16, 16, 16, 0);
UnCompress(F + 32, 16, 16, 0);
***************
*** 171,177 ****
}
void
! CompAll(char *fbuf)
{
Compress(F, 16, 16, 0);
Compress(F + 16, 16, 16, 0);
--- 181,188 ----
}
void
! CompAll(fbuf)
! char *fbuf;
{
Compress(F, 16, 16, 0);
Compress(F + 16, 16, 16, 0);
***************
*** 183,190 ****
Compress(F + WIDTH * 32 + 16, 16, 16, 0);
Compress(F + WIDTH * 32 + 32, 16, 16, 0);
BigClear();
! while (NumProbs > 0) {
BigPush(ProbBuf[--NumProbs]);
- }
BigWrite(fbuf);
}
--- 194,200 ----
Compress(F + WIDTH * 32 + 16, 16, 16, 0);
Compress(F + WIDTH * 32 + 32, 16, 16, 0);
BigClear();
! while (NumProbs > 0)
BigPush(ProbBuf[--NumProbs]);
BigWrite(fbuf);
}

25
mail/faces/files/patch-cg Normal file
View file

@ -0,0 +1,25 @@
*** compface/data.h Tue Jan 15 23:58:46 2002
--- /home/lkoeller/tmp/ports/mail/faces/work/faces/compface/data.h Tue Jun 19 04:01:41 1990
***************
*** 1,10 ****
/*
- * $Header: /cvs/faces/faces/compface/data.h,v 1.2 2002/01/15 22:58:46 devface Exp $
- *
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) 1990-2002 James Ashton - Sydney University
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
--- 1,10 ----
/*
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) James Ashton - Sydney University - June 1990.
! *
! * Written 11th November 1989.
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.

336
mail/faces/files/patch-ch Normal file
View file

@ -0,0 +1,336 @@
*** compface/file.c Tue Jan 15 23:58:46 2002
--- /home/lkoeller/tmp/ports/mail/faces/work/faces/compface/file.c Sun Jan 19 19:35:35 2003
***************
*** 1,10 ****
-
/*
- * $Header: /cvs/faces/faces/compface/file.c,v 1.2 2002/01/15 22:58:46 devface Exp $
- *
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) 1990-2002 James Ashton - Sydney University
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
--- 1,9 ----
/*
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) James Ashton - Sydney University - June 1990.
! *
! * Written 11th November 1989.
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
***************
*** 16,147 ****
#include "compface.h"
void
! BigRead(char *fbuf)
{
! int c;
! while (*fbuf != '\0') {
c = *(fbuf++);
! if ((c < FIRSTPRINT) || (c > LASTPRINT)) {
continue;
- }
BigMul(NUMPRINTS);
BigAdd((WORD)(c - FIRSTPRINT));
}
}
-
void
! BigWrite(char *fbuf)
{
static WORD tmp;
static char buf[DIGITS];
! char *s;
! int i;
s = buf;
! while (B.b_words > 0) {
BigDiv(NUMPRINTS, &tmp);
*(s++) = tmp + FIRSTPRINT;
}
! i = 7; /* Leave room for the field name on the first line */
*(fbuf++) = ' ';
! while (s-- > buf) {
! if (i == 0) {
*(fbuf++) = ' ';
- }
*(fbuf++) = *s;
! if (++i >= MAXLINELEN) {
*(fbuf++) = '\n';
i = 0;
}
}
! if (i > 0) {
*(fbuf++) = '\n';
- }
*(fbuf++) = '\0';
}
-
void
! ReadFace(char *fbuf)
{
! int c, i;
! char *s, *t;
t = s = fbuf;
! for (i = strlen(s); i > 0; i--) {
! c = (int) *(s++);
! if ((c >= '0') && (c <= '9')) {
! if (t >= fbuf + DIGITS) {
status = ERR_EXCESS;
break;
}
*(t++) = c - '0';
! } else if ((c >= 'A') && (c <= 'F')) {
! if (t >= fbuf + DIGITS) {
status = ERR_EXCESS;
break;
}
*(t++) = c - 'A' + 10;
! } else if ((c >= 'a') && (c <= 'f')) {
! if (t >= fbuf + DIGITS) {
status = ERR_EXCESS;
break;
}
*(t++) = c - 'a' + 10;
- } else if (((c == 'x') || (c == 'X')) && (t > fbuf) && (*(t-1) == 0)) {
- t--;
}
}
! if (t < fbuf + DIGITS) {
longjmp(comp_env, ERR_INSUFF);
- }
s = fbuf;
t = F;
c = 1 << (BITSPERDIG - 1);
! while (t < F + PIXELS) {
*(t++) = (*s & c) ? 1 : 0;
! if ((c >>= 1) == 0) {
s++;
c = 1 << (BITSPERDIG - 1);
}
}
}
-
void
! WriteFace(char *fbuf)
{
! char *s, *t;
! int i, bits, digits, words;
s = F;
t = fbuf;
bits = digits = words = i = 0;
! while (s < F + PIXELS) {
! if ((bits == 0) && (digits == 0)) {
*(t++) = '0';
*(t++) = 'x';
}
! if (*(s++)) {
i = i * 2 + 1;
! } else {
i *= 2;
}
! if (++bits == BITSPERDIG) {
! *(t++) = *(i + HexDigits);
bits = i = 0;
! if (++digits == DIGSPERWORD) {
*(t++) = ',';
digits = 0;
! if (++words == WORDSPERLINE) {
*(t++) = '\n';
words = 0;
}
}
}
}
*(t++) = '\0';
}
--- 15,191 ----
#include "compface.h"
+ int xbitmap=0;
+
void
! BigRead(fbuf)
! register char *fbuf;
{
! register int c;
! while (*fbuf != '\0')
! {
c = *(fbuf++);
! if ((c < FIRSTPRINT) || (c > LASTPRINT))
continue;
BigMul(NUMPRINTS);
BigAdd((WORD)(c - FIRSTPRINT));
}
}
void
! BigWrite(fbuf)
! register char *fbuf;
{
static WORD tmp;
static char buf[DIGITS];
! register char *s;
! register int i;
s = buf;
! while (B.b_words > 0)
! {
BigDiv(NUMPRINTS, &tmp);
*(s++) = tmp + FIRSTPRINT;
}
! i = 7; /* leave room for the field name on the first line */
*(fbuf++) = ' ';
! while (s-- > buf)
! {
! if (i == 0)
*(fbuf++) = ' ';
*(fbuf++) = *s;
! if (++i >= MAXLINELEN)
! {
*(fbuf++) = '\n';
i = 0;
}
}
! if (i > 0)
*(fbuf++) = '\n';
*(fbuf++) = '\0';
}
void
! ReadFace(fbuf)
! char *fbuf;
{
! register int c, i;
! register char *s, *t;
t = s = fbuf;
! for(i = strlen(s); i > 0; i--)
! {
! c = (int)*(s++);
! if ((c >= '0') && (c <= '9'))
! {
! if (t >= fbuf + DIGITS)
! {
status = ERR_EXCESS;
break;
}
*(t++) = c - '0';
! }
! else if ((c >= 'A') && (c <= 'F'))
! {
! if (t >= fbuf + DIGITS)
! {
status = ERR_EXCESS;
break;
}
*(t++) = c - 'A' + 10;
! }
! else if ((c >= 'a') && (c <= 'f'))
! {
! if (t >= fbuf + DIGITS)
! {
status = ERR_EXCESS;
break;
}
*(t++) = c - 'a' + 10;
}
+ else if (((c == 'x') || (c == 'X')) && (t > fbuf) && (*(t-1) == 0))
+ t--;
}
! if (t < fbuf + DIGITS)
longjmp(comp_env, ERR_INSUFF);
s = fbuf;
t = F;
c = 1 << (BITSPERDIG - 1);
! while (t < F + PIXELS)
! {
*(t++) = (*s & c) ? 1 : 0;
! if ((c >>= 1) == 0)
! {
s++;
c = 1 << (BITSPERDIG - 1);
}
}
}
void
! WriteFace(fbuf)
! char *fbuf;
{
! register char *s, *t;
! register int i, bits, digits, words;
! extern int xbitmap;
! int digsperword = DIGSPERWORD;
! int wordsperline = WORDSPERLINE;
s = F;
t = fbuf;
bits = digits = words = i = 0;
! if (xbitmap) {
! sprintf(t,"#define noname_width 48\n#define noname_height 48\nstatic char noname_bits[] = {\n ");
! while (*t) t++;
! digsperword = 2;
! wordsperline = 15;
! }
! while (s < F + PIXELS)
! {
! if ((bits == 0) && (digits == 0))
! {
*(t++) = '0';
*(t++) = 'x';
}
! if (xbitmap) {
! if (*(s++))
! i = (i >> 1) | 0x8;
! else
! i >>= 1;
! }
! else {
! if (*(s++))
i = i * 2 + 1;
! else
i *= 2;
}
! if (++bits == BITSPERDIG)
! {
! if (xbitmap) {
! t++;
! t[-(digits & 1) * 2] = *(i + HexDigits);
! }
! else *(t++) = *(i + HexDigits);
bits = i = 0;
! if (++digits == digsperword)
! {
! if (xbitmap && (s >= F + PIXELS)) break;
*(t++) = ',';
digits = 0;
! if (++words == wordsperline)
! {
*(t++) = '\n';
+ if (xbitmap) *(t++) = ' ';
words = 0;
}
}
}
}
+ if (xbitmap) {
+ sprintf(t, "}\n");
+ while (*t) t++;
+ }
*(t++) = '\0';
}

208
mail/faces/files/patch-ci Normal file
View file

@ -0,0 +1,208 @@
*** compface/gen.c Tue Jan 15 23:58:46 2002
--- /home/lkoeller/tmp/ports/mail/faces/work/faces/compface/gen.c Wed Jun 19 08:29:13 1991
***************
*** 1,10 ****
-
/*
- * $Header: /cvs/faces/faces/compface/gen.c,v 1.2 2002/01/15 22:58:46 devface Exp $
- *
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) 1990-2002 James Ashton - Sydney University
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
--- 1,9 ----
/*
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) James Ashton - Sydney University - June 1990.
! *
! * Written 11th November 1989.
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
***************
*** 18,79 ****
#define GEN(g) F[h] ^= G.g[k]; break
! static void Gen(char *);
static void
! Gen(char *f)
{
! int m, l, k, j, i, h;
! for (j = 0; j < HEIGHT; j++) {
! for (i = 0; i < WIDTH; i++) {
h = i + j * WIDTH;
k = 0;
! for (l = i - 2; l <= i + 2; l++) {
! for (m = j - 2; m <= j; m++) {
! if ((l >= i) && (m == j)) {
continue;
! }
! if ((l > 0) && (l <= WIDTH) && (m > 0)) {
k = *(f + l + m * WIDTH) ? k * 2 + 1 : k * 2;
}
! }
! }
! switch (i) {
case 1 :
! switch (j) {
case 1 : GEN(g_22);
case 2 : GEN(g_21);
default : GEN(g_20);
}
break;
-
case 2 :
! switch (j) {
case 1 : GEN(g_12);
case 2 : GEN(g_11);
default : GEN(g_10);
}
break;
-
case WIDTH - 1 :
! switch (j) {
case 1 : GEN(g_42);
case 2 : GEN(g_41);
default : GEN(g_40);
}
break;
-
case WIDTH :
! switch (j) {
case 1 : GEN(g_32);
case 2 : GEN(g_31);
default : GEN(g_30);
}
break;
-
default :
! switch (j) {
case 1 : GEN(g_02);
case 2 : GEN(g_01);
default : GEN(g_00);
--- 17,81 ----
#define GEN(g) F[h] ^= G.g[k]; break
! static void Gen P((char *)) ;
static void
! Gen(f)
! register char *f;
{
! register int m, l, k, j, i, h;
! for (j = 0; j < HEIGHT; j++)
! {
! for (i = 0; i < WIDTH; i++)
! {
h = i + j * WIDTH;
k = 0;
! for (l = i - 2; l <= i + 2; l++)
! for (m = j - 2; m <= j; m++)
! {
! if ((l >= i) && (m == j))
continue;
! if ((l > 0) && (l <= WIDTH) && (m > 0))
k = *(f + l + m * WIDTH) ? k * 2 + 1 : k * 2;
}
! switch (i)
! {
case 1 :
! switch (j)
! {
case 1 : GEN(g_22);
case 2 : GEN(g_21);
default : GEN(g_20);
}
break;
case 2 :
! switch (j)
! {
case 1 : GEN(g_12);
case 2 : GEN(g_11);
default : GEN(g_10);
}
break;
case WIDTH - 1 :
! switch (j)
! {
case 1 : GEN(g_42);
case 2 : GEN(g_41);
default : GEN(g_40);
}
break;
case WIDTH :
! switch (j)
! {
case 1 : GEN(g_32);
case 2 : GEN(g_31);
default : GEN(g_30);
}
break;
default :
! switch (j)
! {
case 1 : GEN(g_02);
case 2 : GEN(g_01);
default : GEN(g_00);
***************
*** 84,109 ****
}
}
-
void
GenFace()
{
static char new[PIXELS];
! char *f1, *f2;
! int i;
f1 = new;
f2 = F;
i = PIXELS;
! while (i-- > 0) {
*(f1++) = *(f2++);
- }
Gen(new);
}
-
void
UnGenFace()
{
Gen(F);
}
--- 86,110 ----
}
}
void
GenFace()
{
static char new[PIXELS];
! register char *f1;
! register char *f2;
! register int i;
f1 = new;
f2 = F;
i = PIXELS;
! while (i-- > 0)
*(f1++) = *(f2++);
Gen(new);
}
void
UnGenFace()
{
Gen(F);
}
+

319
mail/faces/files/patch-cj Normal file
View file

@ -0,0 +1,319 @@
*** compface/uncmain.c Thu Feb 21 16:42:54 2002
--- /home/lkoeller/tmp/ports/mail/faces/work/faces/compface/uncmain.c Sun Jan 19 19:35:35 2003
***************
*** 1,9 ****
! /* $Header: /cvs/faces/faces/compface/uncmain.c,v 1.3 2002/02/21 15:42:54 devface Exp $
*
* Uncompface - 48x48x1 image decompression.
*
! * Copyright (c) 1990-2002 James Ashton - Sydney University
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
--- 1,11 ----
! /* @(#)uncmain.c 1.4 91/10/24
*
* Uncompface - 48x48x1 image decompression.
*
! * Copyright (c) James Ashton - Sydney University - June 1990.
! *
! * Written 11th November 1889.
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
***************
*** 13,28 ****
* to me, then an attempt will be made to fix them.
*/
- #include <stdlib.h>
- #include <unistd.h>
#include <fcntl.h>
#include "compface.h"
! #define STRCAT (void) strcat
! #define STRCPY (void) strcpy
! #define WRITE (void) write
! /* The buffer is longer than needed to handle sparse input formats */
#define FACEBUFLEN 2048
char fbuf[FACEBUFLEN];
--- 15,26 ----
* to me, then an attempt will be made to fix them.
*/
#include <fcntl.h>
#include "compface.h"
! extern int xbitmap;
! /* the buffer is longer than needed to handle sparse input formats */
#define FACEBUFLEN 2048
char fbuf[FACEBUFLEN];
***************
*** 32,87 ****
int outfile = 1;
char *outname = "<stdout>";
! char *cmdname; /* Basename of executable */
! /* Error handling definitions follow */
extern int errno, sys_nerr;
extern char *sys_errlist[];
#define ERR ((errno < sys_nerr) ? sys_errlist[errno] : "")
! #define INITERR(s) { \
! STRCPY(fbuf, cmdname); \
! STRCAT(fbuf, ": "); \
! STRCAT(fbuf, (s));\
! }
! #define ADDERR(s) STRCAT(fbuf, (s));
! #define ERROR { \
! STRCAT(fbuf, "\n"); \
! WRITE(2, fbuf, strlen(fbuf)); \
! exit(1); \
! }
! #define INITWARN(s) { \
! STRCPY(fbuf, cmdname); \
! STRCAT(fbuf, ": (warning) "); \
! STRCAT(fbuf, (s)); \
! }
! #define ADDWARN(s) STRCAT(fbuf, (s));
! #define WARN { \
! STRCAT(fbuf, "\n"); \
! WRITE(2, fbuf, strlen(fbuf)); \
! }
int
! main(int argc, char *argv[])
{
cmdname = *argv;
! while (**argv) {
! if (*((*argv)++) == '/') {
cmdname = *argv; /* find the command's basename */
! }
}
! if (argc > 3) {
INITERR("usage: ")
ADDERR(cmdname)
ADDERR(" [infile [outfile]]")
ERROR
}
! if ((argc > 1) && strcmp(*++argv, "-")) {
inname = *argv;
! if ((infile = open(inname, O_RDONLY)) == -1) {
INITERR(inname)
ADDERR(": ")
ADDERR(ERR)
--- 30,87 ----
int outfile = 1;
char *outname = "<stdout>";
! /* basename of executable */
! char *cmdname;
! /* error handling definitions follow */
extern int errno, sys_nerr;
extern char *sys_errlist[];
+ extern void exit P((int)) ;
+
#define ERR ((errno < sys_nerr) ? sys_errlist[errno] : "")
! #define INITERR(s) {(void)strcpy(fbuf, cmdname); (void)strcat(fbuf, ": ");\
! (void)strcat(fbuf, (s));}
! #define ADDERR(s) (void)strcat(fbuf, (s));
! #define ERROR {(void)strcat(fbuf, "\n");\
! (void)write(2, fbuf, strlen(fbuf)); exit(1);}
! #define INITWARN(s) {(void)strcpy(fbuf, cmdname);\
! (void)strcat(fbuf, ": (warning) ");\
! (void)strcat(fbuf, (s));}
! #define ADDWARN(s) (void)strcat(fbuf, (s));
! #define WARN {(void)strcat(fbuf, "\n"); (void)write(2, fbuf, strlen(fbuf));}
int
! main(argc, argv)
! int argc;
! char *argv[];
{
cmdname = *argv;
! while (**argv)
! if (*((*argv)++) == '/')
cmdname = *argv; /* find the command's basename */
!
! if (argc > 1 && !strcmp(argv[1], "-X"))
! {
! xbitmap++;
! argc--;
! argv++;
}
! if (argc > 3)
! {
INITERR("usage: ")
ADDERR(cmdname)
ADDERR(" [infile [outfile]]")
ERROR
}
! if ((argc > 1) && strcmp(*++argv, "-"))
! {
inname = *argv;
! if ((infile = open(inname, O_RDONLY)) == -1)
! {
INITERR(inname)
ADDERR(": ")
ADDERR(ERR)
***************
*** 89,98 ****
}
}
! if (argc > 2) {
outname = *++argv;
! if ((outfile = open(outname, O_WRONLY | O_CREAT |
! O_TRUNC, 0644)) == -1) {
INITERR(outname)
ADDERR(": ")
ADDERR(ERR)
--- 89,99 ----
}
}
! if (argc > 2)
! {
outname = *++argv;
! if ((outfile = open(outname, O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1)
! {
INITERR(outname)
ADDERR(": ")
ADDERR(ERR)
***************
*** 101,107 ****
}
(void) ReadBuf();
! switch (uncompface(fbuf)) {
case -2 : INITERR("internal error")
ERROR
case -1 : INITERR(inname)
--- 102,109 ----
}
(void) ReadBuf();
! switch (uncompface(fbuf))
! {
case -2 : INITERR("internal error")
ERROR
case -1 : INITERR(inname)
***************
*** 121,133 ****
int
WriteBuf()
{
! char *s, *t;
! int len;
s = fbuf;
t = s + strlen(s);
! while (s < t) {
! if ((len = write(outfile, s, t - s)) == -1) {
INITERR(outname)
ADDERR(": ")
ADDERR(ERR)
--- 123,137 ----
int
WriteBuf()
{
! register char *s, *t;
! register int len;
s = fbuf;
t = s + strlen(s);
! while (s < t)
! {
! if ((len = write(outfile, s, t - s)) == -1)
! {
INITERR(outname)
ADDERR(": ")
ADDERR(ERR)
***************
*** 135,161 ****
}
s += len;
}
! return(0);
}
int
ReadBuf()
{
! int count, len;
! char *t;
count = 0;
t = fbuf;
! while ((len = read(infile, t, FACEBUFLEN - count))) {
! if (len == -1) {
INITERR(inname)
ADDERR(": ")
ADDERR(ERR)
ERROR
}
t += len;
! if ((count += len) >= FACEBUFLEN) {
INITWARN(inname)
ADDWARN(" exceeds internal buffer size. Data may be lost")
WARN
--- 139,168 ----
}
s += len;
}
! return 0;
}
int
ReadBuf()
{
! register int count, len;
! register char *t;
count = 0;
t = fbuf;
! while (len = read(infile, t, FACEBUFLEN - count))
! {
! if (len == -1)
! {
INITERR(inname)
ADDERR(": ")
ADDERR(ERR)
ERROR
}
t += len;
! if ((count += len) >= FACEBUFLEN)
! {
INITWARN(inname)
ADDWARN(" exceeds internal buffer size. Data may be lost")
WARN
***************
*** 163,167 ****
}
}
*t = '\0';
! return(count);
}
--- 170,174 ----
}
}
*t = '\0';
! return count;
}

62
mail/faces/files/patch-ck Normal file
View file

@ -0,0 +1,62 @@
*** compface/uncompface.c Thu Feb 21 16:42:54 2002
--- /home/lkoeller/tmp/ports/mail/faces/work/faces/compface/uncompface.c Wed Jun 19 08:29:14 1991
***************
*** 1,10 ****
-
/*
- * $Header: /cvs/faces/faces/compface/uncompface.c,v 1.3 2002/02/21 15:42:54 devface Exp $
- *
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) 1990-2002 James Ashton - Sydney University
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
--- 1,9 ----
/*
* Compface - 48x48x1 image compression and decompression
*
! * Copyright (c) James Ashton - Sydney University - June 1990.
! *
! * Written 11th November 1989.
*
* Permission is given to distribute these sources, as long as the
* copyright messages are not removed, and no monies are exchanged.
***************
*** 14,29 ****
* to me, then an attempt will be made to fix them.
*/
#include "compface.h"
- #include "vars.h"
int
! uncompface(char *fbuf)
{
! if (!(status = setjmp(comp_env))) {
! UnCompAll(fbuf); /* compress otherwise */
UnGenFace();
WriteFace(fbuf);
}
! return(status);
}
--- 13,31 ----
* to me, then an attempt will be made to fix them.
*/
+ #define MAIN
+
#include "compface.h"
int
! uncompface(fbuf)
! char *fbuf;
{
! if (!(status = setjmp(comp_env)))
! {
! UnCompAll(fbuf);/* compress otherwise */
UnGenFace();
WriteFace(fbuf);
}
! return status;
}

27
mail/faces/files/xbm2ikon Normal file
View file

@ -0,0 +1,27 @@
#!/bin/sh
#
# @(#)xbm2ikon 1.4 91/05/06
#
# Copyright (c) Steve Kinzler - March 1991.
#
# Permission is given to distribute these sources, as long as the
# copyright messages are not removed, and no monies are exchanged.
#
# No responsibility is taken for any errors on inaccuracies inherent
# either to the comments or the code of this program, but if reported
# to me, then an attempt will be made to fix them.
PATH=$PATH:/usr/bin/X11; export PATH
# xbm2ikon - convert an X11 bitmap to a Blit ikon bitmap
# stdin/stdout filter
# requires some bitmap filters from the pbmplus package
# kludge by kinzler@cs.indiana.edu
xbmtopbm |
pbmtoicon |
sed -e 1,2d -e '$s/$/,/' |
tr -d '\011\012' |
tr ',' '\012' |
pr -l1 -t -w22 -3 -s, |
sed -e 's/$/,/' -e 's/\(0x....\)\(0x....\)\(0x....\),/\1,\2,\3,/'

16
mail/faces/files/xbmcut48 Normal file
View file

@ -0,0 +1,16 @@
#!/bin/sh
#
# @(#)xbmcut48 1.2 91/04/15
#
# Copyright (c) Steve Kinzler - April 1991.
#
# Permission is given to distribute these sources, as long as the
# copyright messages are not removed, and no monies are exchanged.
#
# No responsibility is taken for any errors on inaccuracies inherent
# either to the comments or the code of this program, but if reported
# to me, then an attempt will be made to fix them.
PATH=$PATH:/usr/bin/X11; export PATH
xbmtopbm | pnmcut 0 0 48 48 | pbmtoxbm

View file

@ -0,0 +1,52 @@
#!/bin/sh
#
# @(#)xbmsize48 1.3 91/11/19
#
# Copyright (c) Steve Kinzler - April 1991.
#
# Permission is given to distribute these sources, as long as the
# copyright messages are not removed, and no monies are exchanged.
#
# No responsibility is taken for any errors on inaccuracies inherent
# either to the comments or the code of this program, but if reported
# to me, then an attempt will be made to fix them.
PATH=$PATH:/usr/bin/X11; export PATH
size=48
# xbmsize48 - size an X11 bitmap to 48x48
#
# If the bitmaps exceeds 48 pixels in either dimension it is scaled down
# to 48 pixels. Then, the bitmap is pasted into the upper left corner of
# a 48x48 blank bitmap.
#
# A stdin/stdout filter.
# Requires filters from the pbmplus package.
#
# Steve Kinzler, kinzler@cs.indiana.edu, March 1991
tmp=/tmp/xbmsize48.$$
tmp2=/tmp/xbmsize48.2.$$
trap "rm -f $tmp $tmp2; exit" 0 1 2 13 15
cat > $tmp || exit
eval `sed -n 's/^#define.*_width[ ]*\([0-9]*\).*$/w=\1/p
s/^#define.*_height[ ]*\([0-9]*\).*$/h=\1/p
/{/q' $tmp`
if test $w -gt $size -o $h -gt $size
then
if test $w -ge $h
then dim=xsize
else dim=ysize
fi
xbmtopbm < $tmp | ppmscale -$dim $size |
ppmtopgm | pgmtopbm | pbmtoxbm > $tmp2
mv $tmp2 $tmp
fi
xbmtopbm < $tmp > $tmp2
pbmmake $size $size | pnmpaste $tmp2 0 0 | pbmtoxbm

26
mail/faces/pkg-message Normal file
View file

@ -0,0 +1,26 @@
**************************************************
NOTE:
For generating faces out of xbm files you must use
the following helper filters:
xbm2ikon
and perhaps
xbmsize48 or xbmcut48
e.g.
1) generate a 48x48x1 xbm file
2) cat <file.xbm> | xbm2ikon > file.ikon
3) compface file.ikon > file.face
And the other way arround to display a face
Note uncompface -X is the same as
uncompface | ikon2xbm
useful for exmh!
**************************************************

View file

@ -2,6 +2,10 @@ bin/faces
lib/X11/app-defaults/Faces
bin/compface
bin/uncompface
bin/ikon2xbm
bin/xbm2ikon
bin/xbmcut48
bin/xbmsize48
include/compface.h
lib/libcompface.a
lib/libcompface.so