From: kivinen@cs.hut.fi (Tero Kivinen)
Subject: Re: [Q] gs252 on DEC Alpha
Date: Fri, 23 Apr 1993 21:12:11 GMT [thread overview]
Message-ID: <KIVINEN.93Apr24001206@laphroaig.cs.hut.fi> (raw)
In-Reply-To: luoma@binah.cc.brandeis.edu's message of Thu, 22 Apr 1993 11:59:00 GMT
In article <1993Apr22.115900.14234@news.cs.brandeis.edu> luoma@binah.cc.brandeis.edu writes:
> In trying to bring up GhostScript 2.5.2, I had difficulting
> with the compilation. In particular, in gsmisc.c
> I could not get the compiler to accept the _pad in
> the structures for malloc. I stubbed this out
> (I was pressed for time) and GhostScript compiled.
gcc can handle that _pad line, but cc don't. I ifdeffed it off if
compiling for alpha (because the last element of the struct is pointer
(64 bits) the size of structure is correctly aligned).
> However, I found the GhostScript could no longer
> handle characters (tiger.ps worked just fine :).
You probably got lots of "Unaligned access"-warnings, at least I did.
I managed to get them all of by fixing the gx_device_raster so it will
align scan lines correctly.
> I would like to hear from people who have
> sucessfully compiled GhostScript (and GhostView)
With this patch i got the ghostscript to compile and it seems to work
quite ok (fonts work all the examples works and it doesn't get any
unaligned access). Ghostview 1.4 only needed dirent and then it
compiled and worked. All this under DEC OSF/1 V1.2 (Rev. 10), DEC AXP
3000/400S 96MB+2GB.
Here is a patch for ghostscript 2.5.2:
----------------------------------------------------------------------
diff -cbr gs252/echogs.c gs252-patched/echogs.c
*** gs252/echogs.c Sat Sep 19 14:48:42 1992
--- gs252-patched/echogs.c Fri Apr 23 16:33:41 1993
***************
*** 116,122 ****
in = stdin;
break;
case 'D': /* insert date/time */
! { long t;
char str[26];
time(&t);
strcpy(str, ctime(&t));
--- 116,122 ----
in = stdin;
break;
case 'D': /* insert date/time */
! { time_t t;
char str[26];
time(&t);
strcpy(str, ctime(&t));
diff -cbr gs252/gdev4081.c gs252-patched/gdev4081.c
*** gs252/gdev4081.c Wed Nov 27 10:09:10 1991
--- gs252-patched/gdev4081.c Fri Apr 23 18:47:12 1993
***************
*** 49,55 ****
/* Check allocations */
if ( out == 0 )
! { if ( out ) gs_free(out, out_size, 1, "r4081_print_page(out)");
return -1;
}
--- 49,56 ----
/* Check allocations */
if ( out == 0 )
! { if ( out ) gs_free((char *) out, out_size, 1,
! "r4081_print_page(out)");
return -1;
}
***************
*** 89,94 ****
/* Eject the page and reinitialize the printer */
fputs("\f\033\rP", prn_stream);
! gs_free(out, out_size, 1, "r4081_print_page(out)");
return 0;
}
--- 90,95 ----
/* Eject the page and reinitialize the printer */
fputs("\f\033\rP", prn_stream);
! gs_free((char *) out, out_size, 1, "r4081_print_page(out)");
return 0;
}
diff -cbr gs252/gdevbit.c gs252-patched/gdevbit.c
*** gs252/gdevbit.c Tue Aug 11 13:00:20 1992
--- gs252-patched/gdevbit.c Fri Apr 23 18:47:29 1993
***************
*** 52,57 ****
if ( !nul )
fwrite(in, 1, line_size, prn_stream);
}
! gs_free(in, line_size, 1, "bit_print_page(in)");
return 0;
}
--- 52,57 ----
if ( !nul )
fwrite(in, 1, line_size, prn_stream);
}
! gs_free((char *) in, line_size, 1, "bit_print_page(in)");
return 0;
}
diff -cbr gs252/gdevcdj.c gs252-patched/gdevcdj.c
*** gs252/gdevcdj.c Sat Sep 19 17:37:50 1992
--- gs252-patched/gdevcdj.c Fri Apr 23 16:40:26 1993
***************
*** 19,24 ****
--- 19,25 ----
/* gdevcdj.c */
/* H-P DeskJet 500C driver (colour) for Ghostscript */
+ #include "std.h"
#include <stdlib.h> /* for rand() */
#include "gdevprn.h"
#include "gdevpcl.h"
diff -cbr gs252/gdevdfax.c gs252-patched/gdevdfax.c
*** gs252/gdevdfax.c Sat Apr 25 20:48:54 1992
--- gs252-patched/gdevdfax.c Fri Apr 23 18:44:14 1993
***************
*** 318,324 ****
free(faxp);
return (0);
! };
private unsigned short
fax_ushort(unsigned short v)
--- 318,324 ----
free(faxp);
return (0);
! }
private unsigned short
fax_ushort(unsigned short v)
diff -cbr gs252/gdevdjtc.c gs252-patched/gdevdjtc.c
*** gs252/gdevdjtc.c Sat Jul 25 17:05:40 1992
--- gs252-patched/gdevdjtc.c Fri Apr 23 16:48:21 1993
***************
*** 21,26 ****
--- 21,27 ----
/* HP DeskJet 500C driver for Ghostscript */
#include "gdevprn.h"
#include "gdevpcl.h"
+ #include <stdlib.h>
/***
*** Note: this driver was contributed by a user, Alfred Kayser:
diff -cbr gs252/gdevpccm.c gs252-patched/gdevpccm.c
*** gs252/gdevpccm.c Mon Aug 17 21:33:46 1992
--- gs252-patched/gdevpccm.c Fri Apr 23 18:42:52 1993
***************
*** 55,64 ****
{{green,cyan,lcyan},{brown,white,lcyan},{yellow,yellow,lmagenta}};
static byte g2[3][3] =
{{lgreen,lgreen,lcyan},{lgreen,lgreen,lcyan},{yellow,yellow,bwhite}};
return (gx_color_index)
! ((g >= c23 ? g2 : g >= c13 ? g1 : g0)
! [r >= c23 ? 2 : r >= c13 ? 1 : 0]
! [b >= c23 ? 2 : b >= c13 ? 1 : 0]);
#undef c13
#undef c23
}
--- 55,72 ----
{{green,cyan,lcyan},{brown,white,lcyan},{yellow,yellow,lmagenta}};
static byte g2[3][3] =
{{lgreen,lgreen,lcyan},{lgreen,lgreen,lcyan},{yellow,yellow,bwhite}};
+ if (g >= c23)
return (gx_color_index)
! g2[r >= c23 ? 2 : r >= c13 ? 1 : 0]
! [b >= c23 ? 2 : b >= c13 ? 1 : 0];
! else if (g >=c13)
! return (gx_color_index)
! g1[r >= c23 ? 2 : r >= c13 ? 1 : 0]
! [b >= c23 ? 2 : b >= c13 ? 1 : 0];
! else
! return (gx_color_index)
! g0[r >= c23 ? 2 : r >= c13 ? 1 : 0]
! [b >= c23 ? 2 : b >= c13 ? 1 : 0];
#undef c13
#undef c23
}
diff -cbr gs252/gdevtknk.c gs252-patched/gdevtknk.c
*** gs252/gdevtknk.c Thu Sep 17 01:26:04 1992
--- gs252-patched/gdevtknk.c Fri Apr 23 16:48:30 1993
***************
*** 25,30 ****
--- 25,31 ----
device descriptors with other geometrical characteristics.
*/
#include "gdevprn.h"
+ #include <stdlib.h>
/* Thanks to Karsten Spang (spang@nbivax.nbi.dk) for contributing */
/* this code to Ghostscript. */
diff -cbr gs252/gsdevice.c gs252-patched/gsdevice.c
*** gs252/gsdevice.c Wed Sep 9 21:54:44 1992
--- gs252-patched/gsdevice.c Fri Apr 23 21:02:34 1993
***************
*** 348,354 ****
--- 348,358 ----
gx_device_raster(const gx_device *dev, int pad)
{ ulong bits = (ulong)dev->width * dev->color_info.depth;
return (pad ?
+ #ifndef __alpha
(uint)((bits + 31) >> 5) << 2 :
+ #else
+ (uint)((bits + 63) >> 6) << 3 :
+ #endif
(uint)((bits + 7) >> 3));
}
diff -cbr gs252/gsmisc.c gs252-patched/gsmisc.c
*** gs252/gsmisc.c Thu Sep 17 01:31:04 1992
--- gs252-patched/gsmisc.c Fri Apr 23 20:12:46 1993
***************
*** 23,28 ****
--- 23,29 ----
#include "gx.h"
#include "malloc_.h"
#include "memory_.h"
+ #include <stdlib.h>
/* Define private replacements for stdin, stdout, and stderr. */
FILE *gs_stdin, *gs_stdout, *gs_stderr;
***************
*** 62,68 ****
--- 63,75 ----
struct malloc_block_data_s { malloc_block_data; };
struct malloc_block_s {
malloc_block_data;
+ /* In alpha the malloc_block_data_s is aligned correctly (last item is
+ * pointer). The cc -std1 complains about the line _pad[xxx], saying
+ * "member types cannot be function types or incomplete type.
+ * (3.5.2.1(27))" ++kivinen */
+ #ifndef __alpha
byte _pad[-sizeof(struct malloc_block_data_s) & 7]; /* pad to double */
+ #endif
};
private malloc_block *malloc_list = 0;
char *
diff -cbr gs252/gxcache.c gs252-patched/gxcache.c
*** gs252/gxcache.c Wed Sep 16 13:48:02 1992
--- gs252-patched/gxcache.c Fri Apr 23 20:53:01 1993
***************
*** 42,55 ****
/* Define the size of the cache structures. */
/* We round the size of a cached_char so that */
/* an immediately following bitmap will be properly aligned. */
const uint cached_char_sizeof =
sizeof(cached_char) + (-sizeof(cached_char) & 3);
#define cc_bits(cc) ((byte *)(cc) + cached_char_sizeof)
const uint cached_fm_pair_sizeof = sizeof(cached_fm_pair);
/* Define the hash chain for a (code, fm_pair) key. */
#define chars_head(dir, code, pair)\
! &(dir)->chars[((uint)(code) + ((uint)(pair) << 4)) & (dir)->chars_mask]
/* Forward references */
private void shorten_cached_char(P3(gs_font_dir *, cached_char *, uint));
--- 42,60 ----
/* Define the size of the cache structures. */
/* We round the size of a cached_char so that */
/* an immediately following bitmap will be properly aligned. */
+ #ifdef __alpha
const uint cached_char_sizeof =
+ sizeof(cached_char) + (-sizeof(cached_char) & 7);
+ #else
+ const uint cached_char_sizeof =
sizeof(cached_char) + (-sizeof(cached_char) & 3);
+ #endif
#define cc_bits(cc) ((byte *)(cc) + cached_char_sizeof)
const uint cached_fm_pair_sizeof = sizeof(cached_fm_pair);
/* Define the hash chain for a (code, fm_pair) key. */
#define chars_head(dir, code, pair)\
! &(dir)->chars[((uint)(code) + ((ulong)(pair) << 4)) & (dir)->chars_mask]
/* Forward references */
private void shorten_cached_char(P3(gs_font_dir *, cached_char *, uint));
diff -cbr gs252/idebug.c gs252-patched/idebug.c
*** gs252/idebug.c Fri Jul 17 01:35:04 1992
--- gs252-patched/idebug.c Fri Apr 23 16:32:39 1993
***************
*** 174,180 ****
if ( size && msg )
dprintf2("%s at 0x%lx:\n", msg, (ulong)from);
while ( count-- )
! { dprintf2("..%04x: 0x%02x ", (uint)p & 0xffff, r_type(p));
debug_dump_one_ref(p);
dputc('\n');
p++;
--- 174,180 ----
if ( size && msg )
dprintf2("%s at 0x%lx:\n", msg, (ulong)from);
while ( count-- )
! { dprintf2("..%04x: 0x%02x ", (ulong)p & 0xffff, r_type(p));
debug_dump_one_ref(p);
dputc('\n');
p++;
***************
*** 229,235 ****
{ ref temp;
packed_get(pp, &temp);
dprintf3("..%04x%c 0x%02x ",
! (uint)pp & 0xffff,
((r_is_packed(pp)) ? '*' : ':'),
r_type(&temp));
debug_dump_one_ref(&temp);
--- 229,235 ----
{ ref temp;
packed_get(pp, &temp);
dprintf3("..%04x%c 0x%02x ",
! (ulong)pp & 0xffff,
((r_is_packed(pp)) ? '*' : ':'),
r_type(&temp));
debug_dump_one_ref(&temp);
diff -cbr gs252/iscan.c gs252-patched/iscan.c
*** gs252/iscan.c Thu Sep 3 19:33:00 1992
--- gs252-patched/iscan.c Fri Apr 23 16:51:13 1993
***************
*** 19,24 ****
--- 19,25 ----
/* iscan.c */
/* Token scanner for Ghostscript interpreter */
+ #include "std.h"
#include <ctype.h>
#include "memory_.h"
#include "ghost.h"
--
Tero_Kivinen@hut.FI Work : +358-0-451 4032
Klovinrinne 6b, 02180, Espoo Home : +358-0-524 207
next prev parent reply other threads:[~1993-04-23 21:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-04-22 11:59 [Q] gs252 on DEC Alpha luoma
1993-04-23 21:12 ` Tero Kivinen [this message]
-- strict thread matches above, loose matches on Subject: below --
1993-04-22 12:20 luoma
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox