Changed mechanism for defining size_type
This commit is contained in:
parent
240dd55fd9
commit
4d682ab1e2
|
@ -12,3 +12,4 @@ mal.c
|
||||||
param.h
|
param.h
|
||||||
phys.c
|
phys.c
|
||||||
phys.h
|
phys.h
|
||||||
|
size_type.h
|
||||||
|
|
|
@ -5,7 +5,7 @@ CFLAGS = -O -I$(EMHOME)/modules/h $(COPT)
|
||||||
SUF = o
|
SUF = o
|
||||||
RCC = cc #$ must produce a runnable object
|
RCC = cc #$ must produce a runnable object
|
||||||
|
|
||||||
MALLOCSRC = READ_ME size_type.h param.h impl.h check.h log.h phys.h \
|
MALLOCSRC = READ_ME size_type.h gensize_type.h param.h impl.h check.h log.h phys.h \
|
||||||
mal.c log.c phys.c check.c
|
mal.c log.c phys.c check.c
|
||||||
|
|
||||||
.SUFFIXES: .$(SUF)
|
.SUFFIXES: .$(SUF)
|
||||||
|
@ -35,10 +35,10 @@ opr:
|
||||||
make pr | opr
|
make pr | opr
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.$(SUF) clashes malloc1.c size_type.h getsize malloc.c
|
rm -f *.$(SUF) clashes malloc1.c gensize_type.h getsize malloc.c
|
||||||
|
|
||||||
size_type.h: getsize
|
gensize_type.h: getsize
|
||||||
getsize > size_type.h
|
getsize > gensize_type.h
|
||||||
|
|
||||||
getsize: getsize.c
|
getsize: getsize.c
|
||||||
$(RCC) -o getsize getsize.c
|
$(RCC) -o getsize getsize.c
|
||||||
|
|
|
@ -11,14 +11,17 @@
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
|
puts("#ifndef size_type");
|
||||||
if (sizeof(unsigned int) == sizeof(char *)) {
|
if (sizeof(unsigned int) == sizeof(char *)) {
|
||||||
puts("typedef unsigned int size_type;");
|
puts("#define size_type unsigned int");
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
if (sizeof(long) == sizeof(char *)) {
|
else if (sizeof(long) == sizeof(char *)) {
|
||||||
puts("typedef long size_type;");
|
puts("#define size_type long");
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
fputs("funny pointer size\n", stderr);
|
else {
|
||||||
exit(1);
|
fputs("funny pointer size\n", stderr);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
puts("#endif");
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
15
modules/src/malloc/size_type.h
Normal file
15
modules/src/malloc/size_type.h
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/* $Header$ */
|
||||||
|
/*
|
||||||
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
|
*/
|
||||||
|
/* This file defines size_type if _EM_WSIZE and _EM_PSIZE are defined.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(_EM_WSIZE) && defined(_EM_PSIZE)
|
||||||
|
#if _EM_WSIZE == _EM_PSIZE
|
||||||
|
#define size_type unsigned int
|
||||||
|
#else
|
||||||
|
#define size_type long
|
||||||
|
#endif
|
||||||
|
#endif
|
Loading…
Reference in a new issue