FreeType 1.31.1

This commit is contained in:
2023-08-27 18:03:45 +02:00
commit 5edbb7a80a
454 changed files with 173977 additions and 0 deletions

132
lib/arch/msdos/Makefile.BC Normal file
View File

@@ -0,0 +1,132 @@
# This file is part of the FreeType project.
#
# It builds the library for Borland C++ for MS-DOS, large model.
# Due to size constraints, it does not try to pack all modules into one
# (`single-object mode').
#
# You will need Borland MAKE.
# Tested with Borland C++ v.3.1, 4.02, 5.0.
#
# Use this file while in the lib directory with the following statement:
#
# make -farch/msdos/Makefile.BC
#
#
# A debug version can be obtained with
#
# make -DDEBUG -farch/msdos/Makefile.BC
#
# A special version enabled to handle big fonts (with more than 16,384
# glyphs) can be obtained with
#
# make -DBIGFONTS -farch/msdos/Makefile.BC
ARCH = arch\msdos
FT_MAKEFILE = $(ARCH)\Makefile.BC
CC = bcc
LIB = tlib /c /e
# Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern
# Borland compilers (from BC++ 3.1 on) can increase the limit on
# the length of identifiers.
!if ! $d(DEBUG)
CFLAGS = -ml -A -O2 -3 -i40 -w-nak -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig -I$(ARCH);.;extend
!else
CFLAGS = -v -N -ml -A -i40 -w-nak -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig -I$(ARCH);.;extend
!endif
!if $d(BIGFONTS)
CFLAGS = $(CFLAGS) -DTT_HUGE_PTR=__huge
TTFILE = $(ARCH)\.\hugefile.c
TTMEMORY = $(ARCH)\.\hugemem.c
!else
TTFILE = .\ttfile.c
TTMEMORY = .\ttmemory.c
!endif
TTMUTEX = .\ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
# Do not insert spaces before the \ at end of line,
# otherwise the substitution for TLIB command line will fail.
SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c\
extend\ftxsbit.c extend\ftxgsub.c extend\ftxgpos.c\
extend\ftxopen.c extend\ftxgdef.c
OBJS_X = $(SRC_X:.c=.obj)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c\
ttgload.c ttinterp.c ttload.c ttobjs.c\
ttraster.c ttextend.c ttdebug.c $(PORT)
OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
SRC_S = $(ARCH)\.\freetype.c
OBJ_S = $(SRC_S:.c=.obj)
OBJS_S = $(OBJ_S) $(OBJS_X)
# Since Borland's make does not handle $($(LIB_FILES)), and using
# -DLIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
# by constructing TLIB's response file directly in the `all' target.
#
# Another solution, useful during debugging of part of the library,
# would be to include each .obj in the library as soon as it is compiled.
# It is commented out below. See Makefile.TC for an application.
.c.obj:
$(CC) -c -o$* @&&|
$(CFLAGS) $<
|
# $(LIB) libttf +-$*.obj
!if !$d(DEBUG)
# Skipped if DEBUG build
# (but it changes nothing, since we always build in multiple parts).
all: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @&&|
+ $(OBJS_M: = + )
|
!endif
debug: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @&&|
+ $(OBJS_M: = + )
|
$(OBJ_S): $(SRC_S) $(SRC_M)
# Not used here because it excesses the capacity of COMMAND.COM...
libttf.lib: $(LIB_FILES)
-del libttf.lib
$(LIB) libttf.lib @&&|
+ $(**: = + )
|
!if $d(BIGFONTS)
$(TTMEMORY:.c=.obj): $(TTMEMORY)
$(CC) -c -o$* @&&|
$(CFLAGS) -A- $*.c
|
!endif
clean:
-del *.obj
-del extend\*.obj
-del $(ARCH)\*.obj
-del libttf.bak
-del response
distclean: clean
-del libttf.lib
!include "$(ARCH)\depend.dos"
# end of Makefile

117
lib/arch/msdos/Makefile.MS Normal file
View File

@@ -0,0 +1,117 @@
# This file is part of the FreeType project.
#
# It builds the library for Microsoft C for MS-DOS, large model.
# It also works for Visual C++ 1.x 16-bits compiler, but you should
# instead use the Makefile customized for it, Makefile.VC.
# Due to size constraints, it does not try to pack all modules into one.
#
# You will need NMAKE.
#
# Use this file while in the lib directory with the following statement:
#
# nmake /f arch\msdos\Makefile.MS
#
#
# A debug version can be obtained with
#
# nmake DEBUG=1 /f arch\msdos\Makefile.MS
#
# A special version enabled to handle big fonts (with more than 16,384
# glyphs) can be obtained with
#
# nmake BIGFONTS=1 /f arch\msdos\Makefile.MS
ARCH = arch\msdos
FT_MAKEFILE = $(ARCH)\Makefile.MS
CC = cl /nologo
LIB = lib /noignorecase /nologo
!ifndef DEBUG
CFLAGS = /Ox /AL /W2 /G2 /I$(ARCH) /I. /Iextend
!else
CFLAGS = /Zi /AL /W2 /G2 /I$(ARCH) /I. /Iextend
!endif
!ifndef BIGFONTS
CFLAGS = $(CFLAGS) /Za
TTFILE = .\ttfile.c
TTMEMORY = .\ttmemory.c
!else
CFLAGS = $(CFLAGS) /DTT_HUGE_PTR=__huge /Ze
TTFILE = $(ARCH)\hugefile.c
TTMEMORY = $(ARCH)\hugemem.c
!endif
TTMUTEX = .\ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
# Do not insert spaces between the file names or at end of line, otherwise
# the substitution for LIB command line will fail. Thank you.
#
SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c extend\ftxsbit.c\
extend\ftxopen.c extend\ftxgsub.c extend\ftxgpos.c extend\ftxgdef.c
OBJS_X = $(SRC_X:.c=.obj)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c\
ttgload.c ttinterp.c ttload.c ttobjs.c ttraster.c ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
SRC_S = $(ARCH)\freetype.c
OBJ_S = $(SRC_S:.c=.obj)
OBJS_S = $(OBJ_S) $(OBJS_X)
# Since Microsoft's NMAKE does not handle $($(LIB_FILES)), and using
# LIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
# by constructing LIB's response file directly in the `all' target.
#
# Another solution, useful during debugging of part of the library,
# would be to include each .obj in the library as soon as it is compiled.
# It is commented out below. See Makefile.TC for an application.
.c.obj:
@$(CC) /c /Fo$@ @<<
$(CFLAGS) $*.c
<<
# $(LIB) libttf +-$*.obj
!ifndef DEBUG
# Skipped if DEBUG build
# (but it changes nothing, since we always build in multiple parts).
all: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @<<response
+ $(OBJS_M: = ^ );
<<KEEP
!endif
debug: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @<<response
+ $(OBJS_M: = ^ );
<<KEEP
$(OBJ_S): $(SRC_S) $(SRC_M)
# Not used here because it excesses the capacity of COMMAND.COM...
libttf.lib: $(LIB_FILES)
$(LIB) $@ +-$(?: =-+);
clean:
-del *.obj
-del extend\*.obj
-del $(ARCH)\*.obj
-del response
distclean: clean
-del libttf.lib
!include "$(ARCH)\depend.dos"
# end of Makefile.MS

