Hi,
here are the things I had to work on to get GD.pm to fly
(with perl 5.6.0 and .1).
My environment consists of a VAXstation 4060, VMS 6.2, DEC C
5.7-004 and MMK 3.8-1.
Before GD.pm (latest version 1.3.3; I also did build 1.3.0)
can be built, libgd (min. version 1.8.3), zlib and libpng
must be available. libgd can be optionally built with TrueType
support (libttf required), JPEG support (libjpeg required),
and XPM support (libxpm required).
Yes, I know these are not the latest versions of the libraries.
The reason for this is that I built them last October.
So then:
----- libgd v1.8.3 -----
I had to insert a few <stdlib.h> to get exit() to be known,
conditionalized the includes of <malloc.h>, provided a missing
prototype (needed by GD.pm), and corrected a few char vs.
unsigned char issues (the DEC C compiler doesn't tolerate these).
I renamed the "Putchar" function to "gdPutchar", as I wanted
to save me the hassle of going through building it case-sensitive.
--- gd.c_orig Tue Oct 24 20:00:42 2000
+++ gd.c Tue Oct 24 20:00:42 2000
@@ -1,6 +1,9 @@
-#ifndef _OSD_POSIX /* _OSD_POSIX defines *alloc() in stdlib.h */
+#ifdef HAVE_MALLOC_H
+ /* #ifndef _OSD_POSIX /* _OSD_POSIX defines *alloc() in stdlib.h */
#include <malloc.h>
-#endif /*_OSD_POSIX*/
+#else
+#include <stdlib.h>
+#endif /*HAVE_MALLOC_H*/ /*_OSD_POSIX*/
#include <stdio.h>
#include <math.h>
#include <string.h>
--- gd.h_orig Tue Oct 24 20:39:50 2000
+++ gd.h Tue Oct 24 20:40:12 2000
@@ -91,6 +91,7 @@
gdImagePtr gdImageCreate(int sx, int sy);
gdImagePtr gdImageCreateFromPng(FILE *fd);
gdImagePtr gdImageCreateFromPngCtx(gdIOCtxPtr in);
+gdImagePtr gdImageCreateFromXpm(char *filename);
/* A custom data source. */
/* The source function must return -1 on error, otherwise the number
--- gd2copypal.c_orig Tue Oct 24 20:00:43 2000
+++ gd2copypal.c Tue Oct 24 20:00:42 2000
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <stdlib.h>
#include "gd.h"
/* A short program which converts a .png file into a .gd file, for
--- gd2topng.c_orig Tue Oct 24 20:00:43 2000
+++ gd2topng.c Tue Oct 24 20:00:43 2000
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <stdlib.h>
#include "gd.h"
/* A short program which converts a .png file into a .gd file, for
--- gdcache.h_orig Tue Oct 24 20:00:44 2000
+++ gdcache.h Tue Oct 24 20:00:44 2000
@@ -40,7 +40,11 @@
/* header */
/*********************************************************/
+#ifdef HAVE_MALLOC_H
#include <malloc.h>
+#else
+#include <stdlib.h>
+#endif /*HAVE_MALLOC_H*/
#ifndef NULL
#define NULL (void *)0
#endif
--- gdkanji.c_orig Tue Oct 24 20:00:46 2000
+++ gdkanji.c Tue Oct 24 20:00:46 2000
@@ -304,15 +304,20 @@
error("invalid code specification: \"%s\" or \"%s\"",
EUCSTR, code);
#endif
- strcpy(to, from);
+ strcpy((char *)to, (char *)from);
return;
}
from_len = strlen((const char *)from) +1;
to_len = BUFSIZ;
+#ifdef __VMS
+ if (iconv(cd, (char **)&from, &from_len,
+ (char **)&to, &to_len) == -1) {
+#else
if (iconv(cd, (const char **)&from, &from_len,
(char **)&to, &to_len) == -1) {
+#endif
#ifdef HAVE_ERRNO_H
if (errno == EINVAL) error("invalid end of input string");
else
@@ -322,7 +327,7 @@
else
#endif
error("something happen");
- strcpy(to, from);
+ strcpy((char *)to, (char *)from);
return;
}
@@ -420,12 +425,12 @@
case NEC:
debug("Kanji code is NEC Kanji.");
error("cannot convert NEC Kanji.");
- strcpy(tmp, from);
+ strcpy((char *)tmp, (char *)from);
kanji = FALSE;
break;
case EUC:
debug("Kanji code is EUC.");
- strcpy(tmp, from);
+ strcpy((char *)tmp, (char *)from);
break;
case SJIS:
debug("Kanji code is SJIS.");
@@ -433,17 +438,17 @@
break;
case EUCORSJIS:
debug("Kanji code is EUC or SJIS.");
- strcpy(tmp, from);
+ strcpy((char *)tmp, (char *)from);
kanji = FALSE;
break;
case ASCII:
debug("This is ASCII string.");
- strcpy(tmp, from);
+ strcpy((char *)tmp, (char *)from);
kanji = FALSE;
break;
default:
debug("This string includes unknown code.");
- strcpy(tmp, from);
+ strcpy((char *)tmp, (char *)from);
kanji = FALSE;
break;
}
@@ -469,11 +474,11 @@
if (j >= BUFSIZ) {
error("output buffer overflow at Hankaku --> Zenkaku");
- strcpy(to, tmp);
+ strcpy((char *)to, (char *)tmp);
} else
to[j] = '\0';
} else
- strcpy(to, tmp);
+ strcpy((char *)to, (char *)tmp);
return kanji;
}
@@ -500,10 +505,10 @@
ret = do_check_and_conv(tmp_dest, src);
if (strlen((const char *)tmp_dest) >= dest_max) {
error("output buffer overflow");
- strcpy(dest, src);
+ strcpy((char *)dest, (char *)src);
return -1;
}
- strcpy(dest, tmp_dest);
+ strcpy((char *)dest, (char *)tmp_dest);
return ret;
}
--- gdtest.c_orig Tue Oct 24 20:00:47 2000
+++ gdtest.c Tue Oct 24 20:00:47 2000
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <stdlib.h>
#ifdef _WIN32
#include <process.h>
int unlink(const char * filename) {
@@ -6,6 +7,7 @@
}
#else
#include <unistd.h> /* for getpid(), unlink() */
+#define unlink(x) remove(x)
#endif
#include "gd.h"
--- gdtopng.c_orig Thu Nov 2 02:56:36 2000
+++ gdtopng.c Thu Nov 2 02:56:54 2000
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <stdlib.h>
#include "gd.h"
/* A short program which converts a .png file into a .gd file, for
--- gdttf.c_orig Tue Oct 24 20:00:48 2000
+++ gdttf.c Tue Oct 24 20:00:48 2000
@@ -325,7 +325,7 @@
font_t *a;
fontkey_t *b=(fontkey_t *)key;
int i, n, map_found;
- short platform, encoding;
+ unsigned short platform, encoding;
a = (font_t *)malloc(sizeof(font_t));
a->fontname = (char *)malloc(strlen(b->fontname) + 1);
@@ -784,7 +784,7 @@
fontkey_t fontkey;
char *error, *next;
/* 1.7.2: initialize this variable. */
- char *tmpstr = 0;
+ unsigned char *tmpstr = 0;
/****** initialize font engine on first call ************/
static gdCache_head_t *fontCache;
@@ -817,8 +817,8 @@
if (font->have_char_map_Sjis) {
#endif
if (tmpstr = (unsigned char *)malloc(BUFSIZ)) {
- any2eucjp(tmpstr, string, BUFSIZ);
- next=tmpstr;
+ any2eucjp(tmpstr, (unsigned char *)string, BUFSIZ);
+ next=(char *)tmpstr;
} else
next=string;
#ifndef JISX0208
--- gd_io.c_orig Tue Oct 24 20:00:48 2000
+++ gd_io.c Tue Oct 24 20:00:48 2000
@@ -34,7 +34,7 @@
}
void
-Putchar(int c, gdIOCtx *ctx)
+gdPutchar(int c, gdIOCtx *ctx)
{
(ctx->putC)( ctx, c & 0xff );
}
--- gd_io.h_orig Tue Oct 24 20:00:49 2000
+++ gd_io.h Tue Oct 24 20:00:49 2000
@@ -20,7 +20,7 @@
typedef struct gdIOCtx *gdIOCtxPtr;
void Putword(int w, gdIOCtx *ctx);
-void Putchar(int c, gdIOCtx *ctx);
+void gdPutchar(int c, gdIOCtx *ctx);
void gdPutC(const unsigned char c, gdIOCtx *ctx);
int gdPutBuf(const void *, int, gdIOCtx*);
--- gd_wbmp.c_orig Tue Oct 24 20:00:50 2000
+++ gd_wbmp.c Tue Oct 24 20:00:50 2000
@@ -68,6 +68,7 @@
int gd_putout( int i, void * out )
{
gdPutC( i , (gdIOCtx *) out );
+ return 0;
}
--- wbmp.c_orig Tue Oct 24 20:00:52 2000
+++ wbmp.c Tue Oct 24 20:00:52 2000
@@ -67,7 +67,7 @@
putout( 0x80 | (i & 0x7f << 7*l ) >> 7*l, out );
putout( i & 0x7f, out );
-
+ return 0;
}
--- webpng.c_orig Tue Oct 24 20:00:53 2000
+++ webpng.c Tue Oct 24 20:00:53 2000
@@ -13,6 +13,7 @@
}
#else
#include <unistd.h> /* for getpid(), unlink() */
+#define unlink(x) remove(x)
#endif
int main(int argc, char **argv)
{
[End patch]
----- zlib v1.1.3 ------
Nothing to report; this builds out-of-the-box.
----- libpng v1.0.8 -----
Defined the logical ZLIBSRC to point to the directory
that holds ZLIB.H and LIBZ.OLB. Other than that: O.K.
----- libttf v1.3 -----
Watch your step! The description file plays with SET FILE/ENTER !
One other thing:
--- ftxgsub.h_orig Tue Oct 24 05:33:11 2000
+++ ftxgsub.h Tue Oct 24 05:41:00 2000
@@ -29,6 +29,11 @@
#define TTO_Err_Invalid_GSUB_SubTable_Format 0x1010
#define TTO_Err_Invalid_GSUB_SubTable 0x1011
+#ifdef __VMS
+ /* shorten func name to 31 chars */
+# define TT_GSUB_Register_Alternate_Function TT_GSUB_Register_Alternate_Func
+#endif
+
/* Lookup types for glyph substitution */
[End patch]
----- libjpeg v6b -----
This also contains one function whose name is longer than 31 chars.
But in this case, someone already thought of this.
--- jconfig.vms_orig Thu Apr 19 20:52:23 2001
+++ jconfig.vms Thu Apr 19 20:52:29 2001
@@ -12,7 +12,7 @@
#undef NEED_BSD_STRINGS
#undef NEED_SYS_TYPES_H
#undef NEED_FAR_POINTERS
-#undef NEED_SHORT_EXTERNAL_NAMES
+#define NEED_SHORT_EXTERNAL_NAMES
#undef INCOMPLETE_TYPES_BROKEN
#ifdef JPEG_INTERNALS
[End patch]
----- libxpm -----
I haven't done a lot of X lately, so I chose to not
use this. I have, however, built this library successfully
(I think it was v3.4m or something - it really has been
some time).
And finally:
----- GD.pm v1.3.3 -----
Again, the char vs. unsigned char issue rears its ugly head.
--- gd.xs_orig Fri Apr 20 01:49:12 2001
+++ gd.xs Mon Apr 16 19:52:51 2001
@@ -1235,7 +1235,7 @@
PROTOTYPE: $$$$$$
CODE:
{
- gdImageString(image,font,x,y,s,color);
+ gdImageString(image,font,x,y,(unsigned char*)s,color);
}
void
@@ -1249,7 +1249,7 @@
PROTOTYPE: $$$$$$
CODE:
{
- gdImageStringUp(image,font,x,y,s,color);
+ gdImageStringUp(image,font,x,y,(unsigned char*)s,color);
}
void
[End patch]
All in all, it wasn't that hard. Good job, everyone, and thanks.
cu,
Martin
--
One OS to rule them all | Martin Vorlaender | VMS & WNT programmer
One OS to find them | work: [EMAIL PROTECTED]
One OS to bring them all | http://www.pdv-systeme.de/users/martinv/
And in the Darkness bind them.| home: [EMAIL PROTECTED]