GRASS port to Digital Alpha AXP ready for testing

James Ganong jeg at
Thu Feb 17 20:53:37 EST 1994

I have ported GRASS to the Digitial Alpha AXP running OSF/1.
My port can use the portable GRASS vector files,
so it can share data with existing GRASS installations.
I also got XDRIVER to work with a 24 bit display,
but displaying the usual 8 bit GRASS graphics.

We have been using it at UC Berkeley for a couple of weeks,
and it seems to be stable and really fast.
Please test it and let me know what bugs you find.

Here is the README file:


by James Ganong, jeg at, (510)849-1909 


You can get it by anonymous ftp from
in /pub/grass/grass-alpha-axp-0.1.tar.Z


install the patches you want -- probably you want all but xgre, and if you
				you use xgre you want it to.

patches.setup.axp -- patches src/CMD/utils/setup for alpha axp port
patches.xdriver.24bit -- allows XDRIVER to use 24 bit truecolor hardware 
			to do typical GRASS 8 bit graphics,
			admittedly not an ideal solution,
			but better than restarting your X server in 8 bit mode
			does not change normal operation on 8 bit displays,
			except it might fix a bug or two.
patches.grass.axp -- patches GRASS bugs found in alpha axp port
			also includes #ifdef around redeclartions
                        see discussion below of DO_NOT_REDEFINE_STDLIB
patches.xgre.bugs -- patches xgre cell editor bugs found in alpha axp port
			xgre is not part of the GRASS distribution yet

run src/CMD/utils/setup program as patched by patches.setup.axp
to make an head file that will work on an alpha.
these changes are mostly cc options to get it to compile.

run long2LONG on the patched sources.  this does global substitutions
to make long into LONG and %ld in a scanf to "LDSET".
it current directory and scans every *.c and *.h file 
in the current directory and every subdirectory.

do a GISGEN.axp (or GISGEN.whatever_you_called_it_when_you_ran_setup)

try it out!  please send buggestions to jeg at

if you find bugs and fix them in the globally substited code,
you can use filterdiff to make a patch file that looks like it is 
relative to the original code before the global substitutions.
this way the diffs are applicable to all grass installations.
filterdiff compares every file every file in the current directory
and subdirectories against its first argument.  the *.c and *.h files
are run through sed to elimate the global changes in the input to diff.


the byte order and sizes of types are the same on a decstation
and an alpha axp, except for longs and pointers which are 64 bits.
GRASS on a decstation works well, so i use a macro trick to make
change all the longs in GRASS to ints, which are 32 bits on an alpha axp,
which is the same as a long on a decstation.

i have replaced every long in the GRASS code with the macro LONG.
then i define LONG as int.  that way LONG is the same size a long
on a decstation.  this could be a problem when GRASS substracts
one pointer from another and puts the result in a LONG, because
the difference between two pointers could be greater that 2^32,
but i haven't seen this to be a problem in practice yet.  
i have been compiling with -trapuv which i think helps limit the
pointers to a smaller address space, but i a not really sure if
it does so.

this strategy allows me to use the portable GRASS vector file format
without any fuss, which is a big win when you have a bunch of non-alpha
machines on your network.  in the long run we may want instead of have
GRASS work with 64 bit longs, so that we can process larger datasets
before we hit limitations, but maybe GRASS should be ansi-ized first?


LONG -- macro for when GRASS code had long
on alpha -- int
elsewhere -- long

LDSET -- macro for when GRASS code has scanf reading a long
this macro is put in by a global substitution
these global substitutions vanish in the patch files made with filterdiff
the substitution process only works when the scanf the %ld are the same line
on alpha -- "%d"
elsewhere -- "%ld"

L_IN_LD -- macro for when GRASS code has a scanf reading a long
this macro is put in by hand
whenever a scanf's appears without a " on the same line a human needs to check.
usually this is because the fmt string is being dynamically calculated.
this macro replaces the l in %ld
on alpha -- ""
elsewhere -- "l"


many places in GRASS there are redeclarations of functions from
the stardard libraries, like ftell() and malloc().
i think it is better just to #include the right header file,
and the redeclarations often trip over my long to LONG trick,
so i have #ifdef'ed them out.  if you do not define DO_NOT_REDEFINE_STDLIB
then you get the equivalent of the original GRASS code, with the 
redeclarations.  if you do define DO_NOT_REDEFINE_STDLIB,
then you lose the redeclarations and gain some #includes.

More information about the grass-dev mailing list