View File

@@ -0,0 +1,86 @@
# This file is part of the FreeType project.
#
# It builds the library for Turbo C for MS-DOS, large model.
# Due to size constraints, it does not try to pack all modules into one.
#
# You will need Borland MAKE.
# Tested with Turbo C v.1.5, v.2.0, Turbo C++ v.1.0
# Turbo C v.1.0 (May '87) is too old (lack of structure assignment)
# to compile FreeType. Update your compiler. ;-)
#
# Use this file while in the lib directory with the following statement:
#
# make -farch/msdos/Makefile.TC
#
#
# A debug version can be obtained (except for TC1.5) with
#
# make -DDEBUG -farch/msdos/Makefile.TC
ARCH = arch\msdos
FT_MAKEFILE = $(ARCH)\Makefile.TC
CC = tcc
LIB = tlib /c
!if ! $d(DEBUG)
CFLAGS = -ml -A -a -G -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig -I$(ARCH);.;extend
!else
# For Turbo C v.1.5, replace the -v option below by -y.
CFLAGS = -v -N -ml -A -w-par -w-use -w-aus -w-stu -w-stv -w-cln -w-sig -I$(ARCH);.;extend
!endif
TTFILE = .\ttfile.obj
TTMEMORY = .\ttmemory.obj
TTMUTEX = .\ttmutex.obj
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
OBJS_X = extend\ftxgasp.obj extend\ftxkern.obj extend\ftxpost.obj \
extend\ftxcmap.obj extend\ftxwidth.obj extend\ftxerr18.obj \
extend\ftxsbit.obj extend\ftxopen.obj extend\ftxgsub.obj \
extend\ftxgpos.obj extend\ftxgdef.obj
# the line below does not work with these old versions of make...
# OBJS_X = $(SRC_X:.c=.obj)
OBJS_M = ttapi.obj ttcache.obj ttcalc.obj ttcmap.obj ttdebug.obj \
ttgload.obj ttinterp.obj ttload.obj ttobjs.obj \
ttraster.obj ttextend.obj $(PORT) $(OBJS_X)
# OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
# Not used here because the compiler runs out of memory...
OBJ_S = $(ARCH)\freetype.obj
OBJS_S = $(OBJ_S) $(OBJS_X)
# Since Borland's make is very primitive, we include each .obj
# in the library as soon as it is compiled.
.c.obj:
$(CC) $(CFLAGS) -c -o$* $<
$(LIB) libttf +-$*.obj
!if !$d(DEBUG)
# Skipped if DEBUG build
# (but it changes nothing, since we always build in multiple parts).
all: $(OBJS_M)
!endif
debug: $(OBJS_M)
clean:
-del *.obj
-del extend\*.obj
-del $(ARCH)\*.obj
-del libttf.bak
# -del response
distclean: clean
-del libttf.lib
!include "$(ARCH)\depend.dos"
# end of Makefile

117
lib/arch/msdos/Makefile.VC Normal file
View File

@@ -0,0 +1,117 @@
# This file is part of the FreeType project.
#
# It builds the library for Microsoft Visual C++ 1.x for MS-DOS, large model.
# It also works for Microsoft C/C++ v.7.0 16-bit compiler, but not for
# previous versions (use Makefile.MS instead).
#
# You will need NMAKE.
#
# Use this file while in the lib directory with the following statement:
#
# nmake /f arch\msdos\Makefile.VC
#
#
# A debug version can be obtained with
#
# nmake DEBUG=1 /f arch\msdos\Makefile.VC
#
# A special version enabled to handle big fonts (with more than 16,384
# glyphs) can be obtained with
#
# nmake BIGFONTS=1 /f arch\msdos\Makefile.VC
ARCH = arch\msdos
FT_MAKEFILE = $(ARCH)\Makefile.VC
CC = cl /nologo
LIB = lib /noignorecase /nologo
# One can also consider using "set MSC_CMD_FLAGS=/Gr /Op- /Gy /YX".
# With Microsoft C/C++ 7.0, use /G2 instead of /G3.
!ifndef DEBUG
CFLAGS = $(CFLAGS) /Ox /AL /W2 /G3 /I$(ARCH) /I. /Iextend
!else
CFLAGS = $(CFLAGS) /Zi /Ge /AL /W2 /G3 /I$(ARCH) /I. /Iextend
!endif
!ifndef BIGFONTS
CFLAGS = $(CFLAGS) /Za
TTFILE = .\ttfile.c
TTMEMORY = .\ttmemory.c
!else
CFLAGS = $(CFLAGS) /DTT_HUGE_PTR=__huge /Ze
TTFILE = $(ARCH)\hugefile.c
TTMEMORY = $(ARCH)\hugemem.c
!endif
TTMUTEX = .\ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
# Do not insert spaces between the file names or at end of line, otherwise
# the substitution for LIB command line will fail. Thank you.
#
SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c extend\ftxsbit.c\
extend\ftxopen.c extend\ftxgsub.c extend\ftxgpos.c extend\ftxgdef.c
OBJS_X = $(SRC_X:.c=.obj)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c\
ttgload.c ttinterp.c ttload.c ttobjs.c ttraster.c ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
SRC_S = $(ARCH)\freetype.c
OBJ_S = $(SRC_S:.c=.obj)
OBJS_S = $(OBJ_S) $(OBJS_X)
# Since Microsoft's NMAKE does not handle $($(LIB_FILES)), and using
# LIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
# by constructing LIB's response file directly in the `all' target.
#
# Another solution, useful during debugging of part of the library,
# would be to include each .obj in the library as soon as it is compiled.
# It is commented out below. See Makefile.TC for an application.
.c.obj:
@$(CC) /c /Fo$@ @<<
$(CFLAGS) $*.c
<<
# $(LIB) libttf +-$*.obj
!ifndef DEBUG
# Skipped if DEBUG build
all: $(OBJS_S)
-del libttf.lib
$(LIB) libttf.lib @<<response
+ $(OBJS_S: = + );
<<KEEP
!endif
debug: $(OBJS_M)
-del libttf.lib
$(LIB) libttf.lib @<<response
+ $(OBJS_M: = + );
<<KEEP
$(OBJ_S): $(SRC_S) $(SRC_M)
# Not used here because it excesses the capacity of COMMAND.COM...
libttf.lib: $(LIB_FILES)
$(LIB) $@ +-$(?: =-+);
clean:
-del *.obj
-del extend\*.obj
-del $(ARCH)\*.obj
-del response
distclean: clean
-del libttf.lib
!include "$(ARCH)\depend.dos"
# end of Makefile.VC

View File

@@ -0,0 +1,84 @@
# This file is part of the FreeType project.
#
# It builds the library and test programs for emx-gcc or djgpp under MSDOS.
#
# You will need dmake.
#
# Use this file while in the lib directory with the following statement:
#
# dmake -r -f arch/msdos/Makefile.dm
ARCH = arch/msdos
FT_MAKEFILE = $(ARCH)/Makefile.dm
FT_MAKE = dmake -r
.IMPORT: COMSPEC
SHELL := $(COMSPEC)
SHELLFLAGS := /c
GROUPSHELL := $(SHELL)
GROUPFLAGS := $(SHELLFLAGS)
GROUPSUFFIX := .bat
SHELLMETAS := *"?<>&|
CC = gcc
CFLAGS = -Wall -O2 -g -ansi -pedantic -I$(ARCH) -I. -Iextend
# CFLAGS = -Wall -ansi -O2 -s -I$(ARCH) -I. -Iextend
SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
extend/ftxgsub.c extend/ftxgpos.c extend/ftxopen.c \
extend/ftxgdef.c extend/ftxerr18.c
OBJS_X = $(SRC_X:.c=.o)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
ttfile.c ttgload.c ttinterp.c ttload.c \
ttmemory.c ttmutex.c ttobjs.c ttraster.c ttextend.c
OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
SRC_S = $(ARCH)/freetype.c
OBJ_S = $(SRC_S:.c=.o)
OBJS_S = $(OBJ_S) $(OBJS_X)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: all debug clean distclean depend
all:
$(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S libttf.a
debug:
$(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M libttf.a
$(OBJ_S): $(SRC_S) $(SRC_M)
$(CC) $(CFLAGS) -c -o $@ $(SRC_S)
libttf.a: $($(LIB_FILES))
+-del $@
ar src $@ @$(mktmp $(<:t"\n")\n)
clean:
-[
del *.o
del extend\*.o
del $(ARCH)\*.o
]
distclean: clean
-[
del dep.end
del libttf.a
]
# depend: $(SRC_S) $(SRC_M) $(SRC_X)
# $(CC) -E -M @$(mktmp $(<:t"\n")\n) > dep.end
# ifeq (dep.end,$(wildcard dep.end))
# include dep.end
# endif
# end of Makefile.dm

View File

@@ -0,0 +1,92 @@
# This file is part of the FreeType project.
#
# It builds the library for emx-gcc or djgpp under MSDOS.
#
# You will need GNU make.
#
# Use this file while in the lib directory with the following statement:
#
# make -f arch/msdos/Makefile.gcc
#
# If you have the GNU gettext package installed with DJGPP, you can also try
#
# make -f arch/msdos/Makefile.gcc HAVE_GETTEXT
ARCH = arch/msdos
FT_MAKEFILE = $(ARCH)/Makefile.gcc
CC = gcc
ifndef GETTEXT
GETTEXT=NO_GETTEXT
endif
ifdef DEBUG
CFLAGS = -Wall -O2 -g -ansi -pedantic -I$(ARCH) -I. -Iextend -D$(GETTEXT)
else
CFLAGS = -Wall -ansi -pedantic -O2 -s -I$(ARCH) -I. -Iextend -D$(GETTEXT)
endif
TTFILE = ./ttfile.c
TTMEMORY = ./ttmemory.c
TTMUTEX = ./ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
SRC_X = extend/ftxgasp.c extend/ftxkern.c extend/ftxpost.c \
extend/ftxcmap.c extend/ftxwidth.c extend/ftxsbit.c \
extend/ftxgsub.c extend/ftxgpos.c extend/ftxgdef.c \
extend/ftxopen.c extend/ftxerr18.c
OBJS_X = $(SRC_X:.c=.o)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
ttgload.c ttinterp.c ttload.c ttobjs.c \
ttraster.c ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.o) $(OBJS_X)
SRC_S = $(ARCH)/freetype.c
OBJ_S = $(SRC_S:.c=.o)
OBJS_S = $(OBJ_S) $(OBJS_X)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: all debug clean distclean depend
all:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S libttf.a
debug:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M DEBUG=1 libttf.a
HAVE_GETTEXT:
$(MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S GETTEXT=HAVE_GETTEXT \
libttf.a
$(OBJ_S): $(SRC_S) $(SRC_M)
libttf.a: $($(LIB_FILES))
-del $@
ar src $@ $^
clean:
-del *.o
-del extend\*.o
-del $(ARCH)\*.o
-del response
distclean: clean
-del dep.end
-del libttf.a
depend: $(SRS_S) $(SRC_M) $(SRC_X)
$(CC) -E -M $^ > dep.end
ifeq (dep.end,$(wildcard dep.end))
include dep.end
endif
# end of Makefile.gcc

View File

@@ -0,0 +1,88 @@
# This file is part of the FreeType project
#
# This builds the Watcom library with Watcom's wcc386 under DOS
#
# You'll need Watcom's wmake
#
#
# Invoke by "wmake -f arch\msdos\Makefile.wat" while in the "lib" directory
#
# This will build "freetype\lib\libttf.lib"
#
ARCH = arch\msdos
FT_MAKEFILE = $(ARCH)\Makefile.wat
FT_MAKE = wmake -h
.EXTENSIONS:
.EXTENSIONS: .lib .obj .c .h
.obj:.;.\extend;.\$(ARCH)
.c:.;.\extend;.\$(ARCH)
.h:.;.\extend;.\$(ARCH)
CC = wcc386
CCFLAGS = /otexanl+ /s /w4 /zq /d3 -I$(ARCH) -I. -Iextend
# FIXME: should use something like OBJ = $(SRC:.c=.obj)
SRC_X = ftxgasp.c ftxkern.c ftxpost.c &
ftxcmap.c ftxwidth.c ftxsbit.c ftxerr18.c &
ftxgsub.c ftxgpos.c ftxopen.c ftxgdef.c
OBJS_X = ftxgasp.obj ftxkern.obj ftxpost.obj &
ftxcmap.obj ftxwidth.obj ftxsbit.obj ftxerr18.obj &
ftxgsub.obj ftxgpos.obj ftxopen.obj ftxgdef.obj
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c &
ttfile.c ttgload.c ttinterp.c &
ttload.c ttmemory.c ttmutex.c ttobjs.c ttraster.c &
ttextend.c
OBJS_M = ttapi.obj ttcache.obj ttcalc.obj ttcmap.obj ttdebug.obj &
ttfile.obj ttgload.obj ttinterp.obj &
ttload.obj ttmemory.obj ttmutex.obj ttobjs.obj ttraster.obj &
ttextend.obj $(OBJS_X)
SRC_S = freetype.c
OBJ_S = freetype.obj
OBJS_S = $(OBJ_S) $(OBJ_X)
.c.obj:
$(CC) $(CCFLAGS) $[* /fo=$[*.obj
libname = libttf
libfile = $(libname).lib
cmdfile = $(libname).lst
all: .symbolic
$(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_S $(libfile)
debug: .symbolic
$(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES=OBJS_M $(libfile)
$(libfile): $($(LIB_FILES))
wlib -q -n $(libfile) @$(cmdfile)
# is this correct? Know nothing about wmake and the Watcom compiler...
$(OBJ_S): $(SRC_S) $(SRC_M)
$(CC) $(CCFLAGS) $(SRC_S) /fo=$(OBJ_S)
$(cmdfile): $($(LIB_FILES))
@for %i in ($($(LIB_FILES))) do @%append $(cmdfile) +-%i
clean: .symbolic
@-erase $(OBJ_S)
@-erase $(OBJS_M)
@-erase $(cmdfile)
distclean: .symbolic clean
@-erase $(libfile)
new: .symbolic
@-wtouch *.c
# end of Makefile.wat

107
lib/arch/msdos/depend.dos Normal file
View File

@@ -0,0 +1,107 @@
# This dependency file to be used with various MS-DOS compilers
# has been generated automatically with the script `makedep' on
# 03-Sep-1999.
ttapi.obj: ttapi.c ttconfig.h arch\msdos\ft_conf.h freetype.h fterrid.h \
ftnameid.h ttengine.h tttypes.h ttmutex.h ttcalc.h ttmemory.h \
ttcache.h ttfile.h ttdebug.h ttobjs.h tttables.h ttcmap.h ttload.h \
ttgload.h ttraster.h ttextend.h
ttcache.obj: ttcache.c ttengine.h tttypes.h ttconfig.h \
arch\msdos\ft_conf.h freetype.h fterrid.h ftnameid.h ttmutex.h \
ttmemory.h ttcache.h ttobjs.h tttables.h ttcmap.h ttdebug.h
ttcalc.obj: ttcalc.c ttcalc.h ttconfig.h arch\msdos\ft_conf.h freetype.h \
fterrid.h ftnameid.h ttdebug.h tttypes.h tttables.h
ttcmap.obj: ttcmap.c ttobjs.h ttconfig.h arch\msdos\ft_conf.h ttengine.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttmutex.h ttcache.h \
tttables.h ttcmap.h ttdebug.h ttfile.h ttmemory.h ttload.h
ttdebug.obj: ttdebug.c ttdebug.h ttconfig.h arch\msdos\ft_conf.h \
tttypes.h freetype.h fterrid.h ftnameid.h tttables.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h ttcmap.h
ttextend.obj: ttextend.c ttextend.h ttconfig.h arch\msdos\ft_conf.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttmemory.h
ttfile.obj: ttfile.c ttconfig.h arch\msdos\ft_conf.h freetype.h \
fterrid.h ftnameid.h tttypes.h ttdebug.h ttengine.h ttmutex.h \
ttmemory.h ttfile.h
ttgload.obj: ttgload.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttdebug.h ttcalc.h ttfile.h \
ttengine.h ttmutex.h tttables.h ttobjs.h ttcache.h ttcmap.h ttgload.h \
ttmemory.h tttags.h ttload.h
ttinterp.obj: ttinterp.c freetype.h fterrid.h ftnameid.h tttypes.h \
ttconfig.h arch\msdos\ft_conf.h ttdebug.h ttcalc.h ttmemory.h \
ttinterp.h ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h \
ttcmap.h
ttload.obj: ttload.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttdebug.h ttcalc.h ttfile.h \
ttengine.h ttmutex.h tttables.h ttobjs.h ttcache.h ttcmap.h \
ttmemory.h tttags.h ttload.h
ttmemory.obj: ttmemory.c ttdebug.h ttconfig.h arch\msdos\ft_conf.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttmemory.h ttengine.h \
ttmutex.h
ttmutex.obj: ttmutex.c ttmutex.h ttconfig.h arch\msdos\ft_conf.h
ttobjs.obj: ttobjs.c ttobjs.h ttconfig.h arch\msdos\ft_conf.h ttengine.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttmutex.h ttcache.h \
tttables.h ttcmap.h ttfile.h ttdebug.h ttcalc.h ttmemory.h ttload.h \
ttinterp.h ttextend.h
ttraster.obj: ttraster.c ttraster.h ttconfig.h arch\msdos\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttengine.h tttypes.h ttmutex.h \
ttdebug.h ttcalc.h ttmemory.h
extend\ftxcmap.obj: extend\ftxcmap.c extend\ftxcmap.h freetype.h fterrid.h \
ftnameid.h tttypes.h ttconfig.h arch\msdos\ft_conf.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h
extend\ftxerr18.obj: extend\ftxerr18.c ttconfig.h arch\msdos\ft_conf.h \
extend\ftxerr18.h freetype.h fterrid.h ftnameid.h extend\ftxkern.h \
extend\ftxpost.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h
extend\ftxgasp.obj: extend\ftxgasp.c extend\ftxgasp.h freetype.h fterrid.h \
ftnameid.h tttypes.h ttconfig.h arch\msdos\ft_conf.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h
extend\ftxgdef.obj: extend\ftxgdef.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxgpos.obj: extend\ftxgpos.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxgsub.obj: extend\ftxgsub.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
freetype.h fterrid.h ftnameid.h tttags.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxkern.obj: extend\ftxkern.c extend\ftxkern.h freetype.h fterrid.h \
ftnameid.h ttextend.h ttconfig.h arch\msdos\ft_conf.h tttypes.h \
ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttdebug.h \
ttmemory.h ttfile.h ttload.h tttags.h
extend\ftxopen.obj: extend\ftxopen.c tttypes.h ttconfig.h arch\msdos\ft_conf.h \
freetype.h fterrid.h ftnameid.h ttload.h ttobjs.h ttengine.h \
ttmutex.h ttcache.h tttables.h ttcmap.h ttextend.h ttmemory.h \
ttfile.h ttdebug.h extend\ftxopen.h extend\ftxgdef.h extend\ftxgsub.h \
extend\ftxgpos.h extend\ftxopenf.h
extend\ftxpost.obj: extend\ftxpost.c extend\ftxpost.h freetype.h fterrid.h \
ftnameid.h tttypes.h ttconfig.h arch\msdos\ft_conf.h ttobjs.h \
ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttload.h ttfile.h \
ttdebug.h tttags.h ttmemory.h ttextend.h
extend\ftxsbit.obj: extend\ftxsbit.c extend\ftxsbit.h freetype.h fterrid.h \
ftnameid.h ttobjs.h ttconfig.h arch\msdos\ft_conf.h ttengine.h \
tttypes.h ttmutex.h ttcache.h tttables.h ttcmap.h ttfile.h ttdebug.h \
ttload.h ttmemory.h tttags.h ttextend.h
extend\ftxwidth.obj: extend\ftxwidth.c extend\ftxwidth.h freetype.h fterrid.h \
ftnameid.h ttdebug.h ttconfig.h arch\msdos\ft_conf.h tttypes.h \
ttobjs.h ttengine.h ttmutex.h ttcache.h tttables.h ttcmap.h ttfile.h \
tttags.h ttload.h
arch\msdos\freetype.obj: arch\msdos\freetype.c ttapi.c ttconfig.h \
arch\msdos\ft_conf.h freetype.h fterrid.h ftnameid.h ttengine.h \
tttypes.h ttmutex.h ttcalc.h ttmemory.h ttcache.h ttfile.h ttdebug.h \
ttobjs.h tttables.h ttcmap.h ttload.h ttgload.h ttraster.h ttextend.h \
ttcache.c ttcalc.c ttcmap.c ttdebug.c ttgload.c tttags.h ttinterp.c \
ttinterp.h ttload.c ttobjs.c ttraster.c arch\msdos\hugefile.c \
ttfile.c arch\msdos\hugemem.c ttmutex.c ttextend.c
arch\msdos\hugefile.obj: arch\msdos\hugefile.c ttconfig.h arch\msdos\ft_conf.h \
tttypes.h freetype.h fterrid.h ftnameid.h ttfile.c ttdebug.h \
ttengine.h ttmutex.h ttmemory.h ttfile.h
arch\msdos\hugemem.obj: arch\msdos\hugemem.c ttdebug.h ttconfig.h \
arch\msdos\ft_conf.h tttypes.h freetype.h fterrid.h ftnameid.h \
ttmemory.h ttengine.h ttmutex.h

39
lib/arch/msdos/freetype.c Normal file
View File

@@ -0,0 +1,39 @@
/* This file is part of the FreeType project */
/* Single object library component for MSDOS. */
/* Note that low-optimizing 16-bit compilers (such as Borland ones) can't */
/* successfully compile this file, because it exceeds 64K of code size. */
#define TT_MAKE_OPTION_SINGLE_OBJECT
/* first include common core components */
#include "ttapi.c"
#include "ttcache.c"
#include "ttcalc.c"
#include "ttcmap.c"
#include "ttdebug.c"
#include "ttgload.c"
#include "ttinterp.c"
#include "ttload.c"
#include "ttobjs.c"
#include "ttraster.c"
/* then system-specific (or ANSI) components */
#ifdef TT_HUGE_PTR
#include "arch/msdos/hugefile.c"
#include "arch/msdos/hugemem.c"
#else
#include "ttfile.c"
#include "ttmemory.c"
#endif
#include "ttmutex.c"
/* finally, add some extensions */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
#include "ttextend.c"
#endif
/* END */

253
lib/arch/msdos/ft_conf.h Normal file
View File

@@ -0,0 +1,253 @@
/* This file is part of the FreeType project */
/* ft_conf.h for MSDOS */
/* we need the following because there are some typedefs in this file */
#ifndef FT_CONF_H
#define FT_CONF_H
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE
/* Define if you have the valloc function. */
#undef HAVE_VALLOC
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H
/* Define if you have the <unistd.h> header file. */
#if defined( __EMX__ ) || defined( __DJGPP__ ) || defined( __GO32__ )
/* some compilers are known to have <unistd.h>; */
/* add yours if needed, and report to us the update. */
#define HAVE_UNISTD_H
#else
/* most MS-DOS compilers lack <unistd.h> */
#undef HAVE_UNISTD_H
#endif
/* Define if you need <conio.h> for console I/O functions. */
#ifdef __EMX__
#define HAVE_CONIO_H
#endif
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H
/* Define if you have the libintl library. */
#undef HAVE_LIBINTL
/* DJGPP v.2 may feature the GNU gettext package, with some subtleties. */
/* The macro HAVE_GETTEXT has to be set in the makefile. */
#ifdef HAVE_GETTEXT
#define HAVE_LOCALE_H
#define HAVE_LIBINTL_H
#define HAVE_LIBINTL
#define LOCALEDIR "/usr/djgpp/share/locale"
/* Due to a name conflict, gettext is renamed gettext__ in DJGPP */
#define gettext( str ) gettext__( str )
#endif
/* command.com can't pipe stderr into a file; any message would be */
/* written into the graphics screen. */
#define HAVE_PRINT_FUNCTION 1
#define Print( format, ap ) vfprintf( stdout, (format), (ap) )
/* The number of bytes in a int. We use the ANSI header file limits.h */
/* for determining it since there is no easy way to guess. */
#include <limits.h>
#if UINT_MAX == 0xFFFF
#define SIZEOF_INT 2
#elif UINT_MAX == 0xFFFFFFFF
#define SIZEOF_INT 4
#else
#error "Unsupported number of bytes in `int' type!"
#endif
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
/**********************************************************************/
/* */
/* The following configuration macros can be tweaked manually by */
/* a developer to turn on or off certain features or options in the */
/* TrueType engine. This may be useful to tune it for specific */
/* purposes.. */
/* */
/**********************************************************************/
/*************************************************************************/
/* Define this if the underlying operating system uses a different */
/* character width than 8bit for file names. You must then also supply */
/* a typedef declaration for defining 'TT_Text'. Default is off. */
/* #define HAVE_TT_TEXT */
/*************************************************************************/
/* Define this if you want to generate code to support engine extensions */
/* Default is on, but if you're satisfied by the basic services provided */
/* by the engine and need no extensions, undefine this configuration */
/* macro to save a few more bytes. */
#define TT_CONFIG_OPTION_EXTEND_ENGINE
/*************************************************************************/
/* Define this if you want to generate code to support gray-scaling, */
/* a.k.a. font-smoothing or anti-aliasing. Default is on, but you can */
/* disable it if you don't need it. */
#define TT_CONFIG_OPTION_GRAY_SCALING
/*************************************************************************/
/* Define this if you want to completely disable the use of the bytecode */
/* interpreter. Doing so will produce a much smaller library, but the */
/* quality of the rendered glyphs will enormously suffer from this. */
/* */
/* This switch was introduced due to the Apple patents issue which */
/* emerged recently on the FreeType lists. We still do not have Apple's */
/* opinion on the subject and will change this as soon as we have. */
#undef TT_CONFIG_OPTION_NO_INTERPRETER
/*************************************************************************/
/* Define this if you want to use a big 'switch' statement within the */
/* bytecode interpreter. Because some non-optimizing compilers are not */
/* able to produce jump tables from such statements, undefining this */
/* configuration macro will generate the appropriate C jump table in */
/* ttinterp.c. If you use an optimizing compiler, you should leave it */
/* defined for better performance and code compactness.. */
#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
/*************************************************************************/
/* Define this if you want to build a 'static' version of the TrueType */
/* bytecode interpreter. This will produce much bigger code, which */
/* _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
/*************************************************************************/
/* Define this if you want to build a 'static' version of the scan-line */
/* converter (the component which in charge of converting outlines into */
/* bitmaps). This will produce a bigger object file for "ttraster.c", */
/* which _may_ be faster on some architectures.. */
/* */
/* Do NOT DEFINE THIS is you build a thread-safe version of the engine */
/* */
#undef TT_CONFIG_OPTION_STATIC_RASTER
/*************************************************************************/
/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
/* version of the library. */
#undef TT_CONFIG_OPTION_THREAD_SAFE
/**********************************************************************/
/* */
/* The following macros are used to define the debug level, as well */
/* as individual tracing levels for each component. There are */
/* currently three modes of operation : */
/* */
/* - trace mode (define DEBUG_LEVEL_TRACE) */
/* */
/* The engine prints all error messages, as well as tracing */
/* ones, filtered by each component's level */
/* */
/* - debug mode (define DEBUG_LEVEL_ERROR) */
/* */
/* Disable tracing, but keeps error output and assertion */
/* checks. */
/* */
/* - release mode (don't define anything) */
/* */
/* Don't include error-checking or tracing code in the */
/* engine's code. Ideal for releases. */
/* */
/* NOTE : */
/* */
/* Each component's tracing level is defined in its own source. */
/* */
/**********************************************************************/
/* Define if you want to use the tracing debug mode */
#undef DEBUG_LEVEL_TRACE
/* Define if you want to use the error debug mode - ignored if */
/* DEBUG_LEVEL_TRACE is defined */
#undef DEBUG_LEVEL_ERROR
/**************************************************************************/
/* Definition of various integer sizes. These types are used by ttcalc */
/* and ttinterp (for the 64-bit integers) only.. */
#if SIZEOF_INT == 4
typedef signed int TT_Int32;
typedef unsigned int TT_Word32;
#elif SIZEOF_LONG == 4
typedef signed long TT_Int32;
typedef unsigned long TT_Word32;
#else
#error "no 32bit type found"
#endif
#if SIZEOF_LONG == 8
/* LONG64 must be defined when a 64-bit type is available */
/* INT64 must then be defined to this type.. */
#define LONG64
#define INT64 long
#else
/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
/* will produce many -ansi warnings during library compilation. */
#ifdef TT_USE_LONG_LONG
#define LONG64
#define INT64 long long
#endif /* TT_USE_LONG_LONG */
#endif
#endif /* FT_CONF_H */
/* END */

84
lib/arch/msdos/hugefile.c Normal file
View File

@@ -0,0 +1,84 @@
/*******************************************************************
*
* hugefile.c
*
* File I/O Component (body) for dealing with "huge" objects under
* MS-DOS. Relies on the "default" version, with a small hook.
*
* Written by Antoine Leca based on ideas from Dave Hoo.
* Copyright 1999 by Dave Hoo, Antoine Leca,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
* NOTE
*
* This file #includes the normal version, to avoid discrepancies
* between versions. It uses only ANSI-mandated "tricks", so
* any ANSI-compliant compiler should be able to compile this file.
*
******************************************************************/
#include "ttconfig.h"
#include "tttypes.h"
/* Here we include <stdio.h>, to have the proper definition of fread */
#include <stdio.h>
/* Then, we divert the use of fread to our version */
#undef fread
#define fread(ptr, size, n, stream) huge_fread(ptr, size, n, stream)
LOCAL_FUNC
Long huge_fread ( void *ptr, size_t size, Long n, FILE *stream );
/* Now, we include the "normal" version of ttfile.c */
/* The ANSI/ISO standard mandates that the include of <stdio.h> */
/* there have no bad effects. */
#include "ttfile.c"
/* Then, we define our implementation of fread that makes use of */
/* "huge"-allocated memory. */
/*******************************************************************
*
* Function : huge_fread
*
* Description : replacement version of fread that handles
* "huge"-allocated memory.
*
* Input : See the reference for the runtime library function fread
*
* Output : See the reference for the runtime library function fread
*
* Notes :
*
******************************************************************/
LOCAL_DEF
Long huge_fread ( void *ptr, size_t size, Long n, FILE *stream )
{
char TT_HUGE_PTR * p = (char TT_HUGE_PTR *) ptr;
ULong left = (ULong)n * size;
size_t toRead;
while ( left )
{
toRead = (left > 0x8000) ? 0x8000 : left;
if ( (fread)( p, 1, toRead, stream ) != toRead)
return -1;
else
{
left -= (ULong) toRead;
p += toRead;
}
}
return n * size;
}
/* END */

496
lib/arch/msdos/hugemem.c Normal file
View File

@@ -0,0 +1,496 @@
/*******************************************************************
*
* hugemem.c
*
* Memory management component (body)
* for dealing with "huge" objects with 16-bit MS-DOS.
*
* Written by Dave Hoo and Antoine Leca.
* Copyright 1999 by Dave Hoo, Antoine Leca,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
******************************************************************/
#include <limits.h>
#include "ttdebug.h"
#include "ttmemory.h"
#include "ttengine.h"
#ifndef TT_HUGE_PTR
#error "This component needs TT_HUGE_PTR to be #defined."
#endif
/* ---- Microsoft C compilers support ------------------------------------ */
#if defined( M_I86 ) || defined( _M_I86 )
#include <malloc.h>
#define huge_alloc( size ) _halloc ( size, 1 )
#define huge_free( block ) _hfree ( block )
#endif /* Microsoft compilers */
/* ---- Borland C compiler support --------------------------------------- */
#ifdef __TURBOC__
#include <alloc.h>
#define huge_alloc( size ) farmalloc ( size )
#define huge_free( block ) farfree ( block )
#endif
#if !defined( huge_alloc ) || !defined( huge_free )
#error "Your compiler is not (yet) supported. Check the source file!"
#endif
#ifdef TT_CONFIG_OPTION_THREAD_SAFE
#error "This component needs static allocation and is not re-entrant."
#endif
/* required by the tracing mode */
#undef TT_COMPONENT
#define TT_COMPONENT trace_memory
#ifdef DEBUG_MEMORY
#include <stdio.h>
#define MAX_TRACKED_BLOCKS 1024
struct TMemRec_
{
void* base;
Long size;
};
typedef struct TMemRec_ TMemRec;
static TMemRec pointers[MAX_TRACKED_BLOCKS + 1];
static Int num_alloc;
static Int num_free;
static Int num_realloc; /* counts only `real' reallocations
(i.e., an existing buffer will be resized
to a value larger than zero */
static Int fail_alloc;
static Int fail_realloc;
static Int fail_free;
#else
/* We need a tracing stack of the calls to big chunks of memory, */
/* in order to call the matching version of free(). */
#define MAX_TRACKED_BIGCHUNKS 16
struct TMemRec_
{
void* base;
Long size;
};
typedef struct TMemRec_ TMemRec;
static TMemRec pointers[MAX_TRACKED_BIGCHUNKS + 1];
#endif /* DEBUG_MEMORY */
#ifndef TT_CONFIG_OPTION_THREAD_SAFE
Long TTMemory_Allocated;
Long TTMemory_MaxAllocated;
#endif
/*******************************************************************
*
* Function : TT_Alloc
*
* Description : Allocates memory from the heap buffer.
*
* Input : Size size of the memory to be allocated
* P pointer to a buffer pointer
*
* Output : Error code.
*
* NOTE : The newly allocated block should _always_ be zeroed
* on return. Many parts of the engine rely on this to
* work properly.
*
******************************************************************/
EXPORT_FUNC
TT_Error TT_Alloc( ULong Size, void** P )
{
Int i;
if ( !P )
return TT_Err_Invalid_Argument;
/* Also see below for another case of "invalid argument". */
if ( Size > 0 )
{
if ( Size > ( UINT_MAX & ~0xFu ) )
*P = (void*)huge_alloc( Size );
else
*P = (void*)malloc( Size );
if ( !*P )
return TT_Err_Out_Of_Memory;
#ifndef TT_CONFIG_OPTION_THREAD_SAFE
TTMemory_Allocated += Size;
TTMemory_MaxAllocated += Size;
#endif
#ifdef DEBUG_MEMORY
num_alloc++;
i = 0;
while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != NULL )
i++;
if ( i >= MAX_TRACKED_BLOCKS )
fail_alloc++;
else
{
pointers[i].base = *P;
pointers[i].size = Size;
}
#else
if ( Size > ( UINT_MAX & ~0xFu ) )
{
i = 0;
while ( i < MAX_TRACKED_BIGCHUNKS && pointers[i].base != NULL )
i++;
if ( i >= MAX_TRACKED_BIGCHUNKS )
/* We fail badly here. Increase MAX_TRACKED_BIGCHUNKS if needed. */
return TT_Err_Invalid_Argument;
else
{
pointers[i].base = *P;
pointers[i].size = Size;
}
}
#endif /* DEBUG_MEMORY */
if ( Size > ( UINT_MAX & ~0xFu ) )
{
char TT_HUGE_PTR * p = (char TT_HUGE_PTR *) *P;
ULong left = (ULong)Size;
size_t toClear;
while ( left )
{
toClear = (left > 0xFF00) ? 0xFF00 : left;
MEM_Set( p, 0, toClear );
left -= (ULong) toClear;
p += toClear;
}
}
else
MEM_Set( *P, 0, Size );
}
else
*P = NULL;
return TT_Err_Ok;
}
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
/*******************************************************************
*
* Function : TT_Realloc
*
* Description : Reallocates memory from the heap buffer.
*
* Input : Size new size of the memory to be allocated;
* if zero, TT_Free() will be called
* P pointer to a buffer pointer; if *P == NULL,
* TT_Alloc() will be called
*
* Output : Error code.
*
* NOTES : It's not necessary to zero the memory in case the
* reallocated buffer is larger than before -- the
* application has to take care of this.
*
* If the memory request fails, TT_Free() will be
* called on *P, and TT_Err_Out_Of_Memory returned.
*
******************************************************************/
EXPORT_FUNC
TT_Error TT_Realloc( ULong Size, void** P )
{
void* Q;
#ifdef DEBUG_MEMORY
Int i;
#endif
if ( !P )
return TT_Err_Invalid_Argument;
if ( !*P )
return TT_Alloc( Size, P );
if ( Size == 0 )
return TT_Free( P );
if ( Size > ( UINT_MAX & ~0xFu ) )
Q = NULL; /* Do not even try to deal with big chunks of memory. */
else
Q = (void*)realloc( *P, Size );
if ( !Q )
{
TT_Free( *P );
return TT_Err_Out_Of_Memory;
}
#ifdef DEBUG_MEMORY
num_realloc++;
i = 0;
while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != *P )
i++;
if ( i >= MAX_TRACKED_BLOCKS )
fail_realloc++;
else
{
#ifndef TT_CONFIG_OPTION_THREAD_SAFE
TTMemory_Allocated += Size - pointers[i].size;
if ( Size > pointers[i].size )
TTMemory_MaxAllocated += Size - pointers[i].size;
#endif
pointers[i].base = Q;
pointers[i].size = Size;
}
#endif /* DEBUG_MEMORY */
*P = Q;
return TT_Err_Ok;
}
#endif /* TT_CONFIG_OPTION_EXTEND_ENGINE */
/*******************************************************************
*
* Function : TT_Free
*
* Description : Releases a previously allocated block of memory.
*
* Input : P pointer to memory block
*
* Output : Always SUCCESS.
*
* Note : The pointer must _always_ be set to NULL by this function.
*
******************************************************************/
EXPORT_FUNC
TT_Error TT_Free( void** P )
{
Int i;
Long Size = 0;
if ( !P || !*P )
return TT_Err_Ok;
#ifdef DEBUG_MEMORY
num_free++;
i = 0;
while ( i < MAX_TRACKED_BLOCKS && pointers[i].base != *P )
i++;
if ( i >= MAX_TRACKED_BLOCKS )
fail_free++;
else
{
#ifndef TT_CONFIG_OPTION_THREAD_SAFE
TTMemory_Allocated -= pointers[i].size;
#endif
Size = pointers[i].size;
pointers[i].base = NULL;
pointers[i].size = 0;
}
#else
i = 0;
while ( i < MAX_TRACKED_BIGCHUNKS && pointers[i].base != *P )
i++;
/* If we did not found the pointer, then this is a "small" chunk. */
if ( i < MAX_TRACKED_BIGCHUNKS )
{
Size = pointers[i].size;
pointers[i].base = NULL;
pointers[i].base = NULL;
}
#endif /* DEBUG_MEMORY */
if ( Size > ( UINT_MAX & ~0xFu ) )
huge_free( *P );
else
free( *P );
*P = NULL;
return TT_Err_Ok;
}
/*******************************************************************
*
* Function : TTMemory_Init
*
* Description : Initializes the memory.
*
* Output : Always SUCCESS.
*
******************************************************************/
LOCAL_FUNC
TT_Error TTMemory_Init( void )
{
#ifdef DEBUG_MEMORY
Int i;
for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
{
pointers[i].base = NULL;
pointers[i].size = 0;
}
num_alloc = 0;
num_realloc = 0;
num_free = 0;
fail_alloc = 0;
fail_realloc = 0;
fail_free = 0;
#else
Int i;
for ( i = 0; i < MAX_TRACKED_BIGCHUNKS; i++ )
{
pointers[i].base = NULL;
pointers[i].size = 0;
}
#endif
#ifndef TT_CONFIG_OPTION_THREAD_SAFE
TTMemory_Allocated = 0;
TTMemory_MaxAllocated = 0;
#endif
return TT_Err_Ok;
}
/*******************************************************************
*
* Function : TTMemory_Done
*
* Description : Finalizes memory usage.
*
* Output : Always SUCCESS.
*
******************************************************************/
LOCAL_FUNC
TT_Error TTMemory_Done( void )
{
#ifdef DEBUG_MEMORY
Int i, num_leaked, tot_leaked;
num_leaked = 0;
tot_leaked = 0;
for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
{
if ( pointers[i].base )
{
num_leaked ++;
tot_leaked += pointers[i].size;
}
}
fprintf( stderr,
"%d memory allocations, of which %d failed\n",
num_alloc,
fail_alloc );
fprintf( stderr,
"%d memory reallocations, of which %d failed\n",
num_realloc,
fail_realloc );
fprintf( stderr,
"%d memory frees, of which %d failed\n",
num_free,
fail_free );
if ( num_leaked > 0 )
{
fprintf( stderr,
"There are %d leaked memory blocks, totalizing %d bytes\n",
num_leaked, tot_leaked );
for ( i = 0; i < MAX_TRACKED_BLOCKS; i++ )
{
if ( pointers[i].base )
{
fprintf( stderr,
"index: %4d (base: $%08lx, size: %08ld)\n",
i,
(long)pointers[i].base,
pointers[i].size );
}
}
}
else
fprintf( stderr, "No memory leaks !\n" );
#endif /* DEBUG_MEMORY */
return TT_Err_Ok;
}
/* END */

26
lib/arch/msdos/makedep Normal file
View File

@@ -0,0 +1,26 @@
# makedep
#
# This shell script creates a dependency file necessary for older compilers
# on the MS-DOS platform.
echo "\
# This dependency file to be used with various MS-DOS compilers
# has been generated automatically with the script \`makedep' on
# `date +%d-%b-%Y`.
" > depend.dos
(cd ../..
gcc -MM -Iarch/msdos -I. *.c | \
sed -e "s/\.o:/.obj:/" -e "s:/:\\\\:g") >> depend.dos
(cd ../..
gcc -MM -Iarch/msdos -I. -Iextend extend/*.c | \
sed -e "s/^\(.*\)\.o:/extend\\\\\1.obj:/" -e "s:/:\\\\:g") >> depend.dos
(cd ../..
gcc -MM -Iarch/msdos -I. -Iextend \
-DTT_HUGE_PTR -Dhuge_alloc -Dhuge_free arch/msdos/*.c | \
sed -e "s/^\(.*\)\.o:/arch\\\\msdos\\\\\1.obj:/" \
-e "s:/:\\\\:g") >> depend.dos
# eof