Initial commit of new GUI code.
This commit is contained in:
commit
0748aaf9e2
2019 changed files with 517690 additions and 0 deletions
4
.gitattributes
vendored
Normal file
4
.gitattributes
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
*.fnt filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.gif filter=lfs diff=lfs merge=lfs -text
|
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
bin/
|
||||
obj/
|
||||
build-*/
|
||||
installed/
|
||||
thirdparty/jpeg-9e/.deps/
|
||||
thirdparty/libpng-1.6.37/.deps/
|
||||
|
||||
*~
|
26
LICENSE
Normal file
26
LICENSE
Normal file
|
@ -0,0 +1,26 @@
|
|||
|
||||
Third Party Library Licenses:
|
||||
|
||||
|
||||
GRX
|
||||
---
|
||||
http://grx.gnu.de/index.html
|
||||
Lib: LGPL with DOS binary exception / Fonts: MIT
|
||||
|
||||
|
||||
JPEG
|
||||
----
|
||||
https://ijg.org/
|
||||
"As-Is"
|
||||
|
||||
|
||||
PNG
|
||||
---
|
||||
http://www.libpng.org/pub/png/libpng.html
|
||||
PNG Reference Library License v2 ("As-Is")
|
||||
|
||||
|
||||
ZLIB
|
||||
----
|
||||
https://www.zlib.net/
|
||||
"As-Is"
|
123
Makefile.djgpp
Normal file
123
Makefile.djgpp
Normal file
|
@ -0,0 +1,123 @@
|
|||
#
|
||||
# Kangaroo Punch MultiPlayer Game Server Mark II
|
||||
# Copyright (C) 2020-2021 Scott Duensing
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# General
|
||||
CC = gcc
|
||||
LD = gcc
|
||||
RM = rm -f
|
||||
RMDIR = rm -rf
|
||||
INSTALL = install
|
||||
DEBUG = -g
|
||||
|
||||
## CHANGE THIS ##
|
||||
TARGET = client
|
||||
SRCDIR = .
|
||||
OBJDIR = obj
|
||||
BINDIR = bin
|
||||
## CHANGE THIS ##
|
||||
|
||||
# CFLAGS, LDFLAGS, CPPFLAGS, PREFIX can be overriden on CLI
|
||||
CFLAGS := $(DEBUG)
|
||||
CFLAGS += -I$(SRCDIR)/installed/dos/include -I$(SRCDIR)/client/src
|
||||
CPPFLAGS :=
|
||||
LDFLAGS := -L$(SRCDIR)/installed/dos/lib
|
||||
LDLIBS := -lgrx20 -ljpeg -lpng -lz
|
||||
PREFIX :=
|
||||
TARGET_ARCH :=
|
||||
|
||||
|
||||
# Compiler Flags
|
||||
ALL_CFLAGS := $(CFLAGS)
|
||||
ALL_CFLAGS += -Wall -Ofast
|
||||
#ALL_CFLAGS += -Wall -O0 -pg
|
||||
|
||||
# Preprocessor Flags
|
||||
ALL_CPPFLAGS := $(CPPFLAGS)
|
||||
|
||||
# Linker Flags
|
||||
ALL_LDFLAGS := $(LDFLAGS)
|
||||
ALL_LDLIBS := $(LDLIBS) -lc
|
||||
|
||||
|
||||
# Source, Binaries, Dependencies
|
||||
SRC := $(shell find $(SRCDIR)/client -type f -name '*.c')
|
||||
OBJ := $(patsubst $(SRCDIR)/%,$(OBJDIR)/%,$(SRC:.c=.o))
|
||||
DEP := $(OBJ:.o=.d)
|
||||
BIN := $(BINDIR)/$(TARGET)
|
||||
-include $(DEP)
|
||||
|
||||
#$(info [${SRC}])
|
||||
#$(info [${OBJ}])
|
||||
|
||||
|
||||
# Verbosity Control, ala automake
|
||||
V = 0
|
||||
|
||||
# Verbosity for CC
|
||||
REAL_CC := $(CC)
|
||||
CC_0 = @echo "CC $<"; $(REAL_CC)
|
||||
CC_1 = $(REAL_CC)
|
||||
CC = $(CC_$(V))
|
||||
|
||||
# Verbosity for LD
|
||||
REAL_LD := $(LD)
|
||||
LD_0 = @echo "LD $@"; $(REAL_LD)
|
||||
LD_1 = $(REAL_LD)
|
||||
LD = $(LD_$(V))
|
||||
|
||||
# Verbosity for RM
|
||||
REAL_RM := $(RM)
|
||||
RM_0 = @echo "Cleaning..."; $(REAL_RM)
|
||||
RM_1 = $(REAL_RM)
|
||||
RM = $(RM_$(V))
|
||||
|
||||
# Verbosity for RMDIR
|
||||
REAL_RMDIR := $(RMDIR)
|
||||
RMDIR_0 = @$(REAL_RMDIR)
|
||||
RMDIR_1 = $(REAL_RMDIR)
|
||||
RMDIR = $(RMDIR_$(V))
|
||||
|
||||
|
||||
|
||||
# Build Rules
|
||||
.PHONY: clean
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
all: setup $(BIN)
|
||||
setup: dir
|
||||
remake: clean all
|
||||
|
||||
dir:
|
||||
@mkdir -p $(OBJDIR)
|
||||
@mkdir -p $(BINDIR)
|
||||
|
||||
|
||||
$(BIN): $(OBJ)
|
||||
$(LD) $(ALL_LDFLAGS) $^ $(ALL_LDLIBS) -o $@
|
||||
|
||||
$(OBJDIR)/%.o: $(SRCDIR)/%.c
|
||||
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) -c -MMD -MP -o $@ $<
|
||||
|
||||
|
||||
install: $(BIN)
|
||||
$(INSTALL) -d $(PREFIX)/bin
|
||||
$(INSTALL) $(BIN) $(PREFIX)/bin
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJ) $(DEP) $(BIN)
|
||||
$(RMDIR) $(OBJDIR) $(BINDIR) 2> /dev/null; true
|
32
build.sh
Executable file
32
build.sh
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
#
|
||||
# Kangaroo Punch MultiPlayer Game Server Mark II
|
||||
# Copyright (C) 2020-2021 Scott Duensing
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# This requires DJGPP for Linux in /opt/cross/djgpp
|
||||
#
|
||||
# See: https://github.com/andrewwutw/build-djgpp
|
||||
|
||||
mkdir -p \
|
||||
obj/client/src
|
||||
|
||||
source /opt/cross/djgpp/setenv
|
||||
|
||||
make -f Makefile.djgpp
|
||||
|
||||
rm bin/client
|
123
buildPrerequisites.sh
Executable file
123
buildPrerequisites.sh
Executable file
|
@ -0,0 +1,123 @@
|
|||
#!/bin/bash -x
|
||||
|
||||
|
||||
export BUILD_HOME=$(pwd)
|
||||
export INSTALLED=${BUILD_HOME}/installed
|
||||
export DJGPP=/opt/cross/djgpp
|
||||
|
||||
|
||||
function buildGrx() {
|
||||
|
||||
pushd grx249
|
||||
cp -f ${BUILD_HOME}/makedefs.grx .
|
||||
|
||||
make -f makefile.dj2 clean
|
||||
make -f makefile.dj2 libs \
|
||||
CROSS_PLATFORM="${DJGPP}/bin/i586-pc-msdosdjgpp-" \
|
||||
C_FLAGS="-I${INSTALLED}/dos/include" \
|
||||
L_FLAGS="-L${INSTALLED}/dos/lib"
|
||||
cp -p -f lib/dj2/*.a ${INSTALLED}/dos/lib
|
||||
cp -p -f include/*.h ${INSTALLED}/dos/include
|
||||
make -f makefile.dj2 clean
|
||||
rm lib/dj2/lib*
|
||||
rm bin/*.exe
|
||||
|
||||
make -f makefile.x11 clean
|
||||
make -f makefile.x11 libs \
|
||||
C_FLAGS="-I${INSTALLED}/linux/include" \
|
||||
L_FLAGS="-L${INSTALLED}/linux/lib"
|
||||
cp -p -f lib/unix/*.a ${INSTALLED}/linux/lib
|
||||
cp -p -f include/*.h ${INSTALLED}/linux/include
|
||||
make -f makefile.x11 clean
|
||||
rm lib/unix/lib*
|
||||
rm bin/{bin2c,fnt2c,xmodetest}
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
function buildJpeg() {
|
||||
pushd jpeg-9e
|
||||
|
||||
(
|
||||
source ${DJGPP}/setenv
|
||||
sed -i 's/RM= del/RM= rm/g' makefile.dj
|
||||
cp -f jconfig.dj jconfig.h
|
||||
make -i -f makefile.dj clean
|
||||
make -i -f makefile.dj libjpeg.a
|
||||
cp -p -f *.a ${INSTALLED}/dos/lib
|
||||
cp -p -f *.h ${INSTALLED}/dos/include
|
||||
make -i -f makefile.dj clean
|
||||
)
|
||||
|
||||
./configure --prefix=${INSTALLED}/linux --disable-shared
|
||||
make clean
|
||||
make
|
||||
make install
|
||||
make clean
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
function buildPng() {
|
||||
pushd libpng-1.6.37
|
||||
|
||||
(
|
||||
source ${DJGPP}/setenv
|
||||
cp scripts/makefile.dj2 .
|
||||
sed -i "s#\-I\.\./zlib#\-I${INSTALLED}/dos/include \-DPNG_NO_CONSOLE_IO#g" makefile.dj2
|
||||
sed -i "s#\-L\.\./zlib/#\-L${INSTALLED}/dos/lib#g" makefile.dj2
|
||||
make -f makefile.dj2 clean
|
||||
make -f makefile.dj2 libpng.a
|
||||
cp -p -f *.a ${INSTALLED}/dos/lib
|
||||
cp -p -f *.h ${INSTALLED}/dos/include
|
||||
make -f makefile.dj2 clean
|
||||
)
|
||||
|
||||
make clean
|
||||
cp scripts/makefile.linux .
|
||||
make -f makefile.linux clean
|
||||
make -f makefile.linux libpng.a
|
||||
cp -p -f *.a ${INSTALLED}/linux/lib
|
||||
cp -p -f *.h ${INSTALLED}/linux/include
|
||||
make -f makefile.linux clean
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
function buildZlib() {
|
||||
pushd zlib-1.2.12
|
||||
|
||||
(
|
||||
source ${DJGPP}/setenv
|
||||
make clean
|
||||
./configure --prefix=${INSTALLED}/dos
|
||||
make
|
||||
make install
|
||||
make clean
|
||||
rm *.exe
|
||||
)
|
||||
|
||||
make clean
|
||||
./configure --prefix=${INSTALLED}/linux --static
|
||||
make
|
||||
make install
|
||||
make clean
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
mkdir -p ${INSTALLED}/dos/{include,lib,share}
|
||||
mkdir -p ${INSTALLED}/linux/{include,lib,share}
|
||||
|
||||
pushd thirdparty
|
||||
|
||||
buildZlib
|
||||
buildPng
|
||||
buildJpeg
|
||||
buildGrx
|
||||
|
||||
popd
|
42
client/client.pro
Normal file
42
client/client.pro
Normal file
|
@ -0,0 +1,42 @@
|
|||
TEMPLATE = app
|
||||
CONFIG -= app_bundle
|
||||
CONFIG -= qt
|
||||
CONFIG -= console
|
||||
CONFIG += c99
|
||||
|
||||
LINUX = $$PWD/../installed/linux
|
||||
SHARED = $$PWD/../shared
|
||||
|
||||
DESTDIR = $$OUT_PWD/bin
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/src \
|
||||
$$LINUX/include \
|
||||
$$SHARED
|
||||
|
||||
HEADERS += \
|
||||
$$SHARED/macros.h \
|
||||
../shared/array.h \
|
||||
../shared/memory.h \
|
||||
../shared/stddclmr.h \
|
||||
../shared/thirdparty/memwatch/memwatch.h \
|
||||
../shared/thirdparty/stb_ds.h \
|
||||
src/gui/gui.h \
|
||||
src/gui/wmwindow.h \
|
||||
src/os.h
|
||||
|
||||
SOURCES += \
|
||||
../shared/array.c \
|
||||
../shared/memory.c \
|
||||
../shared/thirdparty/memwatch/memwatch.c \
|
||||
src/gui/gui.c \
|
||||
src/gui/wmwindow.c \
|
||||
src/main.c
|
||||
|
||||
LIBS += \
|
||||
-L$$LINUX/lib \
|
||||
-lgrx20X \
|
||||
-lX11 \
|
||||
-ljpeg \
|
||||
-lpng \
|
||||
-lz
|
231
client/client.pro.user
Normal file
231
client/client.pro.user
Normal file
|
@ -0,0 +1,231 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 5.0.2, 2022-05-12T20:34:53. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{b66758f8-0b3c-4017-8297-d2a3cceca9ca}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="int">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||
<value type="QString" key="language">Cpp</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||
<value type="QString" key="language">QmlJS</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
|
||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
|
||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
|
||||
<value type="bool" key="EditorConfiguration.inEntireDocument">true</value>
|
||||
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="DeviceType">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.15.0 GCC 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.15.0 GCC 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5150.gcc_64_kit</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/scott/code/gui/build-client-Desktop_Qt_5_15_0_GCC_64bit-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/scott/code/gui/build-client-Desktop_Qt_5_15_0_GCC_64bit-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/scott/code/gui/build-client-Desktop_Qt_5_15_0_GCC_64bit-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/scott/code/gui/build-client-Desktop_Qt_5_15_0_GCC_64bit-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="int" key="QtQuickCompiler">0</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/scott/code/gui/build-client-Desktop_Qt_5_15_0_GCC_64bit-Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/scott/code/gui/build-client-Desktop_Qt_5_15_0_GCC_64bit-Profile</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="int" key="QtQuickCompiler">0</value>
|
||||
<value type="int" key="SeparateDebugInfo">0</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
||||
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="int">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
</qtcreator>
|
123
client/src/gui/gui.c
Normal file
123
client/src/gui/gui.c
Normal file
|
@ -0,0 +1,123 @@
|
|||
#include "gui.h"
|
||||
#include "wmwindow.h"
|
||||
#include "array.h"
|
||||
|
||||
|
||||
typedef struct VideoModeS {
|
||||
int width;
|
||||
int height;
|
||||
int depth;
|
||||
} VideoModeT;
|
||||
|
||||
typedef struct WidgetCatalogS {
|
||||
uint8_t key; // Magic
|
||||
RegisterT *value;
|
||||
} WidgetCatalogT;
|
||||
|
||||
|
||||
GrColor *__guiBaseColors = NULL;
|
||||
|
||||
|
||||
static uint8_t _magicCount = 0;
|
||||
static WidgetCatalogT *_widgetCatalog = NULL;
|
||||
static uint8_t _guiRunning = 1;
|
||||
|
||||
|
||||
void guiModesShow(void) {
|
||||
VideoModeT mode[256];
|
||||
int32_t modeCount = 0;
|
||||
int32_t i;
|
||||
GrFrameMode fm;
|
||||
const GrVideoMode *mp;
|
||||
|
||||
GrSetDriver(NULL);
|
||||
if (GrCurrentVideoDriver() == NULL) {
|
||||
printf("No graphics driver found!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (fm=GR_firstGraphicsFrameMode; fm<=GR_lastGraphicsFrameMode; fm++) {
|
||||
mp = GrFirstVideoMode(fm);
|
||||
while (mp != NULL) {
|
||||
if (mp->width >= 640 && mp->height >= 480 && mp->bpp >= 8) {
|
||||
mode[modeCount].width = mp->width;
|
||||
mode[modeCount].height = mp->height;
|
||||
mode[modeCount].depth = mp->bpp;
|
||||
modeCount++;
|
||||
}
|
||||
mp = GrNextVideoMode(mp);
|
||||
}
|
||||
}
|
||||
|
||||
GrSetMode(GR_default_text);
|
||||
|
||||
printf("Available graphics modes:\n\n");
|
||||
for (i=0; i<modeCount; i++) {
|
||||
printf("%4d x %4d %2d bpp\n", mode[i].width, mode[i].height, mode[i].depth);
|
||||
}
|
||||
|
||||
GrKeyRead();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void guiRun(void) {
|
||||
while (_guiRunning) {
|
||||
wmPaint();
|
||||
if (GrKeyRead() == GrKey_Escape) guiStop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void guiRegister(WidgetRegisterT widgetRegister) {
|
||||
RegisterT *reg = widgetRegister(_magicCount);
|
||||
hmput(_widgetCatalog, _magicCount, reg);
|
||||
_magicCount++;
|
||||
}
|
||||
|
||||
|
||||
void guiShutdown(void) {
|
||||
wmShutdown();
|
||||
|
||||
while (hmlen(_widgetCatalog) > 0) {
|
||||
if (_widgetCatalog[0].value->unregister) _widgetCatalog[0].value->unregister(NULL);
|
||||
hmdel(_widgetCatalog, _widgetCatalog[0].key);
|
||||
}
|
||||
hmfree(_widgetCatalog);
|
||||
|
||||
DEL(__guiBaseColors);
|
||||
|
||||
GrSetMode(GR_default_text);
|
||||
}
|
||||
|
||||
|
||||
void guiStartup(int16_t width, int16_t height, int16_t depth) {
|
||||
if (!GrSetMode(GR_width_height_bpp_graphics, width, height, depth)) {
|
||||
//***TODO*** Die
|
||||
}
|
||||
|
||||
GrSetRGBcolorMode();
|
||||
__guiBaseColors = GrAllocEgaColors();
|
||||
|
||||
wmStartup();
|
||||
|
||||
guiRegister(windowRegister);
|
||||
}
|
||||
|
||||
|
||||
void guiStop(void) {
|
||||
_guiRunning = 0;
|
||||
}
|
||||
|
||||
|
||||
void guiWidgetBaseSet(WidgetT *widget, uint8_t magic, uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
|
||||
widget->magic = magic;
|
||||
|
||||
widget->r.x = x;
|
||||
widget->r.y = y;
|
||||
widget->r.w = w;
|
||||
widget->r.h = h;
|
||||
|
||||
widget->reg = hmget(_widgetCatalog, magic);
|
||||
}
|
75
client/src/gui/gui.h
Normal file
75
client/src/gui/gui.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
#ifndef GUI_H
|
||||
#define GUI_H
|
||||
|
||||
|
||||
#include "grx20.h"
|
||||
#include "grxkeys.h"
|
||||
|
||||
#include "os.h"
|
||||
|
||||
|
||||
struct WidgetS;
|
||||
|
||||
typedef void (*GuiCallbackT)(void *data, ...);
|
||||
typedef void (*WidgetEventT)(struct WidgetS *widget, ...);
|
||||
|
||||
typedef struct RectS {
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
union {
|
||||
uint16_t w;
|
||||
uint16_t x2;
|
||||
};
|
||||
union {
|
||||
uint16_t h;
|
||||
uint16_t y2;
|
||||
};
|
||||
} RectT;
|
||||
|
||||
typedef struct RegisterS {
|
||||
char *widgetName;
|
||||
WidgetEventT paint;
|
||||
WidgetEventT destroy;
|
||||
GuiCallbackT unregister;
|
||||
} RegisterT;
|
||||
|
||||
typedef struct WidgetS {
|
||||
uint8_t magic;
|
||||
RectT r;
|
||||
RegisterT *reg;
|
||||
} WidgetT;
|
||||
|
||||
typedef RegisterT *(*WidgetRegisterT)(uint8_t);
|
||||
|
||||
|
||||
extern GrColor *__guiBaseColors;
|
||||
|
||||
|
||||
#define GUI_BLACK __guiBaseColors[0]
|
||||
#define GUI_BLUE __guiBaseColors[1]
|
||||
#define GUI_GREEN __guiBaseColors[2]
|
||||
#define GUI_CYAN __guiBaseColors[3]
|
||||
#define GUI_RED __guiBaseColors[4]
|
||||
#define GUI_MAGENTA __guiBaseColors[5]
|
||||
#define GUI_BROWN __guiBaseColors[6]
|
||||
#define GUI_LIGHTGRAY __guiBaseColors[7]
|
||||
#define GUI_DARKGRAY __guiBaseColors[8]
|
||||
#define GUI_LIGHTBLUE __guiBaseColors[9]
|
||||
#define GUI_LIGHTGREEN __guiBaseColors[10]
|
||||
#define GUI_LIGHTCYAN __guiBaseColors[11]
|
||||
#define GUI_LIGHTRED __guiBaseColors[12]
|
||||
#define GUI_LIGHTMAGENTA __guiBaseColors[13]
|
||||
#define GUI_YELLOW __guiBaseColors[14]
|
||||
#define GUI_WHITE __guiBaseColors[15]
|
||||
|
||||
|
||||
void guiModesShow(void);
|
||||
void guiRegister(WidgetRegisterT widgetRegister);
|
||||
void guiRun(void);
|
||||
void guiShutdown(void);
|
||||
void guiStartup(int16_t width, int16_t height, int16_t depth);
|
||||
void guiStop(void);
|
||||
void guiWidgetBaseSet(WidgetT *widget, uint8_t magic, uint16_t x, uint16_t y, uint16_t w, uint16_t h);
|
||||
|
||||
|
||||
#endif // GUI_H
|
261
client/src/gui/wmwindow.c
Normal file
261
client/src/gui/wmwindow.c
Normal file
|
@ -0,0 +1,261 @@
|
|||
#include "wmwindow.h"
|
||||
#include "array.h"
|
||||
|
||||
|
||||
uint8_t __MAGIC_WINDOW = 0;
|
||||
|
||||
static WindowT **_windowList = NULL;
|
||||
static GrTextOption _textOption;
|
||||
|
||||
|
||||
WindowT *windowCreate(uint16_t x, uint16_t y, uint16_t w, uint16_t h, char *title, uint8_t flags, ...) {
|
||||
WindowT *win = NULL;
|
||||
|
||||
NEW(WindowT, win);
|
||||
|
||||
guiWidgetBaseSet((WidgetT *)win, __MAGIC_WINDOW, x, y, w, h);
|
||||
win->title = strdup(title);
|
||||
win->flags = flags;
|
||||
|
||||
arrput(_windowList, win);
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
|
||||
void windowDestroy(struct WidgetS *widget, ...) {
|
||||
uint16_t i;
|
||||
WindowT *window = (WindowT *)widget;
|
||||
|
||||
for (i=0; i<arrlen(_windowList); i++) {
|
||||
if (window == _windowList[i]) {
|
||||
if (_windowList[i]->title) DEL(_windowList[i]->title);
|
||||
DEL(_windowList[i]);
|
||||
arrdel(_windowList, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void windowPaint(struct WidgetS *widget, ...) {
|
||||
WindowT *w = (WindowT *)widget;
|
||||
uint16_t x1 = w->base.r.x;
|
||||
uint16_t y1 = w->base.r.y;
|
||||
uint16_t x2 = w->base.r.x + w->base.r.w - 1;
|
||||
uint16_t y2 = w->base.r.y + w->base.r.h - 1;
|
||||
uint16_t tx1;
|
||||
uint16_t ty1;
|
||||
uint16_t tx2;
|
||||
uint16_t ty2;
|
||||
uint16_t minimizeOffset = 0;
|
||||
GrColor titleBackgroundColor = GUI_DARKGRAY;
|
||||
|
||||
// Fake Window contents.
|
||||
GrFilledBox(x1, y1, x2, y2, GUI_BLACK);
|
||||
|
||||
// If we need a titlebar, it's 18px.
|
||||
if (w->title || w->flags & WIN_CLOSE || w->flags & WIN_MAXIMIZE || w->flags & WIN_MINIMIZE) {
|
||||
|
||||
// Draw title bar background.
|
||||
y1 -= 18;
|
||||
GrFilledBox(x1, y1, x2, y1 + 17, titleBackgroundColor);
|
||||
|
||||
// Close box?
|
||||
if (w->flags & WIN_CLOSE) {
|
||||
// 26px wide, 18 tall including highlight and shadow.
|
||||
w->close.x = x1 + 1;
|
||||
w->close.y = y1 + 1;
|
||||
w->close.x2 = w->close.x + 24;
|
||||
w->close.y2 = w->close.y + 15;
|
||||
GrFilledBox(w->close.x + 1, w->close.y + 1, w->close.x2 - 1, w->close.y2 - 1, GUI_LIGHTGRAY);
|
||||
GrHLine(w->close.x, w->close.x2, w->close.y, GUI_WHITE);
|
||||
GrVLine(w->close.x, w->close.y, w->close.y2, GUI_WHITE);
|
||||
// Button is 8px down, 3px tall, and 4px in on both sides.
|
||||
tx1 = w->close.x + 4;
|
||||
ty1 = w->close.y + 7;
|
||||
tx2 = w->close.x2 - 4;
|
||||
ty2 = w->close.y + 9;
|
||||
GrHLine(tx1, tx2, ty1, GUI_WHITE);
|
||||
GrPlot(tx1, ty1 + 1, GUI_WHITE);
|
||||
GrHLine(tx1, tx2, ty2, GUI_BLACK);
|
||||
GrVLine(tx2, ty1, ty2, GUI_BLACK);
|
||||
// Set titlebar area.
|
||||
w->titlebar.x = w->close.x2 + 2;
|
||||
} else {
|
||||
// No close box.
|
||||
w->close.x = 0;
|
||||
w->close.y = 0;
|
||||
w->close.x2 = 0;
|
||||
w->close.y2 = 0;
|
||||
// Set titlebar area.
|
||||
w->titlebar.x = x1;
|
||||
}
|
||||
w->titlebar.y = y1;
|
||||
w->titlebar.x2 = x2;
|
||||
w->titlebar.y2 = y1 + 17;
|
||||
|
||||
// Maximize box?
|
||||
if (w->flags & WIN_MAXIMIZE) {
|
||||
// 26px wide, 18 tall including highlight and shadow.
|
||||
w->maximize.y = y1 + 1;
|
||||
w->maximize.x2 = x2 - 1;
|
||||
w->maximize.x = w->maximize.x2 - 24;
|
||||
w->maximize.y2 = w->maximize.y + 15;
|
||||
GrFilledBox(w->maximize.x + 1, w->maximize.y + 1, w->maximize.x2 - 1, w->maximize.y2 - 1, GUI_LIGHTGRAY);
|
||||
GrHLine(w->maximize.x, w->maximize.x2, w->maximize.y, GUI_WHITE);
|
||||
GrVLine(w->maximize.x, w->maximize.y, w->maximize.y2, GUI_WHITE);
|
||||
// Button is 3px down, and 4px in on both sides.
|
||||
tx1 = w->maximize.x + 4;
|
||||
ty1 = w->maximize.y + 4;
|
||||
tx2 = w->maximize.x2 - 3;
|
||||
ty2 = w->maximize.y + 12;
|
||||
GrHLine(tx1, tx2, ty1, GUI_WHITE);
|
||||
GrVLine(tx1, ty1, ty2, GUI_WHITE);
|
||||
GrHLine(tx1, tx2, ty2, GUI_BLACK);
|
||||
GrVLine(tx2, ty1, ty2, GUI_BLACK);
|
||||
// Move minimize button over.
|
||||
minimizeOffset = 26;
|
||||
// Set titlebar area.
|
||||
w->titlebar.x2 -= 26;
|
||||
} else {
|
||||
// No maximize box.
|
||||
w->maximize.x = 0;
|
||||
w->maximize.y = 0;
|
||||
w->maximize.x2 = 0;
|
||||
w->maximize.y2 = 0;
|
||||
}
|
||||
|
||||
// Minimize box?
|
||||
if (w->flags & WIN_MINIMIZE) {
|
||||
// 26px wide, 18 tall including highlight and shadow.
|
||||
w->minimize.y = y1 + 1;
|
||||
w->minimize.x2 = x2 - 1 - minimizeOffset;
|
||||
w->minimize.x = w->minimize.x2 - 24;
|
||||
w->minimize.y2 = w->minimize.y + 15;
|
||||
GrFilledBox(w->minimize.x + 1, w->minimize.y + 1, w->minimize.x2 - 1, w->minimize.y2 - 1, GUI_LIGHTGRAY);
|
||||
GrHLine(w->minimize.x, w->minimize.x2, w->minimize.y, GUI_WHITE);
|
||||
GrVLine(w->minimize.x, w->minimize.y, w->minimize.y2, GUI_WHITE);
|
||||
tx1 = w->minimize.x + 10;
|
||||
ty1 = w->minimize.y + 6;
|
||||
tx2 = w->minimize.x2 - 8;
|
||||
ty2 = w->minimize.y + 9;
|
||||
GrHLine(tx1, tx2, ty1, GUI_WHITE);
|
||||
GrVLine(tx1, ty1, ty2, GUI_WHITE);
|
||||
GrHLine(tx1, tx2, ty2, GUI_BLACK);
|
||||
GrVLine(tx2, ty1, ty2, GUI_BLACK);
|
||||
// Set titlebar area.
|
||||
w->titlebar.x2 -= 26;
|
||||
} else {
|
||||
// No minimize box.
|
||||
w->minimize.x = 0;
|
||||
w->minimize.y = 0;
|
||||
w->minimize.x2 = 0;
|
||||
w->minimize.y2 = 0;
|
||||
}
|
||||
|
||||
// Title font area is 12px high.
|
||||
GrHLine(w->titlebar.x, w->titlebar.x2 - 1, w->titlebar.y, GUI_WHITE);
|
||||
GrVLine(w->titlebar.x, w->titlebar.y, w->titlebar.y2 - 1, GUI_WHITE);
|
||||
if (w->title) {
|
||||
//***TODO*** Look into GrTextRegion
|
||||
_textOption.txo_bgcolor.v = titleBackgroundColor;
|
||||
ty1 = w->titlebar.y + 2;
|
||||
tx1 = w->titlebar.x + 2 + (w->titlebar.x2 - w->titlebar.x - 4) * 0.5 - (GrStringWidth(w->title, strlen(w->title), &_textOption) * 0.5);
|
||||
//***TODO*** Does not handle text being clipped.
|
||||
GrDrawString(w->title, strlen(w->title), tx1, ty1, &_textOption);
|
||||
}
|
||||
}
|
||||
|
||||
// Innermost shadow frame. 1px wide.
|
||||
x1--;
|
||||
y1--;
|
||||
x2++;
|
||||
y2++;
|
||||
GrHLine(x1, x2, y2, GUI_WHITE);
|
||||
GrVLine(x2, y1, y2, GUI_WHITE);
|
||||
GrHLine(x1, x2, y1, GUI_DARKGRAY);
|
||||
GrVLine(x1, y1, y2, GUI_DARKGRAY);
|
||||
|
||||
// Frame Border. 4px wide.
|
||||
x1 -= 4;
|
||||
y1 -= 4;
|
||||
x2 += 4;
|
||||
y2 += 4;
|
||||
GrFilledBox(x1, y1, x1 + 3, y2, GUI_LIGHTGRAY);
|
||||
GrFilledBox(x2, y1, x2 - 3, y2, GUI_LIGHTGRAY);
|
||||
GrFilledBox(x1, y1, x2, y1 + 3, GUI_LIGHTGRAY);
|
||||
GrFilledBox(x1, y2, x2, y2 - 3, GUI_LIGHTGRAY);
|
||||
|
||||
// Resize handle.
|
||||
if (w->flags & WIN_RESIZE) {
|
||||
ty1 = y2 - 15 - 3;
|
||||
tx1 = x2 - 15 - 3;
|
||||
GrHLine(x2, x2 - 3, ty1, GUI_DARKGRAY);
|
||||
GrHLine(x2, x2 - 3, ty1 + 1, GUI_WHITE);
|
||||
GrVLine(tx1, y2, y2 - 3, GUI_DARKGRAY);
|
||||
GrVLine(tx1 + 1, y2, y2 - 3, GUI_WHITE);
|
||||
}
|
||||
|
||||
// Outermost shadow frame. 1px wide.
|
||||
x1--;
|
||||
y1--;
|
||||
x2++;
|
||||
y2++;
|
||||
GrHLine(x1, x2, y1, GUI_WHITE);
|
||||
GrVLine(x1, y1, y2, GUI_WHITE);
|
||||
GrHLine(x1, x2, y2, GUI_DARKGRAY);
|
||||
GrVLine(x2, y1, y2, GUI_DARKGRAY);
|
||||
}
|
||||
|
||||
|
||||
RegisterT *windowRegister(uint8_t magic) {
|
||||
static RegisterT reg = {
|
||||
"Window",
|
||||
windowPaint,
|
||||
windowDestroy,
|
||||
NULL
|
||||
};
|
||||
|
||||
// One-time widget startup code.
|
||||
__MAGIC_WINDOW = magic;
|
||||
|
||||
_textOption.txo_bgcolor.v = GUI_DARKGRAY;
|
||||
_textOption.txo_fgcolor.v = GUI_WHITE;
|
||||
_textOption.txo_chrtype = GR_BYTE_TEXT;
|
||||
_textOption.txo_direct = GR_TEXT_RIGHT;
|
||||
_textOption.txo_font = &GrFont_PC8x14;
|
||||
_textOption.txo_xalign = GR_ALIGN_DEFAULT;
|
||||
_textOption.txo_yalign = GR_ALIGN_DEFAULT;
|
||||
|
||||
return ®
|
||||
}
|
||||
|
||||
|
||||
void wmPaint(void) {
|
||||
uint16_t i;
|
||||
WidgetT *widget;
|
||||
|
||||
// Paint desktop.
|
||||
GrClearScreen(GUI_CYAN);
|
||||
|
||||
// Paint all windows.
|
||||
for (i=0; i<arrlen(_windowList); i++) {
|
||||
GrSetContext(GrScreenContext());
|
||||
widget = (WidgetT *)_windowList[i];
|
||||
widget->reg->paint(widget);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wmShutdown(void) {
|
||||
while (arrlen(_windowList) > 0) {
|
||||
windowDestroy((WidgetT *)_windowList[0]);
|
||||
}
|
||||
arrfree(_windowList);
|
||||
}
|
||||
|
||||
|
||||
void wmStartup(void) {
|
||||
|
||||
}
|
40
client/src/gui/wmwindow.h
Normal file
40
client/src/gui/wmwindow.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
#ifndef WMWINDOW_H
|
||||
#define WMWINDOW_H
|
||||
|
||||
|
||||
#include "gui.h"
|
||||
|
||||
|
||||
#define WIN_NONE 0
|
||||
#define WIN_CLOSE 1
|
||||
#define WIN_MAXIMIZE 2
|
||||
#define WIN_MINIMIZE 4
|
||||
#define WIN_RESIZE 8
|
||||
|
||||
|
||||
typedef struct WindowS {
|
||||
WidgetT base;
|
||||
char *title;
|
||||
uint8_t flags;
|
||||
RectT close;
|
||||
RectT titlebar;
|
||||
RectT minimize;
|
||||
RectT maximize;
|
||||
} WindowT;
|
||||
|
||||
|
||||
extern uint8_t __MAGIC_WINDOW;
|
||||
|
||||
|
||||
WindowT *windowCreate(uint16_t x, uint16_t y, uint16_t w, uint16_t h, char *title, uint8_t flags, ...);
|
||||
void windowDestroy(struct WidgetS *widget, ...);
|
||||
void windowPaint(struct WidgetS *widget, ...);
|
||||
RegisterT *windowRegister(uint8_t magic);
|
||||
|
||||
|
||||
void wmPaint(void);
|
||||
void wmShutdown(void);
|
||||
void wmStartup(void);
|
||||
|
||||
|
||||
#endif // WMWINDOW_H
|
18
client/src/main.c
Normal file
18
client/src/main.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "gui/gui.h"
|
||||
#include "gui/wmwindow.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
guiStartup(800, 600, 24);
|
||||
|
||||
windowCreate(50, 50, 300, 200, "Testing", WIN_CLOSE | WIN_MAXIMIZE | WIN_MINIMIZE | WIN_RESIZE);
|
||||
guiRun();
|
||||
|
||||
guiShutdown();
|
||||
|
||||
return 0;
|
||||
}
|
17
client/src/os.h
Normal file
17
client/src/os.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#ifndef OS_H
|
||||
#define OS_H
|
||||
|
||||
|
||||
#define MEMORY_CHECK_ENABLED
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "macros.h"
|
||||
#include "memory.h"
|
||||
#include "stddclmr.h"
|
||||
|
||||
|
||||
#endif // OS_H
|
261
makedefs.grx
Normal file
261
makedefs.grx
Normal file
|
@ -0,0 +1,261 @@
|
|||
### CONFIGURATION ########################################################
|
||||
|
||||
# This file sets variables that direct the libary build for the
|
||||
# programmer needs. The file is used for the four standard plattforms
|
||||
|
||||
# Specify version of GRX
|
||||
# Currently only used to generate name of shared libraries for linux
|
||||
GRX_VERSION=2.4.9
|
||||
|
||||
# Specify if you have libtiff.a and corresponding .h files.
|
||||
# Change setting to 'y' if you have it, or to 'n' if not.
|
||||
HAVE_LIBTIFF=n
|
||||
|
||||
# Specify if you have libjpeg.a and corresponding .h files.
|
||||
HAVE_LIBJPEG=y
|
||||
|
||||
# Specify if you have libpng.a and corresponding .h files.
|
||||
HAVE_LIBPNG=y
|
||||
|
||||
# Specify if one of the above libs requires the
|
||||
# zlib compression library
|
||||
NEED_ZLIB=y
|
||||
|
||||
# Specify if you want to include printing code from addons
|
||||
INCLUDE_PRINTING_CODE=n
|
||||
|
||||
# Specify if you want to include bmp image code from addons
|
||||
INCLUDE_BMP_CODE=y
|
||||
|
||||
# Specify if you want to include GNU_Pascal (gpc) support
|
||||
INCLUDE_GPC_SUPPORT=n
|
||||
|
||||
# Specify if you want shared library support (Linux console and X11)
|
||||
INCLUDE_SHARED_SUPPORT=n
|
||||
|
||||
# Specify if you want to include BGI support
|
||||
INCLUDE_BGI_SUPPORT=n
|
||||
|
||||
# For cross-compiling, specify prefix for tools including the trailing dash
|
||||
# (e.g. i386-mingw32- for using i386-mingw32-gcc instead of just gcc)
|
||||
#CROSS_PLATFORM=i586-pc-msdosdjgpp-
|
||||
|
||||
# Specify if you want to use Unix tools on DOS-like platforms
|
||||
HAVE_UNIX_TOOLS=y
|
||||
|
||||
# Specify in linux if you want to build the library for x86_64
|
||||
BUILD_X86_64=y
|
||||
|
||||
# For SDL driver the executable prefix EP is used to discriminate
|
||||
# between linux X11 and mingw32. Set
|
||||
#EP=x ... For linux X11.
|
||||
#EP= ... For mingw32
|
||||
EP=x
|
||||
|
||||
### SYSTEM SETTINGS ######################################################
|
||||
|
||||
CC = $(CROSS_PLATFORM)gcc
|
||||
PC = $(CROSS_PLATFORM)gpc
|
||||
AR = $(CROSS_PLATFORM)ar
|
||||
RANLIB = $(CROSS_PLATFORM)ranlib
|
||||
STRIP = $(CROSS_PLATFORM)strip
|
||||
|
||||
# Different systems / setups may generate .o files
|
||||
# this tag files will show what version is present
|
||||
SYSTEM_TAG_PREFIX = systag
|
||||
LINUX_i386_CONSOLE = $(SYSTEM_TAG_PREFIX).000
|
||||
LINUX_i386_X11 = $(SYSTEM_TAG_PREFIX).002
|
||||
DOS_DJGPP_V2 = $(SYSTEM_TAG_PREFIX).004
|
||||
WIN32_GCC_i386_STATIC = $(SYSTEM_TAG_PREFIX).006
|
||||
ANY_GCC_SDL_STATIC = $(SYSTEM_TAG_PREFIX).008
|
||||
|
||||
ifdef DEBUG
|
||||
CCOPT = -O2 -fno-strict-aliasing -Wall -g -DDEBUG=$(DEBUG) ${C_FLAGS}
|
||||
LDOPT = -g ${L_FLAGS}
|
||||
else
|
||||
CCOPT = -O2 -fno-strict-aliasing -Wall ${C_FLAGS}
|
||||
LDOPT = -s ${L_FLAGS}
|
||||
endif
|
||||
|
||||
ifdef PROFILE
|
||||
CCOPT += -pg
|
||||
endif
|
||||
|
||||
# Additional warnings for development
|
||||
WARNOPTS = -W -Wshadow -Wpointer-arith -Wbad-function-cast \
|
||||
-Wcast-align -Wconversion -Wmissing-prototypes \
|
||||
-Wnested-externs -Wstrict-prototypes
|
||||
#CCOPT += $(WARNOPTS)
|
||||
|
||||
# Some systems can't allocate big arrays on stack.
|
||||
# If test/xcirctest fails on bigger diameters, try
|
||||
#CCOPT += -DSMALL_STACK
|
||||
|
||||
# You may want to enable one (or both) of the following
|
||||
# switches if your get lots of warnings when compiling GRX
|
||||
#CCOPT += -DNO_LEFTSIDE_LVALUE_CAST
|
||||
#CCOPT += -DNO_LEFTSIDE_PTR_CAST
|
||||
|
||||
##########################################################################
|
||||
|
||||
ifdef GRXVSDL
|
||||
ifeq ($(EP),x)
|
||||
GRXVX11=y
|
||||
else
|
||||
GRXVW32=y
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef GRXVLNX
|
||||
GRXVUNX=y
|
||||
endif
|
||||
|
||||
ifdef GRXVX11
|
||||
GRXVUNX=y
|
||||
endif
|
||||
|
||||
### UNIX SPECIFIC ########################################################
|
||||
|
||||
ifdef GRXVUNX
|
||||
|
||||
# Put libgrx20.a, libgrx20.so, libgrx20X.a, libgrx20X.so and libgrx20S.a
|
||||
# in lib/unix
|
||||
GRX_LIB_SUBDIR=unix
|
||||
|
||||
# Set here the default destination dirs for install and uninstall targets
|
||||
prefix=/usr/local
|
||||
|
||||
# Set the default GRX font path
|
||||
#GRX_DEFAULT_FONT_PATH=${datadir}/grx/fonts
|
||||
|
||||
# check for i386 or x86_64 build
|
||||
ifeq ($(BUILD_X86_64),y)
|
||||
CCOPT += -m64
|
||||
LDOPT += -m64
|
||||
else
|
||||
CCOPT += -m32
|
||||
LDOPT += -m32
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
### LINUX CONSOLE SPECIFIC ###############################################
|
||||
|
||||
ifdef GRXVLNX
|
||||
|
||||
# Use direct PS/2 mouse driver instead the svgalib one
|
||||
USE_DIRECT_MOUSE_DRIVER=n
|
||||
|
||||
# Set the videodrivers to be included, you can set both or only one of them
|
||||
# (remember to set USE_DIRECT_MOUSE_DRIVER to 'y' if you set only the
|
||||
# framebuffer driver)
|
||||
USE_SVGALIB_DRIVER=y
|
||||
USE_FRAMEBUFFER_DRIVER=y
|
||||
|
||||
# Set or not set suid root. This is required for the svgalib 1.4.x stable
|
||||
# release, it can be set to 'n' if you use the framebuffer driver only or
|
||||
# the svgalib 1.9.x alpha release without the 1 and 4 bpp resolutions
|
||||
# (see bellow)
|
||||
SET_SUIDROOT=y
|
||||
|
||||
# Set to 'y' this variable if you want to add the framedrivers that use
|
||||
# inport/outport instructions: 1 and 4 bpp modes and the 8 bpp mode X. But
|
||||
# beware this works only with svgalib 1.4.x (not with 1.9.x) and without
|
||||
# the linux framebuffer enabled
|
||||
USE_INOUTP_FRAMEDRIVERS=y
|
||||
|
||||
endif
|
||||
|
||||
### LINUX X11 SPECIFIC ###################################################
|
||||
|
||||
ifdef GRXVX11
|
||||
|
||||
# The X11 base dir on your system
|
||||
X11BASE=/usr/X11R6
|
||||
|
||||
# Add directories with X11 include files here
|
||||
X11INCS=-I$(X11BASE)/include
|
||||
|
||||
# put X11 required libraries and directories here
|
||||
# note: some systems need -lsocket added
|
||||
X11LIB=$(X11BASE)/lib
|
||||
X11LIBS=-L$(X11LIB) -lX11
|
||||
|
||||
# Set to try to use the XFree86 Direct Graphics Access driver (DGA2)
|
||||
# (if DGA2 is not available, fall back to the windowed X11 driver)
|
||||
# As of XFree-4.3.99.5 DGA/DGA2 seems stable, but use with caution.
|
||||
USE_XF86DGA_DRIVER=n
|
||||
# Set to 'y' this variable if you want the DGA2 driver to use direct
|
||||
# framebuffer access. That should not make DGA2 more unstable and is
|
||||
# faster. If this setting is 'y', the DGA2 driver (see above) must
|
||||
# also be 'y', or you will get compilation/linkage errors.
|
||||
USE_XF86DGA_FRAMEBUFFER=n
|
||||
# Set or not set suid root for X11. This is required for the DGA2
|
||||
# framebuffer access, it can be set to 'n' if you use the standard
|
||||
# X11 driver only or DGA2 without framebuffer access.
|
||||
SET_XSUIDROOT=n
|
||||
|
||||
endif
|
||||
|
||||
### DOS DJGPPv2 SPECIFIC #################################################
|
||||
|
||||
ifdef GRXVDJ2
|
||||
|
||||
# Put libgrx20.a to lib/dj2
|
||||
GRX_LIB_SUBDIR=dj2
|
||||
|
||||
# Set here the destination dir for install and uninstall targets
|
||||
prefix=/dev/env/DJDIR
|
||||
|
||||
# Set the default GRX font path
|
||||
#GRX_DEFAULT_FONT_PATH=/dev/env/DJDIR/share/grx/fonts
|
||||
|
||||
# If you want to use 'upx.exe' compressor
|
||||
# disable the echo line and enable upx line.
|
||||
EXE_COMPRESS = -echo
|
||||
#EXE_COMPRESS = upx --best
|
||||
|
||||
# Default compiler switches. In djgpp.env. under [make],
|
||||
# add the line "BUTT=-mcpu=i386", if that is your target,
|
||||
# or directly add -mcpu here.
|
||||
# At present gcc supports 'i386', 'i486', 'i586' ('pentium'),
|
||||
# 'i686' ('pentiumpro') and 'k6'.
|
||||
#CCOPT += $(BUTT)
|
||||
#CCOPT += -mcpu=i586
|
||||
|
||||
# GRX uses "uclock" to gets 1 ms resolution in the input code,
|
||||
# this can causes problems in Win3.1, so you may want to enable
|
||||
# the following switch
|
||||
#CCOPT += -DNO_REPROGRAM_TIMER
|
||||
|
||||
endif
|
||||
|
||||
### WIN32 MINGW SPECIFIC #################################################
|
||||
|
||||
ifdef GRXVW32
|
||||
|
||||
# Put libgrx20.a and libgrx20S.a to lib/win32
|
||||
GRX_LIB_SUBDIR=win32
|
||||
|
||||
# Set here the destination dir for install and uninstall targets
|
||||
prefix=C:\MINGW
|
||||
|
||||
# Set the default GRX font path
|
||||
#GRX_DEFAULT_FONT_PATH=c:/grxfonts
|
||||
|
||||
endif
|
||||
|
||||
### COMMON ##############################################################
|
||||
|
||||
exec_prefix=${prefix}
|
||||
|
||||
bindir=${exec_prefix}/bin
|
||||
libdir=${exec_prefix}/lib
|
||||
datadir=${prefix}/share
|
||||
|
||||
infodir=${prefix}/info
|
||||
includedir=${prefix}/include
|
||||
unitsdir=${exec_prefix}/units
|
||||
|
||||
##########################################################################
|
||||
|
4
shared/array.c
Normal file
4
shared/array.c
Normal file
|
@ -0,0 +1,4 @@
|
|||
#include "array.h"
|
||||
|
||||
#define STB_DS_IMPLEMENTATION
|
||||
#include "thirdparty/stb_ds.h"
|
9
shared/array.h
Normal file
9
shared/array.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef ARRAY_H
|
||||
#define ARRAY_H
|
||||
|
||||
|
||||
#include "os.h"
|
||||
#include "thirdparty/stb_ds.h"
|
||||
|
||||
|
||||
#endif // ARRAY_H
|
19
shared/macros.h
Normal file
19
shared/macros.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
#ifndef MACROS_H
|
||||
#define MACROS_H
|
||||
|
||||
|
||||
// Should be after system headers in this file.
|
||||
#define MEMORY_CHECK_ENABLED
|
||||
#include "memory.h"
|
||||
|
||||
|
||||
// Allocation helpers.
|
||||
#define NEW(t,v) (v)=(t*)malloc(sizeof(t)) // Add check for NULL and die here.
|
||||
#define DEL(v) {if(v) {free(v); v=NULL;}}
|
||||
|
||||
|
||||
#define SUCCESS 0
|
||||
#define FAIL 1
|
||||
|
||||
|
||||
#endif // MACROS_H
|
1
shared/memory.c
Normal file
1
shared/memory.c
Normal file
|
@ -0,0 +1 @@
|
|||
#include "memory.h"
|
13
shared/memory.h
Normal file
13
shared/memory.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#ifndef MEMORY_H
|
||||
#define MEMORY_H
|
||||
|
||||
|
||||
#include "os.h"
|
||||
|
||||
#ifdef MEMORY_CHECK_ENABLED
|
||||
#define MEMWATCH
|
||||
#include "thirdparty/memwatch/memwatch.h"
|
||||
#endif
|
||||
|
||||
|
||||
#endif // MEMORY_H
|
95
shared/stddclmr.h
Normal file
95
shared/stddclmr.h
Normal file
|
@ -0,0 +1,95 @@
|
|||
#ifndef STDDCLMR_H
|
||||
#define STDDCLMR_H
|
||||
|
||||
/*
|
||||
Action figures sold separately. Add toner. All models over 18 years of age.
|
||||
All rights reserved. Allow four to six weeks for delivery. An equal
|
||||
opportunity employer. Any resemblance to actual persons, living or dead, is
|
||||
unintentional and purely coincidental. Apply only to affected area. Approved
|
||||
for veterans. As seen on TV. At participating locations only. Avoid contact
|
||||
with mucous membranes. Avoid contact with skin. Avoid extreme temperatures
|
||||
and store in a cool dry place. Batteries not included. Be sure each item is
|
||||
properly endorsed. Beware of dog. Booths for two or more. Breaking seal
|
||||
constitutes acceptance of agreement. Call toll free number before digging.
|
||||
Caveat emptor. Check here if tax deductible. Close cover before striking
|
||||
Colors may fade. Contains a substantial amount of non-tobacco ingredients.
|
||||
Contents may settle during shipment. Contestants have been briefed on some
|
||||
questions before the show. Copyright 1995 Joker's Wild. Disclaimer does
|
||||
not cover hurricane, lightning, tornado, tsunami, volcanic eruption,
|
||||
earthquake, flood, and other Acts of God, misuse, neglect, unauthorized
|
||||
repair, damage from improper installation, broken antenna or marred cabinet,
|
||||
incorrect line voltage, missing or altered serial numbers, sonic boom
|
||||
vibrations, electromagnetic radiation from nuclear blasts, customer
|
||||
adjustments that are not covered in the joke list, and incidents owing to
|
||||
airplane crash, ship sinking, motor vehicle accidents, leaky roof, broken
|
||||
glass, falling rocks, mud slides, forest fire, flying projectiles, or
|
||||
dropping the item. Do not bend, fold, mutilate, or spindle. Do not place
|
||||
near flammable or magnetic source. Do not puncture, incinerate, or store
|
||||
above 120 degrees Fahrenheit. Do not stamp. Use other side for additional
|
||||
listings. Do not use while operating a motor vehicle or heavy equipment. Do
|
||||
not write below this line. Documents are provided "as is" without any
|
||||
warranties expressed or implied. Don't quote me on anything. Don't quote me
|
||||
on that. Driver does not carry cash. Drop in any mailbox. Edited for
|
||||
television. Employees and their families are not eligible. Falling rock.
|
||||
First pull up, then pull down. Flames redirected to /dev/null. For a
|
||||
limited time only. For external use only. For off-road use only. For office
|
||||
use only. For recreational use only. Do not disturb. Freshest if eaten
|
||||
before date on carton. Hand wash only, tumble dry on low heat. If a rash,
|
||||
redness, irritation, or swelling develops, discontinue use. If condition
|
||||
persists, consult your physician. If defects are discovered, do not attempt
|
||||
to fix them yourself, but return to an authorized service center. If
|
||||
ingested, do not induce vomiting, if symptoms persist, consult a doctor.
|
||||
Keep away from open flames and avoid inhaling fumes. Keep away from
|
||||
sunlight, pets, and small children. Keep cool; process promptly. Limit
|
||||
one-per-family please. Limited time offer, call now to ensure prompt
|
||||
delivery. List at least two alternate dates. List each check separately by
|
||||
bank number. List was current at time of printing. Lost ticket pays maximum
|
||||
rate. May be too intense for some viewers. Must be 18 to enter. No Canadian
|
||||
coins. No alcohol, dogs or horses. No anchovies unless otherwise specified.
|
||||
No animals were harmed in the production of these documents. No money down.
|
||||
No other warranty expressed or implied. No passes accepted for this
|
||||
engagement. No postage necessary if mailed in the United States. No
|
||||
preservatives added. No purchase necessary. No salt, MSG, artificial color
|
||||
or flavor added. No shoes, no shirt, no service, no kidding. No solicitors.
|
||||
No substitutions allowed. No transfers issued until the bus comes to a
|
||||
complete stop. No user-serviceable parts inside. Not affiliated with the
|
||||
American Red Cross. Not liable for damages due to use or misuse. Not
|
||||
recommended for children. Not responsible for direct, indirect, incidental
|
||||
or consequential damages resulting from any defect, error or failure to
|
||||
perform. Not the Beatles. Objects in mirror may be closer than they appear.
|
||||
One size fits all. Many suitcases look alike. Other copyright laws for
|
||||
specific entries apply wherever noted. Other restrictions may apply. Package
|
||||
sold by weight, not volume. Parental advisory - explicit lyrics. Penalty for
|
||||
private use. Place stamp here. Please remain seated until the ride has come
|
||||
to a complete stop. Possible penalties for early withdrawal. Post office will
|
||||
not deliver without postage. Postage will be paid by addressee. Prerecorded
|
||||
for this time zone. Price does not include taxes. Processed at location
|
||||
stamped in code at top of carton. Quantities are limited while supplies last.
|
||||
Read at your own risk. Record additional transactions on back of previous
|
||||
stub. Replace with same type. Reproduction strictly prohibited. Restaurant
|
||||
package, not for resale. Return to sender, no forwarding order on file,
|
||||
unable to forward. Safety goggles may be required during use. Sanitized for
|
||||
your protection. Sealed for your protection, do not use if the safety seal is
|
||||
broken. See label for sequence. Shading within a garment may occur. Sign here
|
||||
without admitting guilt. Simulated picture. Slightly enlarged to show detail.
|
||||
Slightly higher west of the Rockies. Slippery when wet. Smoking these may be
|
||||
hazardous to your health. Some assembly required. Some equipment shown is
|
||||
optional. Some of the trademarks mentioned in this product appear for
|
||||
identification purposes only. Subject to FCC approval. Subject to change
|
||||
without notice. Substantial penalty for early withdrawal. Text may contain
|
||||
material some readers may find objectionable, parental guidance is advised.
|
||||
Text used in these documents is made from 100% recycled electrons and magnetic
|
||||
particles. These documents do not reflect the thoughts or opinions of either
|
||||
myself, my company, my friends, or my rabbit. This is not an offer to sell
|
||||
securities. This offer is void where prohibited, taxed, or otherwise
|
||||
restricted. This product is meant for educational purposes only. Times
|
||||
approximate. Unix is a registered trademark of AT&T. Use only as directed. Use
|
||||
only in a well-ventilated are. User assumes full liabilities. Void where
|
||||
prohibited. We have sent the forms which seem right for you. You must be
|
||||
present to win. You need not be present to win. Your canceled check is your
|
||||
receipt. Your mileage may vary. I didn't do it. You can't prove anything.
|
||||
|
||||
This supersedes all previous notices.
|
||||
*/
|
||||
|
||||
#endif // STDDCLMR_H
|
133
shared/thirdparty/memwatch/FAQ
vendored
Normal file
133
shared/thirdparty/memwatch/FAQ
vendored
Normal file
|
@ -0,0 +1,133 @@
|
|||
Frequently Asked Questions for memwatch
|
||||
|
||||
Q. I'm not getting any log file! What's wrong??
|
||||
|
||||
A. Did you define MEMWATCH when compiling all files?
|
||||
Did you include memwatch.h in all the files?
|
||||
If you did, then...:
|
||||
|
||||
Memwatch creates the file when it initializes. If you're not
|
||||
getting the log file, it's because a) memwatch is not
|
||||
initializing or b) it's initializing, but can't create the
|
||||
file.
|
||||
|
||||
Memwatch has two functions, mwInit() and mwTerm(), that
|
||||
initialize and terminate memwatch, respectively. They are
|
||||
nestable. You USUALLY don't need to call mwInit() and
|
||||
mwTerm(), since memwatch will auto-initialize on the first
|
||||
call to a memory function, and then add mwTerm() to the
|
||||
atexit() list.
|
||||
|
||||
You can call mwInit() and mwTerm() manually, if it's not
|
||||
initializing properly or if your system doesn't support
|
||||
atexit(). Call mwInit() as soon as you can, and mwTerm() at
|
||||
the logical no-error ending of your program. Call mwAbort()
|
||||
if the program is stopping due to an error; this will
|
||||
terminate memwatch even if more than one call to mwTerm() is
|
||||
outstanding.
|
||||
|
||||
If you are using C++, remember that global and static C++
|
||||
objects constructors execute before main() when considering
|
||||
where to put mwInit(). Also, their destructors execute after
|
||||
main(). You may want to create a global object very early
|
||||
with mwInit() in the constructor and mwTerm() in the
|
||||
destructor. Too bad C++ does not guarantee initialization
|
||||
order for global objects.
|
||||
|
||||
If this didn't help, try adding a call to mwDoFlush(1) after
|
||||
mwInit(). If THAT didn't help, then memwatch is unable to
|
||||
create the log file. Check write permissions.
|
||||
|
||||
If you can't use a log file, you can still use memwatch by
|
||||
redirecting the output to a function of your choice. See the
|
||||
next question.
|
||||
|
||||
Q. I'd like memwatch's output to pipe to my fave debugger! How?
|
||||
|
||||
A. Call mwSetOutFunc() with the address of a "void func(int c)"
|
||||
function. You should also consider doing something about
|
||||
the ARI handler, see memwatch.h for more details about that.
|
||||
|
||||
Q. Why isn't there any C++ support?
|
||||
|
||||
A. Because C++ is for sissies! =) Just kidding.
|
||||
C++ comes with overridable allocation/deallocation
|
||||
built-in. You can define your own new/delete operators
|
||||
for any class, and thus circumvent memwatch, or confuse
|
||||
it to no end. Also, the keywords "new" and "delete" may
|
||||
appear in declarations in C++, making the preprocessor
|
||||
replacement approach shaky. You can do it, but it's not
|
||||
very stable.
|
||||
|
||||
If someone were to write a rock solid new/delete checker
|
||||
for C++, there is no conflict with memwatch; use them both.
|
||||
|
||||
Q. I'm getting "WILD free" errors, but the code is bug-free!
|
||||
|
||||
A. If memwatch's free() recieves a pointer that wasn't allocated
|
||||
by memwatch, a "WILD free" message appears. If the source of
|
||||
the memory buffer is outside of memwatch (a non-standard
|
||||
library function, for instance), you can use mwFree_() to
|
||||
release it. mwFree_() calls free() on the pointer given if
|
||||
memwatch can't recognize it, instead of blocking it.
|
||||
|
||||
Another source of "WILD free" messages is that if memwatch
|
||||
is terminated before all memory allocated is freed, memwatch
|
||||
will have forgotten about it, and thus generate the errors.
|
||||
This is commonly caused by having memwatch auto-initialize,
|
||||
and then using atexit() to clean up. When auto-initializing,
|
||||
memwatch registers mwTerm() with atexit(), but if mwTerm()
|
||||
runs before all memory is freed, then you will get "unfreed"
|
||||
and "WILD free" messages when your own atexit()-registered
|
||||
cleanup code runs, and frees the memory.
|
||||
|
||||
Q. I'm getting "unfreed" errors, but the code is bug-free!
|
||||
|
||||
A. You can get erroneous "unfreed" messages if memwatch
|
||||
terminates before all memory has been freed. Try using
|
||||
mwInit() and mwTerm() instead of auto-initialization.
|
||||
|
||||
If you _are_ using mwInit() and mwTerm(), it may be that
|
||||
some code in your program executes before mwInit() or
|
||||
after mwTerm(). Make sure that mwInit() is the first thing
|
||||
executed, and mwTerm() the last.
|
||||
|
||||
Q. When compiling memwatch I get these 'might get clobbered'
|
||||
errors, and something about a longjmp() inside memwatch.
|
||||
|
||||
A. When using gcc or egcs with the optimization to inline
|
||||
functions, this warning occurs. This is because gcc and
|
||||
egcs inlines memwatch's functions with setjmp/longjmp,
|
||||
causing the calling functions to become unstable.
|
||||
|
||||
The gcc/egcs maintainers have been informed of this
|
||||
problem, but until they modify the inline optimization
|
||||
so that it leaves setjmp functions alone, make sure to
|
||||
compile memwatch without inline function optimizations.
|
||||
|
||||
gcc 2.95.2 can be patched for this, and I have been told
|
||||
it will be fixed in an upcoming version.
|
||||
|
||||
Q. My program crashes with SIGSEGV or alignment errors, but
|
||||
only when I compile with memwatch enabled!
|
||||
|
||||
A. You are using a 64-bit (or higher) platform, and memwatch
|
||||
was unable to detect and adjust for this. You'll have to
|
||||
either compile with a suitable define for mwROUNDALLOC,
|
||||
I suggest (number of bits / 8), or define mwROUNDALLOC
|
||||
directly in memwatch.c.
|
||||
|
||||
Also, please check your limits.h file for the relevant
|
||||
#defines, and tell me what they are.
|
||||
|
||||
Q. When I include string.h after memwatch.h, I get errors
|
||||
related to strdup(), what gives?
|
||||
|
||||
A. Most, but probably not all, platforms are nice about
|
||||
including files multiple times, so I could probably
|
||||
avoid these errors by including string.h from memwatch.h.
|
||||
But since I want to be on the safe side, I don't.
|
||||
|
||||
To fix this, simply include string.h before memwatch.h,
|
||||
or modify memwatch.h to include string.h.
|
||||
|
2
shared/thirdparty/memwatch/Makefile
vendored
Normal file
2
shared/thirdparty/memwatch/Makefile
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
test:
|
||||
$(CC) -DMEMWATCH -DMW_STDIO test.c memwatch.c
|
99
shared/thirdparty/memwatch/README
vendored
Normal file
99
shared/thirdparty/memwatch/README
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
README for MEMWATCH 2.69
|
||||
|
||||
This file should be enough to get you started, and should be
|
||||
enough for small projects. For more info, see the files USING
|
||||
and the FAQ. If this is not enough, see memwatch.h, which is
|
||||
well documented.
|
||||
|
||||
Memwatch is licensed under the GPL from version 2.69
|
||||
onwards. Please read the file gpl.txt for more details.
|
||||
|
||||
If you choose to use memwatch to validate your projects, I
|
||||
would like to hear about it. Please drop me a line at
|
||||
johan@linkdata.se about the project itself, the hardware,
|
||||
operating system, compiler and any URL(s) you feel is
|
||||
appropriate.
|
||||
|
||||
***** To run the test program:
|
||||
|
||||
Look at the source code for test.c first. It does some really
|
||||
nasty things, and I want you to be aware of that. If memwatch
|
||||
can't capture SIGSEGV (General Protection Fault for Windoze),
|
||||
your program will dump core (crash for Windoze).
|
||||
|
||||
Once you've done that, you can build the test program.
|
||||
|
||||
Linux and other *nixes with gcc:
|
||||
|
||||
gcc -o test -DMEMWATCH -DMEMWATCH_STDIO test.c memwatch.c
|
||||
|
||||
Windows 95, Windows NT with MS Visual C++:
|
||||
|
||||
cl -DMEMWATCH -DMEMWATCH_STDIO test.c memwatch.c
|
||||
|
||||
Then simply run the test program.
|
||||
|
||||
./test
|
||||
|
||||
|
||||
***** Quick-start instructions:
|
||||
|
||||
1. Make sure that memwatch.h is included in all of the
|
||||
source code files. If you have an include file that
|
||||
all of the source code uses, you might be able to include
|
||||
memwatch.h from there.
|
||||
|
||||
2. Recompile the program with MEMWATCH defined. See your
|
||||
compiler's documentation if you don't know how to do this.
|
||||
The usual switch looks like "-DMEMWATCH". To have MEMWATCH
|
||||
use stderr for some output (like, "Abort, Retry, Ignore?"),
|
||||
please also define MW_STDIO (or MEMWATCH_STDIO, same thing).
|
||||
|
||||
3. Run the program and examine the output in the
|
||||
log file "memwatch.log". If you didn't get a log file,
|
||||
you probably didn't do step 1 and 2 correctly, or your
|
||||
program crashed before memwatch flushed the file buffer.
|
||||
To have memwatch _always_ flush the buffer, add a call
|
||||
to "mwDoFlush(1)" at the top of your main function.
|
||||
|
||||
4. There is no fourth step... but remember that there
|
||||
are limits to what memwatch can do, and that you need
|
||||
to be aware of them:
|
||||
|
||||
***** Limits to memwatch:
|
||||
|
||||
Memwatch cannot catch all wild pointer writes. It can catch
|
||||
those it could make itself due to your program trashing
|
||||
memwatch's internal data structures. It can catch, sort of,
|
||||
wild writes into No Mans Land buffers (see the header file for
|
||||
more info). Anything else and you're going to get core dumped,
|
||||
or data corruption if you're lucky.
|
||||
|
||||
There are other limits of course, but that one is the most
|
||||
serious one, and the one that you're likely to be suffering
|
||||
from.
|
||||
|
||||
***** Can use memwatch with XXXXX?
|
||||
|
||||
Probably the answer is yes. It's been tested with several
|
||||
different platforms and compilers. It may not work on yours
|
||||
though... but there's only one way to find out.
|
||||
|
||||
***** Need more assistance?
|
||||
|
||||
I don't want e-mail on "how to program in C", or "I've got a
|
||||
bug, help me". I _do_ want you to send email to me if you
|
||||
find a bug in memwatch, or if it won't compile cleanly on your
|
||||
system (assuming it's an ANSI-C compiler of course).
|
||||
|
||||
If you need help with using memwatch, read the header file.
|
||||
If, after reading the header file, you still can't resolve the
|
||||
problem, please mail me with the details.
|
||||
|
||||
I can be reached at "johan@linkdata.se".
|
||||
|
||||
The latest version of memwatch should be found at
|
||||
"http://www.linkdata.se/".
|
||||
|
||||
Johan Lindh
|
||||
|
213
shared/thirdparty/memwatch/USING
vendored
Normal file
213
shared/thirdparty/memwatch/USING
vendored
Normal file
|
@ -0,0 +1,213 @@
|
|||
Using memwatch
|
||||
==============
|
||||
|
||||
What is it?
|
||||
|
||||
Memwatch is primarily a memory leak detector for C. Besides
|
||||
detecting leaks, it can do a bunch of other stuff, but lets
|
||||
stay to the basics. If you _really_ want to know all the
|
||||
gory details, you should check out the header file,
|
||||
memwatch.h, and the source code. It's actually got some
|
||||
comments! (Whoa, what a concept!)
|
||||
|
||||
How do I get the latest version?
|
||||
|
||||
http://www.linkdata.se/sourcecode.html
|
||||
ftp://ftp.linkdata.se/pub/memwatch/
|
||||
|
||||
How does it work?
|
||||
|
||||
Using the C preprocessor, memwatch replaces all your
|
||||
programs calls to ANSI C memory allocation functions with
|
||||
calls to it's own functions, which keeps a record of all
|
||||
allocations.
|
||||
|
||||
Memwatch is very unobtrusive; unless the define MEMWATCH is
|
||||
defined, memwatch removes all traces of itself from the
|
||||
code (using the preprocessor).
|
||||
|
||||
Memwatch normally writes it's data to the file
|
||||
memwatch.log, but this can be overridden; see the section
|
||||
on I/O, later.
|
||||
|
||||
Can I use it for my C++ sources?
|
||||
|
||||
You can, but it's not recommended. C++ allows individual
|
||||
classes to have their own memory management, and the
|
||||
preprocessor approach used by memwatch can cause havoc
|
||||
with such class declarations if improperly used.
|
||||
|
||||
If you have no such classes, or have them but still want
|
||||
to test it, you can give it a try.
|
||||
|
||||
First, re-enable the C++ support code in memwatch.
|
||||
If you can't find it, you probably shouldn't be using
|
||||
it. Then, in your source code, after including ALL
|
||||
header files:
|
||||
|
||||
#define new mwNew
|
||||
#define delete mwDelete
|
||||
|
||||
This will cause calls to new and delete in that source file
|
||||
to be directed to memwatch. Also, be sure to read all the
|
||||
text in memwatch.h regarding C++ support.
|
||||
|
||||
Is this stuff thread-safe?
|
||||
|
||||
I doubt it. As of version 2.66, there is rudimentary support
|
||||
for threads, if you happen to be using Win32 or if you have
|
||||
pthreads. Define WIN32 or MW_PTHREADS to signify this fact.
|
||||
|
||||
This will cause a global mutex to be created, and memwatch
|
||||
will lock it when accessing the global memory chain, but it's
|
||||
still far from certified threadsafe.
|
||||
|
||||
Initialization and cleanup
|
||||
|
||||
In order to do it's work in a timely fashion, memwatch
|
||||
needs to do some startup and cleanup work. mwInit()
|
||||
initializes memwatch and mwTerm() terminates it. Memwatch
|
||||
can auto-initialize, and will do so if you don't call
|
||||
mwInit() yourself. If this is the case, memwatch will use
|
||||
atexit() to register mwTerm() to the atexit-queue.
|
||||
|
||||
The auto-init technique has a caveat; if you are using
|
||||
atexit() yourself to do cleanup work, memwatch may
|
||||
terminate before your program is done. To be on the safe
|
||||
side, use mwInit() and mwTerm().
|
||||
|
||||
mwInit() and mwTerm() is nestable, so you can call mwInit()
|
||||
several times, requiring mwTerm() to be called an equal
|
||||
number of times to terminate memwatch.
|
||||
|
||||
In case of the program aborting in a controlled way, you
|
||||
may want to call mwAbort() instead of mwTerm(). mwAbort()
|
||||
will terminate memwatch even if there are outstanding calls
|
||||
to mwTerm().
|
||||
|
||||
I/O operations
|
||||
|
||||
During normal operations, memwatch creates a file named
|
||||
memwatch.log. Sometimes, memwatch.log can't be created;
|
||||
then memwatch tries to create files name memwatNN.log,
|
||||
where NN is between 01 and 99. If that fails, no log will
|
||||
be produced.
|
||||
|
||||
If you can't use a file log, or don't want to, no worry.
|
||||
Just call mwSetOutFunc() with the address of a "void
|
||||
func(int c)" function, and all output will be directed
|
||||
there, character by character.
|
||||
|
||||
Memwatch also has an Abort/Retry/Ignore handler that is
|
||||
used when an ASSERT or VERIFY fails. The default handler
|
||||
does no I/O, but automatically aborts the program. You can
|
||||
use any handler you want; just send the address of a "int
|
||||
func(const char*)" to mwSetAriFunc(). For more details on
|
||||
that, see memwatch.h.
|
||||
|
||||
TRACE/ASSERT/VERIFY macros
|
||||
|
||||
Memwatch defines (if not already defined) the macros TRACE,
|
||||
ASSERT and VERIFY. If you are already using macros with
|
||||
these names, memwatch 2.61 and later will not override
|
||||
them. Memwatch 2.61 and later will also always define the
|
||||
macros mwTRACE, mwASSERT and mwVERIFY, so you can use these
|
||||
to make sure you're talking to memwatch. Versions prior
|
||||
to 2.61 will *OVERRIDE* existing TRACE, ASSERT and VERIFY.
|
||||
|
||||
To make sure that existing TRACE, ASSERT and VERIFY macros
|
||||
are preserved, you can define MW_NOTRACE, MW_NOASSERT and
|
||||
MW_NOVERIFY. All versions of memwatch will abide by these.
|
||||
|
||||
How slow can you go?
|
||||
|
||||
Memwatch slows things down. Large allocations aren't
|
||||
affected so that you can measure it, but small allocations
|
||||
that would utilize a compilers small-allocator function
|
||||
suddenly cannot, and so gets slowed down alot. As a worst
|
||||
case, expect it to be 3-5 times slower.
|
||||
|
||||
Free'ing gets hit worse, I'm afraid, as memwatch checks
|
||||
a lot of stuff when freeing. Expect it to be 5-7 times
|
||||
slower, no matter what the size of the allocation.
|
||||
|
||||
Stress-testing the application
|
||||
|
||||
You can simulate low-memory conditions using mwLimit().
|
||||
mwLimit() takes the maximum number of bytes to be
|
||||
allocated; when the limit is hit, allocation requests will
|
||||
fail, and a "limit" message will be logged.
|
||||
|
||||
If you hit a real low-memory situation, memwatch logs that
|
||||
too. Memwatch itself has some reserve memory tucked away so
|
||||
it should continue running even in the worst conditions.
|
||||
|
||||
Hunting down wild writes and other Nasty Things
|
||||
|
||||
Wild writes are usually caused by using pointers that arent
|
||||
initialized, or that were initialized, but then the memory
|
||||
they points to is moved or freed. The best way to avoid
|
||||
these kind of problems is to ALWAYS initialize pointers to
|
||||
NULL, and after freeing a memory buffer, setting all
|
||||
pointers that pointed to it to NULL.
|
||||
|
||||
To aid in tracking down uninitialized pointers memwatch
|
||||
zaps all memory with certain values. Recently allocated
|
||||
memory (unless calloc'd, of course), contains 0xFE.
|
||||
Recently freed memory contains 0xFD. So if your program
|
||||
crashes when using memwatch and not without memwatch, it's
|
||||
most likely because you are not initializing your allocated
|
||||
buffers, or using the buffers after they've been freed.
|
||||
|
||||
In the event that a wild pointer should damage memwatch's
|
||||
internal data structures, memwatch employs checksums,
|
||||
multiple copies of some values, and can also repair it's
|
||||
own data structures.
|
||||
|
||||
If you are a paranoid person, and as programmer you should
|
||||
be, you can use memwatch's mwIsReadAddr() and
|
||||
mwIsSafeAddr() functions to check the accessibility of
|
||||
memory. These are implemented for both ANSI C systems and
|
||||
Win32 systems. Just put an mwASSERT() around the check and
|
||||
forget about it.
|
||||
|
||||
Can I help?
|
||||
|
||||
Well, sure. For instance, I like memwatch to compile
|
||||
without any warnings or errors. If you are using an ANSI C
|
||||
compliant compiler, and are getting warnings or errors,
|
||||
please mail me the details and instructions on how to fix
|
||||
them, if you can.
|
||||
|
||||
Another thing you can do if you decide to use memwatch is
|
||||
to mail me the name of the project(s) (and URL, if any),
|
||||
hardware and operating system, compiler and what user
|
||||
(organization). I will then post this info on the list of
|
||||
memwatch users.
|
||||
(http://www.linkdata.se/memwatchusers.html)
|
||||
|
||||
Top five problems using memwatch
|
||||
|
||||
5. Passed a non-memwatch allocated pointer to memwatch's
|
||||
free(). Symtom: Causes an erroneous "WILD free" log
|
||||
entry to appear. Cure: Either include memwatch.h for
|
||||
the file that allocates, or use mwFree_() to free it.
|
||||
|
||||
4. Relied on auto-initialization when using atexit().
|
||||
Symptom: Causes incorrect "unfreed" and "WILD free"
|
||||
messages. Cure: Use mwInit() and mwTerm().
|
||||
|
||||
3. Forgot to include memwatch.h in all files. Symptom:
|
||||
Tends to generate "WILD free" and "unfreed" messages.
|
||||
Cure: Make sure to include memwatch.h!
|
||||
|
||||
2. No write permissions in currect directory. Symptom:
|
||||
Seems like memwatch 'just aint working'. Cure: Use
|
||||
mwSetOutFunc() to redirect output.
|
||||
|
||||
...and the number one problem is...
|
||||
|
||||
1. Didn't define MEMWATCH when compiling. Symptom:
|
||||
Memwatch dutifully disables itself. Cure: Try adding
|
||||
-DMEMWATCH to the command line.
|
||||
|
340
shared/thirdparty/memwatch/gpl.txt
vendored
Normal file
340
shared/thirdparty/memwatch/gpl.txt
vendored
Normal file
|
@ -0,0 +1,340 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
2664
shared/thirdparty/memwatch/memwatch.c
vendored
Normal file
2664
shared/thirdparty/memwatch/memwatch.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
710
shared/thirdparty/memwatch/memwatch.h
vendored
Normal file
710
shared/thirdparty/memwatch/memwatch.h
vendored
Normal file
|
@ -0,0 +1,710 @@
|
|||
/*
|
||||
** MEMWATCH.H
|
||||
** Nonintrusive ANSI C memory leak / overwrite detection
|
||||
** Copyright (C) 1992-2002 Johan Lindh
|
||||
** All rights reserved.
|
||||
** Version 2.71
|
||||
**
|
||||
************************************************************************
|
||||
**
|
||||
** PURPOSE:
|
||||
**
|
||||
** MEMWATCH has been written to allow guys and gals that like to
|
||||
** program in C a public-domain memory error control product.
|
||||
** I hope you'll find it's as advanced as most commercial packages.
|
||||
** The idea is that you use it during the development phase and
|
||||
** then remove the MEMWATCH define to produce your final product.
|
||||
** MEMWATCH is distributed in source code form in order to allow
|
||||
** you to compile it for your platform with your own compiler.
|
||||
** It's aim is to be 100% ANSI C, but some compilers are more stingy
|
||||
** than others. If it doesn't compile without warnings, please mail
|
||||
** me the configuration of operating system and compiler you are using
|
||||
** along with a description of how to modify the source, and the version
|
||||
** number of MEMWATCH that you are using.
|
||||
**
|
||||
************************************************************************
|
||||
|
||||
This file is part of MEMWATCH.
|
||||
|
||||
MEMWATCH is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
MEMWATCH is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with MEMWATCH; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
************************************************************************
|
||||
**
|
||||
** REVISION HISTORY:
|
||||
**
|
||||
** 920810 JLI [1.00]
|
||||
** 920830 JLI [1.10 double-free detection]
|
||||
** 920912 JLI [1.15 mwPuts, mwGrab/Drop, mwLimit]
|
||||
** 921022 JLI [1.20 ASSERT and VERIFY]
|
||||
** 921105 JLI [1.30 C++ support and TRACE]
|
||||
** 921116 JLI [1.40 mwSetOutFunc]
|
||||
** 930215 JLI [1.50 modified ASSERT/VERIFY]
|
||||
** 930327 JLI [1.51 better auto-init & PC-lint support]
|
||||
** 930506 JLI [1.55 MemWatch class, improved C++ support]
|
||||
** 930507 JLI [1.60 mwTest & CHECK()]
|
||||
** 930809 JLI [1.65 Abort/Retry/Ignore]
|
||||
** 930820 JLI [1.70 data dump when unfreed]
|
||||
** 931016 JLI [1.72 modified C++ new/delete handling]
|
||||
** 931108 JLI [1.77 mwSetAssertAction() & some small changes]
|
||||
** 940110 JLI [1.80 no-mans-land alloc/checking]
|
||||
** 940328 JLI [2.00 version 2.0 rewrite]
|
||||
** Improved NML (no-mans-land) support.
|
||||
** Improved performance (especially for free()ing!).
|
||||
** Support for 'read-only' buffers (checksums)
|
||||
** ^^ NOTE: I never did this... maybe I should?
|
||||
** FBI (free'd block info) tagged before freed blocks
|
||||
** Exporting of the mwCounter variable
|
||||
** mwBreakOut() localizes debugger support
|
||||
** Allocation statistics (global, per-module, per-line)
|
||||
** Self-repair ability with relinking
|
||||
** 950913 JLI [2.10 improved garbage handling]
|
||||
** 951201 JLI [2.11 improved auto-free in emergencies]
|
||||
** 960125 JLI [X.01 implemented auto-checking using mwAutoCheck()]
|
||||
** 960514 JLI [2.12 undefining of existing macros]
|
||||
** 960515 JLI [2.13 possibility to use default new() & delete()]
|
||||
** 960516 JLI [2.20 suppression of file flushing on unfreed msgs]
|
||||
** 960516 JLI [2.21 better support for using MEMWATCH with DLL's]
|
||||
** 960710 JLI [X.02 multiple logs and mwFlushNow()]
|
||||
** 960801 JLI [2.22 merged X.01 version with current]
|
||||
** 960805 JLI [2.30 mwIsXXXXAddr() to avoid unneeded GP's]
|
||||
** 960805 JLI [2.31 merged X.02 version with current]
|
||||
** 961002 JLI [2.32 support for realloc() + fixed STDERR bug]
|
||||
** 961222 JLI [2.40 added mwMark() & mwUnmark()]
|
||||
** 970101 JLI [2.41 added over/underflow checking after failed ASSERT/VERIFY]
|
||||
** 970113 JLI [2.42 added support for PC-Lint 7.00g]
|
||||
** 970207 JLI [2.43 added support for strdup()]
|
||||
** 970209 JLI [2.44 changed default filename to lowercase]
|
||||
** 970405 JLI [2.45 fixed bug related with atexit() and some C++ compilers]
|
||||
** 970723 JLI [2.46 added MW_ARI_NULLREAD flag]
|
||||
** 970813 JLI [2.47 stabilized marker handling]
|
||||
** 980317 JLI [2.48 ripped out C++ support; wasn't working good anyway]
|
||||
** 980318 JLI [2.50 improved self-repair facilities & SIGSEGV support]
|
||||
** 980417 JLI [2.51 more checks for invalid addresses]
|
||||
** 980512 JLI [2.52 moved MW_ARI_NULLREAD to occur before aborting]
|
||||
** 990112 JLI [2.53 added check for empty heap to mwIsOwned]
|
||||
** 990217 JLI [2.55 improved the emergency repairs diagnostics and NML]
|
||||
** 990224 JLI [2.56 changed ordering of members in structures]
|
||||
** 990303 JLI [2.57 first maybe-fixit-for-hpux test]
|
||||
** 990516 JLI [2.58 added 'static' to the definition of mwAutoInit]
|
||||
** 990517 JLI [2.59 fixed some high-sensitivity warnings]
|
||||
** 990610 JLI [2.60 fixed some more high-sensitivity warnings]
|
||||
** 990715 JLI [2.61 changed TRACE/ASSERT/VERIFY macro names]
|
||||
** 991001 JLI [2.62 added CHECK_BUFFER() and mwTestBuffer()]
|
||||
** 991007 JLI [2.63 first shot at a 64-bit compatible version]
|
||||
** 991009 JLI [2.64 undef's strdup() if defined, mwStrdup made const]
|
||||
** 000704 JLI [2.65 added some more detection for 64-bits]
|
||||
** 010502 JLI [2.66 incorporated some user fixes]
|
||||
** [mwRelink() could print out garbage pointer (thanks mac@phobos.ca)]
|
||||
** [added array destructor for C++ (thanks rdasilva@connecttel.com)]
|
||||
** [added mutex support (thanks rdasilva@connecttel.com)]
|
||||
** 010531 JLI [2.67 fix: mwMutexXXX() was declared even if MW_HAVE_MUTEX was not defined]
|
||||
** 010619 JLI [2.68 fix: mwRealloc() could leave the mutex locked]
|
||||
** 020918 JLI [2.69 changed to GPL, added C++ array allocation by Howard Cohen]
|
||||
** 030212 JLI [2.70 mwMalloc() bug for very large allocations (4GB on 32bits)]
|
||||
** 030520 JLI [2.71 added ULONG_LONG_MAX as a 64-bit detector (thanks Sami Salonen)]
|
||||
**
|
||||
** To use, simply include 'MEMWATCH.H' as a header file,
|
||||
** and add MEMWATCH.C to your list of files, and define the macro
|
||||
** 'MEMWATCH'. If this is not defined, MEMWATCH will disable itself.
|
||||
**
|
||||
** To call the standard C malloc / realloc / calloc / free; use mwMalloc_(),
|
||||
** mwCalloc_() and mwFree_(). Note that mwFree_() will correctly
|
||||
** free both malloc()'d memory as well as mwMalloc()'d.
|
||||
**
|
||||
** 980317: C++ support has been disabled.
|
||||
** The code remains, but is not compiled.
|
||||
**
|
||||
** For use with C++, which allows use of inlining in header files
|
||||
** and class specific new/delete, you must also define 'new' as
|
||||
** 'mwNew' and 'delete' as 'mwDelete'. Do this *after* you include
|
||||
** C++ header files from libraries, otherwise you can mess up their
|
||||
** class definitions. If you don't define these, the C++ allocations
|
||||
** will not have source file and line number information. Also note,
|
||||
** most C++ class libraries implement their own C++ memory management,
|
||||
** and don't allow anyone to override them. MFC belongs to this crew.
|
||||
** In these cases, the only thing to do is to use MEMWATCH_NOCPP.
|
||||
**
|
||||
** You can capture output from MEMWATCH using mwSetOutFunc().
|
||||
** Just give it the adress of a "void myOutFunc(int c)" function,
|
||||
** and all characters to be output will be redirected there.
|
||||
**
|
||||
** A failing ASSERT() or VERIFY() will normally always abort your
|
||||
** program. This can be changed using mwSetAriFunc(). Give it a
|
||||
** pointer to a "int myAriFunc(const char *)" function. Your function
|
||||
** must ask the user whether to Abort, Retry or Ignore the trap.
|
||||
** Return 2 to Abort, 1 to Retry or 0 to Ignore. Beware retry; it
|
||||
** causes the expression to be evaluated again! MEMWATCH has a
|
||||
** default ARI handler. It's disabled by default, but you can enable
|
||||
** it by calling 'mwDefaultAri()'. Note that this will STILL abort
|
||||
** your program unless you define MEMWATCH_STDIO to allow MEMWATCH
|
||||
** to use the standard C I/O streams. Also, setting the ARI function
|
||||
** will cause MEMWATCH *NOT* to write the ARI error to stderr. The
|
||||
** error string is passed to the ARI function instead, as the
|
||||
** 'const char *' parameter.
|
||||
**
|
||||
** You can disable MEMWATCH's ASSERT/VERIFY and/or TRACE implementations.
|
||||
** This can be useful if you're using a debug terminal or smart debugger.
|
||||
** Disable them by defining MW_NOASSERT, MW_NOVERIFY or MW_NOTRACE.
|
||||
**
|
||||
** MEMWATCH fills all allocated memory with the byte 0xFE, so if
|
||||
** you're looking at erroneous data which are all 0xFE:s, the
|
||||
** data probably was not initialized by you. The exception is
|
||||
** calloc(), which will fill with zero's. All freed buffers are
|
||||
** zapped with 0xFD. If this is what you look at, you're using
|
||||
** data that has been freed. If this is the case, be aware that
|
||||
** MEMWATCH places a 'free'd block info' structure immediately
|
||||
** before the freed data. This block contains info about where
|
||||
** the block was freed. The information is in readable text,
|
||||
** in the format "FBI<counter>filename(line)", for example:
|
||||
** "FBI<267>test.c(12)". Using FBI's slows down free(), so it's
|
||||
** disabled by default. Use mwFreeBufferInfo(1) to enable it.
|
||||
**
|
||||
** To aid in tracking down wild pointer writes, MEMWATCH can perform
|
||||
** no-mans-land allocations. No-mans-land will contain the byte 0xFC.
|
||||
** MEMWATCH will, when this is enabled, convert recently free'd memory
|
||||
** into NML allocations.
|
||||
**
|
||||
** MEMWATCH protects it's own data buffers with checksums. If you
|
||||
** get an internal error, it means you're overwriting wildly,
|
||||
** or using an uninitialized pointer.
|
||||
**
|
||||
************************************************************************
|
||||
**
|
||||
** Note when compiling with Microsoft C:
|
||||
** - MSC ignores fflush() by default. This is overridden, so that
|
||||
** the disk log will always be current.
|
||||
**
|
||||
** This utility has been tested with:
|
||||
** PC-lint 7.0k, passed as 100% ANSI C compatible
|
||||
** Microsoft Visual C++ on Win16 and Win32
|
||||
** Microsoft C on DOS
|
||||
** SAS C on an Amiga 500
|
||||
** Gnu C on a PC running Red Hat Linux
|
||||
** ...and using an (to me) unknown compiler on an Atari machine.
|
||||
**
|
||||
************************************************************************
|
||||
**
|
||||
** Format of error messages in MEMWATCH.LOG:
|
||||
** message: <sequence-number> filename(linenumber), information
|
||||
**
|
||||
** Errors caught by MemWatch, when they are detected, and any
|
||||
** actions taken besides writing to the log file MEMWATCH.LOG:
|
||||
**
|
||||
** Double-freeing:
|
||||
** A pointer that was recently freed and has not since been
|
||||
** reused was freed again. The place where the previous free()
|
||||
** was executed is displayed.
|
||||
** Detect: delete or free() using the offending pointer.
|
||||
** Action: The delete or free() is cancelled, execution continues.
|
||||
** Underflow:
|
||||
** You have written just ahead of the allocated memory.
|
||||
** The size and place of the allocation is displayed.
|
||||
** Detect: delete or free() of the damaged buffer.
|
||||
** Action: The buffer is freed, but there may be secondary damage.
|
||||
** Overflow:
|
||||
** Like underflow, but you've written after the end of the buffer.
|
||||
** Detect: see Underflow.
|
||||
** Action: see Underflow.
|
||||
** WILD free:
|
||||
** An unrecognized pointer was passed to delete or free().
|
||||
** The pointer may have been returned from a library function;
|
||||
** in that case, use mwFree_() to force free() of it.
|
||||
** Also, this may be a double-free, but the previous free was
|
||||
** too long ago, causing MEMWATCH to 'forget' it.
|
||||
** Detect: delete or free() of the offending pointer.
|
||||
** Action: The delete or free() is cancelled, execution continues.
|
||||
** NULL free:
|
||||
** It's unclear to me whether or not freeing of NULL pointers
|
||||
** is legal in ANSI C, therefore a warning is written to the log file,
|
||||
** but the error counter remains the same. This is legal using C++,
|
||||
** so the warning does not appear with delete.
|
||||
** Detect: When you free(NULL).
|
||||
** Action: The free() is cancelled.
|
||||
** Failed:
|
||||
** A request to allocate memory failed. If the allocation is
|
||||
** small, this may be due to memory depletion, but is more likely
|
||||
** to be memory fragmentation problems. The amount of memory
|
||||
** allocated so far is displayed also.
|
||||
** Detect: When you new, malloc(), realloc() or calloc() memory.
|
||||
** Action: NULL is returned.
|
||||
** Realloc:
|
||||
** A request to re-allocate a memory buffer failed for reasons
|
||||
** other than out-of-memory. The specific reason is shown.
|
||||
** Detect: When you realloc()
|
||||
** Action: realloc() is cancelled, NULL is returned
|
||||
** Limit fail:
|
||||
** A request to allocate memory failed since it would violate
|
||||
** the limit set using mwLimit(). mwLimit() is used to stress-test
|
||||
** your code under simulated low memory conditions.
|
||||
** Detect: At new, malloc(), realloc() or calloc().
|
||||
** Action: NULL is returned.
|
||||
** Assert trap:
|
||||
** An ASSERT() failed. The ASSERT() macro works like C's assert()
|
||||
** macro/function, except that it's interactive. See your C manual.
|
||||
** Detect: On the ASSERT().
|
||||
** Action: Program ends with an advisory message to stderr, OR
|
||||
** Program writes the ASSERT to the log and continues, OR
|
||||
** Program asks Abort/Retry/Ignore? and takes that action.
|
||||
** Verify trap:
|
||||
** A VERIFY() failed. The VERIFY() macro works like ASSERT(),
|
||||
** but if MEMWATCH is not defined, it still evaluates the
|
||||
** expression, but it does not act upon the result.
|
||||
** Detect: On the VERIFY().
|
||||
** Action: Program ends with an advisory message to stderr, OR
|
||||
** Program writes the VERIFY to the log and continues, OR
|
||||
** Program asks Abort/Retry/Ignore? and takes that action.
|
||||
** Wild pointer:
|
||||
** A no-mans-land buffer has been written into. MEMWATCH can
|
||||
** allocate and distribute chunks of memory solely for the
|
||||
** purpose of trying to catch random writes into memory.
|
||||
** Detect: Always on CHECK(), but can be detected in several places.
|
||||
** Action: The error is logged, and if an ARI handler is installed,
|
||||
** it is executed, otherwise, execution continues.
|
||||
** Unfreed:
|
||||
** A memory buffer you allocated has not been freed.
|
||||
** You are informed where it was allocated, and whether any
|
||||
** over or underflow has occured. MemWatch also displays up to
|
||||
** 16 bytes of the data, as much as it can, in hex and text.
|
||||
** Detect: When MemWatch terminates.
|
||||
** Action: The buffer is freed.
|
||||
** Check:
|
||||
** An error was detected during a CHECK() operation.
|
||||
** The associated pointer is displayed along with
|
||||
** the file and line where the CHECK() was executed.
|
||||
** Followed immediately by a normal error message.
|
||||
** Detect: When you CHECK()
|
||||
** Action: Depends on the error
|
||||
** Relink:
|
||||
** After a MEMWATCH internal control block has been trashed,
|
||||
** MEMWATCH tries to repair the damage. If successful, program
|
||||
** execution will continue instead of aborting. Some information
|
||||
** about the block may be gone permanently, though.
|
||||
** Detect: N/A
|
||||
** Action: Relink successful: program continues.
|
||||
** Relink fails: program aborts.
|
||||
** Internal:
|
||||
** An internal error is flagged by MEMWATCH when it's control
|
||||
** structures have been damaged. You are likely using an uninitialized
|
||||
** pointer somewhere in your program, or are zapping memory all over.
|
||||
** The message may give you additional diagnostic information.
|
||||
** If possible, MEMWATCH will recover and continue execution.
|
||||
** Detect: Various actions.
|
||||
** Action: Whatever is needed
|
||||
** Mark:
|
||||
** The program terminated without umarking all marked pointers. Marking
|
||||
** can be used to track resources other than memory. mwMark(pointer,text,...)
|
||||
** when the resource is allocated, and mwUnmark(pointer) when it's freed.
|
||||
** The 'text' is displayed for still marked pointers when the program
|
||||
** ends.
|
||||
** Detect: When MemWatch terminates.
|
||||
** Action: The error is logged.
|
||||
**
|
||||
**
|
||||
************************************************************************
|
||||
**
|
||||
** The author may be reached by e-mail at the address below. If you
|
||||
** mail me about source code changes in MEMWATCH, remember to include
|
||||
** MW's version number.
|
||||
**
|
||||
** Johan Lindh
|
||||
** johan@linkdata.se
|
||||
**
|
||||
** The latest version of MEMWATCH may be downloaded from
|
||||
** http://www.linkdata.se/
|
||||
*/
|
||||
|
||||
#ifndef __MEMWATCH_H
|
||||
#define __MEMWATCH_H
|
||||
|
||||
/* Make sure that malloc(), realloc(), calloc() and free() are declared. */
|
||||
/*lint -save -e537 */
|
||||
#include <stdlib.h>
|
||||
/*lint -restore */
|
||||
|
||||
/* strdup() */
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** Constants used
|
||||
** All MEMWATCH constants start with the prefix MW_, followed by
|
||||
** a short mnemonic which indicates where the constant is used,
|
||||
** followed by a descriptive text about it.
|
||||
*/
|
||||
|
||||
#define MW_ARI_NULLREAD 0x10 /* Null read (to start debugger) */
|
||||
#define MW_ARI_ABORT 0x04 /* ARI handler says: abort program! */
|
||||
#define MW_ARI_RETRY 0x02 /* ARI handler says: retry action! */
|
||||
#define MW_ARI_IGNORE 0x01 /* ARI handler says: ignore error! */
|
||||
|
||||
#define MW_VAL_NEW 0xFE /* value in newly allocated memory */
|
||||
#define MW_VAL_DEL 0xFD /* value in newly deleted memory */
|
||||
#define MW_VAL_NML 0xFC /* value in no-mans-land */
|
||||
#define MW_VAL_GRB 0xFB /* value in grabbed memory */
|
||||
|
||||
#define MW_TEST_ALL 0xFFFF /* perform all tests */
|
||||
#define MW_TEST_CHAIN 0x0001 /* walk the heap chain */
|
||||
#define MW_TEST_ALLOC 0x0002 /* test allocations & NML guards */
|
||||
#define MW_TEST_NML 0x0004 /* test all-NML areas for modifications */
|
||||
|
||||
#define MW_NML_NONE 0 /* no NML */
|
||||
#define MW_NML_FREE 1 /* turn FREE'd memory into NML */
|
||||
#define MW_NML_ALL 2 /* all unused memory is NML */
|
||||
#define MW_NML_DEFAULT 0 /* the default NML setting */
|
||||
|
||||
#define MW_STAT_GLOBAL 0 /* only global statistics collected */
|
||||
#define MW_STAT_MODULE 1 /* collect statistics on a module basis */
|
||||
#define MW_STAT_LINE 2 /* collect statistics on a line basis */
|
||||
#define MW_STAT_DEFAULT 0 /* the default statistics setting */
|
||||
|
||||
/*
|
||||
** MemWatch internal constants
|
||||
** You may change these and recompile MemWatch to change the limits
|
||||
** of some parameters. Respect the recommended minimums!
|
||||
*/
|
||||
#define MW_TRACE_BUFFER 2048 /* (min 160) size of TRACE()'s output buffer */
|
||||
#define MW_FREE_LIST 64 /* (min 4) number of free()'s to track */
|
||||
|
||||
/*
|
||||
** Exported variables
|
||||
** In case you have to remove the 'const' keyword because your compiler
|
||||
** doesn't support it, be aware that changing the values may cause
|
||||
** unpredictable behaviour.
|
||||
** - mwCounter contains the current action count. You can use this to
|
||||
** place breakpoints using a debugger, if you want.
|
||||
*/
|
||||
#ifndef __MEMWATCH_C
|
||||
extern const unsigned long mwCounter;
|
||||
#endif
|
||||
|
||||
/*
|
||||
** System functions
|
||||
** Normally, it is not nessecary to call any of these. MEMWATCH will
|
||||
** automatically initialize itself on the first MEMWATCH function call,
|
||||
** and set up a call to mwAbort() using atexit(). Some C++ implementations
|
||||
** run the atexit() chain before the program has terminated, so you
|
||||
** may have to use mwInit() or the MemWatch C++ class to get good
|
||||
** behaviour.
|
||||
** - mwInit() can be called to disable the atexit() usage. If mwInit()
|
||||
** is called directly, you must call mwTerm() to end MemWatch, or
|
||||
** mwAbort().
|
||||
** - mwTerm() is usually not nessecary to call; but if called, it will
|
||||
** call mwAbort() if it finds that it is cancelling the 'topmost'
|
||||
** mwInit() call.
|
||||
** - mwAbort() cleans up after MEMWATCH, reports unfreed buffers, etc.
|
||||
*/
|
||||
void mwInit( void );
|
||||
void mwTerm( void );
|
||||
void mwAbort( void );
|
||||
|
||||
/*
|
||||
** Setup functions
|
||||
** These functions control the operation of MEMWATCH's protective features.
|
||||
** - mwFlushNow() causes MEMWATCH to flush it's buffers.
|
||||
** - mwDoFlush() controls whether MEMWATCH flushes the disk buffers after
|
||||
** writes. The default is smart flushing: MEMWATCH will not flush buffers
|
||||
** explicitly until memory errors are detected. Then, all writes are
|
||||
** flushed until program end or mwDoFlush(0) is called.
|
||||
** - mwLimit() sets the allocation limit, an arbitrary limit on how much
|
||||
** memory your program may allocate in bytes. Used to stress-test app.
|
||||
** Also, in virtual-memory or multitasking environs, puts a limit on
|
||||
** how much MW_NML_ALL can eat up.
|
||||
** - mwGrab() grabs up X kilobytes of memory. Allocates actual memory,
|
||||
** can be used to stress test app & OS both.
|
||||
** - mwDrop() drops X kilobytes of grabbed memory.
|
||||
** - mwNoMansLand() sets the behaviour of the NML logic. See the
|
||||
** MW_NML_xxx for more information. The default is MW_NML_DEFAULT.
|
||||
** - mwStatistics() sets the behaviour of the statistics collector. See
|
||||
** the MW_STAT_xxx defines for more information. Default MW_STAT_DEFAULT.
|
||||
** - mwFreeBufferInfo() enables or disables the tagging of free'd buffers
|
||||
** with freeing information. This information is written in text form,
|
||||
** using sprintf(), so it's pretty slow. Disabled by default.
|
||||
** - mwAutoCheck() performs a CHECK() operation whenever a MemWatch function
|
||||
** is used. Slows down performance, of course.
|
||||
** - mwCalcCheck() calculates checksums for all data buffers. Slow!
|
||||
** - mwDumpCheck() logs buffers where stored & calc'd checksums differ. Slow!!
|
||||
** - mwMark() sets a generic marker. Returns the pointer given.
|
||||
** - mwUnmark() removes a generic marker. If, at the end of execution, some
|
||||
** markers are still in existence, these will be reported as leakage.
|
||||
** returns the pointer given.
|
||||
*/
|
||||
void mwFlushNow( void );
|
||||
void mwDoFlush( int onoff );
|
||||
void mwLimit( long bytes );
|
||||
unsigned mwGrab( unsigned kilobytes );
|
||||
unsigned mwDrop( unsigned kilobytes );
|
||||
void mwNoMansLand( int mw_nml_level );
|
||||
void mwStatistics( int level );
|
||||
void mwFreeBufferInfo( int onoff );
|
||||
void mwAutoCheck( int onoff );
|
||||
void mwCalcCheck( void );
|
||||
void mwDumpCheck( void );
|
||||
void * mwMark( void *p, const char *description, const char *file, unsigned line );
|
||||
void * mwUnmark( void *p, const char *file, unsigned line );
|
||||
|
||||
/*
|
||||
** Testing/verification/tracing
|
||||
** All of these macros except VERIFY() evaluates to a null statement
|
||||
** if MEMWATCH is not defined during compilation.
|
||||
** - mwIsReadAddr() checks a memory area for read privilige.
|
||||
** - mwIsSafeAddr() checks a memory area for both read & write privilige.
|
||||
** This function and mwIsReadAddr() is highly system-specific and
|
||||
** may not be implemented. If this is the case, they will default
|
||||
** to returning nonzero for any non-NULL pointer.
|
||||
** - CHECK() does a complete memory integrity test. Slow!
|
||||
** - CHECK_THIS() checks only selected components.
|
||||
** - CHECK_BUFFER() checks the indicated buffer for errors.
|
||||
** - mwASSERT() or ASSERT() If the expression evaluates to nonzero, execution continues.
|
||||
** Otherwise, the ARI handler is called, if present. If not present,
|
||||
** the default ARI action is taken (set with mwSetAriAction()).
|
||||
** ASSERT() can be disabled by defining MW_NOASSERT.
|
||||
** - mwVERIFY() or VERIFY() works just like ASSERT(), but when compiling without
|
||||
** MEMWATCH the macro evaluates to the expression.
|
||||
** VERIFY() can be disabled by defining MW_NOVERIFY.
|
||||
** - mwTRACE() or TRACE() writes some text and data to the log. Use like printf().
|
||||
** TRACE() can be disabled by defining MW_NOTRACE.
|
||||
*/
|
||||
int mwIsReadAddr( const void *p, unsigned len );
|
||||
int mwIsSafeAddr( void *p, unsigned len );
|
||||
int mwTest( const char *file, int line, int mw_test_flags );
|
||||
int mwTestBuffer( const char *file, int line, void *p );
|
||||
int mwAssert( int, const char*, const char*, int );
|
||||
int mwVerify( int, const char*, const char*, int );
|
||||
|
||||
/*
|
||||
** User I/O functions
|
||||
** - mwTrace() works like printf(), but dumps output either to the
|
||||
** function specified with mwSetOutFunc(), or the log file.
|
||||
** - mwPuts() works like puts(), dumps output like mwTrace().
|
||||
** - mwSetOutFunc() allows you to give the adress of a function
|
||||
** where all user output will go. (exeption: see mwSetAriFunc)
|
||||
** Specifying NULL will direct output to the log file.
|
||||
** - mwSetAriFunc() gives MEMWATCH the adress of a function to call
|
||||
** when an 'Abort, Retry, Ignore' question is called for. The
|
||||
** actual error message is NOT printed when you've set this adress,
|
||||
** but instead it is passed as an argument. If you call with NULL
|
||||
** for an argument, the ARI handler is disabled again. When the
|
||||
** handler is disabled, MEMWATCH will automatically take the
|
||||
** action specified by mwSetAriAction().
|
||||
** - mwSetAriAction() sets the default ARI return value MEMWATCH should
|
||||
** use if no ARI handler is specified. Defaults to MW_ARI_ABORT.
|
||||
** - mwAriHandler() is an ANSI ARI handler you can use if you like. It
|
||||
** dumps output to stderr, and expects input from stdin.
|
||||
** - mwBreakOut() is called in certain cases when MEMWATCH feels it would
|
||||
** be nice to break into a debugger. If you feel like MEMWATCH, place
|
||||
** an execution breakpoint on this function.
|
||||
*/
|
||||
void mwTrace( const char* format_string, ... );
|
||||
void mwPuts( const char* text );
|
||||
void mwSetOutFunc( void (*func)(int) );
|
||||
void mwSetAriFunc( int (*func)(const char*) );
|
||||
void mwSetAriAction( int mw_ari_value );
|
||||
int mwAriHandler( const char* cause );
|
||||
void mwBreakOut( const char* cause );
|
||||
|
||||
/*
|
||||
** Allocation/deallocation functions
|
||||
** These functions are the ones actually to perform allocations
|
||||
** when running MEMWATCH, for both C and C++ calls.
|
||||
** - mwMalloc() debugging allocator
|
||||
** - mwMalloc_() always resolves to a clean call of malloc()
|
||||
** - mwRealloc() debugging re-allocator
|
||||
** - mwRealloc_() always resolves to a clean call of realloc()
|
||||
** - mwCalloc() debugging allocator, fills with zeros
|
||||
** - mwCalloc_() always resolves to a clean call of calloc()
|
||||
** - mwFree() debugging free. Can only free memory which has
|
||||
** been allocated by MEMWATCH.
|
||||
** - mwFree_() resolves to a) normal free() or b) debugging free.
|
||||
** Can free memory allocated by MEMWATCH and malloc() both.
|
||||
** Does not generate any runtime errors.
|
||||
*/
|
||||
void* mwMalloc( size_t, const char*, int );
|
||||
void* mwMalloc_( size_t );
|
||||
void* mwRealloc( void *, size_t, const char*, int );
|
||||
void* mwRealloc_( void *, size_t );
|
||||
void* mwCalloc( size_t, size_t, const char*, int );
|
||||
void* mwCalloc_( size_t, size_t );
|
||||
void mwFree( void*, const char*, int );
|
||||
void mwFree_( void* );
|
||||
char* mwStrdup( const char *, const char*, int );
|
||||
|
||||
/*
|
||||
** Enable/disable precompiler block
|
||||
** This block of defines and if(n)defs make sure that references
|
||||
** to MEMWATCH is completely removed from the code if the MEMWATCH
|
||||
** manifest constant is not defined.
|
||||
*/
|
||||
#ifndef __MEMWATCH_C
|
||||
#ifdef MEMWATCH
|
||||
|
||||
#define mwASSERT(exp) while(mwAssert((int)(exp),#exp,__FILE__,__LINE__))
|
||||
#ifndef MW_NOASSERT
|
||||
#ifndef ASSERT
|
||||
#define ASSERT mwASSERT
|
||||
#endif /* !ASSERT */
|
||||
#endif /* !MW_NOASSERT */
|
||||
#define mwVERIFY(exp) while(mwVerify((int)(exp),#exp,__FILE__,__LINE__))
|
||||
#ifndef MW_NOVERIFY
|
||||
#ifndef VERIFY
|
||||
#define VERIFY mwVERIFY
|
||||
#endif /* !VERIFY */
|
||||
#endif /* !MW_NOVERIFY */
|
||||
#define mwTRACE mwTrace
|
||||
#ifndef MW_NOTRACE
|
||||
#ifndef TRACE
|
||||
#define TRACE mwTRACE
|
||||
#endif /* !TRACE */
|
||||
#endif /* !MW_NOTRACE */
|
||||
|
||||
/* some compilers use a define and not a function */
|
||||
/* for strdup(). */
|
||||
#ifdef strdup
|
||||
#undef strdup
|
||||
#endif
|
||||
|
||||
#define malloc(n) mwMalloc(n,__FILE__,__LINE__)
|
||||
#define strdup(p) mwStrdup(p,__FILE__,__LINE__)
|
||||
#define realloc(p,n) mwRealloc(p,n,__FILE__,__LINE__)
|
||||
#define calloc(n,m) mwCalloc(n,m,__FILE__,__LINE__)
|
||||
#define free(p) mwFree(p,__FILE__,__LINE__)
|
||||
#define CHECK() mwTest(__FILE__,__LINE__,MW_TEST_ALL)
|
||||
#define CHECK_THIS(n) mwTest(__FILE__,__LINE__,n)
|
||||
#define CHECK_BUFFER(b) mwTestBuffer(__FILE__,__LINE__,b)
|
||||
#define MARK(p) mwMark(p,#p,__FILE__,__LINE__)
|
||||
#define UNMARK(p) mwUnmark(p,__FILE__,__LINE__)
|
||||
|
||||
#else /* MEMWATCH */
|
||||
|
||||
#define mwASSERT(exp)
|
||||
#ifndef MW_NOASSERT
|
||||
#ifndef ASSERT
|
||||
#define ASSERT mwASSERT
|
||||
#endif /* !ASSERT */
|
||||
#endif /* !MW_NOASSERT */
|
||||
|
||||
#define mwVERIFY(exp) exp
|
||||
#ifndef MW_NOVERIFY
|
||||
#ifndef VERIFY
|
||||
#define VERIFY mwVERIFY
|
||||
#endif /* !VERIFY */
|
||||
#endif /* !MW_NOVERIFY */
|
||||
|
||||
/*lint -esym(773,mwTRACE) */
|
||||
#define mwTRACE /*lint -save -e506 */ 1?(void)0:mwDummyTraceFunction /*lint -restore */
|
||||
#ifndef MW_NOTRACE
|
||||
#ifndef TRACE
|
||||
/*lint -esym(773,TRACE) */
|
||||
#define TRACE mwTRACE
|
||||
#endif /* !TRACE */
|
||||
#endif /* !MW_NOTRACE */
|
||||
|
||||
extern void mwDummyTraceFunction(const char *,...);
|
||||
/*lint -save -e652 */
|
||||
#define mwDoFlush(n)
|
||||
#define mwPuts(s)
|
||||
#define mwInit()
|
||||
#define mwGrab(n)
|
||||
#define mwDrop(n)
|
||||
#define mwLimit(n)
|
||||
#define mwTest(f,l)
|
||||
#define mwSetOutFunc(f)
|
||||
#define mwSetAriFunc(f)
|
||||
#define mwDefaultAri()
|
||||
#define mwNomansland()
|
||||
#define mwStatistics(f)
|
||||
#define mwMark(p,t,f,n) (p)
|
||||
#define mwUnmark(p,f,n) (p)
|
||||
#define mwMalloc(n,f,l) malloc(n)
|
||||
#define mwStrdup(p,f,l) strdup(p)
|
||||
#define mwRealloc(p,n,f,l) realloc(p,n)
|
||||
#define mwCalloc(n,m,f,l) calloc(n,m)
|
||||
#define mwFree(p) free(p)
|
||||
#define mwMalloc_(n) malloc(n)
|
||||
#define mwRealloc_(p,n) realloc(p,n)
|
||||
#define mwCalloc_(n,m) calloc(n,m)
|
||||
#define mwFree_(p) free(p)
|
||||
#define mwAssert(e,es,f,l)
|
||||
#define mwVerify(e,es,f,l) (e)
|
||||
#define mwTrace mwDummyTrace
|
||||
#define mwTestBuffer(f,l,b) (0)
|
||||
#define CHECK()
|
||||
#define CHECK_THIS(n)
|
||||
#define CHECK_BUFFER(b)
|
||||
#define MARK(p) (p)
|
||||
#define UNMARK(p) (p)
|
||||
/*lint -restore */
|
||||
|
||||
#endif /* MEMWATCH */
|
||||
#endif /* !__MEMWATCH_C */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0 /* 980317: disabled C++ */
|
||||
|
||||
/*
|
||||
** C++ support section
|
||||
** Implements the C++ support. Please note that in order to avoid
|
||||
** messing up library classes, C++ support is disabled by default.
|
||||
** You must NOT enable it until AFTER the inclusion of all header
|
||||
** files belonging to code that are not compiled with MEMWATCH, and
|
||||
** possibly for some that are! The reason for this is that a C++
|
||||
** class may implement it's own new() function, and the preprocessor
|
||||
** would substitute this crucial declaration for MEMWATCH new().
|
||||
** You can forcibly deny C++ support by defining MEMWATCH_NOCPP.
|
||||
** To enble C++ support, you must be compiling C++, MEMWATCH must
|
||||
** be defined, MEMWATCH_NOCPP must not be defined, and finally,
|
||||
** you must define 'new' to be 'mwNew', and 'delete' to be 'mwDelete'.
|
||||
** Unlike C, C++ code can begin executing *way* before main(), for
|
||||
** example if a global variable is created. For this reason, you can
|
||||
** declare a global variable of the class 'MemWatch'. If this is
|
||||
** is the first variable created, it will then check ALL C++ allocations
|
||||
** and deallocations. Unfortunately, this evaluation order is not
|
||||
** guaranteed by C++, though the compilers I've tried evaluates them
|
||||
** in the order encountered.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
#ifndef __MEMWATCH_C
|
||||
#ifdef MEMWATCH
|
||||
#ifndef MEMWATCH_NOCPP
|
||||
extern int mwNCur;
|
||||
extern const char *mwNFile;
|
||||
extern int mwNLine;
|
||||
class MemWatch {
|
||||
public:
|
||||
MemWatch();
|
||||
~MemWatch();
|
||||
};
|
||||
void * operator new(size_t);
|
||||
void * operator new(size_t,const char *,int);
|
||||
void * operator new[] (size_t,const char *,int); // hjc 07/16/02
|
||||
void operator delete(void *);
|
||||
#define mwNew new(__FILE__,__LINE__)
|
||||
#define mwDelete (mwNCur=1,mwNFile=__FILE__,mwNLine=__LINE__),delete
|
||||
#endif /* MEMWATCH_NOCPP */
|
||||
#endif /* MEMWATCH */
|
||||
#endif /* !__MEMWATCH_C */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* 980317: disabled C++ */
|
||||
|
||||
#endif /* __MEMWATCH_H */
|
||||
|
||||
/* EOF MEMWATCH.H */
|
15
shared/thirdparty/memwatch/memwatch.lsm
vendored
Normal file
15
shared/thirdparty/memwatch/memwatch.lsm
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
Begin3
|
||||
Title: memwatch
|
||||
Version: 2.71
|
||||
Entered-date: 2002-09-18
|
||||
Description: fault tolerant ANSI-C source code memory leak and corruption detection
|
||||
Keywords: memwatch debugging library memory leak source code ansi c
|
||||
Author: johan@linkdata.se
|
||||
Maintained-by: johan@linkdata.se
|
||||
Primary-site: ftp.linkdata.se /pub/memwatch
|
||||
42K memwatch-2.71.tar.gz
|
||||
Alternate-site:
|
||||
Original-site: ftp.linkdata.se /pub/memwatch
|
||||
Platforms: all
|
||||
Copying-policy: GPL
|
||||
End
|
116
shared/thirdparty/memwatch/test.C
vendored
Normal file
116
shared/thirdparty/memwatch/test.C
vendored
Normal file
|
@ -0,0 +1,116 @@
|
|||
|
||||
/*
|
||||
** NOTE: Running this program in a Win32 or Unix environment
|
||||
** will probably result in a segmentation fault or protection
|
||||
** error. These errors may be caused by MEMWATCH when it is
|
||||
** looking at memory to see if it owns it, or may be caused by
|
||||
** the test program writing to memory it does not own.
|
||||
**
|
||||
** MEMWATCH has two functions called 'mwIsReadAddr()' and
|
||||
** 'mwIsSafeAddr()', which are system-specific.
|
||||
** If they are implemented for your system, and works
|
||||
** correctly, MEMWATCH will identify garbage pointers and
|
||||
** avoid causing segmentation faults, GP's etc.
|
||||
**
|
||||
** If they are NOT implemented, count on getting the core
|
||||
** dumped when running this test program! As of this writing,
|
||||
** the safe-address checking has been implemented for Win32
|
||||
** and ANSI-C compliant systems. The ANSI-C checking traps
|
||||
** SIGSEGV and uses setjmp/longjmp to resume processing.
|
||||
**
|
||||
** Note for Win95 users: The Win32 IsBadReadPtr() and its
|
||||
** similar functions can return incorrect values. This has
|
||||
** not happened under WinNT, though, just Win95.
|
||||
**
|
||||
** 991009 Johan Lindh
|
||||
**
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include "memwatch.h"
|
||||
|
||||
#ifndef SIGSEGV
|
||||
#error "SIGNAL.H does not define SIGSEGV; running this program WILL cause a core dump/crash!"
|
||||
#endif
|
||||
|
||||
#ifndef MEMWATCH
|
||||
#error "You really, really don't want to run this without memwatch. Trust me."
|
||||
#endif
|
||||
|
||||
#if !defined(MW_STDIO) && !defined(MEMWATCH_STDIO)
|
||||
#error "Define MW_STDIO and try again, please."
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
char *p;
|
||||
|
||||
/* Collect stats on a line number basis */
|
||||
mwStatistics( 2 );
|
||||
|
||||
/* Slows things down, but OK for this test prg */
|
||||
/* mwAutoCheck( 1 ); */
|
||||
|
||||
TRACE("Hello world!\n");
|
||||
|
||||
p = malloc(210);
|
||||
free(p);
|
||||
p = malloc(20);
|
||||
p = malloc(200); /* causes unfreed error */
|
||||
p[-1] = 0; /* causes underflow error */
|
||||
free(p);
|
||||
|
||||
p = malloc(100);
|
||||
p[ -(int)(sizeof(long)*8) ] = -1; /* try to damage MW's heap chain */
|
||||
free( p ); /* should cause relink */
|
||||
|
||||
mwSetAriFunc( mwAriHandler );
|
||||
ASSERT(1==2);
|
||||
|
||||
mwLimit(1000000);
|
||||
mwNoMansLand( MW_NML_ALL );
|
||||
|
||||
/* These may cause a general protection fault (segmentation fault) */
|
||||
/* They're here to help test the no-mans-land protection */
|
||||
if( mwIsSafeAddr(p+50000,1) ) {
|
||||
TRACE("Killing byte at %p\n", p+50000);
|
||||
*(p+50000) = 0;
|
||||
}
|
||||
if( mwIsSafeAddr(p+30000,1) ) {
|
||||
TRACE("Killing byte at %p\n", p+30000);
|
||||
*(p+30000) = 0;
|
||||
}
|
||||
if( mwIsSafeAddr(p+1000,1) ) {
|
||||
TRACE("Killing byte at %p\n", p+1000);
|
||||
*(p+1000) = 0;
|
||||
}
|
||||
if( mwIsSafeAddr(p-100,1) ) {
|
||||
TRACE("Killing byte at %p\n", p-100);
|
||||
*(p-100) = 0;
|
||||
}
|
||||
|
||||
/* This may cause a GP fault as well, since MW data buffers */
|
||||
/* have been damaged in the above killing spree */
|
||||
CHECK();
|
||||
|
||||
p = malloc(12000);
|
||||
p[-5] = 1;
|
||||
p[-10] = 2;
|
||||
p[-15] = 3;
|
||||
p[-20] = 4;
|
||||
|
||||
/* This may cause a GP fault since MW's buffer list may have */
|
||||
/* been damaged by above killing, and it will try to repair it. */
|
||||
free(p);
|
||||
|
||||
p = realloc(p,10); /* causes realloc: free'd from error */
|
||||
|
||||
/* May cause GP since MW will inspect the memory to see if it owns it. */
|
||||
free( (void*)main );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Comment out the following line to compile. */
|
||||
#error "Hey! Don't just compile this program, read the comments first!"
|
1895
shared/thirdparty/stb_ds.h
vendored
Normal file
1895
shared/thirdparty/stb_ds.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
475
test.conf
Normal file
475
test.conf
Normal file
|
@ -0,0 +1,475 @@
|
|||
# This is the configuration file for dosbox-staging (0.78.0).
|
||||
# Lines starting with a '#' character are comments.
|
||||
|
||||
[sdl]
|
||||
# fullscreen: Start directly in fullscreen.
|
||||
# Run INTRO and see Special Keys for window control hotkeys.
|
||||
# display: Number of display to use; values depend on OS and user settings.
|
||||
# fullresolution: What resolution to use for fullscreen: 'original', 'desktop'
|
||||
# or a fixed size (e.g. 1024x768).
|
||||
# windowresolution: Set window size when running in windowed mode:
|
||||
# default: Select the best option based on your
|
||||
# environment and other settings.
|
||||
# small, medium, or large (or s, m, l):
|
||||
# Size the window relative to the desktop.
|
||||
# <custom>: Scale the window to the given dimensions in
|
||||
# WxH format. For example: 1024x768.
|
||||
# Scaling is not performed for output=surface.
|
||||
# window_position: Set initial window position when running in windowed mode:
|
||||
# auto: Let the window manager decide the position.
|
||||
# <custom>: Set window position in X,Y format. For example: 250,100
|
||||
# 0,0 is the top-left corner of the screen.
|
||||
# window_decorations: Controls whether to display window decorations in windowed mode.
|
||||
# vsync: Synchronize with display refresh rate if supported. This can
|
||||
# reduce flickering and tearing, but may also impact performance.
|
||||
# vsync_skip: Number of microseconds to allow rendering to block before skipping the next frame. 0 disables this and will always render.
|
||||
# max_resolution: Optionally restricts the viewport resolution within the window/screen:
|
||||
# auto: The viewport fills the window/screen (default).
|
||||
# <custom>: Set max viewport resolution in WxH format.
|
||||
# For example: 960x720
|
||||
# output: What video system to use for output.
|
||||
# Possible values: surface, texture, texturenb, texturepp, opengl, openglnb, openglpp.
|
||||
# texture_renderer: Choose a renderer driver when using a texture output mode.
|
||||
# Use texture_renderer=auto for an automatic choice.
|
||||
# Possible values: auto, opengl, opengles2, software.
|
||||
# capture_mouse: Choose a mouse control method:
|
||||
# onclick: Capture the mouse when clicking any button in the window.
|
||||
# onstart: Capture the mouse immediately on start.
|
||||
# seamless: Let the mouse move seamlessly; captures only with middle-click or hotkey.
|
||||
# nomouse: Hide the mouse and don't send input to the game.
|
||||
# Choose how middle-clicks are handled (second parameter):
|
||||
# middlegame: Middle-clicks are sent to the game.
|
||||
# middlerelease: Middle-click will release the captured mouse, and also capture when seamless.
|
||||
# Defaults (if not present or incorrect): seamless middlerelease
|
||||
# Possible values: seamless, onclick, onstart, nomouse.
|
||||
# sensitivity: Mouse sensitivity. The optional second parameter specifies vertical sensitivity (e.g. 100,-50).
|
||||
# raw_mouse_input: Enable this setting to bypass your operating system's mouse
|
||||
# acceleration and sensitivity settings. This works in
|
||||
# fullscreen or when the mouse is captured in window mode.
|
||||
# waitonerror: Wait before closing the console if dosbox has an error.
|
||||
# priority: Priority levels for dosbox. Second entry behind the comma is for when dosbox is not focused/minimized.
|
||||
# pause is only valid for the second entry. auto disables priority levels and uses OS defaults
|
||||
# Possible values: auto, lowest, lower, normal, higher, highest, pause.
|
||||
# mapperfile: File used to load/save the key/event mappings from.
|
||||
# Resetmapper only works with the default value.
|
||||
# screensaver: Use 'allow' or 'block' to override the SDL_VIDEO_ALLOW_SCREENSAVER
|
||||
# environment variable (which usually blocks the OS screensaver
|
||||
# while the emulator is running).
|
||||
# Possible values: auto, allow, block.
|
||||
|
||||
fullscreen = false
|
||||
display = 0
|
||||
fullresolution = desktop
|
||||
windowresolution = default
|
||||
window_position = auto
|
||||
window_decorations = true
|
||||
vsync = false
|
||||
vsync_skip = 7000
|
||||
max_resolution = auto
|
||||
output = opengl
|
||||
texture_renderer = auto
|
||||
capture_mouse = seamless middlerelease
|
||||
sensitivity = 100
|
||||
raw_mouse_input = false
|
||||
waitonerror = true
|
||||
priority = auto,auto
|
||||
mapperfile = mapper-sdl2-0.78.0.map
|
||||
screensaver = auto
|
||||
|
||||
[dosbox]
|
||||
# language: Select another language file.
|
||||
# machine: The type of machine DOSBox tries to emulate.
|
||||
# Possible values: hercules, cga, cga_mono, tandy, pcjr, ega, vgaonly, svga_s3, svga_et3000, svga_et4000, svga_paradise, vesa_nolfb, vesa_oldvbe.
|
||||
# captures: Directory where things like wave, midi, screenshot get captured.
|
||||
# memsize: Amount of memory DOSBox has in megabytes.
|
||||
# This value is best left at its default to avoid problems with some games,
|
||||
# though few games might require a higher value.
|
||||
# There is generally no speed advantage when raising this value.
|
||||
# vmemsize: Video memory in MiB (1-8) or KiB (256 to 8192). 'auto' uses the default per video adapter.
|
||||
# Possible values: auto, 1, 2, 4, 8, 256, 512, 1024, 2048, 4096, 8192.
|
||||
# vesa_modes: Controls the selection of VESA 1.2 and 2.0 modes offered:
|
||||
# compatible A tailored selection that maximizes game compatibility.
|
||||
# This is recommended along with 4 or 8 MB of video memory.
|
||||
# all Offers all modes for a given video memory size, however
|
||||
# some games may not use them properly (flickering) or may need
|
||||
# more system memory (mem = ) to use them.
|
||||
# Possible values: compatible, all.
|
||||
# autoexec_section: How autoexec sections are handled from multiple config files.
|
||||
# join : combines them into one big section (legacy behavior).
|
||||
# overwrite : use the last one encountered, like other conf settings.
|
||||
# Possible values: join, overwrite.
|
||||
# startup_verbosity: Controls verbosity prior to displaying the program:
|
||||
# Verbosity | Splash | Welcome | Early stdout
|
||||
# high | yes | yes | yes
|
||||
# medium | no | yes | yes
|
||||
# low | no | no | yes
|
||||
# quiet | no | no | no
|
||||
# splash_only | yes | no | no
|
||||
# auto | 'low' if exec or dir is passed, otherwise 'high'
|
||||
# Possible values: auto, high, medium, low, splash_only, quiet.
|
||||
|
||||
language =
|
||||
machine = svga_s3
|
||||
captures = capture
|
||||
memsize = 16
|
||||
vmemsize = auto
|
||||
vesa_modes = compatible
|
||||
autoexec_section = join
|
||||
startup_verbosity = auto
|
||||
|
||||
[render]
|
||||
# frameskip: How many frames DOSBox skips before drawing one.
|
||||
# aspect: Scales the vertical resolution to produce a 4:3 display aspect
|
||||
# ratio, matching that of the original standard-definition monitors
|
||||
# for which the majority of DOS games were designed. This setting
|
||||
# only affects video modes that use non-square pixels, such as
|
||||
# 320x200 or 640x400; where as square-pixel modes, such as 640x480
|
||||
# and 800x600, will be displayed as-is.
|
||||
# monochrome_palette: Select default palette for monochrome display.
|
||||
# Works only when emulating hercules or cga_mono.
|
||||
# You can also cycle through available colours using F11.
|
||||
# Possible values: white, paperwhite, green, amber.
|
||||
# scaler: Scaler used to enlarge/enhance low resolution modes.
|
||||
# If 'forced' is appended, then the scaler will be used even if
|
||||
# the result might not be desired.
|
||||
# Note that some scalers may use black borders to fit the image
|
||||
# within your configured display resolution. If this is
|
||||
# undesirable, try either a different scaler or enabling
|
||||
# fullresolution output.
|
||||
# Possible values: none, normal2x, normal3x, advmame2x, advmame3x, advinterp2x, advinterp3x, hq2x, hq3x, 2xsai, super2xsai, supereagle, tv2x, tv3x, rgb2x, rgb3x, scan2x, scan3x.
|
||||
# glshader: Either 'none' or a GLSL shader name. Works only with
|
||||
# OpenGL output. Can be either an absolute path, a file
|
||||
# in the 'glshaders' subdirectory of the DOSBox
|
||||
# configuration directory, or one of the built-in shaders:
|
||||
# advinterp2x, advinterp3x, advmame2x, advmame3x,
|
||||
# crt-easymode-flat, crt-fakelottes-flat, rgb2x, rgb3x,
|
||||
# scan2x, scan3x, tv2x, tv3x, sharp (default).
|
||||
|
||||
frameskip = 0
|
||||
aspect = true
|
||||
monochrome_palette = white
|
||||
scaler = none
|
||||
glshader = default
|
||||
|
||||
[composite]
|
||||
# composite: Enable composite mode on start. 'auto' lets the program decide.
|
||||
# Note: Fine-tune the settings below (ie: hue) using the composite hotkeys.
|
||||
# Then read the new settings from your console and enter them here.
|
||||
# Possible values: auto, on, off.
|
||||
# era: Era of composite technology. When 'auto', PCjr uses new and CGA/Tandy use old.
|
||||
# Possible values: auto, old, new.
|
||||
# hue: Appearance of RGB palette. For example, adjust until sky is blue.
|
||||
# saturation: Intensity of colors, from washed out to vivid.
|
||||
# contrast: Ratio between the dark and light area.
|
||||
# brightness: Luminosity of the image, from dark to light.
|
||||
# convergence: Convergence of subpixel elements, from blurry to sharp (CGA and Tandy-only).
|
||||
|
||||
composite = auto
|
||||
era = auto
|
||||
hue = 0
|
||||
saturation = 100
|
||||
contrast = 100
|
||||
brightness = 0
|
||||
convergence = 0
|
||||
|
||||
[cpu]
|
||||
# core: CPU Core used in emulation. auto will switch to dynamic if available and
|
||||
# appropriate.
|
||||
# Possible values: auto, dynamic, normal, simple.
|
||||
# cputype: CPU Type used in emulation. auto is the fastest choice.
|
||||
# Possible values: auto, 386, 386_slow, 486_slow, pentium_slow, 386_prefetch.
|
||||
# cycles: Number of instructions DOSBox tries to emulate each millisecond.
|
||||
# Setting this value too high results in sound dropouts and lags.
|
||||
# Cycles can be set in 3 ways:
|
||||
# 'auto' tries to guess what a game needs.
|
||||
# It usually works, but can fail for certain games.
|
||||
# 'fixed #number' will set a fixed number of cycles. This is what you usually
|
||||
# need if 'auto' fails (Example: fixed 4000).
|
||||
# 'max' will allocate as much cycles as your computer is able to
|
||||
# handle.
|
||||
# Possible values: auto, fixed, max.
|
||||
# cycleup: Number of cycles added or subtracted with speed control hotkeys.
|
||||
# Run INTRO and see Special Keys for list of hotkeys.
|
||||
# cycledown: Setting it lower than 100 will be a percentage.
|
||||
|
||||
core = auto
|
||||
cputype = pentium_slow
|
||||
cycles = 12000
|
||||
#cycles = auto
|
||||
cycleup = 10
|
||||
cycledown = 20
|
||||
|
||||
[mixer]
|
||||
# nosound: Enable silent mode, sound is still emulated though.
|
||||
# rate: Mixer sample rate, setting any device's rate higher than this will probably lower their sound quality.
|
||||
# Possible values: 44100, 48000, 32000, 22050, 16000, 11025, 8000, 49716.
|
||||
# blocksize: Mixer block size, larger blocks might help sound stuttering but sound will also be more lagged.
|
||||
# Possible values: 1024, 2048, 4096, 8192, 512, 256, 128.
|
||||
# prebuffer: How many milliseconds of data to keep on top of the blocksize.
|
||||
# negotiate: Allow system audio driver to negotiate optimal rate and blocksize
|
||||
# as close to the specified values as possible.
|
||||
|
||||
nosound = false
|
||||
rate = 48000
|
||||
blocksize = 512
|
||||
prebuffer = 20
|
||||
negotiate = true
|
||||
|
||||
[midi]
|
||||
# mididevice: Device that will receive the MIDI data (from the emulated MIDI
|
||||
# interface - MPU-401). Choose one of the following:
|
||||
# 'fluidsynth', to use the built-in MIDI synthesizer. See the
|
||||
# [fluidsynth] section for detailed configuration.
|
||||
# 'mt32', to use the built-in Roland MT-32 synthesizer.
|
||||
# See the [mt32] section for detailed configuration.
|
||||
# 'auto', to use the first working external MIDI player. This
|
||||
# might be a software synthesizer or physical device.
|
||||
# Possible values: auto, oss, alsa, fluidsynth, mt32, none.
|
||||
# midiconfig: Configuration options for the selected MIDI interface.
|
||||
# This is usually the id or name of the MIDI synthesizer you want
|
||||
# to use (find the id/name with DOS command 'mixer /listmidi').
|
||||
# - This option has no effect when using the built-in synthesizers
|
||||
# (mididevice = fluidsynth or mt32).
|
||||
# - When using ALSA, use Linux command 'aconnect -l' to list open
|
||||
# MIDI ports, and select one (for example 'midiconfig=14:0'
|
||||
# for sequencer client 14, port 0).
|
||||
# - If you're using a physical Roland MT-32 with revision 0 PCB,
|
||||
# the hardware may require a delay in order to prevent its
|
||||
# buffer from overflowing. In that case, add 'delaysysex',
|
||||
# for example: 'midiconfig=2 delaysysex'.
|
||||
# See the README/Manual for more details.
|
||||
# mpu401: Type of MPU-401 to emulate.
|
||||
# Possible values: intelligent, uart, none.
|
||||
|
||||
mididevice = auto
|
||||
midiconfig =
|
||||
mpu401 = intelligent
|
||||
|
||||
[fluidsynth]
|
||||
# soundfont: Path to a SoundFont file in .sf2 format. You can use an
|
||||
# absolute or relative path, or the name of an .sf2 inside
|
||||
# the 'soundfonts' directory within your DOSBox configuration
|
||||
# directory.
|
||||
# An optional percentage will scale the SoundFont's volume.
|
||||
# For example: 'soundfont.sf2 50' will attenuate it by 50 percent.
|
||||
# The scaling percentage can range from 1 to 500.
|
||||
# chorus: Chorus effect: 'auto', 'on', 'off', or custom values.
|
||||
# When using custom values:
|
||||
# All five must be provided in-order and space-separated.
|
||||
# They are: voice-count level speed depth modulation-wave, where:
|
||||
# - voice-count is an integer from 0 to 99.
|
||||
# - level is a decimal from 0.0 to 10.0
|
||||
# - speed is a decimal, measured in Hz, from 0.1 to 5.0
|
||||
# - depth is a decimal from 0.0 to 21.0
|
||||
# - modulation-wave is either 'sine' or 'triangle'
|
||||
# For example: chorus = 3 1.2 0.3 8.0 sine
|
||||
# reverb: Reverb effect: 'auto', 'on', 'off', or custom values.
|
||||
# When using custom values:
|
||||
# All four must be provided in-order and space-separated.
|
||||
# They are: room-size damping width level, where:
|
||||
# - room-size is a decimal from 0.0 to 1.0
|
||||
# - damping is a decimal from 0.0 to 1.0
|
||||
# - width is a decimal from 0.0 to 100.0
|
||||
# - level is a decimal from 0.0 to 1.0
|
||||
# For example: reverb = 0.61 0.23 0.76 0.56
|
||||
|
||||
soundfont = default.sf2
|
||||
chorus = auto
|
||||
reverb = auto
|
||||
|
||||
[mt32]
|
||||
# model: Model of synthesizer to use.
|
||||
# 'auto' picks the first model with available ROMs, in order as listed.
|
||||
# 'cm32l' and 'mt32' pick the first model of their type, in the order listed.
|
||||
# 'mt32_old' and 'mt32_new' are aliases for 1.07 and 2.04, respectively.
|
||||
# Possible values: auto, cm32l, cm32l_102, cm32l_100, mt32, mt32_old, mt32_107, mt32_106, mt32_105, mt32_104, mt32_bluer, mt32_new, mt32_204.
|
||||
# romdir: The directory containing ROMs for one or more models.
|
||||
# The directory can be absolute or relative, or leave it blank to
|
||||
# use the 'mt32-roms' directory in your DOSBox configuration
|
||||
# directory. Other common system locations will be checked as well.
|
||||
# ROM files inside this directory may include any of the following:
|
||||
# - MT32_CONTROL.ROM and MT32_PCM.ROM, for the 'mt32' model.
|
||||
# - CM32L_CONTROL.ROM and CM32L_PCM.ROM, for the 'cm32l' model.
|
||||
# - Unzipped MAME MT-32 and CM-32L ROMs, for the versioned models.
|
||||
|
||||
model = auto
|
||||
romdir =
|
||||
|
||||
[sblaster]
|
||||
# sbtype: Type of Sound Blaster to emulate. 'gb' is Game Blaster.
|
||||
# Possible values: sb1, sb2, sbpro1, sbpro2, sb16, gb, none.
|
||||
# sbbase: The IO address of the Sound Blaster.
|
||||
# Possible values: 220, 240, 260, 280, 2a0, 2c0, 2e0, 300.
|
||||
# irq: The IRQ number of the Sound Blaster.
|
||||
# Possible values: 7, 5, 3, 9, 10, 11, 12.
|
||||
# dma: The DMA number of the Sound Blaster.
|
||||
# Possible values: 1, 5, 0, 3, 6, 7.
|
||||
# hdma: The High DMA number of the Sound Blaster.
|
||||
# Possible values: 1, 5, 0, 3, 6, 7.
|
||||
# sbmixer: Allow the Sound Blaster mixer to modify the DOSBox mixer.
|
||||
# oplmode: Type of OPL emulation. On 'auto' the mode is determined by 'sbtype'.
|
||||
# All OPL modes are AdLib-compatible, except for 'cms'.
|
||||
# Possible values: auto, cms, opl2, dualopl2, opl3, opl3gold, none.
|
||||
# oplemu: Provider for the OPL emulation. 'compat' provides better quality,
|
||||
# 'nuked' is the default and most accurate (but the most CPU-intensive).
|
||||
# Possible values: default, compat, fast, mame, nuked.
|
||||
|
||||
sbtype = sb16
|
||||
sbbase = 220
|
||||
irq = 7
|
||||
dma = 1
|
||||
hdma = 5
|
||||
sbmixer = true
|
||||
oplmode = auto
|
||||
oplemu = default
|
||||
|
||||
[gus]
|
||||
# gus: Enable Gravis UltraSound emulation.
|
||||
# gusbase: The IO base address of the Gravis UltraSound.
|
||||
# Possible values: 240, 220, 260, 280, 2a0, 2c0, 2e0, 300.
|
||||
# gusirq: The IRQ number of the Gravis UltraSound.
|
||||
# Possible values: 5, 3, 7, 9, 10, 11, 12.
|
||||
# gusdma: The DMA channel of the Gravis UltraSound.
|
||||
# Possible values: 3, 0, 1, 5, 6, 7.
|
||||
# ultradir: Path to UltraSound directory. In this directory
|
||||
# there should be a MIDI directory that contains
|
||||
# the patch files for GUS playback. Patch sets used
|
||||
# with Timidity should work fine.
|
||||
|
||||
gus = false
|
||||
gusbase = 240
|
||||
gusirq = 5
|
||||
gusdma = 3
|
||||
ultradir = C:\ULTRASND
|
||||
|
||||
[innovation]
|
||||
# sidmodel: Model of chip to emulate in the Innovation SSI-2001 card:
|
||||
# - auto: Selects the 6581 chip.
|
||||
# - 6581: The original chip, known for its bassy and rich character.
|
||||
# - 8580: A later revision that more closely matched the SID specification.
|
||||
# It fixed the 6581's DC bias and is less prone to distortion.
|
||||
# The 8580 is an option on reproduction cards, like the DuoSID.
|
||||
# - none: Disables the card.
|
||||
# Possible values: auto, 6581, 8580, none.
|
||||
# sidclock: The SID chip's clock frequency, which is jumperable on reproduction cards.
|
||||
# - default: uses 0.895 MHz, per the original SSI-2001 card.
|
||||
# - c64ntsc: uses 1.023 MHz, per NTSC Commodore PCs and the DuoSID.
|
||||
# - c64pal: uses 0.985 MHz, per PAL Commodore PCs and the DuoSID.
|
||||
# - hardsid: uses 1.000 MHz, available on the DuoSID.
|
||||
# Possible values: default, c64ntsc, c64pal, hardsid.
|
||||
# sidport: The IO port address of the Innovation SSI-2001.
|
||||
# Possible values: 240, 260, 280, 2a0, 2c0.
|
||||
# 6581filter: The SID's analog filtering meant that each chip was physically unique.
|
||||
# Adjusts the 6581's filtering strength as a percent from 0 to 100.
|
||||
# 8580filter: Adjusts the 8580's filtering strength as a percent from 0 to 100.
|
||||
|
||||
sidmodel = none
|
||||
sidclock = default
|
||||
sidport = 280
|
||||
6581filter = 50
|
||||
8580filter = 50
|
||||
|
||||
[speaker]
|
||||
# pcspeaker: Enable PC-Speaker emulation.
|
||||
# pcrate: Sample rate of the PC-Speaker sound generation.
|
||||
# zero_offset: Neutralizes and prevents the PC speaker's DC-offset from harming other sources.
|
||||
# 'auto' enables this for non-Windows systems and disables it on Windows.
|
||||
# If your OS performs its own DC-offset correction, then set this to 'false'.
|
||||
# Possible values: auto, true, false.
|
||||
# tandy: Enable Tandy Sound System emulation. For 'auto', emulation is present only if machine is set to 'tandy'.
|
||||
# Possible values: auto, on, off.
|
||||
# tandyrate: Sample rate of the Tandy 3-Voice generation.
|
||||
# Possible values: 44100, 48000, 32000, 22050, 16000, 11025, 8000, 49716.
|
||||
# disney: Enable Disney Sound Source emulation. (Covox Voice Master and Speech Thing compatible).
|
||||
# ps1audio: Enable IBM PS/1 Audio emulation.
|
||||
|
||||
pcspeaker = true
|
||||
pcrate = 18939
|
||||
zero_offset = auto
|
||||
tandy = auto
|
||||
tandyrate = 44100
|
||||
disney = true
|
||||
ps1audio = false
|
||||
|
||||
[joystick]
|
||||
# joysticktype: Type of joystick to emulate: auto (default),
|
||||
# auto : Detect and use any joystick(s), if possible.,
|
||||
# 2axis : Support up to two joysticks.
|
||||
# 4axis : Support the first joystick only.
|
||||
# 4axis_2 : Support the second joystick only.
|
||||
# fcs : Support a Thrustmaster-type joystick.
|
||||
# ch : Support a CH Flightstick-type joystick.
|
||||
# hidden : Prevent DOS from seeing the joystick(s), but enable them for mapping.
|
||||
# disabled : Fully disable joysticks: won't be polled, mapped, or visible in DOS.
|
||||
# (Remember to reset DOSBox's mapperfile if you saved it earlier)
|
||||
# Possible values: auto, 2axis, 4axis, 4axis_2, fcs, ch, hidden, disabled.
|
||||
# timed: enable timed intervals for axis. Experiment with this option, if your joystick drifts (away).
|
||||
# autofire: continuously fires as long as you keep the button pressed.
|
||||
# swap34: swap the 3rd and the 4th axis. Can be useful for certain joysticks.
|
||||
# buttonwrap: enable button wrapping at the number of emulated buttons.
|
||||
# circularinput: enable translation of circular input to square output.
|
||||
# Try enabling this if your left analog stick can only move in a circle.
|
||||
# deadzone: the percentage of motion to ignore. 100 turns the stick into a digital one.
|
||||
|
||||
joysticktype = auto
|
||||
timed = true
|
||||
autofire = false
|
||||
swap34 = false
|
||||
buttonwrap = false
|
||||
circularinput = false
|
||||
deadzone = 10
|
||||
|
||||
[serial]
|
||||
# serial1: set type of device connected to com port.
|
||||
# Can be disabled, dummy, modem, nullmodem, directserial.
|
||||
# Additional parameters must be in the same line in the form of
|
||||
# parameter:value. Parameter for all types is irq (optional).
|
||||
# for directserial: realport (required), rxdelay (optional).
|
||||
# (realport:COM1 realport:ttyS0).
|
||||
# for modem: listenport (optional).
|
||||
# for nullmodem: server, rxdelay, txdelay, telnet, usedtr,
|
||||
# transparent, port, inhsocket (all optional).
|
||||
# Example: serial1=modem listenport:5000
|
||||
# Possible values: dummy, disabled, modem, nullmodem, directserial.
|
||||
# serial2: see serial1
|
||||
# Possible values: dummy, disabled, modem, nullmodem, directserial.
|
||||
# serial3: see serial1
|
||||
# Possible values: dummy, disabled, modem, nullmodem, directserial.
|
||||
# serial4: see serial1
|
||||
# Possible values: dummy, disabled, modem, nullmodem, directserial.
|
||||
# phonebookfile: File used to map fake phone numbers to addresses.
|
||||
|
||||
serial1 = modem listenport:8192 sock:1
|
||||
serial2 = dummy
|
||||
serial3 = disabled
|
||||
serial4 = disabled
|
||||
phonebookfile = phonebook.txt
|
||||
|
||||
[dos]
|
||||
# xms: Enable XMS support.
|
||||
# ems: Enable EMS support. The default (=true) provides the best
|
||||
# compatibility but certain applications may run better with
|
||||
# other choices, or require EMS support to be disabled (=false)
|
||||
# to work at all.
|
||||
# Possible values: true, emsboard, emm386, false.
|
||||
# umb: Enable UMB support.
|
||||
# ver: Set DOS version (5.0 by default). Specify as major.minor format.
|
||||
# A single number is treated as the major version.
|
||||
# Common settings are 3.3, 5.0, 6.22, and 7.1.
|
||||
# keyboardlayout: Language code of the keyboard layout (or none).
|
||||
|
||||
xms = false
|
||||
ems = false
|
||||
umb = false
|
||||
ver = 5.0
|
||||
keyboardlayout = auto
|
||||
|
||||
[ipx]
|
||||
# ipx: Enable ipx over UDP/IP emulation.
|
||||
|
||||
ipx = false
|
||||
|
||||
[autoexec]
|
||||
mount c ~/dos
|
||||
c:
|
||||
autoexec.bat
|
4
test.sh
Executable file
4
test.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
#${HOME}/code/dosbox-custom/dosbox-staging/build/dosbox -noprimaryconf -nolocalconf -conf test.conf &
|
||||
#dosbox -noprimaryconf -nolocalconf -conf test.conf &
|
||||
${HOME}/bin/dosbox-staging-linux-v0.78.1/dosbox -noprimaryconf -nolocalconf -conf test.conf &
|
1
thirdparty/grx249/Makefile
vendored
Symbolic link
1
thirdparty/grx249/Makefile
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
makefile.x11
|
669
thirdparty/grx249/addons/bmp/bmp.c
vendored
Normal file
669
thirdparty/grx249/addons/bmp/bmp.c
vendored
Normal file
|
@ -0,0 +1,669 @@
|
|||
/*
|
||||
** <bmp.c> - BMP read/write file
|
||||
** by Michal Stencl Copyright (c) 1998
|
||||
** - read BMP 2, 4, 8 bpp
|
||||
** - write BMP 8, 24 bpp
|
||||
** <e-mail> - [stenclpmd@ba.telecom.sk]
|
||||
**
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#if defined(_MSC_VER) && defined(_WIN32)
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#ifdef __MSDOS__
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
#include "libgrx.h"
|
||||
#include "clipping.h"
|
||||
|
||||
#if defined(__MSDOS__) || defined(MSDOS)
|
||||
#define BIN_WR (O_WRONLY | O_BINARY)
|
||||
#define BIN_RD (O_RDONLY | O_BINARY)
|
||||
#else
|
||||
#define BIN_WR O_WRONLY
|
||||
#define BIN_RD O_RDONLY
|
||||
#endif
|
||||
|
||||
#define BIN_CREAT (BIN_WR|O_CREAT)
|
||||
|
||||
#ifndef S_IREAD
|
||||
#define S_IREAD S_IRUSR
|
||||
#endif
|
||||
#ifndef S_IWRITE
|
||||
#define S_IWRITE S_IWUSR
|
||||
#endif
|
||||
|
||||
#define CREAT_PERM S_IREAD|S_IWRITE
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#define BMPFILEHEADERSIZE 14
|
||||
#define BMPINFOHEADERSIZE 40
|
||||
|
||||
#define BI_RGB 0L
|
||||
#define BI_RLE8 1L
|
||||
#define BI_RLE4 2L
|
||||
|
||||
#define _GrBitmapPointerTypes_DEFINED_
|
||||
typedef struct _GR_bitmapfileheader GrBitmapFileHeader;
|
||||
typedef struct _GR_bitmapinfoheader GrBitmapInfoHeader;
|
||||
typedef struct _GR_bmpimagecolors GrBmpImageColors;
|
||||
typedef struct _GR_bmpimage GrBmpImage;
|
||||
|
||||
/* ************************************************************************ */
|
||||
/* _GR_bitmapfileheader */
|
||||
/* ************************************************************************ */
|
||||
struct _GR_bitmapfileheader {
|
||||
GR_int16u bf_type;
|
||||
GR_int32u bf_size;
|
||||
GR_int16u bf_reserved1;
|
||||
GR_int16u bf_reserved2;
|
||||
GR_int32u bf_offbits;
|
||||
};
|
||||
|
||||
/* ************************************************************************ */
|
||||
/* _GR_bitmapinfoheader */
|
||||
/* ************************************************************************ */
|
||||
struct _GR_bitmapinfoheader {
|
||||
GR_int32u bn_size;
|
||||
GR_int32u bn_width;
|
||||
GR_int32u bn_height;
|
||||
GR_int16u bn_planes;
|
||||
GR_int16u bn_bitcount;
|
||||
GR_int32u bn_compression;
|
||||
GR_int32u bn_sizeimage;
|
||||
GR_int32u bn_xpelspermeter;
|
||||
GR_int32u bn_ypelspermeter;
|
||||
GR_int32u bn_clrused;
|
||||
GR_int32u bn_clrimportant;
|
||||
};
|
||||
|
||||
/* ************************************************************************ */
|
||||
/* _GR_bmpimagecolors */
|
||||
/* ************************************************************************ */
|
||||
struct _GR_bmpimagecolors {
|
||||
GR_int8u *bp_palette; /* (R, G, B, Reserved) * | 2 | 16 | 256 */
|
||||
GrColor *bp_colormap;
|
||||
int bp_numcolors;
|
||||
};
|
||||
|
||||
/* ************************************************************************ */
|
||||
/* _GR_bmpimage */
|
||||
/* ************************************************************************ */
|
||||
struct _GR_bmpimage {
|
||||
GrBitmapFileHeader *bi_bmpfileheader;
|
||||
GrBitmapInfoHeader *bi_bmpinfoheader;
|
||||
GrBmpImageColors *bi_bmpimagecolors;
|
||||
GR_int16s bi_erasepalette;
|
||||
char *bi_map;
|
||||
};
|
||||
|
||||
#define bi_width bi_bmpinfoheader->bn_width
|
||||
#define bi_height bi_bmpinfoheader->bn_height
|
||||
#define bi_palette bi_bmpimagecolors->bp_palette
|
||||
#define bi_colormap bi_bmpimagecolors->bp_colormap
|
||||
#define bi_numcolors bi_bmpimagecolors->bp_numcolors
|
||||
|
||||
int GrLoadBmpFileHeader ( int _handle, GrBitmapFileHeader* _fileheader );
|
||||
int GrLoadBmpInfoHeader ( int _handle, GrBitmapInfoHeader* _infoheader );
|
||||
static unsigned char *__GrLoadPaletteBmp ( int _handle, unsigned long _paloffset, int _colors );
|
||||
static unsigned char *GrLoadPaletteBmp ( int _handle, int *_col, GrBitmapInfoHeader *_iheader );
|
||||
static char *GrLoadImageFromBmpBiRgb ( int _handle, unsigned long _offset, long _maxbufsize, int _colors, GrBitmapInfoHeader *_infoheader );
|
||||
static char *GrLoadImageFromBmpBiRle8 ( int _handle, unsigned long _offset, unsigned long _maxbufsize, int _colors, GrBitmapInfoHeader *_infoheader );
|
||||
static char *GrLoadImageFromBmpBiRle4 ( int _handle, unsigned long _offset, unsigned long _maxbufsize, int _colors, GrBitmapInfoHeader *_infoheader );
|
||||
static char *GrLoadImageFromBmp ( int _handle, unsigned long _offset, int _colors, GrBitmapInfoHeader *_infoheader );
|
||||
|
||||
/* exported functions */
|
||||
int GrFreeBmpImageColors ( GrBmpImageColors *_pal );
|
||||
int GrAllocBmpImageColors ( GrBmpImage *_bmp, GrBmpImageColors *_pal );
|
||||
GrBmpImage *GrLoadBmpImage ( char *_filename );
|
||||
GrPattern *GrConvertBmpImageToPattern ( GrBmpImage *_bmp );
|
||||
GrPattern *GrConvertBmpImageToStaticPattern ( GrBmpImage *_bmp );
|
||||
void GrUnloadBmpImage ( GrBmpImage *_bmp );
|
||||
int GrSaveBmpImage ( char *_filename, GrContext *_c, int _x1, int _y1, int _x2, int _y2 );
|
||||
unsigned long GrBmpImageWidth ( GrBmpImage* _bmp );
|
||||
unsigned long GrBmpImageHeight ( GrBmpImage* _bmp );
|
||||
char *GrBmpImagePalette ( GrBmpImage* _bmp );
|
||||
GrColor *GrBmpImageColorMap ( GrBmpImage* _bmp );
|
||||
GrColor GrBmpImageNumColors ( GrBmpImage* _bmp );
|
||||
/* end of exported functions */
|
||||
|
||||
/* ************************************************************************ */
|
||||
int GrLoadBmpFileHeader ( int _handle, GrBitmapFileHeader *_fileheader )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
if (( !_fileheader ) || ( _handle == -1 )) return FALSE;
|
||||
memset(_fileheader, 0, BMPFILEHEADERSIZE);
|
||||
lseek(_handle, SEEK_SET, 0);
|
||||
read(_handle, &_fileheader->bf_type, 2);
|
||||
read(_handle, &_fileheader->bf_size, 4);
|
||||
read(_handle, &_fileheader->bf_reserved1, 2);
|
||||
read(_handle, &_fileheader->bf_reserved2, 2);
|
||||
read(_handle, &_fileheader->bf_offbits, 4);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
int GrLoadBmpInfoHeader ( int _handle, GrBitmapInfoHeader *_infoheader )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
if (( !_infoheader ) || ( _handle == -1 )) return FALSE;
|
||||
lseek(_handle, SEEK_SET, BMPFILEHEADERSIZE);
|
||||
_infoheader->bn_size = 0;
|
||||
read(_handle, &_infoheader->bn_size, 4);
|
||||
memset(_infoheader, 0, _infoheader->bn_size);
|
||||
read(_handle, &_infoheader->bn_width, 4);
|
||||
if ( _infoheader->bn_width % 4 )
|
||||
_infoheader->bn_width += 4 - (_infoheader->bn_width % 4);
|
||||
read(_handle, &_infoheader->bn_height, 4);
|
||||
read(_handle, &_infoheader->bn_planes, 2);
|
||||
read(_handle, &_infoheader->bn_bitcount, 2);
|
||||
read(_handle, &_infoheader->bn_compression, 4);
|
||||
read(_handle, &_infoheader->bn_sizeimage, 4);
|
||||
read(_handle, &_infoheader->bn_xpelspermeter, 4);
|
||||
read(_handle, &_infoheader->bn_ypelspermeter, 4);
|
||||
read(_handle, &_infoheader->bn_clrused, 4);
|
||||
read(_handle, &_infoheader->bn_clrimportant, 4);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
static unsigned char *__GrLoadPaletteBmp ( int _handle, unsigned long _paloffset, int _colors )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
unsigned char *palette;
|
||||
if ( _handle == -1 ) return NULL;
|
||||
palette = (unsigned char*)malloc(_colors * 4);
|
||||
if ( !palette ) return NULL;
|
||||
lseek(_handle, SEEK_SET, _paloffset);
|
||||
read(_handle, palette, _colors * 4);
|
||||
return palette;
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
static unsigned char *GrLoadPaletteBmp ( int _handle, int *_col, GrBitmapInfoHeader* _iheader )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
unsigned char *palette;
|
||||
unsigned long paloffset;
|
||||
*_col = -1;
|
||||
if (( _handle == -1 ) || ( !_iheader )) return NULL;
|
||||
palette = NULL;
|
||||
paloffset = BMPFILEHEADERSIZE + _iheader->bn_size;
|
||||
switch ( _iheader->bn_bitcount )
|
||||
{
|
||||
case 1 : { *_col = 2; palette = __GrLoadPaletteBmp(_handle, paloffset, 2); } break;
|
||||
case 4 : { *_col = 16; palette = __GrLoadPaletteBmp(_handle, paloffset, 16); } break;
|
||||
case 8 : { *_col = 256; palette = __GrLoadPaletteBmp(_handle, paloffset, 256); } break;
|
||||
case 24 : { *_col = 0; palette = NULL; } break;
|
||||
default : *_col = -1;
|
||||
}
|
||||
if (( !palette ) && ( *_col != 0 )) *_col = -1;
|
||||
return palette;
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
static char *GrLoadImageFromBmpBiRgb ( int _handle, unsigned long _offset, long _maxbufsize, int _colors,
|
||||
GrBitmapInfoHeader *_infoheader )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
char *map = NULL;
|
||||
char *buffer = NULL;
|
||||
unsigned long width;
|
||||
unsigned long size;
|
||||
unsigned long i;
|
||||
if (( _handle == -1 ) || ( !_infoheader ) || ( _infoheader->bn_bitcount < 1 ))
|
||||
return NULL;
|
||||
width = _infoheader->bn_width;
|
||||
size = width;
|
||||
i = size;
|
||||
lseek(_handle, SEEK_SET, _offset);
|
||||
if ( _infoheader->bn_bitcount == 1 )
|
||||
{
|
||||
unsigned char bits[8], n;
|
||||
unsigned long w, bufsize;
|
||||
int j, k;
|
||||
char *runmap;
|
||||
_maxbufsize = _maxbufsize * 8;
|
||||
map = (char *)malloc(_maxbufsize);
|
||||
bufsize = (unsigned long)ceil((float)width / 8);
|
||||
buffer = (char *)malloc(bufsize);
|
||||
runmap = NULL;
|
||||
if ( !map || !buffer )
|
||||
{
|
||||
if (map) free(map);
|
||||
if (buffer) free(buffer);
|
||||
return NULL;
|
||||
}
|
||||
while ( i <= _maxbufsize )
|
||||
{
|
||||
read(_handle, buffer, bufsize);
|
||||
runmap = &map[_maxbufsize - i];
|
||||
for ( w = 0; w < width; w++)
|
||||
{
|
||||
j = w % 8;
|
||||
if ( !j )
|
||||
{
|
||||
n = buffer[w / 8];
|
||||
for ( k = 0; k < 8; k++ )
|
||||
{
|
||||
bits[7 - k] = n & 1;
|
||||
n = n >> 1;
|
||||
}
|
||||
}
|
||||
runmap[w] = bits[j];
|
||||
}
|
||||
i += size;
|
||||
}
|
||||
}
|
||||
if ( _infoheader->bn_bitcount == 4 )
|
||||
{
|
||||
unsigned long bufsize;
|
||||
char *runmap;
|
||||
unsigned char bits[2], n;
|
||||
unsigned long w;
|
||||
int j, q;
|
||||
_maxbufsize = _maxbufsize * 2;
|
||||
map = (char *)malloc(_maxbufsize);
|
||||
bufsize = (unsigned long)ceil((float)width / 2);
|
||||
buffer = (char*)malloc(bufsize);
|
||||
runmap = NULL;
|
||||
if ( !map || !buffer )
|
||||
{
|
||||
if (map) free(map);
|
||||
if (buffer) free(buffer);
|
||||
return NULL;
|
||||
}
|
||||
while ( i <= _maxbufsize )
|
||||
{
|
||||
read(_handle, buffer, bufsize);
|
||||
runmap = &map[_maxbufsize - i];
|
||||
for ( w = 0; w < width; w++)
|
||||
{
|
||||
j = w % 2;
|
||||
if ( !j )
|
||||
{
|
||||
n = buffer[w / 2];
|
||||
q = n & 255;
|
||||
bits[1] = q & 15;
|
||||
q = q >> 4;
|
||||
bits[0] = q & 15;
|
||||
n = n >> 8;
|
||||
}
|
||||
runmap[w] = bits[j];
|
||||
}
|
||||
i += size;
|
||||
}
|
||||
}
|
||||
if ( _infoheader->bn_bitcount == 8 )
|
||||
{
|
||||
unsigned long bufsize;
|
||||
map = (char*)malloc(_maxbufsize);
|
||||
bufsize = size;
|
||||
if ( !map ) return NULL;
|
||||
while ( i <= _maxbufsize )
|
||||
{
|
||||
read(_handle, &map[_maxbufsize - i], bufsize);
|
||||
i += bufsize;
|
||||
}
|
||||
}
|
||||
if ( _infoheader->bn_bitcount == 24 )
|
||||
{
|
||||
}
|
||||
if (buffer) free(buffer);
|
||||
return map;
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
static char *GrLoadImageFromBmpBiRle8 ( int _handle, unsigned long _offset, unsigned long _maxbufsize, int _colors,
|
||||
GrBitmapInfoHeader *_infoheader )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
return NULL; /* this version not contains Rle8 yet */
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
static char *GrLoadImageFromBmpBiRle4 ( int _handle, unsigned long _offset, unsigned long _maxbufsize, int _colors,
|
||||
GrBitmapInfoHeader *_infoheader )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
return NULL; /* this version not contains Rle4 yet */
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
static char *GrLoadImageFromBmp ( int _handle, unsigned long _offset, int _colors, GrBitmapInfoHeader *_infoheader )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
char* map;
|
||||
int maxbufsize;
|
||||
if (( _handle == -1 ) || ( !_infoheader )) return NULL;
|
||||
map = NULL;
|
||||
maxbufsize = _infoheader->bn_sizeimage;
|
||||
switch ( _infoheader->bn_compression ) {
|
||||
case BI_RGB :
|
||||
{
|
||||
if ( !maxbufsize )
|
||||
maxbufsize = _infoheader->bn_width * _infoheader->bn_height;
|
||||
map = GrLoadImageFromBmpBiRgb(_handle, _offset, maxbufsize, _colors, _infoheader); break;
|
||||
}
|
||||
case BI_RLE8 :
|
||||
map = GrLoadImageFromBmpBiRle8(_handle, _offset, maxbufsize, _colors, _infoheader); break;
|
||||
case BI_RLE4 :
|
||||
map = GrLoadImageFromBmpBiRle4(_handle, _offset, maxbufsize, _colors, _infoheader); break;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/*====++====================================================================*/
|
||||
/* EXPORTED FUNCTIONS */
|
||||
/*==++======================================================================*/
|
||||
|
||||
/* ************************************************************************ */
|
||||
int GrFreeBmpImageColors ( GrBmpImageColors *_pal )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
if (( !_pal ) || ( !_pal->bp_colormap )) return FALSE;
|
||||
if ( _pal->bp_palette )
|
||||
{
|
||||
int i;
|
||||
GrColor *colors = _pal->bp_colormap;
|
||||
colors[0] = _pal->bp_numcolors;
|
||||
for ( i = 0; i < _pal->bp_numcolors; i++ )
|
||||
GrFreeColor(colors[i+1]);
|
||||
free(_pal->bp_palette);
|
||||
_pal->bp_palette = NULL;
|
||||
_pal->bp_numcolors = 0;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
int GrAllocBmpImageColors ( GrBmpImage *_bmp, GrBmpImageColors *_pal )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
if (( !_bmp ) || ( _bmp->bi_colormap != NULL ) || (_bmp->bi_numcolors < 2 ))
|
||||
return FALSE;
|
||||
_bmp->bi_erasepalette = TRUE;
|
||||
if ( _bmp->bi_palette )
|
||||
{
|
||||
int i;
|
||||
GrColor *colors = malloc(sizeof(GrColor)*(_bmp->bi_numcolors+1));
|
||||
if ( !colors ) return FALSE;
|
||||
colors[0] = _bmp->bi_numcolors;
|
||||
for ( i = 0; i < _bmp->bi_numcolors; i++ )
|
||||
colors[i+1] = GrAllocColor(_bmp->bi_palette[i*4+2], _bmp->bi_palette[i*4+1], _bmp->bi_palette[i*4+0]);
|
||||
_bmp->bi_colormap = colors;
|
||||
if ( _pal )
|
||||
{
|
||||
_bmp->bi_erasepalette = FALSE;
|
||||
memcpy(_pal,_bmp->bi_bmpimagecolors,sizeof(GrBmpImageColors));
|
||||
_bmp->bi_palette = NULL;
|
||||
_bmp->bi_numcolors = 0;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
GrBmpImage *GrLoadBmpImage ( char *_filename )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
#define defClose { \
|
||||
close(handle); \
|
||||
if (bmpimage) free(bmpimage); \
|
||||
return NULL; \
|
||||
}
|
||||
#define ADD2PTR(p,o) ((void *) ((char *)(p)+(o)) )
|
||||
int handle;
|
||||
GrBmpImage *bmpimage = NULL;
|
||||
if ( (handle = open(_filename, BIN_RD)) != -1 ) {
|
||||
bmpimage = malloc( sizeof(GrBmpImage)
|
||||
+sizeof(GrBitmapFileHeader)
|
||||
+sizeof(GrBitmapInfoHeader)
|
||||
+sizeof(GrBmpImageColors));
|
||||
if ( !bmpimage ) defClose;
|
||||
memset(bmpimage, 0, sizeof(GrBmpImage)
|
||||
+sizeof(GrBitmapFileHeader)
|
||||
+sizeof(GrBitmapInfoHeader)
|
||||
+sizeof(GrBmpImageColors));
|
||||
bmpimage->bi_bmpfileheader = ADD2PTR(bmpimage, sizeof(GrBmpImage));
|
||||
bmpimage->bi_bmpinfoheader = ADD2PTR(bmpimage, sizeof(GrBmpImage)
|
||||
+sizeof(GrBitmapFileHeader));
|
||||
bmpimage->bi_bmpimagecolors = ADD2PTR(bmpimage, sizeof(GrBmpImage)
|
||||
+sizeof(GrBitmapFileHeader)
|
||||
+sizeof(GrBitmapInfoHeader));
|
||||
bmpimage->bi_erasepalette = TRUE;
|
||||
if ( !GrLoadBmpFileHeader(handle, bmpimage->bi_bmpfileheader) )
|
||||
defClose;
|
||||
if ( bmpimage->bi_bmpfileheader->bf_type != 19778 ) /* MAGIC NUMBER */
|
||||
defClose;
|
||||
if ( !GrLoadBmpInfoHeader(handle, bmpimage->bi_bmpinfoheader) )
|
||||
defClose;
|
||||
bmpimage->bi_palette = GrLoadPaletteBmp(handle, &(bmpimage->bi_numcolors), bmpimage->bi_bmpinfoheader);
|
||||
if ( bmpimage->bi_numcolors == -1 )
|
||||
defClose;
|
||||
bmpimage->bi_map = GrLoadImageFromBmp(handle, bmpimage->bi_bmpfileheader->bf_offbits - BMPFILEHEADERSIZE, bmpimage->bi_numcolors, bmpimage->bi_bmpinfoheader);
|
||||
if ( !bmpimage->bi_map )
|
||||
defClose;
|
||||
}
|
||||
#undef defClose
|
||||
return bmpimage;
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
GrPattern *GrConvertBmpImageToPattern ( GrBmpImage *_bmp )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
if (( !_bmp ) || ( !_bmp->bi_map )) return NULL;
|
||||
return GrBuildPixmap(_bmp->bi_map, _bmp->bi_width, _bmp->bi_height, _bmp->bi_colormap);
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
GrPattern *GrConvertBmpImageToStaticPattern ( GrBmpImage *_bmp )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
GrPattern *p = NULL;
|
||||
if ( _bmp && _bmp->bi_map )
|
||||
{
|
||||
p = GrBuildPixmap(_bmp->bi_map, _bmp->bi_width, _bmp->bi_height, _bmp->bi_colormap);
|
||||
if ( p ) GrUnloadBmpImage(_bmp);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
void GrUnloadBmpImage ( GrBmpImage *_bmp )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
if ( !_bmp ) return;
|
||||
if ( _bmp->bi_erasepalette )
|
||||
GrFreeBmpImageColors(_bmp->bi_bmpimagecolors);
|
||||
_bmp->bi_palette = NULL;
|
||||
_bmp->bi_numcolors = 0;
|
||||
if ( _bmp->bi_map ) free(_bmp->bi_map);
|
||||
free(_bmp);
|
||||
_bmp = NULL;
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
int GrSaveBmpImage ( char *_filename, GrContext *_c, int _x1, int _y1, int _x2, int _y2 )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
int handle;
|
||||
unsigned long width, height;
|
||||
unsigned char palette[256*4];
|
||||
int r, g, b;
|
||||
char* line;
|
||||
unsigned long yy, xx;
|
||||
GrColor pixcol;
|
||||
GrBitmapFileHeader fileheader;
|
||||
GrBitmapInfoHeader infoheader;
|
||||
GrColor colors, i;
|
||||
GrContext safe;
|
||||
|
||||
if ( !_c ) _c = (GrContext *)GrCurrentContext();
|
||||
|
||||
/*
|
||||
handle = creat(_filename, S_IWRITE);
|
||||
if ( handle < 0 )
|
||||
{
|
||||
close(handle);
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
handle = open(_filename, BIN_CREAT, CREAT_PERM);
|
||||
if ( handle < 0 ) return FALSE;
|
||||
|
||||
clip_box_(_c, _x1, _y1, _x2, _y2, CLIP_EMPTY_MACRO_ARG, CLIP_EMPTY_MACRO_ARG);
|
||||
|
||||
width = _x2 - _x1;
|
||||
height = _y2 - _y1;
|
||||
|
||||
safe = *GrCurrentContext();
|
||||
GrSetContext(_c);
|
||||
colors = GrNumColors();
|
||||
GrSetContext(&safe);
|
||||
|
||||
if ( width % 4 ) width += 4 - (width % 4);
|
||||
|
||||
/*========= FILEHEADER =========*/
|
||||
fileheader.bf_type = 19778;
|
||||
if ( colors == 256 )
|
||||
fileheader.bf_size = BMPINFOHEADERSIZE + BMPFILEHEADERSIZE + 256*4 + width*height;
|
||||
else
|
||||
fileheader.bf_size = BMPINFOHEADERSIZE + BMPFILEHEADERSIZE + (width*height*3);
|
||||
fileheader.bf_reserved1 = 0;
|
||||
fileheader.bf_reserved2 = 0;
|
||||
if ( colors == 256 )
|
||||
fileheader.bf_offbits = BMPINFOHEADERSIZE + BMPFILEHEADERSIZE + 256*4;
|
||||
else
|
||||
fileheader.bf_offbits = BMPINFOHEADERSIZE + BMPFILEHEADERSIZE;
|
||||
|
||||
/*========= INFOHEADER =========*/
|
||||
infoheader.bn_size = BMPINFOHEADERSIZE;
|
||||
infoheader.bn_width = width;
|
||||
infoheader.bn_height = height;
|
||||
infoheader.bn_planes = 1;
|
||||
infoheader.bn_bitcount = ( colors == 256 ) ? 8 : 24;
|
||||
infoheader.bn_compression = BI_RGB;
|
||||
infoheader.bn_sizeimage = width*height*(infoheader.bn_bitcount / 8);
|
||||
infoheader.bn_xpelspermeter = 0L;
|
||||
infoheader.bn_ypelspermeter = 0L;
|
||||
infoheader.bn_clrused = 0L;
|
||||
infoheader.bn_clrimportant = 0L;
|
||||
|
||||
/*========= PALETTE =========*/
|
||||
if ( colors == 256 )
|
||||
{
|
||||
for ( i = 0; i < colors; i++ )
|
||||
{
|
||||
GrQueryColor(i, &r, &g, &b);
|
||||
palette[(i*4)] = (unsigned char)b;
|
||||
palette[(i*4)+1] = (unsigned char)g;
|
||||
palette[(i*4)+2] = (unsigned char)r;
|
||||
palette[(i*4)+3] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
line = (char *)malloc(width*(infoheader.bn_bitcount / 8));
|
||||
if ( !line )
|
||||
{
|
||||
close(handle);
|
||||
return FALSE;
|
||||
}
|
||||
/*========= WRITE FILEHEADER =========*/
|
||||
write(handle, &fileheader.bf_type, 2);
|
||||
write(handle, &fileheader.bf_size, 4);
|
||||
write(handle, &fileheader.bf_reserved1, 2);
|
||||
write(handle, &fileheader.bf_reserved2, 2);
|
||||
write(handle, &fileheader.bf_offbits, 4);
|
||||
|
||||
/*========= WRITE INFOHEADER =========*/
|
||||
write(handle, &infoheader.bn_size, 4);
|
||||
write(handle, &infoheader.bn_width, 4);
|
||||
write(handle, &infoheader.bn_height, 4);
|
||||
write(handle, &infoheader.bn_planes, 2);
|
||||
write(handle, &infoheader.bn_bitcount, 2);
|
||||
write(handle, &infoheader.bn_compression, 4);
|
||||
write(handle, &infoheader.bn_sizeimage, 4);
|
||||
write(handle, &infoheader.bn_xpelspermeter, 4);
|
||||
write(handle, &infoheader.bn_ypelspermeter, 4);
|
||||
write(handle, &infoheader.bn_clrused, 4);
|
||||
write(handle, &infoheader.bn_clrimportant, 4);
|
||||
|
||||
/*========= WRITE PALETTE =========*/
|
||||
if ( colors == 256 ) write(handle, palette, 256*4);
|
||||
|
||||
/*========= WRITE MAP =========*/
|
||||
yy = height;
|
||||
do {
|
||||
xx = 0;
|
||||
do {
|
||||
pixcol = GrPixelC(_c,_x1+xx,_y1+yy);
|
||||
if ( colors == 256 ) line[xx] = pixcol;
|
||||
else
|
||||
{
|
||||
line[(xx*3)+0] = GrRGBcolorBlue(pixcol);
|
||||
line[(xx*3)+1] = GrRGBcolorGreen(pixcol);;
|
||||
line[(xx*3)+2] = GrRGBcolorRed(pixcol);;
|
||||
}
|
||||
} while(++xx < width);
|
||||
write(handle, line, width*(infoheader.bn_bitcount / 8));
|
||||
} while(--yy > 0);
|
||||
free((void *)line);
|
||||
close(handle);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
unsigned long GrBmpImageWidth ( GrBmpImage* _bmp )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
return ( _bmp && _bmp->bi_bmpinfoheader ) ? _bmp->bi_width : 0L;
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
unsigned long GrBmpImageHeight ( GrBmpImage* _bmp )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
return ( _bmp && _bmp->bi_bmpinfoheader ) ? _bmp->bi_height : 0L;
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
char *GrBmpImagePalette ( GrBmpImage* _bmp )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
return (char *)(( _bmp && _bmp->bi_bmpimagecolors ) ? _bmp->bi_palette : NULL);
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
GrColor *GrBmpImageColorMap ( GrBmpImage* _bmp )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
return ( _bmp && _bmp->bi_bmpimagecolors ) ? _bmp->bi_colormap : NULL;
|
||||
}
|
||||
|
||||
/* ************************************************************************ */
|
||||
GrColor GrGetBmpImageNumColors ( GrBmpImage* _bmp )
|
||||
/* ************************************************************************ */
|
||||
{
|
||||
return ( _bmp && _bmp->bi_bmpimagecolors ) ? _bmp->bi_numcolors : 0;
|
||||
}
|
||||
|
190
thirdparty/grx249/addons/bmp/bmp.hlp
vendored
Normal file
190
thirdparty/grx249/addons/bmp/bmp.hlp
vendored
Normal file
|
@ -0,0 +1,190 @@
|
|||
==============================
|
||||
o LOAD MS-WINDOWS BITMAP FILE
|
||||
==============================
|
||||
Syntax
|
||||
------
|
||||
GrBmpImage *GrLoadBmpImage ( char *_filename );
|
||||
|
||||
Description
|
||||
-----------
|
||||
This function load BMP file format ( 1, 4, 8 Bytes Per Pixel ) from
|
||||
the file _filename into structure GrBmpImage*.
|
||||
|
||||
Return Value
|
||||
------------
|
||||
On succes pointer to new GrBmpImage structure, otherwise NULL
|
||||
|
||||
Example
|
||||
-------
|
||||
GrBmpImage* bmp = GrLoadBmpImage("logogrx.bmp");
|
||||
|
||||
==============================
|
||||
o SETTING GrBmpImage COLORS
|
||||
==============================
|
||||
Syntax
|
||||
------
|
||||
int GrAllocBmpImageColors ( GrBmpImage *_bmp, GrBmpImageColors *_col );
|
||||
|
||||
Description
|
||||
-----------
|
||||
This function setting GrBmpImage colors. (_bmp) is pointer to GrBmpImage
|
||||
structure and (_pal) is pointer to structrure, where we want to store
|
||||
information about BMP palette and colors. If (_col) is NULL, it set colors and into
|
||||
(_bmp) structure write 1 for own destroing palette by GrUnloadBmpImage.
|
||||
Otherwise palette will be destroy only by function GrEraseBmpImageColors.
|
||||
|
||||
Return Value
|
||||
------------
|
||||
On succes 1, otherwise 0
|
||||
|
||||
Example 1 ( _col is NULL )
|
||||
-------
|
||||
GrBmpImage* bmp = GrLoadBmpImage("logogrx.bmp");
|
||||
GrAllocBmpImageColors(bmp, NULL);
|
||||
GrUnloadBmpImage(bmp);
|
||||
|
||||
Example 2 ( _col is pointer to structure )
|
||||
-------
|
||||
GrBmpImage* bmp = GrLoadBmpImage("logogrx.bmp");
|
||||
GrBmpImageColors col;
|
||||
GrAllocBmpImageColors(bmp, &col);
|
||||
GrUnloadBmpImage(bmp);
|
||||
GrFreeBmpImageColors(&pal);
|
||||
|
||||
==============================
|
||||
o FREE GrBmpImage COLORS
|
||||
==============================
|
||||
Syntax
|
||||
------
|
||||
int GrFreeBmpImageColors ( GrBmpImageColors *_col );
|
||||
|
||||
Description
|
||||
-----------
|
||||
It destroy _col structure, free GrBmpImage Colors and set to NULL
|
||||
|
||||
Return Value
|
||||
------------
|
||||
On succes 1, otherwise 0
|
||||
|
||||
Example
|
||||
-------
|
||||
GrBmpImage* bmp = GrLoadBmpImage("logogrx.bmp");
|
||||
GrBmpImageColors bmpcolors;
|
||||
GrAllocBmpImageColors(bmp, &bmpcolors);
|
||||
GrUnloadBmpImage(bmp);
|
||||
GrFreeBmpImageColors(&bmpcolors);
|
||||
|
||||
===============================
|
||||
o CONVERT GrBmpImage STRUCTURE
|
||||
===============================
|
||||
Syntax
|
||||
------
|
||||
GrPattern *GrConvertBmpImageToPattern ( GrBmpImage *_bmp );
|
||||
|
||||
Description
|
||||
-----------
|
||||
Make GrPattern structure from GrBmpImage pointer.
|
||||
|
||||
Return Value
|
||||
------------
|
||||
On succes pointer to new GrPattern structure, else NULL
|
||||
|
||||
Example
|
||||
-------
|
||||
GrPattern *bmppat;
|
||||
GrBmpImage *bmp = GrLoadBmpImage("logogrx.bmp");
|
||||
GrAllocBmpImageColors(bmp, NULL);
|
||||
bmppat = GrConvertBmpImageToPattern(bmp);
|
||||
if ( bmppat ) GrPatternFilledBox(0, 0, GrMaxX(), GrMaxY(), bmppat);
|
||||
GrUnloadBmpImage(bmp);
|
||||
if ( bmppat ) GrDestroyPattern(bmppat);
|
||||
|
||||
IN THE OTHER WAY
|
||||
|
||||
Syntax
|
||||
------
|
||||
GrPattern *GrConvertBmpImageToStaticPattern ( GrBmpImage *_bmp );
|
||||
|
||||
Description
|
||||
-----------
|
||||
Make GrPattern structure from GrBmpImage pointer, AND GrBmpImage (_bmp)
|
||||
structure unload.
|
||||
|
||||
Return Value
|
||||
------------
|
||||
On succes pointer to new GrPattern structure, else NULL
|
||||
|
||||
Example
|
||||
-------
|
||||
GrPattern *bmppat;
|
||||
GrBmpImage *bmp = GrLoadBmpImage("logogrx.bmp");
|
||||
GrAllocBmpImageColors(bmp, NULL);
|
||||
bmppat = GrConvertBmpImageToStaticPattern(bmp);
|
||||
if ( bmppat ) GrPatternFilledBox(0, 0, GrMaxX(), GrMaxY(), bmppat);
|
||||
if ( bmppat ) GrDestroyPattern(bmppat);
|
||||
|
||||
==============================
|
||||
o UNLOAD GrBmpImage STRUCTURE
|
||||
==============================
|
||||
|
||||
Syntax
|
||||
------
|
||||
int GrUnloadBmpImage ( GrBmpImage *_bmp );
|
||||
|
||||
Description
|
||||
-----------
|
||||
Free _bmp and BmpImage colors/palette (only if GrAllocBmpImagePalette
|
||||
contains NULL in 2nd variable ).
|
||||
|
||||
Return Value
|
||||
------------
|
||||
On succes 1, else 0
|
||||
|
||||
Example
|
||||
-------
|
||||
GrBmpImage* bmp = GrLoadBmpImage("logogrx.bmp");
|
||||
GrUnloadBmpImage(bmp);
|
||||
|
||||
=========================================
|
||||
o SAVE CONTEXT TO MS-WINDOWS BITMAP FILE
|
||||
=========================================
|
||||
Syntax
|
||||
------
|
||||
int GrSaveBmpImage ( char *_filename, GrContext *_c, int _x1, int _y1,
|
||||
int _x2, int _y2 );
|
||||
|
||||
Description
|
||||
-----------
|
||||
Save context from the position ( where _x1,_y1 is left uppon origin &&
|
||||
_x2,_y2 right bottom origin)
|
||||
to BMP ( 8 or 24 bpp file ). The BMP file will be set to 8 Bits Per Line,
|
||||
when GrNumColors() in GRXxx.H is set to 256, otherwise it'll be set to
|
||||
24 Bits Per Line.
|
||||
If _context is set to NULL, _c will be pointer to current context
|
||||
structure.
|
||||
|
||||
Return Value
|
||||
------------
|
||||
On succes 1, owtherwise 0
|
||||
|
||||
Example
|
||||
-------
|
||||
GrSaveBmpImage("logogrx.bmp", NULL, 100, 100, 400, 400);
|
||||
|
||||
|
||||
|
||||
=========================================
|
||||
======= THE END =========================
|
||||
=========================================
|
||||
|
||||
Michal Stencl
|
||||
|
||||
<e-mail> - [stenclpmd@ba.telecom.sk]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
30
thirdparty/grx249/addons/bmp/bmptest.c
vendored
Normal file
30
thirdparty/grx249/addons/bmp/bmptest.c
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include "grx20.h"
|
||||
#include "bmp.c"
|
||||
|
||||
int main ( void )
|
||||
{
|
||||
GrBmpImage *bmp256, *bmp;
|
||||
GrPattern *p256, *p;
|
||||
GrSetMode(GR_width_height_color_graphics, 800, 600, 256);
|
||||
bmp256 = GrLoadBmpImage("mysha256.bmp");
|
||||
bmp = GrLoadBmpImage("some1.bmp");
|
||||
GrAllocBmpImageColors(bmp, NULL);
|
||||
GrAllocBmpImageColors(bmp256, NULL);
|
||||
p256 = GrConvertBmpImageToPattern(bmp256);
|
||||
p = GrConvertBmpImageToPattern(bmp);
|
||||
if ( p ) {
|
||||
GrImageDisplay(0, 0, GrImageFromPattern(p));
|
||||
getkey();
|
||||
}
|
||||
if ( p256 ) {
|
||||
GrImageDisplay(300, 300, GrImageFromPattern(p256));
|
||||
getkey();
|
||||
}
|
||||
if ( p ) GrDestroyPattern(p);
|
||||
if ( p256 ) GrDestroyPattern(p256);
|
||||
GrSaveBmpImage("save.bmp", NULL, 0, 0, 400, 400);
|
||||
GrUnloadBmpImage(bmp);
|
||||
GrUnloadBmpImage(bmp256);
|
||||
return 0;
|
||||
};
|
||||
|
78
thirdparty/grx249/addons/bmp/grxbmp.h
vendored
Normal file
78
thirdparty/grx249/addons/bmp/grxbmp.h
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
** <grxbmp.h> - BMP read/write file
|
||||
** by Michal Stencl Copyright (c) 1998
|
||||
** - read BMP 2, 4, 8 bpp
|
||||
** - write BMP 8, 24 bpp
|
||||
** <e-mail> - [stenclpmd@ba.telecom.sk]
|
||||
**
|
||||
*/
|
||||
|
||||
#include "libgrx.h"
|
||||
|
||||
#define _GrBitmapPointerTypes_DEFINED_
|
||||
typedef struct _GR_bitmapfileheader GrBitmapFileHeader;
|
||||
typedef struct _GR_bitmapinfoheader GrBitmapInfoHeader;
|
||||
typedef struct _GR_bmpimagecolors GrBmpImageColors;
|
||||
typedef struct _GR_bmpimage GrBmpImage;
|
||||
|
||||
/* ************************************************************************ */
|
||||
/* _GR_bitmapfileheader */
|
||||
/* ************************************************************************ */
|
||||
struct _GR_bitmapfileheader {
|
||||
GR_int16u bf_type;
|
||||
GR_int32u bf_size;
|
||||
GR_int16u bf_reserved1;
|
||||
GR_int16u bf_reserved2;
|
||||
GR_int32u bf_offbits;
|
||||
};
|
||||
|
||||
/* ************************************************************************ */
|
||||
/* _GR_bitmapinfoheader */
|
||||
/* ************************************************************************ */
|
||||
struct _GR_bitmapinfoheader {
|
||||
GR_int32u bn_size;
|
||||
GR_int32u bn_width;
|
||||
GR_int32u bn_height;
|
||||
GR_int16u bn_planes;
|
||||
GR_int16u bn_bitcount;
|
||||
GR_int32u bn_compression;
|
||||
GR_int32u bn_sizeimage;
|
||||
GR_int32u bn_xpelspermeter;
|
||||
GR_int32u bn_ypelspermeter;
|
||||
GR_int32u bn_clrused;
|
||||
GR_int32u bn_clrimportant;
|
||||
};
|
||||
|
||||
/* ************************************************************************ */
|
||||
/* _GR_bmpimagecolors IMPORTANT */
|
||||
/* ************************************************************************ */
|
||||
struct _GR_bmpimagecolors {
|
||||
GR_int8u *bp_palette; /* (R, G, B, Reserved) * | 2 | 16 | 256 */
|
||||
GrColor *bp_colormap;
|
||||
int bp_numcolors;
|
||||
};
|
||||
|
||||
/* ************************************************************************ */
|
||||
/* _GR_bmpimage IMPORTANT */
|
||||
/* ************************************************************************ */
|
||||
struct _GR_bmpimage {
|
||||
GrBitmapFileHeader *bi_bmpfileheader;
|
||||
GrBitmapInfoHeader *bi_bmpinfoheader;
|
||||
GrBmpImageColors *bi_bmpimagecolors;
|
||||
GR_int16s bi_erasepalette;
|
||||
char *bi_map;
|
||||
};
|
||||
|
||||
GrBmpImage *GrLoadBmpImage ( char *_filename );
|
||||
int GrSaveBmpImage ( char *_filename, GrContext *_c, int _x1, int _y1, int _x2, int _y2 );
|
||||
void GrUnloadBmpImage ( GrBmpImage *_bmp );
|
||||
int GrAllocBmpImageColors ( GrBmpImage *_bmp, GrBmpImageColors *_pal );
|
||||
int GrFreeBmpImageColors ( GrBmpImageColors *_pal );
|
||||
GrPattern *GrConvertBmpImageToPattern ( GrBmpImage *_bmp );
|
||||
GrPattern *GrConvertBmpImageToStaticPattern ( GrBmpImage *_bmp );
|
||||
unsigned long GrBmpImageWidth ( GrBmpImage* _bmp );
|
||||
unsigned long GrBmpImageHeight ( GrBmpImage* _bmp );
|
||||
char *GrBmpImagePalette ( GrBmpImage* _bmp );
|
||||
GrColor *GrBmpImageColorMap ( GrBmpImage* _bmp );
|
||||
GrColor GrBmpImageNumColors ( GrBmpImage* _bmp );
|
||||
|
210
thirdparty/grx249/addons/ctx2tiff.c
vendored
Normal file
210
thirdparty/grx249/addons/ctx2tiff.c
vendored
Normal file
|
@ -0,0 +1,210 @@
|
|||
/**
|
||||
** CTX2TIFF.C ---- saves a context in a TIFF file
|
||||
**
|
||||
** Copyright (c) 1997 Hartmut Schirmer
|
||||
**
|
||||
** requires tifflib by Sam Leffler (sam@engr.sgi.com)
|
||||
** available at ftp://ftp.sgi.com/graphics/tiff
|
||||
**
|
||||
** should work with every compiler supporting both,
|
||||
** tifflib and GRX libraries
|
||||
**/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <grx20.h>
|
||||
#include <tiffio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define SCALE(x) ((x)<<8)
|
||||
|
||||
#define puttobuf(r,x,depth,col) do { \
|
||||
switch (depth) { \
|
||||
case 1 : if (col) { \
|
||||
int offset = (x) >> 3; \
|
||||
int mask = 0x80 >> ((x) & 7); \
|
||||
r[offset] |= mask; \
|
||||
} \
|
||||
break; \
|
||||
case 8 : r[x] = (unsigned char)(col); break; \
|
||||
case 24: r[3*(x)+0] = GrRGBcolorRed(col); \
|
||||
r[3*(x)+1] = GrRGBcolorGreen(col); \
|
||||
r[3*(x)+2] = GrRGBcolorBlue(col); \
|
||||
break; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
||||
/*
|
||||
** SaveContextToTiff - Dump a context in a TIFF file
|
||||
**
|
||||
** Arguments:
|
||||
** ctx: Context to be saved (NULL -> use current context)
|
||||
** tiffn: Name of tiff file
|
||||
** compr: Compression method (see tiff.h), 0: automatic selection
|
||||
** docn: string saved in the tiff file (DOCUMENTNAME tag)
|
||||
**
|
||||
** Returns 0 on success
|
||||
** -1 on error
|
||||
*/
|
||||
int
|
||||
SaveContextToTiff(GrContext *ctx, char *tiffn, unsigned compr, char *docn) {
|
||||
int depth, i, res;
|
||||
long row;
|
||||
TIFF *tif;
|
||||
long width, height, colors;
|
||||
short photometric;
|
||||
short samplesperpixel;
|
||||
short bitspersample;
|
||||
unsigned char *r;
|
||||
unsigned short red[256], green[256], blue[256];
|
||||
|
||||
if (!ctx) ctx = (GrContext *)GrCurrentContext();
|
||||
if (!ctx) return -1;
|
||||
width = ctx->gc_xmax+1;
|
||||
height = ctx->gc_ymax+1;
|
||||
colors = GrNumColors();
|
||||
if (colors < 2) return -1;
|
||||
if (colors == 2) depth = 1; else
|
||||
if (colors <= 256) depth = 8; else
|
||||
if (colors <= 1L<<24) depth = 24; else return -1;
|
||||
|
||||
if (!compr) { /* compr == 0 -> auto select compression */
|
||||
if (depth==1) compr = COMPRESSION_CCITTFAX4;
|
||||
else compr = COMPRESSION_LZW;
|
||||
}
|
||||
|
||||
switch (depth) {
|
||||
case 1:
|
||||
samplesperpixel = 1;
|
||||
bitspersample = 1;
|
||||
photometric = PHOTOMETRIC_MINISBLACK;
|
||||
break;
|
||||
case 8:
|
||||
samplesperpixel = 1;
|
||||
bitspersample = 8;
|
||||
photometric = PHOTOMETRIC_PALETTE;
|
||||
break;
|
||||
case 24:
|
||||
samplesperpixel = 3;
|
||||
bitspersample = 8;
|
||||
photometric = PHOTOMETRIC_RGB;
|
||||
break;
|
||||
default:
|
||||
return -1; /* shouldn't happen */
|
||||
}
|
||||
|
||||
r = (unsigned char *) malloc( depth>1 ?
|
||||
samplesperpixel*width*sizeof(unsigned char) :
|
||||
(width+7)/8);
|
||||
if (!r) return -1;
|
||||
|
||||
tif = TIFFOpen(tiffn, "w");
|
||||
if (tif == NULL) {
|
||||
free(r);
|
||||
return -1;
|
||||
}
|
||||
|
||||
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width);
|
||||
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, height);
|
||||
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bitspersample);
|
||||
TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
|
||||
TIFFSetField(tif, TIFFTAG_COMPRESSION, compr);
|
||||
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric);
|
||||
if (docn)
|
||||
TIFFSetField(tif, TIFFTAG_DOCUMENTNAME, docn);
|
||||
TIFFSetField(tif, TIFFTAG_IMAGEDESCRIPTION, "GRX saved context");
|
||||
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
|
||||
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, height);
|
||||
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
||||
|
||||
memset(red, 0, sizeof(red));
|
||||
memset(green, 0, sizeof(green));
|
||||
memset(blue, 0, sizeof(blue));
|
||||
if (depth == 8) {
|
||||
for (i = 0; i < colors; i++) {
|
||||
int r, g, b;
|
||||
GrQueryColor(i, &r, &g, &b);
|
||||
red[i] = SCALE(r);
|
||||
green[i] = SCALE(g);
|
||||
blue[i] = SCALE(b);
|
||||
}
|
||||
TIFFSetField(tif, TIFFTAG_COLORMAP, red, green, blue);
|
||||
}
|
||||
res = 0;
|
||||
for (row = 0; row < height; row++) {
|
||||
int x;
|
||||
GrColor c;
|
||||
#if GRX_VERSION_API-0 >= 0x229
|
||||
const GrColor *rcb = GrGetScanlineC(ctx,0,width-1,row);
|
||||
if (rcb) {
|
||||
for (x=0; x < width; ++x) {
|
||||
c = rcb[x];
|
||||
puttobuf(r,x,depth,c);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (depth==1) memset (r,0,(width+7)/8);
|
||||
for (x=0; x < width; ++x) {
|
||||
c = GrPixelC(ctx,x,row);
|
||||
puttobuf(r,x,depth,c);
|
||||
}
|
||||
}
|
||||
if (TIFFWriteScanline(tif, r, row, 0) < 0) {
|
||||
res = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
TIFFFlushData(tif);
|
||||
TIFFClose(tif);
|
||||
free(r);
|
||||
return res;
|
||||
}
|
||||
|
||||
#ifdef TEST_CTX2TIFF
|
||||
#include "../test/test.h"
|
||||
|
||||
TESTFUNC(wintest)
|
||||
{
|
||||
int x = GrSizeX();
|
||||
int y = GrSizeY();
|
||||
int ww = (x / 2) - 10;
|
||||
int wh = (y / 2) - 10;
|
||||
long c;
|
||||
GrContext *w1 = GrCreateSubContext(5,5,ww+4,wh+4,NULL,NULL);
|
||||
GrContext *w2 = GrCreateSubContext(15+ww,5,ww+ww+14,wh+4,NULL,NULL);
|
||||
GrContext *w3 = GrCreateSubContext(5,15+wh,ww+4,wh+wh+14,NULL,NULL);
|
||||
GrContext *w4 = GrCreateSubContext(15+ww,15+wh,ww+ww+14,wh+wh+14,NULL,NULL);
|
||||
|
||||
GrSetContext(w1);
|
||||
c = GrAllocColor(200,100,100);
|
||||
drawing(0,0,ww,wh,c,GrBlack());
|
||||
c = GrAllocColor(100,50,50);
|
||||
GrBox(0,0,ww-1,wh-1,c);
|
||||
|
||||
GrSetContext(w2);
|
||||
c = GrAllocColor(100,200,200);
|
||||
drawing(0,0,ww,wh,c,GrBlack());
|
||||
c = GrAllocColor(50,100,100);
|
||||
GrBox(0,0,ww-1,wh-1,c);
|
||||
|
||||
GrSetContext(w3);
|
||||
c = GrAllocColor(200,200,0);
|
||||
drawing(0,0,ww,wh,c,GrBlack());
|
||||
c = GrAllocColor(100,100,0);
|
||||
GrBox(0,0,ww-1,wh-1,c);
|
||||
|
||||
GrSetContext(w4);
|
||||
c = GrAllocColor(0,100,200);
|
||||
drawing(0,0,ww,wh,c,GrBlack());
|
||||
c = GrAllocColor(255,0,100);
|
||||
GrBox(0,0,ww-1,wh-1,c);
|
||||
|
||||
GrSetContext(NULL);
|
||||
|
||||
SaveContextToTiff(NULL, "test.tif", 0, "Context2TIFF test file");
|
||||
getch();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
64
thirdparty/grx249/addons/print/copying.uz
vendored
Normal file
64
thirdparty/grx249/addons/print/copying.uz
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
[See below for an english version]
|
||||
|
||||
PRINTER.BGI
|
||||
|
||||
(C) Copyright 1990-1995 Ullrich von Bassewitz
|
||||
|
||||
Bedingungen fuer Nutzung und Weitergabe
|
||||
|
||||
|
||||
Die Software (sowohl die Quellcodes, als auch die Binaries) werden
|
||||
ohne jegliche Zusagen/Garantien bez<65>glich Funktionalit„t oder
|
||||
Funktionsf„higkeit abgegeben. Weder die Autoren noch die Distributoren
|
||||
<EFBFBD>bernehmen eine Verantwortung f<>r Sch„den, die durch die Benutzung der
|
||||
Software verursacht werden.
|
||||
|
||||
Die Software darf frei verwendet und weitergegeben werden, wobei
|
||||
"frei" ausdr<64>cklich auch eine kommerzielle Nutzung/Weitergabe
|
||||
einschlieát, *vorausgesetzt* die folgenden Bedingungen werden
|
||||
eingehalten:
|
||||
|
||||
1. Die Herkunft der Software muá - wenn <20>berhaupt - dann korrekt
|
||||
angegeben werden. Es ist nicht erlaubt, die Software als Werk
|
||||
eines anderen auszugeben. Wird die Software in Teilen oder als
|
||||
Ganzes in einem Produkt benutzt, dann w<>rde ich mich <20>ber einen
|
||||
Hinweis auf die Herkunft in der Dokumentation freuen. Ein solcher
|
||||
Hinweis ist aber nicht zwingend notwendig.
|
||||
|
||||
2. Ge„nderte Quellcodes m<>ssen deutlich als solche gekennzeichnet
|
||||
werden und d<>rfen nicht ohne einen expliziten Hinweis auf die
|
||||
durchgef<65>hrten Žnderungen weiterverteilt werden.
|
||||
|
||||
3. Die Bedingungen <20>ber die Nutzung/Weitergabe d<>rfen nicht entfernt
|
||||
oder ge„ndert werden.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
[Dasselbe auf englisch:]
|
||||
|
||||
|
||||
PRINTER.BGI
|
||||
|
||||
(C) Copyright 1990-1995 Ullrich von Bassewitz
|
||||
|
||||
COPYING CONDITIONS
|
||||
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution
|
||||
|
||||
|
1272
thirdparty/grx249/addons/print/grxprint.c
vendored
Normal file
1272
thirdparty/grx249/addons/print/grxprint.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
133
thirdparty/grx249/addons/print/grxprint.h
vendored
Normal file
133
thirdparty/grx249/addons/print/grxprint.h
vendored
Normal file
|
@ -0,0 +1,133 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** grxprint.h : Output of graphics on printer from GRX graphic library
|
||||
** Version 0.5 (beta) 98/01/26 Andris Pavenis (pavenis@acad.latnet.lv)
|
||||
**
|
||||
** Version 0.6 98/03/03 A.Pavenis
|
||||
** Renamed some procedures
|
||||
**
|
||||
** Version 0.66 98/05/07 H.Schirmer
|
||||
** - made cpp # start on first column
|
||||
**
|
||||
** Version 0.67 98/05/10 H.Schirmer
|
||||
** - eleminated C++ style comments for better portability
|
||||
**
|
||||
** Version 0.68 98/05/13 H.Schirmer
|
||||
** - clean source for better portability / ANSI-C conformance
|
||||
**
|
||||
** This code is port of part of printer BGI driver
|
||||
** (C) 1990-1995 Ullrich von Bassewitz (see copying.uz).
|
||||
**
|
||||
** Full version of printer BGI driver version 4.0 can be found
|
||||
** at URL ftp://ftp.musoftware.com/pub/uz/
|
||||
** An alternate URL is http://www.lanet.lv/~pavenis/printerbgi+src.zip
|
||||
**
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __GRXPRINT_H
|
||||
#define __GRXPRINT_H
|
||||
|
||||
enum __grxPrintModes
|
||||
{
|
||||
FX_240x72 = 0, /* EPSON FX (8-Nadel), 240 * 72 DPI */
|
||||
FX_240x216 = 1, /* EPSON FX (8-Nadel), 240 * 216 DPI */
|
||||
LQ_180x180 = 2, /* EPSON LQ (24-Nadel), 180 * 180 DPI */
|
||||
LQ_360x180 = 3, /* EPSON LQ (24-Nadel), 360 * 180 DPI */
|
||||
LQ_360x360 = 4, /* EPSON LQ (24-Nadel), 360 * 360 DPI */
|
||||
|
||||
P6_360x360 = 5, /* NEC P6, P6+, P60 (24-Nadel), 360 * 360 DPI (1) */
|
||||
X24_180x180 = 6, /* IBM Proprinter X24 (24-Nadel), 180 * 180 DPI */
|
||||
X24_360x180 = 7, /* IBM Proprinter X24 (24-Nadel), 360 * 180 DPI */
|
||||
|
||||
LQ_P6_180x180x9 = 8, /* EPSON LQ / NEC P6, P6+, 180 * 180 DPI, 9 Farben (6) */
|
||||
LQ_P6_360x180x9 = 9, /* EPSON LQ / NEC P6, P6+, 360 * 180 DPI, 9 Farben (6) */
|
||||
LQ_P6_360x360x9 = 10, /* EPSON LQ, 360 * 360 DPI, 9 Farben (6) */
|
||||
P6_360x360x9 = 11, /* NEC P6, P6+, 360 * 360 DPI, 9 Farben (6) */
|
||||
|
||||
GRX_PRN_RESERVED_1 = 12, /* Reserviert */
|
||||
GRX_PRN_USER1 = 13, /* Benutzerdefinierter Modus 1 (not implemented) (2) */
|
||||
GRX_PRN_USER2 = 14, /* Benutzerdefinierter Modus 2 (not implemented) (2) */
|
||||
GRX_PRN_USER3 = 15, /* Benutzerdefinierter Modus 3 (not implemented) (2) */
|
||||
|
||||
HPLJ_75x75 = 16, /* HP LJ, 75 * 75 DPI (3) */
|
||||
HPLJ_100x100 = 17, /* HP LJ, 100 * 100 DPI (3) */
|
||||
HPLJ_150x150 = 18, /* HP LJ, 150 * 150 DPI (3) */
|
||||
HPLJ_300x300 = 19, /* HP LJ, 300 * 300 DPI (3) */
|
||||
HPLJ_75x75_NC = 20, /* HP LJ, 75 * 75 DPI, keine Kompression (4) */
|
||||
HPLJ_100x100_NC = 21, /* HP LJ, 100 * 100 DPI, keine Kompression (4) */
|
||||
HPLJ_150x150_NC = 22, /* HP LJ, 150 * 150 DPI, keine Kompression (4) */
|
||||
HPLJ_300x300_NC = 23, /* HP LJ, 300 * 300 DPI, keine Kompression (4) */
|
||||
|
||||
HPDJ500C_75x75x8 = 24, /* HP DJ 500C, 75 * 75 DPI, 8 Farben, A4 */
|
||||
HPDJ500C_100x100x8 = 25, /* HP DJ 500C, 100 * 100 DPI, 8 Farben, A4 */
|
||||
HPDJ500C_150x150x8 = 26, /* HP DJ 500C, 150 * 150 DPI, 8 Farben, A4 */
|
||||
HPDJ500C_300x300x8 = 27, /* HP DJ 500C, 300 * 300 DPI, 8 Farben, A4 */
|
||||
|
||||
HPDJ500C_75x75x8_B = 28, /* HP DJ 550C, 75 * 75 DPI, 8 Farben, echtes Schwarz (7) */
|
||||
HPDJ500C_100x100x8_B = 29, /* HP DJ 550C, 100 * 100 DPI, 8 Farben, echtes Schwarz (7) */
|
||||
HPDJ500C_150x150x8_B = 30, /* HP DJ 550C, 150 * 150 DPI, 8 Farben, echtes Schwarz (7) */
|
||||
HPDJ500C_300x300x8_B = 31, /* HP DJ 550C, 300 * 300 DPI, 8 Farben, echtes Schwarz (7) */
|
||||
|
||||
HPLJ_600x600 = 32, /* HP LJ IV, 600 * 600 DPI (5) */
|
||||
LQ_180x180_A3 = 33, /* EPSON LQ (24-Nadel), 180 * 180 DPI, DIN A3 */
|
||||
LQ_360x180_A3 = 34, /* EPSON LQ (24-Nadel), 360 * 180 DPI, DIN A3 */
|
||||
LQ_360x360_A3 = 35, /* EPSON LQ (24-Nadel), 360 * 360 DPI, DIN A3 */
|
||||
P7_360x360_A3 = 36, /* NEC P7 (24-Nadel), 360 * 360 DPI, DIN A3 (1) */
|
||||
LQ_180x180x9_A3 = 37, /* EPSON LQ (24-Nadel), 180 * 180 DPI, DIN A3, 9 Farben (6) */
|
||||
LQ_360x180x9_A3 = 38, /* EPSON LQ (24-Nadel), 360 * 180 DPI, DIN A3, 9 Farben (6) */
|
||||
LQ_360x360x9_A3 = 39, /* EPSON LQ (24-Nadel), 360 * 360 DPI, DIN A3, 9 Farben (6) */
|
||||
P7_360x360x9_A3 = 40, /* NEC P7 (24-Nadel), 360 * 360 DPI, DIN A3, 9 Farben (1) (6) */
|
||||
|
||||
HPDJ1200C150 = 41, /* Deskjet 1200C, 256 Farben */
|
||||
HPLJ_1200x1200 = 42 /* HP LJ4000, 1200 * 1200 DPI (5) */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int GrPrintSetMode (int mode);
|
||||
|
||||
int GrPrintToFile (const char * DestFile);
|
||||
|
||||
int GrDoPrinting (void);
|
||||
|
||||
void GrPrintGetAspectRatio ( unsigned * x , unsigned * y );
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* Setting and quering some printer settings. These procedures */
|
||||
/* are usufull only with LaserJet or DeskJet printers */
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
struct GrPrintOptionsType
|
||||
{
|
||||
short Quality; /* see enum __GrPrintQuality */
|
||||
|
||||
short Shingling; /* 0* - normal */
|
||||
/* 1 - 25% (2 pass) */
|
||||
/* 2 - 50% (4 pass) */
|
||||
|
||||
short Depletion; /* 0 - none */
|
||||
/* 1* - 25% */
|
||||
/* 2 - 50% */
|
||||
|
||||
short MediaType; /* 0* - plain paper */
|
||||
/* 1 - bond paper */
|
||||
/* 2 - special paper */
|
||||
/* 3 - glossy film */
|
||||
/* 4 - transparency film */
|
||||
};
|
||||
|
||||
|
||||
void GrPrintGetDefaultOptions ( struct GrPrintOptionsType * opt );
|
||||
void GrPrintGetCurrentOptions ( struct GrPrintOptionsType * opt );
|
||||
void GrPrintSetOptions ( struct GrPrintOptionsType * opt );
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
BIN
thirdparty/grx249/addons/print/grxprint.lo
vendored
Normal file
BIN
thirdparty/grx249/addons/print/grxprint.lo
vendored
Normal file
Binary file not shown.
109
thirdparty/grx249/addons/print/grxprint.txt
vendored
Normal file
109
thirdparty/grx249/addons/print/grxprint.txt
vendored
Normal file
|
@ -0,0 +1,109 @@
|
|||
|
||||
PRINTING FROM GRX GRAPHIC LIBRARY
|
||||
Version 0.7
|
||||
|
||||
Andris Pavenis
|
||||
e-mail: pavenis@lanet.lv
|
||||
|
||||
26 June 1998
|
||||
|
||||
This directory contains procedures that allows printing graphics
|
||||
from GRX graphic library. The source of this package is based on
|
||||
sources of printer BGI driver for Borland C and Pascal compilers
|
||||
developed by Ullrich von Bassevitz (see copying.uz).
|
||||
Printing from GRX is tested under MS-DOS with DJGPP and under Linux.
|
||||
There is no plans to allow use it from MS-DOS real mode with Borland C++
|
||||
as the memory available to program is insufficient to allocate memory
|
||||
area necessary to build image in memory.
|
||||
|
||||
|
||||
|
||||
int GrPrintSetMode (int mode)
|
||||
|
||||
Initializes GRX with "memory only" driver with necessary image size to print
|
||||
the page. See grxprint.h for available modes.
|
||||
|
||||
|
||||
|
||||
int GrDoPrinting (void)
|
||||
|
||||
Outputs the image built with GRX functions after call to GrSetPrintMode to
|
||||
printer. In MS-DOS the output is done to file 'prn'. In Linux the output
|
||||
is written through pipe to lpr.
|
||||
|
||||
|
||||
|
||||
int GrPrintToFile (const char * fName)
|
||||
|
||||
The same as GrDoPrinting but the output is written to requested file. For Linux
|
||||
there is one more option: if filename begins with '|', the remaining part of
|
||||
name is interpretted as command for popen() (it is GrPrintToFile("|lpr") is
|
||||
the equivalent with GrDoPrinting).
|
||||
|
||||
|
||||
|
||||
int GrPrintGetAspectRatio ( unsigned * aspx , unsigned * aspy )
|
||||
|
||||
Returns aspect ratio for image on printer. For example
|
||||
unsigned AspX, AspY;
|
||||
double Asp;
|
||||
int MaxX, MaxY;
|
||||
MaxX = GrSizeX ();
|
||||
MaxY = GrSizeY ();
|
||||
GrPrintGetAspectRatio (&AspX,&AspY);
|
||||
Asp = ((double) AspX)/AspY;
|
||||
GrEllipse (MaxX/2-100,MaxY/2,(int) (r*Asp), (int) r, 1);
|
||||
will draw circle (see test.cc)
|
||||
|
||||
|
||||
|
||||
|
||||
void GrPrintGetDefaultOptions ( struct GrPrintOptionsType * opt )
|
||||
void GrPrintGetCurrentOptions ( struct GrPrintOptionsType * opt )
|
||||
void GrPrintSetOptions ( struct GrPrintOptionsType * opt )
|
||||
|
||||
Allows to retrieve printing options. Works for LaserJet and DeskJet
|
||||
printers. Does nothing for dot matrix printers.
|
||||
|
||||
|
||||
------------------------ ChangeLog -----------------------------
|
||||
|
||||
|
||||
98/05/13 H.Schirmer
|
||||
- clean source for better portability / ANSI-C conformance
|
||||
|
||||
98/05/10 H.Schirmer
|
||||
- eleminated C++ style comments for better portability
|
||||
|
||||
7 May 1998 H.Schirmer
|
||||
- made cpp # start on first column
|
||||
|
||||
9 March 1998 Andris Pavenis
|
||||
- Version changed to 0.65
|
||||
- Changed procedure GrPrintToFile(). Now under Linux the output is
|
||||
written to pipe if the name begins with '|'
|
||||
|
||||
3 March 1998 Andris Pavenis
|
||||
- Fixed problem when printing directly to printer (DJGPP version).
|
||||
The opened file was opened in text mode (old bug in libc, it is told
|
||||
to be fixed, but the workaround mentioned for that worked OK so
|
||||
I didn't study it more).
|
||||
- Get rid of most of warnings that appears with -Wall
|
||||
|
||||
26 February 1998 Andris Pavenis
|
||||
- Version changed to 0.6
|
||||
- Many bugfixes. The first tests appeared to be incomplete.
|
||||
Therefore a mirrored image were printed before. FIXED
|
||||
|
||||
24 February 1998 Andris Pavenis
|
||||
- Changed names of functions: GrDoPrinting() to GrPrintToFile()
|
||||
- A new function added to print to PRN under MS-DOS and
|
||||
to pipe output to lpr under Linux
|
||||
|
||||
18 February 1998 Andris Pavenis
|
||||
- Fixes to allow to work under Linux (still printing to file only)
|
||||
|
||||
26 January 1998 Andris Pavenis
|
||||
- Initial version. Only some preliminary tests were done so this
|
||||
version still were very buggy.
|
||||
|
221
thirdparty/grx249/addons/print/grxprn00.h
vendored
Normal file
221
thirdparty/grx249/addons/print/grxprn00.h
vendored
Normal file
|
@ -0,0 +1,221 @@
|
|||
/*****************************************************************************/
|
||||
/* */
|
||||
/* grxprn00.h : Output of graphics on printer from GRX graphic library */
|
||||
/* Version 0.5 (beta) 98/01/26 Andris Pavenis (pavenis@acad.latnet.lv) */
|
||||
/* */
|
||||
/* Version 0.66 98/05/07 H.Schirmer */
|
||||
/* - made cpp # start on first column */
|
||||
/* */
|
||||
/* Version 0.68 98/05/13 H.Schirmer */
|
||||
/* - clean source for better portability / ANSI-C conformance */
|
||||
/* */
|
||||
/* Version 0.7 98/05/20 A.Pavenis */
|
||||
/* - removed definitions of procedures internal to grxprint.c */
|
||||
/* (they are now declared static inside grxprint.c) */
|
||||
/* */
|
||||
/* This code is port of part of printer BGI driver */
|
||||
/* (C) 1990-1995 Ullrich von Bassewitz (see copying.uz). */
|
||||
/* */
|
||||
/* Full version of printer BGI driver version 4.0 can be found */
|
||||
/* at URL ftp://ftp.musoftware.com/pub/uz/ */
|
||||
/* An alternate URL is http://www.lanet.lv/~pavenis/printerbgi+src.zip */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef __GRXPRN00_H
|
||||
#define __GRXPRN00_H
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#ifndef __GRX20_H_INCLUDED__
|
||||
#include <grx20.h>
|
||||
#endif
|
||||
|
||||
/* */
|
||||
/* Datentyp BOOLEAN */
|
||||
/* */
|
||||
typedef unsigned char BOOLEAN;
|
||||
#define TRUE 1
|
||||
#define OK TRUE
|
||||
#define FALSE 0
|
||||
|
||||
/* */
|
||||
/* Diverse andere Datentypen mit festen Bit-Groessen */
|
||||
/* */
|
||||
/*
|
||||
>>>>> These types should be mapped to the GRX internal types GR_int..u <<<<<
|
||||
*/
|
||||
typedef unsigned int WORD;
|
||||
typedef unsigned char BYTE;
|
||||
typedef unsigned long DWORD;
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* Macros */
|
||||
/* */
|
||||
/****************************************************************************/
|
||||
|
||||
/* NULL Macro */
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
/* Die Farbtabelle wird (da nicht verwendet) als Moeglichkeit zur Einstellung*/
|
||||
/* von diversen Daten von aussen benutzt. Sie heisst daher nicht ColorTable */
|
||||
/* (wie im SVGA-Treiber), sondern Settings (fuer die aktuelle Tabelle) und */
|
||||
/* DefaultSettings (fuer die Default-Einstellungen). */
|
||||
|
||||
/* Defines zum Zugriff auf die Elemente von Settings und DefaultSettings */
|
||||
#define djDefQuality (DefaultSettings.Quality)
|
||||
#define djDefShingling (DefaultSettings.Shingling)
|
||||
#define djDefDepletion (DefaultSettings.Depletion)
|
||||
#define djDefMediaType (DefaultSettings.MediaType)
|
||||
#define djQuality (Settings.Quality)
|
||||
#define djShingling (Settings.Shingling)
|
||||
#define djDepletion (Settings.Depletion)
|
||||
#define djMediaType (Settings.MediaType)
|
||||
|
||||
|
||||
/* RGB Palette. */
|
||||
struct RGBEntry {
|
||||
BYTE R, G, B;
|
||||
};
|
||||
|
||||
/****************************************************************************/
|
||||
/* Konstante fuer das Flags Byte von _DST */
|
||||
/****************************************************************************/
|
||||
|
||||
#define pfIsEpson 0x01 /* Epson-Modus */
|
||||
|
||||
/* Nadeldrucker-Flags */
|
||||
#define pfReverse 0x02 /* Nadelnummerierung umdrehen (EPSON) */
|
||||
|
||||
/* Deskjet-Flags */
|
||||
#define pfSeparateBlack 0x02 /* Separate Schwarz-Plane (Deskjet) */
|
||||
#define pfDoCompression 0x04 /* TIFF Pacbits Kompression durchfuehren */
|
||||
#define pfHasPalette 0x08 /* RGB Palette ja/nein */
|
||||
|
||||
|
||||
/* Anzahl Druckermodi */
|
||||
#define MaxModes 43
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* Grund-Deskriptor fuer einen Druckermodus */
|
||||
/****************************************************************************/
|
||||
|
||||
/* Die folgende struct enthaelt die Grund-Werte bzw. Funktionen, die sich */
|
||||
/* nie aendern. Jeder Treiber kann spezielle Funktionen am Ende hinzufuegen.*/
|
||||
|
||||
struct _DST {
|
||||
|
||||
WORD XDPI; /* Aufloesung in X-Richtung*/
|
||||
WORD YDPI; /* Aufloesung in Y-Richtung*/
|
||||
WORD XInch; /* Groesse X in Inch * 1000*/
|
||||
WORD YInch; /* Groesse Y in Inch * 1000*/
|
||||
|
||||
WORD ColorCount; /* Anzahl Farben des Modus*/
|
||||
BYTE ColorBits; /* Anzahl Bit in denen ein Pixel codiert ist */
|
||||
BYTE Flags; /* Diverse bitmapped Flags */
|
||||
|
||||
char *Name; /* Name des Modes */
|
||||
|
||||
void (*Print) ( struct _DST * , int );
|
||||
/*void (*Print) (); *//* Druck-Routine */
|
||||
|
||||
/* Member functions, die obige Flags auswerten, alle inline! */
|
||||
/*BOOLEAN IsEpson () const { return Flags & pfIsEpson; } */
|
||||
/*BOOLEAN Reverse () const { return Flags & pfReverse; } */
|
||||
/*BOOLEAN SeparateBlack () const { return Flags & pfSeparateBlack; } */
|
||||
/*BOOLEAN DoCompression () const { return Flags & pfDoCompression; } */
|
||||
/*BOOLEAN HasPalette () const { return Flags & pfHasPalette; } */
|
||||
|
||||
};
|
||||
|
||||
#define IsEpson(x) (x->Flags & pfIsEpson)
|
||||
#define Reverse(x) (x->Flags & pfReverse)
|
||||
#define hasSeparateBlack(x) (x->Flags & pfSeparateBlack)
|
||||
#define DoCompression(x) (x->Flags & pfDoCompression)
|
||||
#define HasPalette(x) (x->Flags & pfHasPalette)
|
||||
|
||||
/* Der Zeiger auf die aktuelle DST*/
|
||||
/* extern struct _DST *DSTPtr; */
|
||||
/* Die Tabelle mit den Zeigern auf die Modi*/
|
||||
extern struct _DST *DSTTable [MaxModes];
|
||||
|
||||
|
||||
/* Groesse des Ausgabepuffers*/
|
||||
#define PrintBufSize 1024
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Dot matrix printers related procedures */
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Die folgende Struktur enthaelt einen Device-Status-Block. Die ersten */
|
||||
/* Werte muessen immer dieselben sein, da sie vom Grafik-Modul so erwartet */
|
||||
/* werden. Im Anschluss kommen eigene Variablen, die von Drucker zu Drucker */
|
||||
/* bzw. besser von Treiber zu Treiber verschieden sein koennen. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
struct EpsonDST {
|
||||
|
||||
struct _DST DST; /* Orginal-DST */
|
||||
|
||||
BYTE ColBytes; /* Anzahl Bytes / Druckerspalte */
|
||||
BYTE PassCount; /* Wie oft ueberdrucken */
|
||||
|
||||
char *LineFeed1; /* Normaler Linefeed */
|
||||
char *LineFeed2; /* Linefeed zwischen Ueberdrucken */
|
||||
|
||||
char *GraphicsOn; /* Grafik einschalten (mit Init) */
|
||||
char *GraphicsOff; /* Grafik ausschalten */
|
||||
|
||||
char *PreBytes; /* String vor Grafik-Daten */
|
||||
char *PostBytes; /* String nach Grafik-Daten */
|
||||
|
||||
};
|
||||
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* Universelle Ausgaberoutine fuer Nadeldrucker. */
|
||||
/* */
|
||||
/* Parameter: */
|
||||
/* (keine) */
|
||||
/* */
|
||||
/* Ergebnisse: */
|
||||
/* (keine) bzw. hoffentlich ein Ausdruck... */
|
||||
/* */
|
||||
/****************************************************************************/
|
||||
|
||||
void EpsonPrint ( struct _DST * DSTPtr , int PRNHandle );
|
||||
/* Universelle Drucker-Routine fuer Nadeldrucker */
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* Laser and DeskJet printers related procedures */
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* Die folgende Struktur enthaelt fuer den LaserJet angepassten Device- */
|
||||
/* Status Block. */
|
||||
/* */
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
struct LJDST {
|
||||
|
||||
struct _DST DST; /* Orginal-DST */
|
||||
char *GraphicsOn; /* Grafik einschalten (mit Init) */
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
void LaserPrint ( struct _DST * DSTPtr , int PRNHandle );
|
||||
|
||||
|
||||
#endif
|
1047
thirdparty/grx249/addons/print/printer.doc
vendored
Normal file
1047
thirdparty/grx249/addons/print/printer.doc
vendored
Normal file
File diff suppressed because it is too large
Load diff
78
thirdparty/grx249/addons/print/printest.c
vendored
Normal file
78
thirdparty/grx249/addons/print/printest.c
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
#include <string.h>
|
||||
#include <grx20.h>
|
||||
#include <stdio.h>
|
||||
#include "grxprint.h"
|
||||
|
||||
|
||||
static void displaytext (GrFont *font,char *text,int len);
|
||||
|
||||
|
||||
int GRXMain (int argc , char * argv [])
|
||||
{
|
||||
int i, j, rc, mc, MaxX, MaxY;
|
||||
unsigned AspX, AspY;
|
||||
double Asp, r;
|
||||
char * text = "Printing example from GRX";
|
||||
GrFont * Fnt = GrBuildConvertedFont(
|
||||
&GrDefaultFont,
|
||||
(GR_FONTCVT_SKIPCHARS | GR_FONTCVT_RESIZE),
|
||||
36,
|
||||
72,
|
||||
' ',
|
||||
'z'
|
||||
);
|
||||
|
||||
/* rc = GrPrintSetMode (LQ_180x180); mc = 2; */
|
||||
/* rc = GrPrintSetMode (HPLJ_300x300); mc = 2; */
|
||||
/* rc = GrPrintSetMode (HPLJ_1200x1200); mc = 2; */
|
||||
/* rc = GrPrintSetMode (HPLJ_IV_600x600); mc = 2; */
|
||||
/* rc = GrPrintSetMode (HPLJ_300x300_NC); mc = 2; */
|
||||
rc = GrPrintSetMode (HPDJ500C_300x300x8_B); mc = 8;
|
||||
printf ("GrPrintSetMode : rc=%d\n",rc);
|
||||
|
||||
MaxX = GrMaxX ();
|
||||
MaxY = GrMaxY ();
|
||||
GrPrintGetAspectRatio (&AspX,&AspY);
|
||||
Asp = ((double) AspX)/AspY;
|
||||
printf ("Size : (%d %d)\n",MaxX,MaxY);
|
||||
|
||||
GrBox (0,0,MaxX,MaxY,mc-1); /* Draw box around page */
|
||||
GrLine (0,MaxY,MaxX,MaxY-30,mc-1);
|
||||
r = (int) (MaxY/20);
|
||||
GrEllipse ((int) (r*Asp), (int) r, (int) (r*Asp), (int) r, mc-1);
|
||||
displaytext (Fnt,text,strlen(text));
|
||||
|
||||
if (mc>2) for (i=0; i<8; i++)
|
||||
{
|
||||
int x0 = 50*i;
|
||||
GrFilledBox (x0,1,x0+30,31,i);
|
||||
}
|
||||
|
||||
for (i=1; i<14; i++)
|
||||
{
|
||||
r = (double) (MaxY*(0.45-0.03*i));
|
||||
for (j=0; j<(mc>2 ? 3 : 1); j++)
|
||||
{
|
||||
GrEllipse (MaxX/2-100,MaxY/2,
|
||||
(int) (r*Asp), (int) r, i>=mc ? mc-1 : i);
|
||||
r--;
|
||||
}
|
||||
}
|
||||
GrPrintToFile ("test.pcl");
|
||||
/* GrDoPrinting (); */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void displaytext (GrFont *font,char *text,int len)
|
||||
{
|
||||
GrTextOption opt;
|
||||
memset(&opt,0,sizeof(opt));
|
||||
opt.txo_font = font;
|
||||
opt.txo_xalign = GR_ALIGN_LEFT;
|
||||
opt.txo_yalign = GR_ALIGN_TOP;
|
||||
opt.txo_direct = GR_TEXT_RIGHT;
|
||||
opt.txo_fgcolor.v = 1;
|
||||
opt.txo_bgcolor.v = 0;
|
||||
GrDrawString(text,len,100,100,&opt);
|
||||
}
|
1655
thirdparty/grx249/addons/print/prndata.c
vendored
Normal file
1655
thirdparty/grx249/addons/print/prndata.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
BIN
thirdparty/grx249/addons/print/prndata.lo
vendored
Normal file
BIN
thirdparty/grx249/addons/print/prndata.lo
vendored
Normal file
Binary file not shown.
45
thirdparty/grx249/addons/print/readme.txt
vendored
Normal file
45
thirdparty/grx249/addons/print/readme.txt
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
Printing from GRX
|
||||
|
||||
This is source of beta version of printing procedures for GRX.
|
||||
These procedures are based on sources of printer BGI drivers
|
||||
for Borland C++ and Pascal compilers. This BGI driver was
|
||||
developed by Ullrich von Bassevitz (see copying.uz).
|
||||
|
||||
Only part of sources of printer BGI driver are used. I didn't port
|
||||
drawing functions from BGI driver as they are already implemented in GRX.
|
||||
I took only printing part which is now rather heavily modified to get
|
||||
rid of Borland C++ specific features (e.g. inline assembler).
|
||||
|
||||
Current version is tested with DJGPP and Linux versions of GRX only.
|
||||
I didn't even try to compile it with Borland C++ for real mode as
|
||||
I think it is useless due to lack of memory needed for buffer where
|
||||
to create image. To print from GRX under Linux one should install
|
||||
printer filter that allows to send PCL output to printer.
|
||||
|
||||
Only some modes are tested:
|
||||
Epson LQ printer : 180x180 dpi
|
||||
LaserJet 4L : 300x300 dpi (with and without compression)
|
||||
|
||||
I also tried DeskJet 500C mode (300x300 dpi with separate black)
|
||||
on DeskJet 690C and it worked.
|
||||
|
||||
Printing code is linked into executable only when it is really required.
|
||||
|
||||
Currently it's included as addon to GRX.
|
||||
|
||||
-------------------- Files -------------------------------------------
|
||||
grxprint.c - main sources of printing code
|
||||
grxprint.h - interface definitions for user
|
||||
prndata.c - printer definitions
|
||||
grxprn00.h - definitions used internally by grxprint only
|
||||
printest.c - test example
|
||||
copying.uz - original copyright notice from Ullrich von Bassevitz
|
||||
printer.doc - original docs on printer BGI driver
|
||||
------------------------------------------------------------------------
|
||||
|
||||
NOTE: Ullrich von Bassevitz is no more maintaining printer BGI driver.
|
||||
Addresses mentioned in printer.doc are NO MORE USABLE
|
||||
|
||||
|
||||
Andris Pavenis
|
||||
e-mail: pavenis@latnet.lv
|
47
thirdparty/grx249/addons/print/readme.uz
vendored
Normal file
47
thirdparty/grx249/addons/print/readme.uz
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
|
||||
Das Paket enthaelt die komplette Distribution meines PRINTER BGI-Treibers mit
|
||||
allen Quellen.
|
||||
|
||||
|
||||
|
||||
Bitte beachten:
|
||||
|
||||
* Fuer die Uebersetzung der Quellen wird Borland C++ in der Version
|
||||
3.1 benoetigt.
|
||||
|
||||
* Die Adressen und Telefonnumern, die in README.TXT genannt sind, sind
|
||||
nicht mehr gueltig.
|
||||
|
||||
* Ich will keine Anrufe, Briefe oder Mails bezueglich des Treibers
|
||||
bekommen. Ich mache nichts mehr mit dem Treiber, und o.g. Dinge
|
||||
stehlen mir nur meine Zeit. Eine Ausnahme mache ich nur, wenn mir
|
||||
die anfallende Zeit bezahlt wird.
|
||||
|
||||
* Fuer die Quellen gilt folgendes Copyright:
|
||||
|
||||
Die Software (sowohl die Quellcodes, als auch die Binaries) werden
|
||||
ohne jegliche Zusagen/Garantien bez<65>glich Funktionalit„t oder
|
||||
Funktionsf„higkeit abgegeben. Weder die Autoren noch die Distributoren
|
||||
<EFBFBD>bernehmen eine Verantwortung f<>r Sch„den, die durch die Benutzung der
|
||||
Software verursacht werden.
|
||||
|
||||
Die Software darf frei verwendet und weitergegeben werden, wobei
|
||||
"frei" ausdr<64>cklich auch eine kommerzielle Nutzung/Weitergabe
|
||||
einschlieát, *vorausgesetzt* die folgenden Bedingungen werden
|
||||
eingehalten:
|
||||
|
||||
1. Die Herkunft der Software muá - wenn <20>berhaupt - dann korrekt
|
||||
angegeben werden. Es ist nicht erlaubt, die Software als Werk
|
||||
eines anderen auszugeben. Wird die Software in Teilen oder als
|
||||
Ganzes in einem Produkt benutzt, dann w<>rde ich mich <20>ber einen
|
||||
Hinweis auf die Herkunft in der Dokumentation freuen. Ein solcher
|
||||
Hinweis ist aber nicht zwingend notwendig.
|
||||
|
||||
2. Ge„nderte Quellcodes m<>ssen deutlich als solche gekennzeichnet
|
||||
werden und d<>rfen nicht ohne einen expliziten Hinweis auf die
|
||||
durchgef<65>hrten Žnderungen weiterverteilt werden.
|
||||
|
||||
3. Die Bedingungen <20>ber die Nutzung/Weitergabe d<>rfen nicht entfernt
|
||||
oder ge„ndert werden.
|
||||
|
||||
|
32
thirdparty/grx249/chr/addfonts.bat
vendored
Executable file
32
thirdparty/grx249/chr/addfonts.bat
vendored
Executable file
|
@ -0,0 +1,32 @@
|
|||
rem We are not distributing Borland BGI fonts with GRX.
|
||||
rem To add them to the library put .CHR files in this
|
||||
rem directory (where this script is located) and run it
|
||||
rem after building GRX
|
||||
rem This file is for Borland C.
|
||||
|
||||
if "%1"=="" addfonts bold euro goth lcom litt sans scri simp trip tscr
|
||||
|
||||
del *.obj
|
||||
del addfonts.rsp
|
||||
bcc -O -ml -ebin2c.exe ..\src\utilprog\bin2c.c
|
||||
|
||||
:proc
|
||||
if not exist %1.chr goto next
|
||||
|
||||
echo Processing %1.chr
|
||||
bin2c %1.chr _%1_font %1.c
|
||||
bcc -c -O -ml %1.c
|
||||
echo +%1.obj & >> addfonts.rsp
|
||||
del %1.c
|
||||
|
||||
:next
|
||||
shift
|
||||
if not "%1"=="" goto proc
|
||||
|
||||
:done
|
||||
echo , >> addfonts.rsp
|
||||
tlib ..\lib\bcc\grx20l.lib @addfonts.rsp
|
||||
|
||||
del *.obj
|
||||
del addfonts.rsp
|
||||
del ..\lib\bcc\grx20l.bak
|
21
thirdparty/grx249/chr/addfonts.sh
vendored
Executable file
21
thirdparty/grx249/chr/addfonts.sh
vendored
Executable file
|
@ -0,0 +1,21 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# We are not distributing Borland BGI fonts with GRX.
|
||||
# To add them to the library put .CHR files in this
|
||||
# directory (where this script is located) and run it
|
||||
# after building GRX
|
||||
#
|
||||
|
||||
rm -f *.o
|
||||
gcc -O2 ../src/utilprog/bin2c.c -o bin2c.exe
|
||||
for x in *.chr; do
|
||||
echo "Processing $x ...";
|
||||
name=`basename $x | sed -e 's,\.chr,,g'`
|
||||
./bin2c $x _${name}_font $name.c
|
||||
gcc -c -O2 $name.c
|
||||
rm $name.c
|
||||
done
|
||||
|
||||
ar rc ../lib/dj2/libgrx20.a *.o
|
||||
ranlib ../lib/dj2/libgrx20.a
|
||||
rm -f *.o
|
21
thirdparty/grx249/chr/addfonts.x11
vendored
Executable file
21
thirdparty/grx249/chr/addfonts.x11
vendored
Executable file
|
@ -0,0 +1,21 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# We are not distributing Borland BGI fonts with GRX.
|
||||
# To add them to the library put .CHR files in this
|
||||
# directory (where this script is located) and run it
|
||||
# after building GRX
|
||||
#
|
||||
|
||||
rm -f *.o
|
||||
gcc -O2 ../src/utilprog/bin2c.c -o bin2c
|
||||
for x in *.chr; do
|
||||
echo "Processing $x ...";
|
||||
name=`basename $x | sed -e 's,\.chr,,g'`
|
||||
./bin2c $x _${name}_font $name.c
|
||||
gcc -c -O2 $name.c
|
||||
rm $name.c
|
||||
done
|
||||
|
||||
ar rc ../lib/unix/libgrx20X.a *.o
|
||||
ranlib ../lib/unix/libgrx20X.a
|
||||
rm -f *.o
|
64
thirdparty/grx249/compat/grx.h
vendored
Normal file
64
thirdparty/grx249/compat/grx.h
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
** grx.h ---- GRX 2.0 -> 1.0x backward compatibility declarations
|
||||
**
|
||||
** Copyright (c) 1995 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
|
||||
** [e-mail: csaba@vuse.vanderbilt.edu]
|
||||
**
|
||||
** This file is part of the GRX graphics library.
|
||||
**
|
||||
** The GRX graphics library is free software; you can redistribute it
|
||||
** and/or modify it under some conditions; see the "copying.grx" file
|
||||
** for details.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
**/
|
||||
|
||||
#ifndef __GRX_H_INCLUDED__
|
||||
#define __GRX_H_INCLUDED__
|
||||
|
||||
#ifndef __GRX20_H_INCLUDED__
|
||||
#include "grx20.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* old style context creation
|
||||
*/
|
||||
static char far *_context_memory_[4] = { 0 };
|
||||
#ifdef GrCreateContext
|
||||
#undef GrCreateContext
|
||||
#endif
|
||||
#define GrCreateContext(w,h,mem,where) ( \
|
||||
_context_memory_[0] = (char far *)(mem), \
|
||||
GrCreateFrameContext( \
|
||||
GrCoreFrameMode(), \
|
||||
(w),(h), \
|
||||
(((GrCurrentFrameDriver()->num_planes == 1) && _context_memory_[0]) ? \
|
||||
_context_memory_ : \
|
||||
(char far **)0 \
|
||||
), \
|
||||
(where) \
|
||||
) \
|
||||
)
|
||||
|
||||
/*
|
||||
* drawing stuff
|
||||
*/
|
||||
#define GR_MAX_POLY_VERTICES GR_MAX_POLYGON_POINTS
|
||||
#define GrCircleArc(x,y,r,s,e,c) (GrCircleArc)((x),(y),(r),(s),(e),GR_ARC_STYLE_OPEN,(c))
|
||||
#define GrEllipseArc(x,y,w,h,s,e,c) (GrEllipseArc)((x),(y),(w),(h),(s),(e),GR_ARC_STYLE_OPEN,(c))
|
||||
#define GrFilledCircleArc(x,y,r,s,e,c) (GrFilledCircleArc)((x),(y),(r),(s),(e),GR_ARC_STYLE_CLOSE2,(c))
|
||||
#define GrFilledEllipseArc(x,y,w,h,s,e,c) (GrFilledEllipseArc)((x),(y),(w),(h),(s),(e),GR_ARC_STYLE_CLOSE2,(c))
|
||||
#define GrGetLastArcCoords GrLastArcCoords
|
||||
|
||||
/*
|
||||
* text stuff
|
||||
*/
|
||||
#define GrLoadBIOSFont GrLoadFont /* I don't know whether this is a good idea */
|
||||
#define GrFontWidth(opt) ((opt)->txo_font->h.width)
|
||||
#define GrFontHeight(opt) ((opt)->txo_font->h.height)
|
||||
|
||||
#endif /* whole file */
|
||||
|
88
thirdparty/grx249/compat/mousex.h
vendored
Normal file
88
thirdparty/grx249/compat/mousex.h
vendored
Normal file
|
@ -0,0 +1,88 @@
|
|||
/**
|
||||
** mousex.h ---- GRX 2.0 -> 1.0x mouse backward compatibility declarations
|
||||
**
|
||||
** Copyright (c) 1995 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
|
||||
** [e-mail: csaba@vuse.vanderbilt.edu]
|
||||
**
|
||||
** This file is part of the GRX graphics library.
|
||||
**
|
||||
** The GRX graphics library is free software; you can redistribute it
|
||||
** and/or modify it under some conditions; see the "copying.grx" file
|
||||
** for details.
|
||||
**
|
||||
** This library is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
**/
|
||||
|
||||
#ifndef __MOUSEX_H_INCLUDED__
|
||||
#define __MOUSEX_H_INCLUDED__
|
||||
|
||||
#ifndef __GRX20_H_INCLUDED__
|
||||
#include "grx20.h"
|
||||
#endif
|
||||
|
||||
#ifndef M_MOTION /* "eventque.h" also defines these */
|
||||
#define M_MOTION GR_M_MOTION
|
||||
#define M_LEFT_DOWN GR_M_LEFT_DOWN
|
||||
#define M_LEFT_UP GR_M_LEFT_UP
|
||||
#define M_RIGHT_DOWN GR_M_RIGHT_DOWN
|
||||
#define M_RIGHT_UP GR_M_RIGHT_UP
|
||||
#define M_MIDDLE_DOWN GR_M_MIDDLE_DOWN
|
||||
#define M_MIDDLE_UP GR_M_MIDDLE_UP
|
||||
#define M_BUTTON_DOWN GR_M_BUTTON_DOWN
|
||||
#define M_BUTTON_UP GR_M_BUTTON_UP
|
||||
#define M_BUTTON_CHANGE GR_M_BUTTON_CHANGE
|
||||
#define M_LEFT GR_M_LEFT
|
||||
#define M_RIGHT GR_M_RIGHT
|
||||
#define M_MIDDLE GR_M_MIDDLE
|
||||
#endif /* M_MOTION */
|
||||
|
||||
#define M_KEYPRESS GR_M_KEYPRESS
|
||||
#define M_POLL GR_M_POLL
|
||||
#define M_NOPAINT GR_M_NOPAINT
|
||||
#define M_EVENT GR_M_EVENT
|
||||
|
||||
#ifndef KB_SHIFT /* "eventque.h" also defines these */
|
||||
#define KB_RIGHTSHIFT GR_KB_RIGHTSHIFT
|
||||
#define KB_LEFTSHIFT GR_KB_LEFTSHIFT
|
||||
#define KB_CTRL GR_KB_CTRL
|
||||
#define KB_ALT GR_KB_ALT
|
||||
#define KB_SCROLLOCK GR_KB_SCROLLOCK
|
||||
#define KB_NUMLOCK GR_KB_NUMLOCK
|
||||
#define KB_CAPSLOCK GR_KB_CAPSLOCK
|
||||
#define KB_INSERT GR_KB_INSERT
|
||||
#define KB_SHIFT GR_KB_SHIFT
|
||||
#endif /* KB_SHIFT */
|
||||
|
||||
#define M_CUR_NORMAL GR_M_CUR_NORMAL
|
||||
#define M_CUR_RUBBER GR_M_CUR_RUBBER
|
||||
#define M_CUR_LINE GR_M_CUR_LINE
|
||||
#define M_CUR_BOX GR_M_CUR_BOX
|
||||
|
||||
#define MouseEvent GrMouseEvent
|
||||
#define MouseDetect GrMouseDetect
|
||||
#define MouseEventMode GrMouseEventMode
|
||||
#define MouseInit GrMouseInit
|
||||
#define MouseUnInit GrMouseUnInit
|
||||
#define MouseSetSpeed(s) GrMouseSetSpeed(1,s)
|
||||
#define MouseSetAccel GrMouseSetAccel
|
||||
#define MouseSetLimits GrMouseSetLimits
|
||||
#define MouseGetLimits GrMouseGetLimits
|
||||
#define MouseWarp GrMouseWarp
|
||||
#define MouseEventEnable GrMouseEventEnable
|
||||
#define MouseGetEvent GrMouseGetEvent
|
||||
#define MousePendingEvent GrMousePendingEvent
|
||||
#define MouseGetCursor GrMouseGetCursor
|
||||
#define MouseSetCursor GrMouseSetCursor
|
||||
#define MouseSetColors GrMouseSetColors
|
||||
#define MouseSetCursorMode GrMouseSetCursorMode
|
||||
#define MouseDisplayCursor GrMouseDisplayCursor
|
||||
#define MouseEraseCursor GrMouseEraseCursor
|
||||
#define MouseBlock GrMouseBlock
|
||||
#define MouseUnBlock GrMouseUnBlock
|
||||
#define MouseCursorIsDisplayed GrMouseCursorIsDisplayed
|
||||
|
||||
#endif /* whole file */
|
||||
|
403
thirdparty/grx249/configure
vendored
Executable file
403
thirdparty/grx249/configure
vendored
Executable file
|
@ -0,0 +1,403 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Configure script for GRX
|
||||
#
|
||||
# NOTE: This script is completely OPTIONAL. If you don't know what
|
||||
# to do with it, just ignore it and follow the normal install
|
||||
# instructions.
|
||||
#
|
||||
# Copyright (C) 2001-2002,2004 Frank Heckenbach <frank@pascal.gnu.de>
|
||||
# Peter Gerwinski <peter@gerwinski.de>
|
||||
#
|
||||
# Parts copied from some version of GCC's configure script,
|
||||
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
silent=n
|
||||
|
||||
default_prefix=/usr/local
|
||||
prefix=$default_prefix
|
||||
exec_prefix='${prefix}'
|
||||
bindir='${exec_prefix}/bin'
|
||||
datadir='${prefix}/share'
|
||||
libdir='${exec_prefix}/lib'
|
||||
includedir='${prefix}/include'
|
||||
infodir='${prefix}/info'
|
||||
|
||||
# "Detect" default target (wrong for cross-compiling)
|
||||
if [ x"$COMSPEC" != x ]; then
|
||||
default_target=DJGPP
|
||||
else
|
||||
default_target=x11
|
||||
fi
|
||||
target=$default_target
|
||||
|
||||
default_fontpath='${datadir}/grx/fonts'
|
||||
fontpath=""
|
||||
|
||||
default_x11base=/usr/X11R6
|
||||
x11base="$default_x11base"
|
||||
|
||||
default_x11lib='$(X11BASE)/lib'
|
||||
x11lib="$default_x11lib"
|
||||
|
||||
default_unitspath='${exec_prefix}/units'
|
||||
unitspath="$default_unitspath"
|
||||
|
||||
HAVE_LIBJPEG=n
|
||||
HAVE_LIBPNG=n
|
||||
NEED_ZLIB=n
|
||||
HAVE_LIBTIFF=n
|
||||
# if you are able to run this script you have (ba)sh
|
||||
# we suppose you have other needed unix tools as well
|
||||
HAVE_UNIX_TOOLS=y
|
||||
INCLUDE_BMP_CODE=y
|
||||
INCLUDE_PRINTING_CODE=y
|
||||
INCLUDE_GPC_SUPPORT=n
|
||||
INCLUDE_SHARED_SUPPORT=y
|
||||
INCLUDE_BGI_SUPPORT=y
|
||||
USE_DIRECT_MOUSE_DRIVER=n
|
||||
USE_SVGALIB_DRIVER=y
|
||||
USE_FRAMEBUFFER_DRIVER=y
|
||||
SET_SUIDROOT=y
|
||||
USE_INOUTP_FRAMEDRIVERS=y
|
||||
BUILD_X86_64=n
|
||||
lsocket=""
|
||||
subst_EP=""
|
||||
|
||||
ac_prev=
|
||||
for ac_option do
|
||||
|
||||
# If the previous option needs an argument, assign it.
|
||||
if test -n "$ac_prev"; then
|
||||
eval "$ac_prev=\$ac_option"
|
||||
ac_prev=
|
||||
continue
|
||||
fi
|
||||
|
||||
case "$ac_option" in
|
||||
-*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'`;;
|
||||
*) ac_optarg=;;
|
||||
esac
|
||||
|
||||
case "$ac_option" in
|
||||
|
||||
-s | --silent | --silen | --sile | --sil | --si | --s)
|
||||
silent=y;;
|
||||
|
||||
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
|
||||
ac_prev=prefix;;
|
||||
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
|
||||
prefix="$ac_optarg";;
|
||||
|
||||
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
|
||||
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
|
||||
| --exec | --exe | --ex)
|
||||
ac_prev=exec_prefix ;;
|
||||
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
|
||||
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
|
||||
| --exec=* | --exe=* | --ex=*)
|
||||
exec_prefix=$ac_optarg ;;
|
||||
|
||||
-bindir | --bindir | --bindi | --bind | --bin | --bi)
|
||||
ac_prev=bindir ;;
|
||||
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
|
||||
bindir=$ac_optarg ;;
|
||||
|
||||
-libdir | --libdir | --libdi | --libd)
|
||||
ac_prev=libdir ;;
|
||||
-libdir=* | --libdir=* | --libdi=* | --libd=*)
|
||||
libdir=$ac_optarg ;;
|
||||
|
||||
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
|
||||
ac_prev=datadir ;;
|
||||
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
|
||||
| --da=*)
|
||||
datadir=$ac_optarg ;;
|
||||
|
||||
-includedir | --includedir | --includedi | --included | --include \
|
||||
| --includ | --inclu | --incl | --inc)
|
||||
ac_prev=includedir ;;
|
||||
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
|
||||
| --includ=* | --inclu=* | --incl=* | --inc=*)
|
||||
includedir=$ac_optarg ;;
|
||||
|
||||
-infodir | --infodir | --infodi | --infod | --info | --inf)
|
||||
ac_prev=infodir ;;
|
||||
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
|
||||
infodir=$ac_optarg ;;
|
||||
|
||||
-target | --target | --targe | --targ | --tar | --ta | --t)
|
||||
ac_prev=target;;
|
||||
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
|
||||
target="$ac_optarg";;
|
||||
|
||||
# Don't complain about unknown enable, disable, with and without options
|
||||
-enable-* | --enable-* | -en-* | --en-*)
|
||||
case "`echo "$ac_option" | sed -e 's/^-*enable-//;s/^-*en-//'`" in
|
||||
x86_64) BUILD_X86_64=y;;
|
||||
jpeg) HAVE_LIBJPEG=y;;
|
||||
png) HAVE_LIBPNG=y;;
|
||||
z | zlib) NEED_ZLIB=y;;
|
||||
png-z) HAVE_LIBPNG=y; NEED_ZLIB=y;;
|
||||
tiff) HAVE_LIBTIFF=y;;
|
||||
bmp) INCLUDE_BMP_CODE=y;;
|
||||
print) INCLUDE_PRINTING_CODE=y;;
|
||||
pascal | gpc) INCLUDE_GPC_SUPPORT=y;;
|
||||
shared) INCLUDE_SHARED_SUPPORT=y;;
|
||||
bgi) INCLUDE_BGI_SUPPORT=y;;
|
||||
direct-mouse) USE_DIRECT_MOUSE_DRIVER=y;;
|
||||
svgalib) USE_SVGALIB_DRIVER=y;;
|
||||
framebuffer) USE_FRAMEBUFFER_DRIVER=y;;
|
||||
suidroot) SET_SUIDROOT=y;;
|
||||
io-framedrivers) USE_INOUTP_FRAMEDRIVERS=y;;
|
||||
lsocket) lsocket=" -lsocket";;
|
||||
esac;;
|
||||
-disable-* | --disable-* | -di-* | --di-*)
|
||||
case "`echo "$ac_option" | sed -e 's/^-*disable-//;s/^-*di-//'`" in
|
||||
x86_64) BUILD_X86_64=n;;
|
||||
jpeg) HAVE_LIBJPEG=n;;
|
||||
png) HAVE_LIBPNG=n;;
|
||||
z | zlib) NEED_ZLIB=n;;
|
||||
png-z) HAVE_LIBPNG=n; NEED_ZLIB=n;;
|
||||
tiff) HAVE_LIBTIFF=n;;
|
||||
bmp) INCLUDE_BMP_CODE=n;;
|
||||
print) INCLUDE_PRINTING_CODE=n;;
|
||||
pascal | gpc) INCLUDE_GPC_SUPPORT=n;;
|
||||
shared) INCLUDE_SHARED_SUPPORT=n;;
|
||||
bgi) INCLUDE_BGI_SUPPORT=n;;
|
||||
direct-mouse) USE_DIRECT_MOUSE_DRIVER=n;;
|
||||
svgalib) USE_SVGALIB_DRIVER=n;;
|
||||
framebuffer) USE_FRAMEBUFFER_DRIVER=n;;
|
||||
suidroot) SET_SUIDROOT=n;;
|
||||
io-framedrivers) USE_INOUTP_FRAMEDRIVERS=n;;
|
||||
lsocket) lsocket="";;
|
||||
esac;;
|
||||
-with-* | --with-*)
|
||||
case "`echo "$ac_option" | sed -e 's/^-*with-//'`" in
|
||||
fontpath=*) fontpath="$ac_optarg";;
|
||||
fontpath) fontpath="$default_fontpath";;
|
||||
x11-base=*) x11base="$ac_optarg";;
|
||||
x11-base) echo "$0: \`--with-x11-base' requires an argument" >&2; exit 1;;
|
||||
x11-lib=*) x11lib="$ac_optarg";;
|
||||
x11-base) echo "$0: \`--with-x11-lib' requires an argument" >&2; exit 1;;
|
||||
unitspath=*) unitspath="$ac_optarg";;
|
||||
unitspath) echo "$0: \`--with-unitspath' requires an argument" >&2; exit 1;;
|
||||
esac;;
|
||||
-without-* | --without-*)
|
||||
case "`echo "$ac_option" | sed -e 's/^-*without-//'`" in
|
||||
fontpath) fontpath="";;
|
||||
esac;;
|
||||
-h | -help | --help | --hel | --he)
|
||||
cat << EOF
|
||||
Usage: $0 [options]
|
||||
Options: [defaults in brackets after descriptions]
|
||||
--help print this message and exit
|
||||
--version print version information and exit
|
||||
--silent silent operation
|
||||
--prefix=PREFIX install architecture-independent files in PREFIX
|
||||
[$default_prefix]
|
||||
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
|
||||
[PREFIX]
|
||||
--bindir=DIR user executables [EPREFIX/bin]
|
||||
--datadir=DIR read-only architecture-independent data
|
||||
[PREFIX/share]
|
||||
--libdir=DIR object code libraries [EPREFIX/lib]
|
||||
--includedir=DIR C header files [PREFIX/include]
|
||||
--infodir=DIR info documentation [PREFIX/info]
|
||||
--target=TARGET configure for TARGET [$default_target]
|
||||
possible values: djgpp,x11,console,w32,sdlx,sdlw
|
||||
or GCC-style ("i386-mingw32") for cross-compiling
|
||||
--enable-x86_64 build for x86_64 architecture [no]
|
||||
--enable-jpeg include JPEG support [no]
|
||||
--enable-png include PNG support [no]
|
||||
--enable-zlib use zlib [no]
|
||||
--enable-png-z include PNG support and use zlib [no]
|
||||
--enable-tiff include TIFF support [no]
|
||||
--enable-bmp include BMP support [yes]
|
||||
--enable-print include printing code [yes]
|
||||
--enable-pascal or include Pascal support [no]
|
||||
--enable-gpc
|
||||
--enable-shared build shared libraries [yes]
|
||||
--enable-bgi include BGI support [yes]
|
||||
--enable-lsocket link lsocket [no]
|
||||
--disable-FOO opposite of --enable-FOO
|
||||
--with-fontpath=PATH set GRX font path to PATH
|
||||
--with-fontpath set GRX font path to $default_fontpath
|
||||
--without-fontpath use no GRX font path [default]
|
||||
--with-x11-base=DIR use DIR as X11 base directory [$default_x11base]
|
||||
--with-x11-lib=DIR use DIR as X11 lib directory [$default_x11lib]
|
||||
--with-unitspath=PATH set GPC units path to PATH [$default_unitspath]
|
||||
The following options apply to the Linux console (not X11) target only:
|
||||
--enable-direct-mouse use PS/2 instead of svgalib mouse driver [no]
|
||||
--enable-svgalib use svgalib driver [yes]
|
||||
--enable-framebuffer use framebuffer driver [yes]
|
||||
--enable-suidroot create suid root executables (required with svgalib
|
||||
1.4.x) [yes]
|
||||
--enable-io-framedrivers use frame drivers that require suid root
|
||||
executables under newer versions of svgalib [yes]
|
||||
Some options can be abbreviated, e.g. \`--p' for \`--prefix',
|
||||
\`--en-FOO' for \`--enable-FOO' and \`--di-FOO' for \`--disable-FOO'.
|
||||
NOTE: This script is completely OPTIONAL. If you don't know what to do with it,
|
||||
just ignore it and follow the normal install instructions.
|
||||
EOF
|
||||
exit 0;;
|
||||
-v | -version | --version | --versio | --versi | --vers)
|
||||
echo "Optional GRX configure script"
|
||||
exit 0;;
|
||||
*) { echo "$0: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "`echo "$target" | tr A-Z a-z`" in
|
||||
*djgpp*) cfgsection=GRXVDJ2; target_makefile=makefile.dj2;;
|
||||
x | x11) cfgsection=GRXVX11; target_makefile=makefile.x11;;
|
||||
console) cfgsection=GRXVLNX; target_makefile=makefile.lnx;;
|
||||
*w32 | *mingw*) cfgsection=GRXVW32; target_makefile=makefile.w32;;
|
||||
sdlx) cfgsection=GRXVX11; target_makefile=makefile.sdl; subst_EP="/^EP=/s/=.*/=x/";;
|
||||
sdlw) cfgsection=GRXVW32; target_makefile=makefile.sdl; subst_EP="/^EP=/s/=.*/=/";;
|
||||
*) echo "$0: invalid target" >&2; exit 1;;
|
||||
esac
|
||||
|
||||
case "$target" in
|
||||
*[A-Za-z0-9]-[A-Za-z0-9]*|mingw32)
|
||||
CROSS_PLATFORM="`echo "$target" | tr A-Z a-z`-"
|
||||
exec_prefix="$prefix/$target";;
|
||||
*)
|
||||
CROSS_PLATFORM=""
|
||||
exec_prefix='${prefix}';;
|
||||
esac
|
||||
|
||||
if [ $USE_SVGALIB_DRIVER != y ] && [ $USE_FRAMEBUFFER_DRIVER != y ]; then
|
||||
echo "$0: either \`--enable-svgalib' or \`--enable-framebuffer' must be set" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $USE_SVGALIB_DRIVER != y ] && [ $USE_DIRECT_MOUSE_DRIVER != y ]; then
|
||||
echo "$0: if \`--disable-svgalib' is unset then \`--enable-direct-mouse' must be set" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -r Makefile ]; then
|
||||
if cmp Makefile makefile.lnx > /dev/null 2>&1 ||
|
||||
cmp Makefile makefile.dj2 > /dev/null 2>&1 ||
|
||||
cmp Makefile makefile.w32 > /dev/null 2>&1 ||
|
||||
cmp Makefile makefile.x11 > /dev/null 2>&1 ||
|
||||
cmp Makefile makefile.sdl > /dev/null 2>&1; then
|
||||
rm -f Makefile
|
||||
else
|
||||
echo "$0: Makefile exists already. Not overwriting!" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -r "$target_makefile" ]; then
|
||||
echo "$0: $target_makefile not found (please run in source directory)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# On DJGPP, `ln -s' creates `makefile.exe', so copy in this case
|
||||
{ ln -s "$target_makefile" Makefile && [ -r Makefile ]; } ||
|
||||
{ rm -f makefile.exe; cp "$target_makefile" Makefile; }
|
||||
[ $silent = y ] || echo "Created Makefile"
|
||||
|
||||
cfgfile="makedefs.grx"
|
||||
cfgorigfile="makedefs.orig"
|
||||
if [ ! -r "$cfgfile" ]; then
|
||||
echo "$0: $cfgfile not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -r "$cfgorigfile" ]; then
|
||||
cp "$cfgfile" "$cfgorigfile"
|
||||
fi
|
||||
|
||||
if [ x"$fontpath" = x ]; then
|
||||
subst_fontpath="/^#*GRX_DEFAULT_FONT_PATH=/s/^#*/#/"
|
||||
else
|
||||
subst_fontpath="/^#*GRX_DEFAULT_FONT_PATH=/{s/^#*//;s|=.*|=$fontpath|;}"
|
||||
fi
|
||||
|
||||
if [ "$cfgsection" = GRXVLNX ] || [ "$cfgsection" = GRXVX11 ]; then
|
||||
extra_unix="/^ifdef GRXVUNX\$/,/^endif\$/{/^prefix=/s|=.*|=$prefix|;$subst_fontpath;}"
|
||||
else
|
||||
extra_unix=
|
||||
fi
|
||||
|
||||
if sed -e "/^BUILD_X86_64=/s/=.*/=$BUILD_X86_64/;
|
||||
$subst_EP;
|
||||
/^HAVE_LIBTIFF=/s/=.*/=$HAVE_LIBTIFF/;
|
||||
/^HAVE_LIBJPEG=/s/=.*/=$HAVE_LIBJPEG/;
|
||||
/^HAVE_LIBPNG=/s/=.*/=$HAVE_LIBPNG/;
|
||||
/^HAVE_UNIX_TOOLS=/s/=.*/=$HAVE_UNIX_TOOLS/;
|
||||
/^NEED_ZLIB=/s/=.*/=$NEED_ZLIB/;
|
||||
/^INCLUDE_PRINTING_CODE=/s/=.*/=$INCLUDE_PRINTING_CODE/;
|
||||
/^INCLUDE_BMP_CODE=/s/=.*/=$INCLUDE_BMP_CODE/;
|
||||
/^INCLUDE_GPC_SUPPORT=/s/=.*/=$INCLUDE_GPC_SUPPORT/;
|
||||
/^INCLUDE_SHARED_SUPPORT=/s/=.*/=$INCLUDE_SHARED_SUPPORT/;
|
||||
/^INCLUDE_BGI_SUPPORT=/s/=.*/=$INCLUDE_BGI_SUPPORT/;
|
||||
/^CROSS_PLATFORM=/s/=.*/=$CROSS_PLATFORM/;
|
||||
/^USE_DIRECT_MOUSE_DRIVER=/s/=.*/=$USE_DIRECT_MOUSE_DRIVER/;
|
||||
/^USE_SVGALIB_DRIVER=/s/=.*/=$USE_SVGALIB_DRIVER/;
|
||||
/^USE_FRAMEBUFFER_DRIVER=/s/=.*/=$USE_FRAMEBUFFER_DRIVER/;
|
||||
/^SET_SUIDROOT=/s/=.*/=$SET_SUIDROOT/;
|
||||
/^USE_INOUTP_FRAMEDRIVERS=/s/=.*/=$USE_INOUTP_FRAMEDRIVERS/;
|
||||
/^exec_prefix=/s|=.*|=$exec_prefix|;
|
||||
/^bindir=/s|=.*|=$bindir|;
|
||||
/^libdir=/s|=.*|=$libdir|;
|
||||
/^datadir=/s|=.*|=$datadir|;
|
||||
/^includedir=/s|=.*|=$includedir|;
|
||||
/^unitsdir=/s|=.*|=$unitspath|;
|
||||
/^infodir=/s|=.*|=$infodir|;
|
||||
$extra_unix;
|
||||
/^ifdef $cfgsection\$/,/^endif\$/{
|
||||
/^prefix=/s|=.*|=$prefix|;
|
||||
$subst_fontpath;
|
||||
/^X11BASE=/s|=.*|=$x11base|;
|
||||
/^X11LIB=/s|=.*|=$x11lib|;
|
||||
/^X11LIBS=/s/\$/$lsocket/;
|
||||
}" "$cfgorigfile" > "$cfgfile"; then
|
||||
[ $silent = y ] || echo "Modified $cfgfile"
|
||||
else
|
||||
cp -f "$cfgorigfile" "$cfgfile"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$INCLUDE_GPC_SUPPORT" = x"y" ]; then
|
||||
for file in pascal/grx.pas pascal/bgi/graph.pas; do
|
||||
if [ ! -r "$file" ]; then
|
||||
echo "$0: $file not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
if sed -e "s/{.*\\\$define LINUX_CONSOLE}/{`if [ x"$target" != x"console" ]; then echo .; fi`\$define LINUX_CONSOLE}/;
|
||||
s/{.*\\\$define SVGALIB}/{`if [ x"$target" != x"console" -o $USE_SVGALIB_DRIVER != y ]; then echo .; fi`\$define SVGALIB}/;
|
||||
s/{.*\\\$define __SDL__}/{`if [ x"$target" != x"sdlx" -a x"$target" != x"sdlw" ]; then echo .; fi`\$define __SDL__}/;
|
||||
s/{.*\\\$L socket}/{`if [ x"$lsocket" = x ]; then echo .; fi`\$L socket}/
|
||||
" "$file" > "$file.new" &&
|
||||
sed -e "s/{.*\\\$L tiff}/{`if [ $HAVE_LIBTIFF != y ]; then echo .; fi`\$L tiff}/;
|
||||
s/{.*\\\$L jpeg}/{`if [ $HAVE_LIBJPEG != y ]; then echo .; fi`\$L jpeg}/;
|
||||
s/{.*\\\$L png}/{`if [ $HAVE_LIBPNG != y ]; then echo .; fi`\$L png}/;
|
||||
s/{.*\\\$L z}/{`if [ $NEED_ZLIB != y ]; then echo .; fi`\$L z}/;
|
||||
" "$file.new" > "$file" &&
|
||||
rm -f "$file.new" ; then
|
||||
[ $silent = y ] || echo "Modified $file"
|
||||
else
|
||||
rm -f "$file.new"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
339
thirdparty/grx249/copying
vendored
Normal file
339
thirdparty/grx249/copying
vendored
Normal file
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
53
thirdparty/grx249/copying.grx
vendored
Normal file
53
thirdparty/grx249/copying.grx
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
This is file "copying.grx".
|
||||
|
||||
This document describes the terms for distributing the source code of and any
|
||||
derived work based on the GRX graphics library. Such source code is marked
|
||||
with the next text:
|
||||
|
||||
** Copyright (c) [year] [author], [author information]
|
||||
**
|
||||
** This file is part of the GRX graphics library.
|
||||
**
|
||||
** The GRX graphics library is free software; you can redistribute it
|
||||
** and/or modify it under some conditions; see the "copying.grx" file
|
||||
** for details.
|
||||
|
||||
Source code with the above copyright is distributed under the following terms:
|
||||
|
||||
(1) The test programs for the graphics library (code in the 'test'
|
||||
sub-directory) is distributed without restrictions. This code
|
||||
is free for use in commercial, shareware or freeware applications.
|
||||
|
||||
(2) The GRX graphics library is distributed under the terms of the
|
||||
GNU LGPL (Library General Public License) with the following amendments
|
||||
and/or exceptions:
|
||||
|
||||
- Using the DOS versions (DOS only! this exception DOES NOT apply to
|
||||
the Linux version) you are permitted to distribute an application
|
||||
linked with GRX in binary only, provided that the documentation
|
||||
of the program:
|
||||
|
||||
a) informs the user that GRX is used in the program, AND
|
||||
|
||||
b) provides the user with the necessary information about
|
||||
how to obtain GRX. (i.e. ftp site, etc..)
|
||||
|
||||
(3) Fonts (in the 'fonts' sub-directory). Most of the fonts included with
|
||||
the GRX library were derived from fonts in the MIT X11R4 distribution.
|
||||
They are distributed according to the terms in the file "COPYING.MIT"
|
||||
(X license). Exceptions are:
|
||||
- The fonts "ter-114b.res", "ter-114n.fna" and "ter-114v.psf" are
|
||||
Copyright (C) 2002 Dimitar Zhekov, but are distributed under the
|
||||
X license too.
|
||||
- The "pc" BIOS font family, which is distributed without restrictions.
|
||||
|
||||
A copy of the GNU GPL (in the file "COPYING") and the GNU LGPL (in
|
||||
the file "COPYING.LIB") is included with this document. If you did
|
||||
not receive a copy of "COPYING" or "COPYING.LIB", you may obtain one
|
||||
from where this document was obtained, or by writing to:
|
||||
|
||||
Free Software Foundation
|
||||
675 Mass Ave
|
||||
Cambridge, MA 02139
|
||||
USA
|
||||
|
481
thirdparty/grx249/copying.lib
vendored
Normal file
481
thirdparty/grx249/copying.lib
vendored
Normal file
|
@ -0,0 +1,481 @@
|
|||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if
|
||||
you distribute copies of the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, so that any problems introduced by others will not reflect on
|
||||
the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the source code distributed need not include anything that is normally
|
||||
distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
96
thirdparty/grx249/copying.mit
vendored
Normal file
96
thirdparty/grx249/copying.mit
vendored
Normal file
|
@ -0,0 +1,96 @@
|
|||
Software in this distribution of the X Window System is covered by copyrights;
|
||||
see the file LABELS in this directory for a list.
|
||||
|
||||
The MIT distribution of the X Window System is publicly available, but is NOT
|
||||
in the public domain. The difference is that copyrights granting rights for
|
||||
unrestricted use and redistribution have been placed on all of the software to
|
||||
identify its authors. You are allowed and encouraged to take this software and
|
||||
build commerical products.
|
||||
|
||||
Individuals or organizations wishing to contribute software to the public
|
||||
releases should use a copyright notice that is no more restrictive than
|
||||
the sample given below. In particular,
|
||||
|
||||
o Do not place any restictions on what can be done with this software
|
||||
(this includes using the GNU "copyleft").
|
||||
|
||||
o Do not include the words "All rights reserved" unless you have had a
|
||||
lawyer verify that you have also explicitly given away all of the
|
||||
necessary rights shown in the samples.
|
||||
|
||||
o Spell out the word "Copyright"; the phrase "(c)" is NOT a legal
|
||||
alternative to the c-in-circle symbol.
|
||||
|
||||
o Put at least a one-line copyright at the top of EVERY source file, if
|
||||
not the full copyright. Also, the copyright line or full notice MUST
|
||||
physically appear in each file. Using the preprocessor to #include the
|
||||
copyright from some other file has no legal meaning (it can be used to
|
||||
incorporate common strings into the binary, but has no effect on the
|
||||
status of the source code).
|
||||
|
||||
o Things that are copyrighted are, by definition, not in the public
|
||||
domain.
|
||||
|
||||
A copyright notice similar to the following is strongly recommended (replacing
|
||||
MIT with your organization's name and putting your name and address at the
|
||||
bottom).
|
||||
|
||||
/*
|
||||
* Copyright 1989 Massachusetts Institute of Technology
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of M.I.T. not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. M.I.T. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
|
||||
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Your Name, Name of your organization
|
||||
*/
|
||||
|
||||
|
||||
X Window System, Version 11
|
||||
Release 4
|
||||
|
||||
contents copyrighted by
|
||||
|
||||
|
||||
Massachusetts Institute of Technology
|
||||
Adobe Systems, Inc.
|
||||
Apollo Computer Inc.
|
||||
Apple Computer, Inc.
|
||||
AT&T, Inc.
|
||||
Don Bennett
|
||||
Bigelow & Holmes
|
||||
Bitstream, Inc.
|
||||
Adam de Boor
|
||||
Cognition Corp.
|
||||
Digital Equipment Corporation
|
||||
Evans & Sutherland Computer Corporation
|
||||
Franz Inc
|
||||
Hewlett-Packard Company
|
||||
IBM Corporation
|
||||
Network Computing Devices, Inc.
|
||||
O'Reilly and Associates, Inc.
|
||||
Dale Schumacher
|
||||
Marvin Solomon
|
||||
Sony Corp.
|
||||
SRI
|
||||
Sun Microsystems, Inc.
|
||||
Tektronix, Inc.
|
||||
Texas Instruments Incorporated
|
||||
UniSoft Systems
|
||||
The Regents of the University of California
|
||||
University of Wisconsin
|
||||
Larry Wall
|
||||
Wyse Technology, Inc.
|
116
thirdparty/grx249/doc/changes.bgi
vendored
Normal file
116
thirdparty/grx249/doc/changes.bgi
vendored
Normal file
|
@ -0,0 +1,116 @@
|
|||
******* 2.3 --> 2.3.4
|
||||
- BCC2GRX is now part of the GRX graphics library.
|
||||
******* 2.0 --> 2.3
|
||||
- will use the floodfill() from GRX 2.25 or newer
|
||||
- Linux: can be compiled as shared library (make SHARED=1 in src/)
|
||||
- made all functions direct linkable (mostly for GPC support)
|
||||
- Pascal (GPC) support by Sven Hilscher included
|
||||
- updated for grx21 (patterns & custom lines)
|
||||
- No more warnings using LIBBCC.H in C++ programs
|
||||
******* 1.3 --> 2.0
|
||||
- new copyright terms, see readme
|
||||
- compiles with both grx v2.0 and v1.03
|
||||
- text.c splitted
|
||||
- added setactivepage(), setvisualpage() and helper func's
|
||||
set_BGI_mode_pages(int p), get_BGI_mode_pages(),
|
||||
getactivepage() and getvisualpage() (functional only with
|
||||
grx v2.0 or newer)
|
||||
- __gr_Y_page_offs disabled if compiled for grx 1.0x
|
||||
- restrict RGB values in setrgbpalette() to 0..63
|
||||
- added extended graphics modes from BC++ 4.5
|
||||
- few experimental custom line hacks for grx 2.0 (lnestyle.c)
|
||||
- more work on Makefiles, make in src or test subdir works
|
||||
- Due to limited stack space with DJGPP v2, complete rewrite
|
||||
of floodfill() to avoid deep recursions.
|
||||
- DJGPP: libbcc2.a will work on v1 and v2 systems with grx10, no need
|
||||
to keep libbccx.a any longer.
|
||||
- Link test: create dummy executable using all library objects. Nice to
|
||||
check grx20fix.h settings.
|
||||
- Optimized makefiles and configuration
|
||||
- getdrivername() will report GRX driver name with GRX2
|
||||
- LINUX: saved some getpixel() calls for floodfill() under X11. Remains slow :-(
|
||||
- LINUX: No need to keep a seperate X11 directory any longer, binaries
|
||||
are just linked with -lgrx20X -X11 instead of -lgrx20 -lvga
|
||||
- LINUX: Enhanced Linux support (svgalib && X11)
|
||||
- rewrote bgi font loading
|
||||
- libbcc.h won't include GRX stuff any more
|
||||
- rewrote floodfill(): Will use it's own dumb monochrome
|
||||
context to keep track of drawn points. Uses less memory but
|
||||
seems to be a little slower in few cases.
|
||||
- moved _ega_color, setrgbdefaults() and setrgbgray256() from libbcc?.a
|
||||
to src/addons.a
|
||||
- added four new functions getmodemaxcolor(), getmodemaxx(), getmodemaxy()
|
||||
and setrgbcolor().
|
||||
- added version check __BCC2GRX__ (equals to 0x21a for v2.1 alpha,
|
||||
0x20b -> v2.0 beta, 0x230 -> v2.3 offical release, ...)
|
||||
|
||||
******* 1.2 --> 1.3 (1.3 didn't made it to public)
|
||||
|
||||
- Vector fonts may be plotted using the actual line style.
|
||||
calling textlinestyle(1) enables and textlinestyle(0) disables
|
||||
this feature.
|
||||
- corrected getmodename() TrueColor definition, name of actual
|
||||
graphics mode valid now, will display 32K/64K/16M instead of
|
||||
huge numbers
|
||||
- CGA/MCGA/ATT400 will be emulated by 16 color modes
|
||||
- EGA64HI sets 16 color mode on non EGA cards
|
||||
- named source files in a more functional way
|
||||
- circle() will use GrCircle() in "round" cases
|
||||
- graphdefaults(), setgraphmode() and initgraph() set up the
|
||||
correct aspect ratio
|
||||
- added __gr_ prefix to several library functions called
|
||||
by other bcc2grx functions. Protects against interference
|
||||
with other libraries (problem reported by Axel Rohde)
|
||||
- updated for libgrx 1.03
|
||||
- should work with .vdr drivers now
|
||||
- uses GrGetLastArcCoords() instead of global variables
|
||||
- BLACK changed into constant
|
||||
- Pascal support improved. KeyPressed and ReadKey will
|
||||
flush stdout first, updated Readme
|
||||
- bccbgi now uses random() instead of RANDOM_TP() for correct
|
||||
support of >32768 colors modes. (Bad news: random() is much slower)
|
||||
- set_BGI_mode_whc translates 64K and 16M color values into
|
||||
GRX internals 0xC010 and 0xC018 (grx1.0x only)
|
||||
- added _ega_color for EGA color emulation in HiColor/TrueColor modes
|
||||
- Corrected range check in setfillstyle() (bug found by Axel Rohde)
|
||||
- Corrected bugs/problems reported by Antonio Carlos Moreirao de Queiroz:
|
||||
- initgraph won't crash if pathtodriver == NULL
|
||||
- When loading a font failed, DEFAULT_FONT size 1 will be used
|
||||
- font switching should be faster now
|
||||
- if a font can't be found, grFontNotFound error will be set.
|
||||
- Correct name expansion in installuserfont()
|
||||
|
||||
******* 1.1 --> 1.2
|
||||
|
||||
- installuserfont() accepts GRX font names (name.fnt).
|
||||
- getmodename() supports modes >32768 colors
|
||||
- initgraph() has NATIVE_GRX driver entry. NATIVE_GRX supports
|
||||
the default, biggest (noninterlaced), BGI_mode graphics and all valid
|
||||
modes from .grn drivers
|
||||
- set_BGI_mode()/set_BGI_mode_whc() routines to emulate BGI driver resolutions
|
||||
- floodfill() doesn't uses second context in simple cases (much faster),
|
||||
leaves viewport if no clipping required
|
||||
- getmoderange(), getmaxmode() and getpalettesize() will call
|
||||
__gr_set_up_modes() first -->> returned values are initialized
|
||||
- closegraph() resets __gr_INIT flag
|
||||
- cleardevice(), clearviewport(), imagesize(), graphresult(), getmaxcolor(), getgraphmode(), getpixel() and
|
||||
putpixel() are checking __gr_INIT flag now
|
||||
- setrgbpalette() check's initgraph(), moved from bccgrx.h -> bccgrx20.c
|
||||
- drawpoly() always closed the polygon -- fixed.
|
||||
- registerfarbgifont() now same as registerbgifont()
|
||||
- setgraphbufsize() returns a defined value
|
||||
- setwritemode() protects against setting color bits
|
||||
- detectgraph() returns the correct graphdriver info
|
||||
- graphdefaults() doesn't call setlinestyle() & setviewport() any more
|
||||
- bccgrx.c/__gr_set_up_modes() executed once only (fixes memory waste)
|
||||
|
||||
******* 1.0 --> 1.1
|
||||
|
||||
- initgraph() will set the requested graphmode if graphdriver != DETECT.
|
||||
- using GrHLineNC and GrPixelNC in bccgrx09.c / _floodfill()
|
||||
- BCC2GRX should run correct with old style drivers (.grd)
|
||||
(bccgrx.c/__gr_set_up_modes changed)
|
||||
- Corrected detectgraph()/initgraph() problem calling Gr... funcs
|
||||
before GrSetMode()
|
||||
- Used normal filled / solid line commands where ever possible
|
||||
- Text direction and justify setting compatible with Borland definition
|
728
thirdparty/grx249/doc/changes.txt
vendored
Normal file
728
thirdparty/grx249/doc/changes.txt
vendored
Normal file
|
@ -0,0 +1,728 @@
|
|||
This file lists the history of changes to the grx source files from
|
||||
the 2.2 version.
|
||||
-------------------------------------------------------------------
|
||||
|
||||
Date Changes
|
||||
|
||||
12/07/10 ----------- GRX v2.4.9 released (Maurice Lombardi)
|
||||
12/07/04 Change configure script and makedefs.grx to conform to recent
|
||||
GNU practice. Honours DESTDIR to ease building binary distributions.
|
||||
INSTALLDIR is no more present in makedefs.grx, but prefix is there
|
||||
to replace it. (Extension of a patch by Guillem Jover to all targets
|
||||
by M. Lombardi)
|
||||
11/11/23 All drivers generate button4 and button5 mouse events (the scroll
|
||||
wheel scrolled up or down). Extended from MGRX by M. Lombardi.
|
||||
11/11/18 Add GrFlush(). Useful only on X11 when when switching between
|
||||
graphics and console windows open simultaneously. (M. Lombardi)
|
||||
10/08/17 Add GrMsecTime(). Adapted from MGRX.
|
||||
09/04/02 Synchronisation of windows and grx mouse cursors by Richard Sanders
|
||||
<richard@dogcreek.ca>
|
||||
08/12/12 Fix a race condition with the loadcolor SetDIBColorTable function
|
||||
call, which happens sometimes on fast multiprocessor machines
|
||||
This affects only 8 bpp modes (Peter Schauer <peterschauer@gmx.net>)
|
||||
08/11/05 Added GrClearContextC function, by Richard Sanders.
|
||||
08/08/01 fdrivers/fd_xwin.c: Sanitized pixel cache code.
|
||||
New faster and specific for X11 putscanline function, this change
|
||||
accelerates a lot displaying pnm, png and jpeg images.
|
||||
Backports from MGRX of M.Alvarez <malfer@telefonica.net>
|
||||
08/05/15 Fix a conflict between underline and XOR char writing reported by
|
||||
Al-Junaid H. Walker (M. Lombardi)
|
||||
07/12/27 Added GrFloodSpill functions, by Richard Sanders <richard@dogcreek.ca>
|
||||
07/12/01 vd_xwin: go to fullscreen if w,h == X resolution, GR_biggest_graphics
|
||||
is honored. Modes higher than X resolution are made no-present.
|
||||
Added videomodes for wide monitors in x11 and w32 drivers.
|
||||
Backports from MGRX of M.Alvarez <malfer@telefonica.net>
|
||||
07/08/11 Fix a keyboard bug reported by A. Moreira. It was a bug produced by
|
||||
the optimiser for gcc >= 4 when using asm: memory clobber.
|
||||
If not corrected it could pop up at other places. (M. Lombardi)
|
||||
|
||||
07/08/29 ----------- GRX v2.4.8 released (Maurice Lombardi)
|
||||
07/08/29 Sanitized win32, eliminating WM_SIZE events
|
||||
07/08/27 Add Sleep(5) to setrgbpalette for win32 which sends WM_PAINT to
|
||||
redraw whole screen. Compare PlayRGBpalette() in test/bgi/bccbgi.c
|
||||
Add Sleep(1) when no more W32events queued to yield control
|
||||
when looking for grx events by M. Lombardi.
|
||||
07/08/21 Correction to WM_PAINT in vdrivers/vd_win32.c: GetUpdateRect() gave
|
||||
wrong UpdateRect -> few missing chars in text drawing, by M. Lombardi
|
||||
07/08/17 Change to text/fontpath.c and text/loadfont.c to allow the syntax
|
||||
/dev/env/DJDIR in djgpp when loading fonts by M. Lombardi
|
||||
07/08/07 Correction to test/test.h to enable test/scroltst to run as expected.
|
||||
07/08/05 Eliminate WM_PAINT in mouse/w32inp.c to enqueue GR_OS_DRAW_REQUEST.
|
||||
Too frequents, they produced saturation of the GRX event queue and
|
||||
gobbling of keybord/mouse events. Compare responsivity of
|
||||
test/mousetst.c, test/bgi/bccbgi.c, pascal/bgi/demo.pas by M. Lombardi
|
||||
07/08/01 The X11 driver now responds to Expose events by using a pixmap
|
||||
for backing store. But this slows it down. You can recover
|
||||
previous behaviour (faster but no response to Expose) by editing
|
||||
src/include/libxwin.h and setting USE_PIXMAP_FOR_BS to 0.
|
||||
Backported from Mariano's MGRX by M. Lombardi.
|
||||
07/07/30 various improvements in makefiles, demo.pas, test/speedtst.c
|
||||
by M. Lombardi.
|
||||
|
||||
07/04/06 ----------- GRX v2.4.7 released (Maurice Lombardi)
|
||||
07/04/06 updates in test/speedtst.c
|
||||
07/04/05 change to bgi/bccgrx.c, so that all 32 bpp modes are considered
|
||||
by BGI as 16M modes (the extra byte is only for padding): this was
|
||||
the case for older drivers up to VESA which gave GrVideoMode->bpp=24
|
||||
in these cases (see lines 246-258 in vdrivers/vesa.c).
|
||||
07/03/25 SDL driver (sdl-rc4-support.zip) by Dimitar Zhekov 28 May 2004
|
||||
with changes to makefiles/makedefs/configure
|
||||
and pascal support by Maurice Lombardi
|
||||
07/03/16 inclusion of various corrections submitted to the list
|
||||
grx.diff-byteorder by Frank Heckenbach 31 May 2006
|
||||
grx-exitprocess.diff GRX app termination bug (winXP)
|
||||
by Mario Zagar 15 Feb 2005
|
||||
grxfixes.zip by Dimitar Zhekov 24 Sep 2004
|
||||
fontdemo-res-fix.diff
|
||||
fontdemo-Y-fix.diff
|
||||
test-changes.diff
|
||||
win32-8bpp-cls-fix.diff (win32 setmode() clear screen problem)
|
||||
xfdga-detect-once.diff (xfdga avoid double detection)
|
||||
grx-w32events.diff (more W32 event handling)
|
||||
by Peter Gerwinski 19 Jun 2004
|
||||
graphresult.diff by Andris Pavenis 8 Jan 2004
|
||||
07/01/05 introduction of GR_PtrInt (integer of same length as a pointer)
|
||||
to suppress warnings (in fact errors) when compiling with
|
||||
x86_64 platforms,
|
||||
renaming sincos() to GrSinCos() in genellip.c to avoid
|
||||
name conflict with builtin, by M. Lombardi.
|
||||
06/09/19 correction to bgi/text4.c to correct update of graphics
|
||||
pointer in vertical writing with outtext (was going in
|
||||
the wrong direction. BP does not update it at all,
|
||||
but this is stupid), by M. Lombardi.
|
||||
06/09/11 correction to grx.pas (bar3d)
|
||||
06/02/10 Better understanding of x86_64. Now by default an i386
|
||||
library is built even on x86_64 platforms. If you set
|
||||
BUILD_X86_64 to 'y' in makdefs.grx a x86_64 library is
|
||||
built, and the install target go to the lib64 subdir
|
||||
(backport from MGRX by M. Lombardi)
|
||||
04/09/24 Added x86_64 support (backport from MGRX by M. Lombardi)
|
||||
xx/09/05 Florian Xaver updated GRX to make it compatible with latest
|
||||
DJGPP/GCC.
|
||||
05/03/08 correction to polytest.pas
|
||||
04/09/27 more changes to graph.pas, jpgtest.pas, imgview.pas,
|
||||
by Frank Heckenbach.
|
||||
04/09/17 more changes to grx.pas and graph.pas, by Frank Heckenbach.
|
||||
04/06/06 more changes for same purpose by Peter Gerwinski.
|
||||
04/04/25 changes to introduce:
|
||||
HAVE_UNIX_TOOLS, CROSS_PLATFORM in makefefs.grx and configure
|
||||
w32 (mingw32) target in configure
|
||||
corresponding changes in makefiles,
|
||||
by Frank Heckenbach and Peter Gerwinski.
|
||||
04/03/28 changes in grx.pas to make it compile with recent versions of
|
||||
gpc, by Frank Heckenbach.
|
||||
03/12/27 Close the framebuffer if DGA is compiled with framebuffer
|
||||
support, not without it, by Dimitar Zhekov.
|
||||
03/12/27 Version 2 of the raw driver. Support for psf2. Better
|
||||
support for RAW: up to 16x32, assuming width:height 1:2
|
||||
(the previous code was always assuming width = 8),
|
||||
by Dimitar Zhekov.
|
||||
03/12/27 Small bug in grxprint.c, by Andris Pavenis.
|
||||
03/12/27 Version 2 of the libGRX DGA2 driver. Features set mode
|
||||
via DGA2 and rendering via Xlib or linear framebuffer,
|
||||
by Dimitar Zhekov.
|
||||
03/12/27 Up to 200 the possible modes in the DGA2 driver, by Dimitar
|
||||
Zhekov.
|
||||
03/12/27 A batch mode for speedtst. Usage: run speedtst to see the
|
||||
mode numbers, then "time speedtst MODE" or [4dos] "timer ^
|
||||
speedtst ^timer". Maybe "first" should be named "prompt",
|
||||
by Dimitar Zhekov.
|
||||
|
||||
03/07/17 ----------- GRX v2.4.6 released (Mariano Alvarez Fernandez)
|
||||
03/07/15 fdv_win.c: the resource header fields must be swapped,
|
||||
not the data they "point" to, by Dimitar Zhekov.
|
||||
03/07/15 Changed the default to 'n' for the USE_INOUTP_FRAMEDRIVERS
|
||||
switch in makedefs.grx
|
||||
03/06/25 In the svgalib driver don't re-setting the initial mode if
|
||||
it's already set, by Dimitar Zhekov.
|
||||
03/06/23 define alloca to __builtin_alloca in src/include/allocate.h
|
||||
to avoid warnings in Mingw with gcc 3.x. src/makefile.lnx,
|
||||
src/makefile.x11: don't link ADDON_LIBS for UTILP.
|
||||
src/stdobjs.mak: remove any duplicate definitions and
|
||||
trailing \-s. src/text/buildfnt.c: produce a more readable
|
||||
bdump() DEBUG output, by Dimitar Zhekov.
|
||||
03/06/23 The GRX raw keyboard I/O can't be safely used in text mode.
|
||||
Fixed it in test/bgi/, by Dimitar Zhekov.
|
||||
03/06/10 Small fixes, replaced some printf with DBGPRINTF, removed
|
||||
GrKeyPressed test in debug mode, it can't be used in all
|
||||
plattforms, by Dimitar Zhekov.
|
||||
03/06/10 Small chamges to fdv_win.c, better name/family supportm, avoid
|
||||
possible overflow, by Dimitar Zhekov.
|
||||
03/06/10 More Pascal updates, by Frank Heckenbach.
|
||||
03/05/31 Small fixes to fdv_fna.c and fdv_xwin.c, by Dimitar Zhekov.
|
||||
03/05/31 Pascal demos updates, by Eike Lange.
|
||||
03/05/03 Added a InvalidateRect in the loadcolor function in the Win32
|
||||
videodriver, now the play-palette bgi demo works properly.
|
||||
I think the Win32 driver is now very usable, not more in alpha.
|
||||
03/05/03 Faster w32_drawpixel function in the Win32 framedrivers.
|
||||
03/05/02 Small patch for the next GPC version, by Frank Heckenbach.
|
||||
03/05/02 Small test fixes, by Dimitar Zhekov.
|
||||
03/05/02 Added a cleanall target to the borland makefile,
|
||||
by Dimitar Zhekov.
|
||||
03/04/02 Added new video driver for Xfree86 DGA2 (Direct Graphics Access),
|
||||
experimental, not compiled by default, you must activate it in
|
||||
makedefs.grx, by Dimitar Zhekov.
|
||||
03/03/31 New 8bpp frame driver (by Josu) and 24 bpp frame driver (by me)
|
||||
for Win32. They use the standard GRX framedirvers plus the
|
||||
necesary InvalidateRects. Now the Win32 version is faster and
|
||||
reliable.
|
||||
03/03/31 With the Thomas idea of using a DIB in the win32 video driver,
|
||||
we can now use the DIB like a linear frame buffer, so the new
|
||||
win32 framedrivers can take advantage of the standard GRX frame
|
||||
drivers, by Josu Onandia.
|
||||
03/03/31 Use a DIB for the hDCMem in the win32 video driver,
|
||||
by Thomas Demmer
|
||||
03/03/11 The alternate linux console input driver now calls
|
||||
_LnxfbSwitchConsoleAndWait if _lnxfb_waiting_to_switch_console
|
||||
is set.
|
||||
03/03/11 Changes to the linuxfb driver. Added code to catch a signal
|
||||
when user wants to change virtual terminals. The driver sets
|
||||
_lnxfb_waiting_to_switch_console and the input driver must
|
||||
calls _LnxfbSwitchConsoleAndWait then.
|
||||
Previous function _SwitchConsoleLnxfbDriver renamed to
|
||||
_LnxfbSwitchConsoleVt, not used,is here only for possible
|
||||
future use.
|
||||
03/03/10 Some more adjustments to GPC changes. This time, however,
|
||||
there will be backward-incompatible changes (WRT …smname'
|
||||
etc.). Therefore, I'm using a compiler version check, so it
|
||||
should work with old and new GPC versions. At this occasion,
|
||||
I'm also removing the old-style external variable syntax
|
||||
(of GPC versions prior to 2000-04-12) from graph.pas, by
|
||||
Frank Heckenbach.
|
||||
03/03/10 Changes the x11 font driver to use it's own X11 display
|
||||
and window. It allows X11 fonts to be loaded before GrSetMode()
|
||||
and makes the font driver independent from the X11 video and
|
||||
frame drivers, by Dimitar Zhekov.
|
||||
03/03/10 Syncs ulheight/ulpos calculation in the X11 font driver with
|
||||
all other drivers for which ulheight isn't known, by
|
||||
Dimitar Zhekov.
|
||||
03/02/27 Changes to the .fna font driver: undpos is not supported and
|
||||
fix driver inability to read fonts with 2+ nonempty "note",
|
||||
by Dimitar Zhekov.
|
||||
03/02/26 Get rid of GRXMain in test programs, we use main now.
|
||||
03/02/12 Sanitize the Thomas changes.
|
||||
03/02/12 Changes to the win32 videodriver. Instead of begin with WinMain
|
||||
and start a thread with the main GRX program, do it backward:
|
||||
begin in main and start a thread to handle the Windows window.
|
||||
With this change we get rid of the awful GRXMain special entry
|
||||
point and GRX compiles now with CygWin, added the new platform
|
||||
to grx20.h, by Thomas Demmer <TDemmer@krafteurope.com>
|
||||
03/02/11 Some small bugfixes for the Pascal units, by Frank Heckenbach.
|
||||
03/01/14 Pascal units rewritten, this is to make the formatting more in
|
||||
line with the GPC conventions, by Frank Heckenbach.
|
||||
02/12/29 The alternate linux console input driver now works with PS2 and
|
||||
IMPS2 mice (but the whell is not used).
|
||||
02/12/21 Added function to change virtual terminals in the linuxfb
|
||||
driver, _SwitchConsoleLnxfbDriver to be called from the input
|
||||
driver (it doesn't work yet).
|
||||
02/12/21 Some cleanups to the linuxfb driver, now the text screen restart
|
||||
ok on exit.
|
||||
02/12/13 Added 8bpp paletted mode to the linuxfb driver,
|
||||
by Josu Onandia.
|
||||
02/11/24 In fdrivers/lfb8.c, lfbbltrv.c, lfbbltvr.c and lfbbltvv.c
|
||||
there was a erroneous test on LBF_BY_NEAR_POINTER instead
|
||||
LFB_BY_NEAR_POINTER, reported by <YaoXiaoxi@elong.com>.
|
||||
02/11/24 Changes avoid some warnings given by `-W' in graph.pas, by
|
||||
Frank Heckenbach.
|
||||
02/11/24 The test program launcher, demogrx, has now two pages. Added
|
||||
some fontdemos.
|
||||
02/10/27 Modetest shows the actual resolution when in graphics mode.
|
||||
02/10/26 Corrected bug in fdrives/ram4.c, if the GR_UNDERLINE_TEXT
|
||||
flag was set colors were wrong, reported by Alex.
|
||||
02/10/26 Corrected bug in draw/bitblt1b.c, bad source origin if the
|
||||
destination origin was negative, by Alex <alexbodn@012.net.il>
|
||||
Changed bb1test.c test program to see the efect.
|
||||
|
||||
02/10/20 ----------- GRX v2.4.5 released (Mariano Alvarez Fernandez)
|
||||
02/10/18 Changed __MINGW32__ to _WIN32 in Pascal units, by
|
||||
Frank Heckenbach.
|
||||
02/10/16 Updated the configure script, by Frank Heckenbach.
|
||||
02/10/02 Corrected bugs in GrFloodFill, before it didn't paint the
|
||||
righter point (causing ocasionall aborts too) and didn't
|
||||
work on subcontexts.
|
||||
02/08/27 Updates to the fdv_raw font driver, the loadfont source
|
||||
now does a cleanup to close the font file, fontdemo test
|
||||
program updated, by Dimitar Zhekov.
|
||||
02/08/10 Make the test/bgi programs depend of a unique file header
|
||||
for input and delay functions.
|
||||
02/08/10 New api functions with a unique color parameter in 0xRRGGBB
|
||||
format:
|
||||
GrColor GrAllocColor2(long hcolor);
|
||||
GrColor GrAllocColor2ID(long hcolor);
|
||||
void GrQueryColor2(GrColor c,long *hcolor);
|
||||
void GrQueryColor2ID(GrColor c,long *hcolor);
|
||||
02/08/06 Added 'setsuid' target to test/makefile.lnx and
|
||||
test/bgi/makefile.lnx. Now you can run 'make -f makefile.lnx'
|
||||
in the grx base directory an them become root and run
|
||||
'make -f makefile.lnx setsuid'.
|
||||
02/08/06 Use the SET_SUIDROOT variable in test/bgi/makefile.lnx,
|
||||
by Dimitar Zhekov.
|
||||
02/08/06 Fontdemo update, by Dimitar Zhekov.
|
||||
02/08/02 Modifications to acomodate new options in makedefs.grx,
|
||||
for the four standard platforms:
|
||||
INCLUDE_BGI_SUPPORT, 'y' by default
|
||||
for the linux console platform:
|
||||
USE_SVGALIB_DRIVER, 'y' by default
|
||||
USE_FRAMEBUFFER_DRIVER, 'y' by default
|
||||
SET_SUIDROOT, 'y' by default
|
||||
USE_INOUTP_FRAMEDRIVERS, 'y' by default
|
||||
Added a note about "Suidroot in the Linux console platform"
|
||||
in the readme file.
|
||||
02/07/29 Revert some changes in the bgi test demos to compile again
|
||||
with DJGPP.
|
||||
02/07/29 Corrected an off-by-one error in the raw font driver, by
|
||||
Dimitar Zhekov.
|
||||
02/07/29 16-bit fix for BGI and GRX. __gr_WR must match GrColor, by
|
||||
Dimitar Zhekov.
|
||||
02/07/29 Changes to the BGI interface, by Dimitar Zhekov.
|
||||
Inline functions defined as macro and non-inline versions.
|
||||
BGI number of colors for DOS / BCC limited to < 15bpp.
|
||||
BGI aspect ratio fixed for 16-bit systems (DOS / BCC).
|
||||
_BGI_INLINE_ moved to fldfill.c, the only module that uses it now.
|
||||
Inline functions in text4.c replaced with macros.
|
||||
Test\bgi\colortst.c fixed to use getch() not getchar().
|
||||
02/07/21 Make bccbgi works with Borland C, by Dimitar Zhekov.
|
||||
02/06/17 Added fontdemo test program, by Dimitar Zhekov.
|
||||
02/06/17 Added the GrDumpFnaFont fucntion, to save a fon in a ascii
|
||||
fna file, by Dimitar Zhekov.
|
||||
02/06/12 Three new font drivers by Dimitar Zhekov:
|
||||
* RAW driver - for RAW data and Linux PSF (not PCF) files. RAW
|
||||
data files must be 8 points wide. 512 character PSF files are
|
||||
supported. For the PSF files contained in Linux systems to be
|
||||
readable with GRX, you'll have to unzip them.
|
||||
* FNA driver - for the ascii font format used by grx 1 font
|
||||
read/write tool. A doc about this format was added to the doc
|
||||
subdirectory.
|
||||
* WIN driver - for MS Windows FNT and RES files. FNT versions 2
|
||||
and 3 are supported, 32-bit RES and FON files are not. The first
|
||||
resource from RES is used. As far as I know, all MS Windows-es
|
||||
from 2.0 to NT 4.0 use FNT version 2 and 16-bit resources packed
|
||||
into FON for raster fonts. To use the MS Windows .FON files,
|
||||
split them into .FNT or .RES files using a resource editor.
|
||||
Note. Big endian support is untested.
|
||||
02/06/12 Fixes for src/makefile.bcc and test/makefile.bcc,
|
||||
by Dimitar Zhekov <jimmy@is-vn.bg>
|
||||
02/04/29 GrResizeSubContext uses now the parent context coordinates.
|
||||
02/04/29 Reverted some 'const' that didn't make sense.
|
||||
02/03/31 The win32 driver accepts arbitrary (user defined) resolution.
|
||||
02/03/14 A new global switch _GR_textattrintensevideo (false by default)
|
||||
permits the use (when true) of 16 background colors in
|
||||
GR_ATTR_TEXT strings.
|
||||
02/03/13 When the close icon is pressed in the w32 version a dialog
|
||||
is issued warning it aborts the program.
|
||||
02/03/12 Fixed some bugs introduced with the new win32 input queue.
|
||||
02/02/11 The makefile install target installs the grxprint.h file
|
||||
if printer support is activate
|
||||
02/02/11 Inprovements to the win32 driver:
|
||||
Now the GRX window is properly closed, so the previous app
|
||||
gets the focus.
|
||||
02/02/02 Inprovements to the win32 driver:
|
||||
The w32 imput queue implemented as a circular queue.
|
||||
All the input related code moved to w32inp.c from vd_win32.c
|
||||
The main window is created in WinMain, so the grx program
|
||||
can use other videodrivers like the memory one.
|
||||
Now the printer stuff compiles and run, checked with the
|
||||
DeskJet driver, printing to a file and them "copy file lpt1",
|
||||
but the printout is not totally correct (?).
|
||||
|
||||
02/01/11 ----------- GRX v2.4.4 released (Mariano Alvarez Fernandez)
|
||||
02/01/09 Modified the demogrx test program to center the image when
|
||||
a mode bigger than 640x480 is selected
|
||||
02/01/09 Added an alternate linux console input driver, it handles
|
||||
the mouse directly openning /dev/psaux, but note only PS/2
|
||||
mouses work by now. It must be activate explicitly by
|
||||
uncomenting the switch "USE_DIRECT_MOUSE_DRIVER=y" in
|
||||
"makedefs.grx"
|
||||
02/01/09 The linux framebuffer video driver now set the console in
|
||||
graphics or text mode when necesary. Now the text cursor is
|
||||
not show, and the svgalib mouse input driver doesn't collide
|
||||
with GPM, so, surprise!, it works!
|
||||
02/01/09 Small changes to improve the linux console input driver
|
||||
02/01/07 More patches to the Pascal interface, by Frank Heckenbach and
|
||||
Maurice Lombardi
|
||||
02/01/02 Go to full screen in the Win32 driver if the requested framemode
|
||||
dimensions are equal to the screen dimensions (setting the
|
||||
client start area at 0,0).
|
||||
01/12/22 More patches to the Pascal interface, by Frank Heckenbach and
|
||||
Maurice Lombardi
|
||||
01/12/22 Added an optional configure script, by Frank Heckenbach
|
||||
01/12/21 The linuxfb driver now open /dev/fb0 by default. An alternative
|
||||
frame buffer device can be specified setting the environment
|
||||
variable $FRAMEBUFFER
|
||||
01/12/21 pascal ega colors are now functions, by Frank Heckenbach
|
||||
01/12/21 fixed some borland bgi incompatibilities, by Frank Heckenbach
|
||||
01/12/21 added 'const' (C) and 'protected' (Pascal) to some
|
||||
function parameters, to make them a little "safer",
|
||||
by Frank Heckenbach
|
||||
01/12/16 Added imgview.pas and colortst.pas demo programs, by
|
||||
Frank Heckenbach
|
||||
01/12/16 Change in the pascal interface: GrAllocEgaColors, GrGetScanline,
|
||||
etc. return a pointer to an array of GrColor, rather than to a
|
||||
single GrColor, by Frank Heckenbach
|
||||
01/12/16 Make installation of shared libraries optional on Linux/X11
|
||||
by Frank Heckenbach
|
||||
01/12/16 GrSaveContextToGrayJpeg added to the pascal interface, by
|
||||
Maurice Lombardi
|
||||
01/11/29 better w32 keyboard handling. Now most special keys with
|
||||
shift, alt and control combinations works
|
||||
01/11/29 added jpeg functions to grx.pas and jpgtest.pas demo, by
|
||||
Maurice Lombardi
|
||||
01/11/29 patch to define gpc-main in grx.pas and graph.pas, by
|
||||
Frank Heckenbach
|
||||
01/11/29 patch to remove warnings on unix in test/bgi programs, by
|
||||
Frank Heckenbach
|
||||
01/11/16 Added new function: GrSaveContextToGrayJpeg. Now
|
||||
GrLoadContextFromJpeg can load grayscale jpeg files
|
||||
01/11/08 jpgtest test program added. It works too without jpeg support
|
||||
and shows a message
|
||||
01/11/08 New jpeg functions (GrSaveContextToJpeg, GrLoadContextFromJpeg,
|
||||
GrQueryJpeg, GrJpegSupport). Added dummy functions if there
|
||||
isn't jpeg support
|
||||
01/11/07 Added new targets to makefiles: install-info, unisntall-info.
|
||||
Now install doesn't install info (readme file updated)
|
||||
01/09/08 Applied additional patches to update Pascal interface, new
|
||||
polytest.pas demo, by Maurice Lombardi
|
||||
01/09/07 Applied patches to update the Pascal interface, by
|
||||
Frank Heckenbach. Note, the "bgi2grx" unit was renamed to
|
||||
"Graph", so it will be BP compatible and more natural to
|
||||
Pascal programmers
|
||||
|
||||
01/06/28 ----------- GRX v2.4.3 released (Mariano Alvarez Fernandez)
|
||||
01/06/27 Added new targets to makefiles: install-bin, uninstall-bin,
|
||||
install-fonts and uninstall-fonts (readme file updated)
|
||||
01/06/26 Moved bin2c, fnt2c, vesainfo, lfbinfo and modetest to
|
||||
src/utilprog. They are build in the source makefile.
|
||||
01/06/22 Except for the w32 version the install target installs the
|
||||
info manual. As suggested by Maurice Lombardi and Waldemar
|
||||
Schultz
|
||||
01/06/21 pngtest test program added. It works too without png support
|
||||
and shows a message
|
||||
01/06/20 Changed BCCGRX cleardevice function to clear the screen to
|
||||
the current BACKGROUND color instead of black. Suggested by
|
||||
Waldemar Schultz
|
||||
01/06/19 ctx2png functions (GrSaveContextToPng, GrLoadContextFromPng,
|
||||
GrQueryPng, GrPngSupport) integrated in GRX. src/pnm subdir
|
||||
renamed to src/gformats. Added dummy functions if there isn't
|
||||
png support
|
||||
01/06/18 New API functions: GrLoadContextFromPnmBuffer and
|
||||
GrQueryPnmBuffer
|
||||
|
||||
01/06/15 ----------- GRX v2.4.2 released (Mariano Alvarez Fernandez)
|
||||
01/06/12 Modified win32 input code for GrMouseGetEvent and GrKeyRead
|
||||
work at the same time, when GrMouseEventEnable(1,0) is set
|
||||
01/06/07 Merged makedefs.gnu, makedefs.x11, makedefs.dj2 and
|
||||
makedefs.w32 in makedefs.grx (readme file updated)
|
||||
01/06/06 Now we can use "GRXMain" for all GRX versions, grx20.h defines
|
||||
it like "main" except for the win32 version. Deleted the ugly
|
||||
"#ifdef __WIN32__ ..." in test programs (except for BGI tests)
|
||||
01/06/05 Added the Linux framebuffer videodriver (vdrivers/vd_lnxfb.c)
|
||||
alpha stage, only in 16 or 24 bpp. To use it set GRX20DRV to
|
||||
"linuxfb" in the GRX Linux version. The mouse doesn't work
|
||||
01/06/05 Some minimal changes to compile ok with gcc 2.96 and
|
||||
Linux 2.4.x
|
||||
01/05/30 Applied patch to sanity bgi code for gcc 3.0, by Andris
|
||||
Pavenis
|
||||
01/05/28 Modified makefiles for linux and x11. Now they build
|
||||
shared and static libs at the same time. Added install and
|
||||
uninstall targets.
|
||||
01/05/16 Applied patch to add standard pascal makefiles for dj2, w32,
|
||||
x11 and lnx. pascal/bgi/test and pascal/bgi/demo merged in
|
||||
pascal/bgi. Pascal readme updated. By Maurice Lombardi
|
||||
01/05/09 Applied patch to produce makefiles for mingw32 pascal tests
|
||||
by Maurice Lombardi
|
||||
|
||||
01/04/26 ----------- GRX v2.4.1 released (Mariano Alvarez Fernandez)
|
||||
01/04/25 User's guide (info) updated, by Vicente Fuentes Gea
|
||||
01/04/20 User's guide (html) updated
|
||||
01/04/19 Applied partially patches to make GRX compile with MS-VC
|
||||
by Hartmut Schirmer
|
||||
01/04/18 Added install and uninstall targets to src/makefile.dj2 and
|
||||
src/makefile.w32
|
||||
01/04/18 Patched src/bgi/text7.c to compile Ok with GCC 3.0
|
||||
by Andris Pavenis
|
||||
01/04/14 New API routine: GrBitBlt1bpp, contributed by Josu Onandia
|
||||
Added bb1test.c test program
|
||||
01/04/01 Changed compiler options from "-O6 -fomit-frame-pointer" to
|
||||
"-O2" only. Suggested by Andris Pavenis.
|
||||
01/03/27 drawpattern and bltr2v_24 added to fdrivers/fd_win32.c
|
||||
01/03/26 Fixed a bug in pnm/ctx2pnm.c, when grx == NULL the actual context
|
||||
must be used. Reported by Vicente Fuentes Gea
|
||||
01/03/25 The dj2 version uses now "uclock" in mouse/input.h to get 1ms
|
||||
resolution in input code. Because "uclock" can be unsafe in W3.1
|
||||
when NO_REPROGRAM_TIMER is defined the old code is used. A
|
||||
comment has been added to makedefs.dj2
|
||||
01/03/25 Changed CLOCKS_PER_SECOND by CLK_TCK for linux in mouse/input.h
|
||||
to get real ticks per second
|
||||
01/03/24 New API routines: GrSetWindowTitle and GrSleep
|
||||
01/03/22 Changed DJGPP test macro from __GO32__ to __DJGPP__
|
||||
by Andris Pavenis
|
||||
|
||||
01/03/18 ----------- GRX v2.4 released (Mariano Alvarez Fernandez)
|
||||
01/03/16 Win32 drivers improved again by Josu Onandia
|
||||
01/03/15 Make bccbgi to use ../rand.h to work with the Win32 drivers
|
||||
01/03/14 Added ifdef to demo programs to use GRXMain with the Win32 drivers
|
||||
01/03/12 Fixed a bug in mouse/xwinkeys.c, preventing getkey & kbhit work
|
||||
together (Now bccbgi demo works properly in X, except restoring
|
||||
from text mode)
|
||||
01/03/10 Support for DJGPP v1 removed (really only removed makefiles by now)
|
||||
01/03/10 Optimized pnm/ctx2pnm.c, contributed by Josu Onandia
|
||||
01/03/10 Improved frame and video drivers for win32, by Josu Onandia
|
||||
<jonandia@fagorautomation.es>
|
||||
01/03/06 Integrated the win32 version written by Gernot Graeff
|
||||
<gernot.graeff@t-online.de>
|
||||
01/03/05 Fixed bug in modetest.c preventing 32 bpp modes to work.
|
||||
01/03/04 Applied patch to solve 32bpp problems, by Hartmut Schirmer
|
||||
01/03/03 Applied patch to make GRX compile with gcc 3.0, by Andris Pavenis
|
||||
01/03/03 Fixed bug in pattern/fillpatt.c
|
||||
01/02/26 Modified setmode.c and svgalib.c to set frame pointer dinamicaly
|
||||
and fix the svgalib video driver.
|
||||
01/02/22 Applied some patches by Maurice Lombardi
|
||||
<Maurice.Lombardi@ujf-grenoble.fr>
|
||||
01/02/20 Fixed bug in pattern/patfbox.c
|
||||
01/02/14 Fixed bug preventing GrLoadFont work with BGI fonts
|
||||
|
||||
01/02/12 ----------- GRX v2.3.4 released (Mariano Alvarez Fernandez)
|
||||
01/02/06 user's manual in info format contributed by Vicente Fuentes Gea
|
||||
<vfg@servidor.unam.mx>
|
||||
01/02/01 new WIN32 Mingw32 target (memory driver only)
|
||||
01/01/28 ctx2pnm functions added.
|
||||
01/01/28 user's manual updated again.
|
||||
01/01/28 new test programs added: pnmtest and demogrx.
|
||||
01/01/28 some test programs bug fixes.
|
||||
01/01/28 pascal subdirectory update contributed by Eike Lange
|
||||
<eike.lange@uni-essen.de>
|
||||
|
||||
01/01/24 ----------- GRX v2.3.3 released (Mariano Alvarez Fernandez)
|
||||
01/01/21 BGI test programs moved to test/bgi
|
||||
01/01/21 Added the updated GRX user's guide.
|
||||
01/01/20 BCC2GRX license comments changed to point to the GRX license.
|
||||
01/01/20 Sources changed to point to the copying.grx file
|
||||
01/01/10 Applied some patches by Andris Pavenis.
|
||||
|
||||
00/09/14 ----------- GRX v2.3.2 released (Peter Gerwinski)
|
||||
|
||||
00/06/21 ----------- GRX v2.3.1 released (Peter Gerwinski)
|
||||
00/06/21 Some bug fixes (solved problems induced by the update).
|
||||
|
||||
00/05/20 ----------- GRX update released (Hartmut Schirmer)
|
||||
00/05/20 Added AIX support in grx20.h, xwininp.c, allocate.h as
|
||||
suggested by Andris Pavenis <pavenis@lanet.lv>.
|
||||
Added BGI-Support from BCC2GRX.
|
||||
00/05/19 Don't use GCC/i386 asm in highlow.h on gcc after v2.8.x
|
||||
00/05/17 Added test/sbctest.c contributed by
|
||||
Mariano Alvarez Fernandez <malfer@teleline.es>
|
||||
Fixed additional subcontext bugs in GrPatternFilledLine
|
||||
and GrPatternFilledPlot (reported by Mariano Alvarez
|
||||
Fernández <malfer@teleline.es>)
|
||||
Applied the 32bit X11 patch by Ulrich Leodolter
|
||||
00/04/23 Applied some changes suggested by Josu Onandia
|
||||
<jonandia@fagorautomation.es>
|
||||
- pattern/patfbox.c: Context offset wasn't added
|
||||
to drawing coordinates
|
||||
- text/buildfnt.c: Fixed a typo, pointer to passed
|
||||
free() not same as returned by malloc()
|
||||
- mouse/drawcurs.c: Incorrect calculation of mouse
|
||||
cursor work area
|
||||
Applied asm bugfixes by Ian Miller <Ian@shelob.f9.co.uk>
|
||||
required for EGCS/GCC compilers after v2.8.x
|
||||
and for binutils after v2.9.1
|
||||
Changed GRX internal version to 0x0231
|
||||
Changed return type of main in test/textpatt.c to int
|
||||
00/04/06 Fixed an uninitialized variable reported by Josu Onandia
|
||||
<jonandia@fagorautomation.es>n wideline/drwcpoly.c
|
||||
98/06/28 Updated addons/print test files
|
||||
Added a note to DJGPP & BCC src/makefiles that command.com
|
||||
is required as shell
|
||||
98/06/08 GCC asm enhancements (arith.h,ioport.h,highlow.h)
|
||||
98/06/07 fine tuning mach64 banking functions
|
||||
98/06/06 Fixed a typo in addons/ctx2jpeg.c
|
||||
DJGPP&BCC didn't cleanup the addons subdir's
|
||||
DJGPP v1 failed on grxprint.c compilation
|
||||
Added optimized GCC/i386 asm repfill_b code
|
||||
|
||||
98/06/03 ----------- GRX v2.3 released (Hartmut Schirmer)
|
||||
98/05/26 Fixed a bug in gcc/highlow.h
|
||||
98/05/24 Printing code synced with Andris
|
||||
Some additional files needed memcopy.h
|
||||
X11R6 driver was broken (XInitImage) -- fixed
|
||||
98/05/20 DOS _GrUpdateInputs() still used getxkey -- fixed
|
||||
ram3x8, ega4, herc1 & dosinput didn't include memcopy.h
|
||||
System endian can now be defined by -D_BIG_ENDIAN or
|
||||
-D_LITTLE_ENDIAN at compile time
|
||||
98/05/19 GrSetFontPath() still used alloca -- fixed
|
||||
Again fixed minor problems in printing code:
|
||||
- some functions where declared extern but
|
||||
implemented static
|
||||
- signed / unsigned problem in RepeatByte()
|
||||
98/05/18 Update printing support.
|
||||
There were no RAM drivers for 1 & 4bpp in X11
|
||||
build.
|
||||
Fixed a bug on short hlines in ram1 & ram4
|
||||
GRX uses it's own memcopy now
|
||||
98/05/17 Watcom makefiles changed for DEBUG support and
|
||||
.dat copy from test/ to bin/
|
||||
98/05/14 Some code fixes to avoid warnings fron SUN cc
|
||||
98/05/13 Minor changes to avoid warnings on several platforms
|
||||
(eg, eliminated C++ style comments, non ASCII chars, ...)
|
||||
98/05/11 Fixed LFB frame buffer address handling when
|
||||
LFB_BY_NEAR_POINTER active
|
||||
JPEG & TIFF save now use GrGetScanlineC() and
|
||||
malloc() instead of alloca()
|
||||
98/05/10 Fixed a typo in watcom/memfill.h
|
||||
GCC v2.8.1 broke dependency file creation under
|
||||
DJGPP v2, no subdir information was included for
|
||||
the target. The gcc -MM output is now passed through
|
||||
a new sed script and the created dep-file should be
|
||||
ok on any version GCC. Same change for Linux and X11
|
||||
makefile. This change makes Watcom makefile creation
|
||||
by utils/watmake work again.
|
||||
Again fixed Watcom makefiles
|
||||
Added -DGRX_DEFAULT_FONT_PATH="...." configuration for
|
||||
default font path when no GRXFONT environment entry
|
||||
specified. This is mostly useful on Unix platforms.
|
||||
Getting scanline changed for GrPixel / GrPixelC
|
||||
like naming: GrGetScanline && GrGetScanlineC
|
||||
98/05/07 Watcom updates (bmp/printing/makefiles)
|
||||
Minor BMP & printing updates for better Unix support
|
||||
98/05/06 Fixed a bug in _GrFrDrvGenericStretchBlt()
|
||||
Fixed potential bug in GrImageFilledBoxAlign()
|
||||
98/05/05 GrGetScanline && GrPutScanline functions added
|
||||
98/05/04 GCC/i386 peek_24 was broken
|
||||
Image streching fixes and imgtest prog
|
||||
98/05/03 Added getindexscanline() and putscanline() to frame
|
||||
drivers and implemented generic versions.
|
||||
Added _GrFrDrvGenericStretchBlt() using integer
|
||||
arithmetic and the new scanline functions.
|
||||
Fixed dynamic memory allocation bugs im image code.
|
||||
GrImageStretch() now uses _GrFrDrvGenericStretchBlt()
|
||||
98/04/30 Pascal definition for GrGetLibrarySystem
|
||||
Changed VBE2 memory mapped IO support so a buggy BIOS
|
||||
won't break the code that easily
|
||||
98/04/28 Pattern filling uses predefined _GrPatternFiller instead
|
||||
of local initialized var
|
||||
S3 drivers banking functions enhanced
|
||||
Unified DJGPP & Watcom VBE2 code
|
||||
98/04/27 Fixed problems in font loading code on big endian systems
|
||||
Updated Watcom support
|
||||
Again eliminated some empty macro args
|
||||
Added GrGetLibrarySystem() returning GRX_VERSION for
|
||||
portable runtime system check
|
||||
98/04/26 Fixed a bug introduced when changing pattern filled text
|
||||
code
|
||||
98/04/22 (Pattern-) fill code unified & simplified.
|
||||
Fixed a filling bug on big endian systems.
|
||||
Makefiles updated (printing, zlib)
|
||||
Configuration switches for 'noisy' compilers
|
||||
Code cleanups and splitted some files
|
||||
98/04/21 Better cooperation between X11 and GRX in Pseudocolor mode
|
||||
Added GrAllocEgaColors() for allocation standard EGA colors
|
||||
Borland-C++ 4bpp blit was broken.
|
||||
Relaxed some macro argument handlings for older BCC versions
|
||||
98/04/20 GRX should work on X11R5 systems now.
|
||||
Added some new key definitions (shift left/right/up/down).
|
||||
Changed inline -> INLINE for portability.
|
||||
Removed empty arguments in clipping.h
|
||||
Again fixed minor problems.
|
||||
98/04/15 Added X11 driver changes by Ulrich. Fixes the XGetImage problem.
|
||||
Fixed several portability problems, mainly removed cast
|
||||
to (unsigned) int of assigned variables.
|
||||
Fixed some bugs Thomas found in the ALPHA code
|
||||
Changed temp. memory allocation. New function ALLOC()
|
||||
will use malloc if SMALL_STACK defined of alloca otherwise.
|
||||
Watcom assembler code didn't work. Changed the #pragma
|
||||
definitions so they don't use macros.
|
||||
Fixed several minor bugs
|
||||
98/04/13 Fixed minor bugs in X11 driver.
|
||||
98/04/06 Checked GNU-Pascal support (basic functions only)
|
||||
98/04/05 Minor bugfixes and some GCC/386 speedups (copy & fill
|
||||
loops aligned on 16byte boundary for optimal performance)
|
||||
Changed the mouse timing information to real world time
|
||||
instead of user process time (X11 & Linux)
|
||||
GrMouseGetEventT will only return a valid ev.dtime if
|
||||
any event occured
|
||||
98/04/02 Faster VGA8X line drawing
|
||||
The far (eg. to video ram) peek and poke operations
|
||||
won't get optimized away any more (solves 4bpp blit bug)
|
||||
98/03/31 Added 64 bit support (_h)
|
||||
Fixed a bug in egavga1.c/drawvline
|
||||
98/03/30 Integrated Gary's Watcom changes.
|
||||
Watcom port now defined LFB_BY_NEAR_POINTER
|
||||
Added _n as near/normal opposite of _f in macro names to
|
||||
avoid empty arguments in macro calls
|
||||
98/03/27 Borland port now uses RAM3x8 in 24bpp and 32bpp modes
|
||||
Fast and robust colfill_... functions for Borland
|
||||
Updated image support
|
||||
98/03/19 24bpp mode changed:
|
||||
- Added repfill_24 and optimized peek_24/poke_24
|
||||
- dropped access24.h (only color component access left)
|
||||
- LFB24 and RAM24 now use the same code.
|
||||
- Optimization for black/grey/white filling: done by repfill_b
|
||||
Fixed some Linux/386 shared lib problems (can't use EBX with -fPIC)
|
||||
98/03/17 Major code rearrangement: (Watcom port may be broken :((
|
||||
- A lot of frame driver now share code and use much
|
||||
more optimized (!= generic) drawing functions
|
||||
- Generic and asm fwdcopy/revcopy functions for blitting
|
||||
- splitted header files to individual system files
|
||||
(filling, copying, ...) for better maintaince and
|
||||
easier optimization
|
||||
- much work on BCC speed & stability
|
||||
- Expect the Watcom port to be broken :((
|
||||
Added Andris latest changes to the printing system
|
||||
98/02/25 Fixed X11 keyboard handling
|
||||
minor changes for BSD compilation
|
||||
updates to printing system
|
||||
98/02/24 Fixed a bug in GrDestroyPattern() when freeing the
|
||||
bitmap planes (found&patched by Michal).
|
||||
access24.h needed another fix for linux shared lib :(
|
||||
98/02/20 Added BMP file read && image display contributed
|
||||
by Michal Stencl
|
||||
Added JPEG context save by Vincenzo Morello
|
||||
98/02/19 Watcom makefiles, fixes to print system
|
||||
Changed access24.h for shared library compilation
|
||||
on Linux-i386 systems
|
||||
98/02/17 Watcom fixes and addons by Gary
|
||||
Fixed svga4, lfb8 and vga8x blit functions
|
||||
Added color selection by bpp to GrSetMode
|
||||
Added patterned text output by Stencl Peter
|
||||
Added printing support (thanks again Andris!)
|
||||
98/01/13 fast RAM to video blit to 16 color driver
|
||||
fast hline for 16 color RAM driver
|
||||
98/01/08 Watcom support integrated. Code cleanup (eg. gcc
|
||||
multi line strings cleaned for other compilers)
|
||||
Added platform dependent lib-subdirs
|
||||
Fixed some Linux/svgalib keyboard bugs
|
||||
98/01/01 Revised keyboard support as suggested by Andris and
|
||||
Vincenzo. See new grxkeys.h file in include dir!
|
||||
97/12/21 Updated DJGPP (v1&v2) makefiles again.
|
||||
Fixed some GCC warnings with additional -W... switches
|
||||
(WARNOPTS in makedefs.gnu)
|
||||
Fixed a BCC problem with the new 16 color blit function
|
||||
Some local functions didn't have a static :(
|
||||
Fixed some Linux && X11 keyboard problems (input got
|
||||
desynced on heavy load / high keyrates)
|
||||
97/12/18 updated Pascal support
|
||||
BCC allocates from heap instead of stack for big blocks
|
||||
eliminated some unchecked malloc's
|
||||
Splitted several code files for smarter linking
|
||||
BCC arithmetic moved from assembler macro to optimized
|
||||
function for more reliable results
|
||||
97/12/16 ported the flood fill function from BCC2GRX. See grx20.h
|
||||
for ...FloodFill
|
||||
97/12/15 changed ulong, ushort, etc to GR_int32u, GR_int16u, etc
|
||||
for better portability and to avoid warnings on Linux
|
||||
97/12/08 Integrated code (variable X11 window size & memory driver)
|
||||
and patches (genellip & SaveContextToTiff & other) by Andris
|
||||
97/11/16 Updated Linux and X11 makefiles
|
||||
97/11/02 Makefiles for DJGPP v1 compilation
|
||||
New (much faster) 16 color video to video blit routine
|
||||
97/11/01 Fixed some far pointers to RAM area in the video drivers
|
||||
97/10/29 Added ALPHA processor support
|
||||
97/10/01 Fixed DJGPP systag generation in SRC makefile
|
||||
97/09/30 Updated makefiles and makedefs
|
||||
Added the addons directory and the SaveContextToTiff
|
||||
function
|
||||
Fixed some BCC specific warnings
|
||||
S3 driver banking doesn't work for 16 color modes, at
|
||||
least for my card. Uses VESA banking for < 256 colors
|
||||
Fixed BCC __emit__() code in arith.h (thanks, Andris)
|
||||
------- grx v2.2 release
|
50
thirdparty/grx249/doc/copying.cb
vendored
Normal file
50
thirdparty/grx249/doc/copying.cb
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
This is the original Csaba Biegl copying file, it will be here until
|
||||
all source files will be updated to point to ../copying.grx
|
||||
The license terms have not changed.
|
||||
|
||||
--------------------------------------------------------------------
|
||||
|
||||
This is file "copying.cb".
|
||||
|
||||
This document describes the terms for distributing the source code of and any
|
||||
derived work based on the GRX graphics library. Such source code is marked
|
||||
with the copyright notice:
|
||||
|
||||
"Copyright (c) 1995 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221"
|
||||
|
||||
Source code with the above copyright is distributed under the following terms:
|
||||
|
||||
(1) The test programs for the graphics library (code in the 'test'
|
||||
sub-directory) is distributed without restrictions. This code
|
||||
is free for use in commercial, shareware or freeware applications.
|
||||
|
||||
(2) The GRX graphics library is distributed under the terms of the
|
||||
GNU LGPL (Library General Public License) with the following amendments
|
||||
and/or exceptions:
|
||||
|
||||
- Using the DOS versions (DOS only! this exception DOES NOT apply to
|
||||
the Linux version) you are permitted to distribute an application
|
||||
linked with GRX in binary only, provided that the documentation
|
||||
of the program:
|
||||
|
||||
a) informs the user that GRX is used in the program, AND
|
||||
|
||||
b) provides the user with the necessary information about
|
||||
how to obtain GRX. (i.e. ftp site, etc..)
|
||||
|
||||
(3) Fonts (in the 'fonts' directory) are distributed according to the
|
||||
terms in the file "COPYING.MIT". Most of the fonts included with the
|
||||
GRX library were derived from fonts in the MIT X11R4 distribution.
|
||||
The exception is the "pc" BIOS font family, which is distributed
|
||||
without restrictions.
|
||||
|
||||
A copy of the GNU GPL (in the file "COPYING") and the GNU LGPL (in
|
||||
the file "COPYING.LIB") is included with this document. If you did
|
||||
not receive a copy of "COPYING" or "COPYING.LIB", you may obtain one
|
||||
from where this document was obtained, or by writing to:
|
||||
|
||||
Free Software Foundation
|
||||
675 Mass Ave
|
||||
Cambridge, MA 02139
|
||||
USA
|
||||
|
123
thirdparty/grx249/doc/credits.doc
vendored
Normal file
123
thirdparty/grx249/doc/credits.doc
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
CONTRIB.DOC
|
||||
===========
|
||||
|
||||
GRX was original written by Csaba Biegl <csaba@vuse.vanderbilt.edu>
|
||||
for DJ Delorie's DOS port of the GCC compiler.
|
||||
|
||||
Michael Goffioul <goffioul@emic.ucl.ac.be> released GRX 2.1a
|
||||
(first full API implementation).
|
||||
|
||||
Starting from version v2.2 GRX was maintained by Hartmut Schirmer
|
||||
<hsc@techfak.uni-kiel.de>.
|
||||
|
||||
Peter Gerwinski <peter@gerwinski.de> released GRX 2.3.1 and 2.3.2.
|
||||
|
||||
Mariano Alvarez Fernandez (malfer@telefonica.net) released GRX 2.3.3,
|
||||
2.3.4 and the 2.4.0-6 series.
|
||||
|
||||
Maurice Lombardi <Maurice.Lombardi@ujf-grenoble.fr> packed together
|
||||
various contributions to release GRX 2.4.7-9
|
||||
|
||||
Credits for GRX > v2.0 in alphabetical order
|
||||
============================================
|
||||
|
||||
Csaba Biegl <csaba@vuse.vanderbilt.edu> for the post v2.0 developers
|
||||
source code (and of course: MANY THANKS FOR THE GREAT GRX LIB !).
|
||||
|
||||
N. D. Culver <ndc@alum.mit.edu> for suggesting the bpp based color
|
||||
spec with GrSetMode().
|
||||
|
||||
Thomas Demmer <TDemmer@krafteurope.com> for inprovements and good ideas
|
||||
with the win32 driver.
|
||||
|
||||
Frank Donahoe <fdonahoe@wilkes1.wilkes.edu> for bug reports and patches.
|
||||
|
||||
Vicente Fuentes Gea <vfg@servidor.unam.mx> for the info version of the
|
||||
user's manual.
|
||||
|
||||
Michael Goffioul <goffioul@emic.ucl.ac.be> for his GREAT work:
|
||||
- Pattern Filled functions
|
||||
- Patterned Line functions
|
||||
- Custom Line functions
|
||||
- User Coordinates functions
|
||||
|
||||
Gernot Graeff <gernot.graeff@t-online.de> for the Win32 driver.
|
||||
|
||||
Thomas Hahn <hahn@itpaxp5.physik.uni-karlsruhe.de> for the ALPHA
|
||||
processor patches (64bit support).
|
||||
|
||||
Frank Heckenbach <frank@g-n-u.de> for Pascal interface updates,
|
||||
configure script and many others inprovements.
|
||||
|
||||
Sven Hilscher <Sven@rufus.lan-ks.de> for GNU-Pascal interface and
|
||||
bug reports.
|
||||
|
||||
Eike Lange <eike.lange@uni-essen.de> for Pascal updates.
|
||||
|
||||
Andrzej Lawa [FidoNet: Andrzej Lawa 2:480/19.77] for linear framebuffer
|
||||
support.
|
||||
|
||||
Maurice Lombardi <Maurice.Lombardi@ujf-grenoble.fr> for many patches
|
||||
and bug reports.
|
||||
|
||||
Peter C. Mehlitz <peter@transvirtual.com> for his suggestions on
|
||||
Linux and X11 event time handling
|
||||
|
||||
Vincenzo Morello <morellov@tin.it> continous using GRX as base
|
||||
graphics API for his MGUI lib. He submitted many suggestions,
|
||||
found lots of bugs and contributed the SaveContextToJpeg() code.
|
||||
|
||||
Josu Onandia <jonandia@fagorautomation.es> for patches, bug reports
|
||||
and lot of inprovements to the Win32 driver.
|
||||
|
||||
Andris Pavenis <pavenis@acad.latnet.lv> for many suggestions, the
|
||||
memory driver, printing support, variable X11 resolution, patches
|
||||
and bug reports.
|
||||
|
||||
Gary Sands <gsands@stbni.co.uk> did the Watcom C++ port.
|
||||
|
||||
Daniel Skarda <0rfelyus@atrey.karlin.mff.cuni.cz> for Linux shared
|
||||
libraries and bug reports.
|
||||
|
||||
Anton Norup Soerensen <norup@ursa.astro.ku.dk> for patches and bug reports.
|
||||
|
||||
Michal Stencl <stenclpmd@bratislava.telecom.sk> for the pattern text
|
||||
output, BMP handling and image display functions.
|
||||
|
||||
Waldemar Schultz <schultz@mathematik.tu-muenchen.de> for bug reports.
|
||||
|
||||
Michael <mh@conrad.chem.uni-potsdam.de> for bug reports.
|
||||
|
||||
Dimitar Zhekov <jimmy@is-vn.bg> for three new font drivers, makefile
|
||||
fixes for the bcc version, bgi updates, X11 fixes and the Xfree86 DGA2
|
||||
video driver.
|
||||
|
||||
###########################################################################
|
||||
This is the original contrib.doc by Csaba Biegl (csaba@vuse.vanderbilt.edu)
|
||||
###########################################################################
|
||||
|
||||
This is a (far from complete) list of people who sent me ideas, bug reports
|
||||
or useful code pieces during the development of GRX 2.0.
|
||||
|
||||
This file is under construction (I need to go back in my e-mail records to
|
||||
see who sent me bug reports, ideas, etc...). Currently it has only the most
|
||||
recent contributions. If you think you sent me something for which you should
|
||||
be mentioned here, but you don't see your name in the list, drop me an e-mail.
|
||||
I may have lost same of the older correspondence.
|
||||
|
||||
Hartmut Schirmer (hsc@techfak.uni-kiel.de) for many good ideas, bug reports,
|
||||
the BGI font loader sources and the protected mode VESA paging code.
|
||||
|
||||
Christian Domp (alma.student.uni-kl.de) for bug reports, the 90x30, 94x30
|
||||
90x34 and 94x34 text modes in the stdvga driver and for fixing the HiColor
|
||||
and TrueColor modes in the et4000 driver.
|
||||
|
||||
Ulrich Leodolter (ulrich@lab1.psy.univie.ac.at) for the wonderful X11
|
||||
video, frame and font drivers, bug reports and the DOS Hercules video
|
||||
driver.
|
||||
|
||||
Daniel Skarda (DSKA4435@novell.karlin.mff.cuni.cz) for bug reports.
|
||||
|
||||
Mauro Condarelli (mc5686@mclink.it) for the Linux SVGA version keyboard
|
||||
enhancements.
|
||||
|
140
thirdparty/grx249/doc/fna.txt
vendored
Normal file
140
thirdparty/grx249/doc/fna.txt
vendored
Normal file
|
@ -0,0 +1,140 @@
|
|||
ASCII FONT FORMAT
|
||||
|
||||
This document describes the ascii font format, FNA, as found in GRX 1 font
|
||||
read/write-tool and GRX 2 FNA driver.
|
||||
|
||||
FILE FORMAT
|
||||
|
||||
An ascii font file consists of lines. Each line consists of zero or more
|
||||
8-bit characters and is terminated by a line feed, a carriage return or a
|
||||
carriage return followed by a line feed, depending on the operating system.
|
||||
Line length must not exceed 129 characters with the line terminators and 127
|
||||
characters without them. Trailing blanks are allowed (and ignored), while
|
||||
leading blanks are not allowed. Lines starting with semicolon are comments.
|
||||
They are ignored, and so are the blank lines.
|
||||
|
||||
HEADER
|
||||
|
||||
An ascii font file starts with a header. The header must specify at least 8
|
||||
font properties. Each property is on a separate line, can only be specified
|
||||
once and has the general form:
|
||||
|
||||
<name><separator><value>
|
||||
|
||||
where separator consists of one or more blanks.
|
||||
|
||||
Required properties:
|
||||
|
||||
name <string>
|
||||
|
||||
Font name.
|
||||
|
||||
family <string>
|
||||
|
||||
Font family.
|
||||
|
||||
isfixed <0|1>
|
||||
|
||||
0 for proportional or 1 for monospaced fonts. Any non-zero value is treated
|
||||
as 1.
|
||||
|
||||
width <number>
|
||||
|
||||
Font width for monospaced fonts.
|
||||
|
||||
avgwidth <number>
|
||||
|
||||
Average font width for proportional fonts.
|
||||
|
||||
Note: monospaced fonts should only specify width, and proportional fonts
|
||||
should only specify avgwidth. The GRX FNA driver does not check for that. It
|
||||
expects one width or avgwidth property for each font, no matter the spacing.
|
||||
|
||||
height <number>
|
||||
|
||||
Font height.
|
||||
|
||||
minchar <number>
|
||||
|
||||
The character with which the font starts. Usually 32 (ascii space).
|
||||
|
||||
maxchar <number>
|
||||
|
||||
The character with which the font ends. Must be > minchar. The number of
|
||||
characters in an ascii font file equals to maxchar - minchar + 1.
|
||||
|
||||
baseline <number>
|
||||
|
||||
Font baseline. 1-based.
|
||||
|
||||
minwidth <number>
|
||||
|
||||
The narrowest character width (proportional fonts only). Must be non-zero.
|
||||
Ignored by the driver.
|
||||
|
||||
maxwidth <number>
|
||||
|
||||
The widest character width (proportional fonts only). Must be <= 127. Ignored
|
||||
by the driver.
|
||||
|
||||
Note: the driver does not require minwidth and maxwidth, but any proper ascii
|
||||
font header should include them when describing a proportional font.
|
||||
|
||||
Optional properties:
|
||||
|
||||
undwidth <number>
|
||||
|
||||
Underline height in lines. The default is height / 15 rounded down, or 1 if
|
||||
the font height is < 15.
|
||||
|
||||
note <string>
|
||||
|
||||
Comment. May be empty. Any number of comments may be specified. The usual
|
||||
comments are the font XFDL name and copyright. Ignored by the driver.
|
||||
|
||||
Note: the comments starting with semicolon are always ignored, while the note
|
||||
comments may be taken into account by a non-GRX driver or program.
|
||||
|
||||
DATA
|
||||
|
||||
The file header is followed by <height * number-of-characters> data lines.
|
||||
Each <height> data lines describe one character scan line by scan line. These
|
||||
lines must all be <width> characters long, where <width> is the width of the
|
||||
character being described. Each line describes one character scan line bit by
|
||||
bit from left to right: period for 0-bit, number sign for 1-bit. A blank line
|
||||
and a comment are usually placed before each <height> lines to make the file
|
||||
more readable. Hope my english was good enought, and here is an example:
|
||||
|
||||
; character 36 ($) width = 8
|
||||
........
|
||||
...#....
|
||||
...#....
|
||||
.#####..
|
||||
#..#..#.
|
||||
#..#....
|
||||
#..#....
|
||||
.#####..
|
||||
...#..#.
|
||||
...#..#.
|
||||
#..#..#.
|
||||
.#####..
|
||||
...#....
|
||||
...#....
|
||||
|
||||
If the character being described is less than 33 (exclamation) or greater
|
||||
than 96 (asciitilde), the comment is shorter:
|
||||
|
||||
; character 255 width = 8
|
||||
|
||||
Note: both the blank line and the comment are ignored and DO NOT act as
|
||||
character data separators. Do not let them fool you and check if there are
|
||||
exactly <height> data lines for each character. The driver will not read a
|
||||
file without enough data in it, but will silently ignore any extra data.
|
||||
|
||||
THE END
|
||||
|
||||
No non-blank lines should follow the data, except for semicolon comments. The
|
||||
driver does not check for that. Placing one blank line after the data is not
|
||||
a practice.
|
||||
|
||||
For a full ascii font example, see ter-114n.fna in the GRX fonts directory.
|
2470
thirdparty/grx249/doc/grx249um.html
vendored
Normal file
2470
thirdparty/grx249/doc/grx249um.html
vendored
Normal file
File diff suppressed because it is too large
Load diff
2317
thirdparty/grx249/doc/grx249um.inf
vendored
Normal file
2317
thirdparty/grx249/doc/grx249um.inf
vendored
Normal file
File diff suppressed because it is too large
Load diff
1610
thirdparty/grx249/doc/old/api.doc
vendored
Normal file
1610
thirdparty/grx249/doc/old/api.doc
vendored
Normal file
File diff suppressed because it is too large
Load diff
511
thirdparty/grx249/doc/old/install.doc
vendored
Normal file
511
thirdparty/grx249/doc/old/install.doc
vendored
Normal file
|
@ -0,0 +1,511 @@
|
|||
THIS FILE IS UNDER CONSTRUCTION!!!!
|
||||
|
||||
After you un-zip the GRX archive you need to do the following things to
|
||||
use it:
|
||||
|
||||
Set two environment variables:
|
||||
|
||||
1) SET GRX20DRV=<driver> gw <width> gh <height> nc <colors>
|
||||
2) SET GRXFONT=<directory for the GRX fonts>
|
||||
|
||||
Available drivers are:
|
||||
|
||||
stdvga
|
||||
stdega
|
||||
et4000
|
||||
cl5426
|
||||
mach64
|
||||
ati28800
|
||||
VESA
|
||||
|
||||
After setting these you may run "bin/modetest" to see what modes you have.
|
||||
|
||||
To compile and link a program you need to make sure that the compiler
|
||||
"sees" the "include" and "lib" directories of the GRX20 package. Either
|
||||
use the -I and -L compiler switches with these directories or copy
|
||||
the files from these dirs to a standard place.
|
||||
|
||||
|
||||
====================== don't read after this ========================
|
||||
|
||||
|
||||
|
||||
Abstract
|
||||
========
|
||||
|
||||
This document contains information necessary for rebuilding
|
||||
the LIBGRX graphics library. Additionally, it describes some internal
|
||||
details of the library associated with way it accesses the video RAM. This
|
||||
info might be useful for adding support for new graphics adapter types.
|
||||
|
||||
|
||||
How to rebuild the library
|
||||
==========================
|
||||
|
||||
The LIBGRX library is built using the Turbo C MAKE. (TC++ 1.01
|
||||
professional was used.) If an other MAKE has to be used it has to provide
|
||||
some method for generating response files from long command lines. The
|
||||
makefiles may have to be changed from the Turbo C MAKE response file
|
||||
syntax to the syntax of the new MAKE. Additionally, the Turbo C MAKE
|
||||
provides a C preprocessor-like conditional syntax. If the new MAKE utility
|
||||
does not support this, the desired option has to be hard-coded.
|
||||
|
||||
The makefile in the base directory of the package (typically it is
|
||||
....djgpp\contrib\libgrx) can be invoked as follows:
|
||||
|
||||
1) make build DJGPP libraries, and the drivers
|
||||
2) make turboc build Turbo C libraries
|
||||
3) make test (1+) build DJGPP test programs
|
||||
4) make turbotst (2+) build Turbo C test programs
|
||||
5) make install copy .h and .a files into DJGPP dirs
|
||||
6) make clean clean up after recompiling
|
||||
|
||||
All graphics library sources are in the 'src' directory. The makefile
|
||||
in that directory can also be used to build a customized version of the
|
||||
library. Customized libraries (and the executable built using them) can be
|
||||
smaller, because they don't include support for all video RAM access
|
||||
methods. (see later) The makefile in the src directory can be used as
|
||||
follows:
|
||||
|
||||
make -DPLANES=<value>
|
||||
-- or --
|
||||
make -DPLANES=<value> [-DMODEL=<memory model>] turboc
|
||||
|
||||
The value of the PLANES macro determines the included video RAM access
|
||||
methods. This is a number obtained by OR-ing together the following
|
||||
values:
|
||||
|
||||
1 monochrome (Hercules)
|
||||
4 16 color EGA/VGA/SVGA
|
||||
8 256 color VGA/SVGA
|
||||
16 32768 color SVGA
|
||||
32 256 color plane mode (mode X)
|
||||
|
||||
For example:
|
||||
|
||||
make -DPLANES=12
|
||||
|
||||
will build a DJGPP library which only includes support for 16 and 256
|
||||
color video modes.
|
||||
|
||||
To rebuild the Turbo C version of the library a copy of TASM is also
|
||||
needed, as the library contains a significant amount of in-line assembly
|
||||
code.
|
||||
|
||||
|
||||
Compiling the test programs
|
||||
===========================
|
||||
|
||||
The makefile in the test directory accepts the following arguments:
|
||||
|
||||
1) make build all DJGPP test programs
|
||||
2) make turboc build all Turbo C test programs
|
||||
3) make <prog>. build a single DJGPP test program
|
||||
4) make <prog>.exe build a single Turbo C test program
|
||||
|
||||
See the accompanying document "tests.doc" on how to run the test programs.
|
||||
|
||||
|
||||
Low-level video RAM access support
|
||||
==================================
|
||||
|
||||
When 'GrSetMode' is called it finally ends up making a call to the mode
|
||||
set routine of the graphics driver which knows about the capabilities of
|
||||
the card, and how to put the card into the desired mode. (This is card
|
||||
dependent -- that's why there are so many drivers.)
|
||||
|
||||
Having done this, the driver returns a status word to the library
|
||||
which specifies the MEMORY ORGANIZATION of the selected graphics mode.
|
||||
There are MUCH FEWER possible memory organizations than video drivers. The
|
||||
currently supported memory organizations in LIBGRX are the following:
|
||||
|
||||
256 color VGA
|
||||
16 color EGA/VGA/SVGA
|
||||
32768 color SVGA
|
||||
8514/A and S3 hardware accelerated video RAM access
|
||||
|
||||
The following two memory organizations are not supported yet, but stubs
|
||||
have been included for them in the library:
|
||||
|
||||
monochrome (Hercules, CGA 640x200 mode, EGA, VGA)
|
||||
VGA 256 color plane-oriented (Mode X, Y...)
|
||||
|
||||
The driver status word is used to set up some global variables
|
||||
describing the layout of the video memory, the number of colors, etc.. The
|
||||
library contains different low-level video RAM access routines for the
|
||||
different video RAM organizations. These low-level video RAM access
|
||||
routines are called indirectly via function pointers. These function
|
||||
pointers are set up when a graphics primitive first attempts to use them.
|
||||
This means that an attempt to draw anything before the first call to
|
||||
'GrSetMode' will fail miserably as the library will has no idea about the
|
||||
video access method to be used.
|
||||
|
||||
The library source files containing the memory mode specific functions
|
||||
are named as follows:
|
||||
|
||||
p1*.c - monochrome (currently dummies only)
|
||||
p4*.c - EGA/VGA 16 color modes
|
||||
p8*.c - VGA 256 color modes
|
||||
ph*.c - VGA 32768 color mode
|
||||
px*.c - VGA 256 color mode X (currently dummies only)
|
||||
pi*.c - 8514/A and S3 256 color mode
|
||||
ps*.c - a few additional S3 routines where its programming
|
||||
differs from the 8514/A
|
||||
|
||||
Each memory mode access group contains ten files (one function in each)
|
||||
which do the following:
|
||||
|
||||
p?init.c - global data and possibly an init function
|
||||
p?pixset.c - set a single pixel
|
||||
p?pixrd.c - read a single pixel
|
||||
p?pixrow.c - set a pixel row
|
||||
p?pixcol.c - set a pixel column
|
||||
p?pixblk.c - set a rectangular pixel block
|
||||
p?bitblt.c - copy a rectangular pixel block
|
||||
p?line.c - draw a line
|
||||
p?char.c - draw a character
|
||||
p?fillp.c - fill a pixel row with a pattern
|
||||
|
||||
The library does all mode-specific video RAM access through these nine
|
||||
functions. There is a small amount of mode specific code related to
|
||||
setup and color management in the files "setmode.c", "layout.c",
|
||||
"context.c" and "colors.c", other than these the rest of the library
|
||||
(drawing functions, etc..) is video RAM organization independent.
|
||||
|
||||
If the library was built to support only a single memory organization
|
||||
then the calls to the appropriate low-level functions are hard-coded into
|
||||
the code (via preprocessor macros in "libgrx.h"). Additionally, in 256 and
|
||||
32768 color modes some trivial pixel manipulations (read and set a single
|
||||
pixel) are expanded in-line.
|
||||
|
||||
If the library supports more than one video RAM model then this
|
||||
in-line expansion is not done, and all low-level access functions are
|
||||
called via pointers. There is a dispatch routine for every low-level
|
||||
service (in the files "sw*.c"). The pointers initially point to these
|
||||
dispatch routines. When a dispatch routine is first called it puts the
|
||||
address of the appropriate (i.e. corresponding to the current video mode)
|
||||
low-level access function into the pointer and then calls it. This way the
|
||||
dispatch routine gets called only the first time a video RAM access
|
||||
function is used. A call to 'GrSetMode' resets the pointers to point to
|
||||
the dispatch routines.
|
||||
|
||||
NOTE: The Turbo C low-level video RAM access routines do not support
|
||||
paging. (Actually, the 32 bit routines do not support it either because it
|
||||
is handled transparently by the 386's page fault mechanism and the DOS
|
||||
extender.) For this reason the Turbo C version has a resolution
|
||||
limitation: 320x200 in 256 color mode and 800x600 in 16 color mode. For
|
||||
the same reason there is no support for the 32768 color modes in the
|
||||
Turbo C version of the library. HOWEVER: the 8514/A and S3 accelerators
|
||||
do not need direct video RAM access and paging. For this reason the
|
||||
full resolution of these boards (1024x768x256) can be supported even in the
|
||||
Turbo C version of the library.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Abstract
|
||||
|
||||
This document describes the graphics driver format used for DJGPP and the
|
||||
LIBGRX graphics library. It also gives hints for creating a driver for an
|
||||
unsupported display adapter.
|
||||
|
||||
Introduction
|
||||
|
||||
The DJGPP graphics drivers do two things:
|
||||
|
||||
(1) Invoke the BIOS INT 10 routine for setting up the desired graphics mode.
|
||||
Different boards support different resolutions and use different mode
|
||||
numbers -- that's why different drivers are needed for different boards.
|
||||
|
||||
(2) Implement page mapping for video modes which use more than 64K of video
|
||||
memory. This is again board dependent.
|
||||
|
||||
Old driver format
|
||||
|
||||
The following C declarations describe the header of an old format DJGPP
|
||||
graphics driver. Of course, real drivers are coded in assembly.
|
||||
|
||||
typedef unsigned short u_short;
|
||||
typedef unsigned char u_char;
|
||||
|
||||
struct old_driver_header {
|
||||
u_short mode_set_routine_offset;
|
||||
u_short paging_routine_offset;
|
||||
u_short paging_mode_flag; /* 0 if no separate R/W, 1 if yes */
|
||||
u_short default_text_width;
|
||||
u_short default_text_height;
|
||||
u_short default_graphics_width;
|
||||
u_short default_graphics_height;
|
||||
};
|
||||
|
||||
The mode set routine does the following:
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
; Entry: AX=mode selection
|
||||
; 0=80x25 text
|
||||
; 1=default text
|
||||
; 2=text CX cols by DX rows
|
||||
; 3=biggest text
|
||||
; 4=320x200 graphics
|
||||
; 5=default graphics
|
||||
; 6=graphics CX width by DX height
|
||||
; 7=biggest non-interlaced graphics
|
||||
; 8=biggest graphics
|
||||
; CX=width (in pixels or characters) (not always used -- depends on AX)
|
||||
; DX=height
|
||||
;
|
||||
; NOTE: This runs in real mode, but don't mess with the segment registers.
|
||||
;
|
||||
; Exit: CX=width (in pixels or characters)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; DX=height
|
||||
;--------------------------------------------------------------------------
|
||||
|
||||
The paging routine does the following:
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
; Entry: AH=read page
|
||||
; AL=write page
|
||||
;
|
||||
; NOTE: This runs in protected mode! Don't mess with the segment registers!
|
||||
; This code must be relocatable and may not reference any data!
|
||||
;
|
||||
; Exit: VGA configured.
|
||||
; AX,BX,CX,DX,SI,DI may be trashed
|
||||
;--------------------------------------------------------------------------
|
||||
|
||||
The old style graphics driver structure remained unchanged for the first 16
|
||||
color drivers developed for LIBGRX. The only difference is that the additional
|
||||
15 bits in the third word of the header were given new meanings. (The 256
|
||||
color DJGPP library only used one bit to encode the capability to map
|
||||
different pages for reading and writing.) The values of these new bitfields
|
||||
were assigned as to stay compatible with the existing 256 color drivers. (I.e.
|
||||
the 0 value in every bitfield selects the 256 color VGA option.) The
|
||||
definition of these bits (from "grdriver.h"):
|
||||
|
||||
#define GRD_NEW_DRIVER 0x0008 /* NEW FORMAT DRIVER IF THIS IS SET */
|
||||
|
||||
#define GRD_PAGING_MASK 0x0007 /* mask for paging modes */
|
||||
#define GRD_NO_RW 0x0000 /* standard paging, no separate R/W */
|
||||
#define GRD_RW_64K 0x0001 /* two separate 64K R/W pages */
|
||||
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
|
||||
/* THE FOLLOWING THREE OPTIONS ARE NOT SUPPORTED AT THIS TIME */
|
||||
#define GRD_RW_32K 0x0002 /* two separate 32Kb pages */
|
||||
#define GRD_MAP_128K 0x0003 /* 128Kb memory map -- some Tridents
|
||||
can do it (1024x768x16 without
|
||||
paging!!!)
|
||||
#define GRD_MAP_EXTMEM 0x0004 /* Can be mapped extended, above 1M.
|
||||
Some Tseng 4000-s can do it, NO
|
||||
PAGING AT ALL!!!! */
|
||||
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
|
||||
|
||||
#define GRD_TYPE_MASK 0xf000 /* adapter type mask */
|
||||
#define GRD_VGA 0x0000 /* vga */
|
||||
#define GRD_EGA 0x1000 /* ega */
|
||||
#define GRD_HERC 0x2000 /* hercules */
|
||||
#define GRD_8514A 0x3000 /* 8514/A or compatible */
|
||||
#define GRD_S3 0x4000 /* S3 graphics accelerator */
|
||||
|
||||
#define GRD_PLANE_MASK 0x0f00 /* bitplane number mask */
|
||||
#define GRD_8_PLANES 0x0000 /* 8 planes = 256 colors */
|
||||
#define GRD_4_PLANES 0x0100 /* 4 planes = 16 colors */
|
||||
#define GRD_1_PLANE 0x0200 /* 1 plane = 2 colors */
|
||||
#define GRD_16_PLANES 0x0300 /* VGA with 32K colors */
|
||||
#define GRD_8_X_PLANES 0x0400 /* VGA in mode X w/ 256 colors */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define GRD_MEM_MASK 0x00f0 /* memory size mask */
|
||||
#define GRD_64K 0x0010 /* 64K display memory */
|
||||
#define GRD_128K 0x0020 /* 128K display memory */
|
||||
#define GRD_256K 0x0030 /* 256K display memory */
|
||||
#define GRD_512K 0x0040 /* 512K display memory */
|
||||
#define GRD_1024K 0x0050 /* 1MB display memory */
|
||||
#define GRD_192K 0x0060 /* 192K -- some 640x480 EGA-s */
|
||||
#define GRD_M_NOTSPEC 0x0000 /* memory amount not specified */
|
||||
|
||||
An old style driver has the 'GRD_NEW_DRIVER' bit cleared. It can work with
|
||||
previous versions of GO32. Of course for 16 color support the application has
|
||||
to be linked with the LIBGRX library instead of the original 256 color
|
||||
library.
|
||||
|
||||
The following additional old format graphics drivers are supplied with the
|
||||
LIBGRX graphics library:
|
||||
|
||||
EGA16.GRD 16 color EGA driver (640x350x16 max. resolution)
|
||||
VGA16.GRD 16 color standard VGA driver (640x480x16 max.
|
||||
resolution)
|
||||
TSENG4KN.GRD same as DJGPP's Tseng ET 4000 256 color driver, but
|
||||
with added support for the 100x40 text mode. (max:
|
||||
1024x768x256)
|
||||
TSENG416.GRD Tseng ET 4000 16 color driver. (max: 1024x768x16)
|
||||
TRID89N.GRD Trident 8900 256 color driver. This driver has an
|
||||
updated paging routine which seems to fix some
|
||||
previous problems on boards with recent enough
|
||||
chipsets. (max: 1024x768x256)
|
||||
TRID8916.GRD: Trident 8900 16 color driver (max: 1024x768x16)
|
||||
|
||||
|
||||
New driver format
|
||||
|
||||
The disadvantage of the old driver format is that the number of colors is not
|
||||
programmable. The new driver format solves this problem and it also gives the
|
||||
application program a way to query the driver for a list of the supported text
|
||||
and graphics modes. For this the driver header was extended as follows:
|
||||
|
||||
struct new_driver_header {
|
||||
u_short mode_set_routine_offset;
|
||||
u_short paging_routine_offset;
|
||||
u_short driver_mode_flag; /* flag word, see bits below */
|
||||
u_short default_text_width;
|
||||
u_short default_text_height;
|
||||
u_short default_graphics_width;
|
||||
u_short default_graphics_height;
|
||||
u_short default_color_number; /* NEW, may be set from environment */
|
||||
u_short init_routine_offset; /* NEW, call once after drvr loaded */
|
||||
u_short text_mode_table_offset; /* NEW, table of supported text modes */
|
||||
u_short graphics_mode_table_offset; /* NEW, table of supported graphics modes */
|
||||
};
|
||||
|
||||
'text_mode_table_offset' points to a table with entries as follows:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct text_mode_entry {
|
||||
u_short columns;
|
||||
u_short rows;
|
||||
u_short number_of_colors; /* in text mode it is mainly here to make
|
||||
GCC happy with the alignments */
|
||||
u_char BIOS_mode; /* BIOS mode number. Mode not available on
|
||||
the current card if this field is 0xff. */
|
||||
u_char special; /* if non zero then the driver does some
|
||||
special hacks to set it up (like
|
||||
the 50 row mode on a standard VGA) */
|
||||
};
|
||||
|
||||
The end of the table is marked by an all 0 entry. The table entries are sorted
|
||||
by increasing size. The field 'graphics_mode_table_offset' points to a table
|
||||
with entries as follows:
|
||||
|
||||
struct graphics_mode_entry {
|
||||
u_short width;
|
||||
u_short height;
|
||||
u_short number_of_colors;
|
||||
u_char BIOS_mode; /* BIOS mode number. Mode not available on
|
||||
the current card if this field is 0xff.
|
||||
(This may happen for example if the card
|
||||
is not fully populated with RAM) */
|
||||
u_char special; /* if non zero then the driver does some
|
||||
special hacks to set it up (like
|
||||
setting up the 32768 color mode on
|
||||
some ET4000 cards) */
|
||||
};
|
||||
|
||||
The end of the table is marked by an all 0 entry. The table is sorted by
|
||||
increasing color number and within the same color modes by increasing size.
|
||||
|
||||
If the driver is of the new type then it also supports an initialization
|
||||
routine. This is called once after the driver is loaded. The initialization
|
||||
routine can do one or more of the following:
|
||||
|
||||
(1) Check whether the video card is of the expected type
|
||||
|
||||
(2) Determine the amount of video memory on board.
|
||||
|
||||
(3) Determine which of the modes in the text and graphics mode tables are
|
||||
actually available (due to video RAM and possibly DAC [32768 colors!!]
|
||||
limitations) and mark the unavailable entries in the tables.
|
||||
|
||||
To use the new format drivers a recent version of GO32 (1.06, after the middle
|
||||
of April 1992) has to be used. Such versions should recognize the "nc
|
||||
<number>" option field in the GO32 environment variable which specifies the
|
||||
default number of colors for the driver.
|
||||
|
||||
The following new format drivers have been included with the LIBGRX library
|
||||
(new drivers have the ".GRN" extension):
|
||||
|
||||
STDEGA.GRN standard EGA 16 color driver
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
STDVGA.GRN standard VGA 16 and 256 color driver
|
||||
ET4000.GRN Tseng ET 4000 16 256 and 32768 color driver
|
||||
TR8900.GRN Trident 8900 16 and 256 color driver
|
||||
ATIULTRA.GRN Driver for the ATI ULTRA board. This board actually
|
||||
contains two graphics adapters: a 512 KByte SVGA board
|
||||
and a 8514/A compatible accelerator. The driver was
|
||||
programmed to use the VGA part for text, 16 color
|
||||
graphics, and low resolution 256 color graphics modes
|
||||
and the 8514/A part for high resolution 256 color
|
||||
modes. This driver should work with any VGA+8514/A
|
||||
(the 8514/A MUST have 1MB memory for 1024x768
|
||||
resolution) combination as long as the ATI-specific
|
||||
modes of the VGA part are not used.
|
||||
STEALTH.GRN Driver for the Diamond Stealth S3 graphics accelerator
|
||||
board. The driver was programmed to use VGA-style video RAM
|
||||
access for text, 16 color graphics, and low resolution 256
|
||||
color graphics modes and the S3 accelarator functions for
|
||||
high resolution 256 color modes. Currently no 32768 color
|
||||
modes are supported on S3 boards. This driver should work
|
||||
with other S3-based boards which have a VESA BIOS.
|
||||
|
||||
|
||||
Creating a driver for an unsupported board
|
||||
|
||||
You can only use EGA or VGA boards in 16 256 or 32768 color modes with the
|
||||
graphics library. In the near future there will be support for Hercules boards
|
||||
as well. SUPPORT IS NOT PLANNED FOR: BOARDS WITH ON-BOARD GRAPHICS PROCESSORS
|
||||
(TIGA, 8514A, etc...) To create a driver for an unsupported EGA or VGA board
|
||||
you will need the followings:
|
||||
|
||||
(1) An assembler (TASM or MASM), a linker (TLINK or LINK) and a utility to
|
||||
convert .EXE files to the .COM format (EXE2BIN). See also the 'makefile'
|
||||
in the 'drivers' sub-directory.
|
||||
(2) A documentation of the board containing the supported BIOS mode numbers
|
||||
and resolutions.
|
||||
(3) If the driver needs to support modes which use a memory map bigger than
|
||||
64K then you also need a piece of code which does page switching on your
|
||||
board. (Any mode above 800x600 in 16 colors or 320x200 in 256 colors
|
||||
DOES USE paging.) Possible sources:
|
||||
- a working, tested 256 color original DJGPP driver (if you just
|
||||
want to convert it to the new format).
|
||||
- VGAKIT.ZIP (available from various archive sites, like wuarchive,
|
||||
simtel, etc...)
|
||||
- various books on the subject.
|
||||
|
||||
It is best to start with the source of a driver supporting similar resolutions
|
||||
as your board. Use the proper format driver, i.e. if you want a new format
|
||||
driver start with a new original, etc... Typically the driver sources are
|
||||
relatively well commented. What you need to do is:
|
||||
|
||||
(1) possibly change the option word at the head of the driver to indicate
|
||||
the number of colors (old format only), the amount of memory on board,
|
||||
the memory mapping capabilities of the board.
|
||||
(2) change the mode setting code to use the proper BIOS mode numbers. In the
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
old format drivers these are somewhat scattered throughout the code, in
|
||||
the new format drivers you need to edit a few tables only.
|
||||
(3) Replace the paging routine with the one suitable for your board. If your
|
||||
driver supports 16 color resolutions beyond 800x600 then you have to
|
||||
make sure that upon exit from the paging routine the graphics controller
|
||||
port's (0x3ce) index register is reset to 8. (See the paging routine in
|
||||
"TR8900.ASM".) If the paging mechanism does not use any register
|
||||
accessed through the graphics controller port, then you don't need to
|
||||
worry about this.
|
487
thirdparty/grx249/doc/old/internal.doc
vendored
Normal file
487
thirdparty/grx249/doc/old/internal.doc
vendored
Normal file
|
@ -0,0 +1,487 @@
|
|||
THIS FILE IS UNDER CONSTRUCTION!!!!!
|
||||
DON'T READ IT. IF YOU WANT TO SEE THE INTERNALS OF GRX 2.0 CONSULT THE
|
||||
SOURCE!
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Abstract
|
||||
========
|
||||
|
||||
This document describes contains information necessary for rebuilding
|
||||
the LIBGRX graphics library. Additionally, it describes some internal
|
||||
details of the library associated with way it accesses the video RAM. This
|
||||
info might be useful for adding support for new graphics adapter types.
|
||||
|
||||
|
||||
How to rebuild the library
|
||||
==========================
|
||||
|
||||
The LIBGRX library is built using the Turbo C MAKE. (TC++ 1.01
|
||||
professional was used.) If an other MAKE has to be used it has to provide
|
||||
some method for generating response files from long command lines. The
|
||||
makefiles may have to be changed from the Turbo C MAKE response file
|
||||
syntax to the syntax of the new MAKE. Additionally, the Turbo C MAKE
|
||||
provides a C preprocessor-like conditional syntax. If the new MAKE utility
|
||||
does not support this, the desired option has to be hard-coded.
|
||||
|
||||
The makefile in the base directory of the package (typically it is
|
||||
....djgpp\contrib\libgrx) can be invoked as follows:
|
||||
|
||||
1) make build DJGPP libraries, and the drivers
|
||||
2) make turboc build Turbo C libraries
|
||||
3) make test (1+) build DJGPP test programs
|
||||
4) make turbotst (2+) build Turbo C test programs
|
||||
5) make install copy .h and .a files into DJGPP dirs
|
||||
6) make clean clean up after recompiling
|
||||
|
||||
All graphics library sources are in the 'src' directory. The makefile
|
||||
in that directory can also be used to build a customized version of the
|
||||
library. Customized libraries (and the executable built using them) can be
|
||||
smaller, because they don't include support for all video RAM access
|
||||
methods. (see later) The makefile in the src directory can be used as
|
||||
follows:
|
||||
|
||||
make -DPLANES=<value>
|
||||
-- or --
|
||||
make -DPLANES=<value> [-DMODEL=<memory model>] turboc
|
||||
|
||||
The value of the PLANES macro determines the included video RAM access
|
||||
methods. This is a number obtained by OR-ing together the following
|
||||
values:
|
||||
|
||||
1 monochrome (Hercules)
|
||||
4 16 color EGA/VGA/SVGA
|
||||
8 256 color VGA/SVGA
|
||||
16 32768 color SVGA
|
||||
32 256 color plane mode (mode X)
|
||||
|
||||
For example:
|
||||
|
||||
make -DPLANES=12
|
||||
|
||||
will build a DJGPP library which only includes support for 16 and 256
|
||||
color video modes.
|
||||
|
||||
To rebuild the Turbo C version of the library a copy of TASM is also
|
||||
needed, as the library contains a significant amount of in-line assembly
|
||||
code.
|
||||
|
||||
|
||||
Compiling the test programs
|
||||
===========================
|
||||
|
||||
The makefile in the test directory accepts the following arguments:
|
||||
|
||||
1) make build all DJGPP test programs
|
||||
2) make turboc build all Turbo C test programs
|
||||
3) make <prog>. build a single DJGPP test program
|
||||
4) make <prog>.exe build a single Turbo C test program
|
||||
|
||||
See the accompanying document "tests.doc" on how to run the test programs.
|
||||
|
||||
|
||||
Low-level video RAM access support
|
||||
==================================
|
||||
|
||||
When 'GrSetMode' is called it finally ends up making a call to the mode
|
||||
set routine of the graphics driver which knows about the capabilities of
|
||||
the card, and how to put the card into the desired mode. (This is card
|
||||
dependent -- that's why there are so many drivers.)
|
||||
|
||||
Having done this, the driver returns a status word to the library
|
||||
which specifies the MEMORY ORGANIZATION of the selected graphics mode.
|
||||
There are MUCH FEWER possible memory organizations than video drivers. The
|
||||
currently supported memory organizations in LIBGRX are the following:
|
||||
|
||||
256 color VGA
|
||||
16 color EGA/VGA/SVGA
|
||||
32768 color SVGA
|
||||
8514/A and S3 hardware accelerated video RAM access
|
||||
|
||||
The following two memory organizations are not supported yet, but stubs
|
||||
have been included for them in the library:
|
||||
|
||||
monochrome (Hercules, CGA 640x200 mode, EGA, VGA)
|
||||
VGA 256 color plane-oriented (Mode X, Y...)
|
||||
|
||||
The driver status word is used to set up some global variables
|
||||
describing the layout of the video memory, the number of colors, etc.. The
|
||||
library contains different low-level video RAM access routines for the
|
||||
different video RAM organizations. These low-level video RAM access
|
||||
routines are called indirectly via function pointers. These function
|
||||
pointers are set up when a graphics primitive first attempts to use them.
|
||||
This means that an attempt to draw anything before the first call to
|
||||
'GrSetMode' will fail miserably as the library will has no idea about the
|
||||
video access method to be used.
|
||||
|
||||
The library source files containing the memory mode specific functions
|
||||
are named as follows:
|
||||
|
||||
p1*.c - monochrome (currently dummies only)
|
||||
p4*.c - EGA/VGA 16 color modes
|
||||
p8*.c - VGA 256 color modes
|
||||
ph*.c - VGA 32768 color mode
|
||||
px*.c - VGA 256 color mode X (currently dummies only)
|
||||
pi*.c - 8514/A and S3 256 color mode
|
||||
ps*.c - a few additional S3 routines where its programming
|
||||
differs from the 8514/A
|
||||
|
||||
Each memory mode access group contains ten files (one function in each)
|
||||
which do the following:
|
||||
|
||||
p?init.c - global data and possibly an init function
|
||||
p?pixset.c - set a single pixel
|
||||
p?pixrd.c - read a single pixel
|
||||
p?pixrow.c - set a pixel row
|
||||
p?pixcol.c - set a pixel column
|
||||
p?pixblk.c - set a rectangular pixel block
|
||||
p?bitblt.c - copy a rectangular pixel block
|
||||
p?line.c - draw a line
|
||||
p?char.c - draw a character
|
||||
p?fillp.c - fill a pixel row with a pattern
|
||||
|
||||
The library does all mode-specific video RAM access through these nine
|
||||
functions. There is a small amount of mode specific code related to
|
||||
setup and color management in the files "setmode.c", "layout.c",
|
||||
"context.c" and "colors.c", other than these the rest of the library
|
||||
(drawing functions, etc..) is video RAM organization independent.
|
||||
|
||||
If the library was built to support only a single memory organization
|
||||
then the calls to the appropriate low-level functions are hard-coded into
|
||||
the code (via preprocessor macros in "libgrx.h"). Additionally, in 256 and
|
||||
32768 color modes some trivial pixel manipulations (read and set a single
|
||||
pixel) are expanded in-line.
|
||||
|
||||
If the library supports more than one video RAM model then this
|
||||
in-line expansion is not done, and all low-level access functions are
|
||||
called via pointers. There is a dispatch routine for every low-level
|
||||
service (in the files "sw*.c"). The pointers initially point to these
|
||||
dispatch routines. When a dispatch routine is first called it puts the
|
||||
address of the appropriate (i.e. corresponding to the current video mode)
|
||||
low-level access function into the pointer and then calls it. This way the
|
||||
dispatch routine gets called only the first time a video RAM access
|
||||
function is used. A call to 'GrSetMode' resets the pointers to point to
|
||||
the dispatch routines.
|
||||
|
||||
NOTE: The Turbo C low-level video RAM access routines do not support
|
||||
paging. (Actually, the 32 bit routines do not support it either because it
|
||||
is handled transparently by the 386's page fault mechanism and the DOS
|
||||
extender.) For this reason the Turbo C version has a resolution
|
||||
limitation: 320x200 in 256 color mode and 800x600 in 16 color mode. For
|
||||
the same reason there is no support for the 32768 color modes in the
|
||||
Turbo C version of the library. HOWEVER: the 8514/A and S3 accelerators
|
||||
do not need direct video RAM access and paging. For this reason the
|
||||
full resolution of these boards (1024x768x256) can be supported even in the
|
||||
Turbo C version of the library.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Abstract
|
||||
|
||||
This document describes the graphics driver format used for DJGPP and the
|
||||
LIBGRX graphics library. It also gives hints for creating a driver for an
|
||||
unsupported display adapter.
|
||||
|
||||
Introduction
|
||||
|
||||
The DJGPP graphics drivers do two things:
|
||||
|
||||
(1) Invoke the BIOS INT 10 routine for setting up the desired graphics mode.
|
||||
Different boards support different resolutions and use different mode
|
||||
numbers -- that's why different drivers are needed for different boards.
|
||||
|
||||
(2) Implement page mapping for video modes which use more than 64K of video
|
||||
memory. This is again board dependent.
|
||||
|
||||
Old driver format
|
||||
|
||||
The following C declarations describe the header of an old format DJGPP
|
||||
graphics driver. Of course, real drivers are coded in assembly.
|
||||
|
||||
typedef unsigned short u_short;
|
||||
typedef unsigned char u_char;
|
||||
|
||||
struct old_driver_header {
|
||||
u_short mode_set_routine_offset;
|
||||
u_short paging_routine_offset;
|
||||
u_short paging_mode_flag; /* 0 if no separate R/W, 1 if yes */
|
||||
u_short default_text_width;
|
||||
u_short default_text_height;
|
||||
u_short default_graphics_width;
|
||||
u_short default_graphics_height;
|
||||
};
|
||||
|
||||
The mode set routine does the following:
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
; Entry: AX=mode selection
|
||||
; 0=80x25 text
|
||||
; 1=default text
|
||||
; 2=text CX cols by DX rows
|
||||
; 3=biggest text
|
||||
; 4=320x200 graphics
|
||||
; 5=default graphics
|
||||
; 6=graphics CX width by DX height
|
||||
; 7=biggest non-interlaced graphics
|
||||
; 8=biggest graphics
|
||||
; CX=width (in pixels or characters) (not always used -- depends on AX)
|
||||
; DX=height
|
||||
;
|
||||
; NOTE: This runs in real mode, but don't mess with the segment registers.
|
||||
;
|
||||
; Exit: CX=width (in pixels or characters)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; DX=height
|
||||
;--------------------------------------------------------------------------
|
||||
|
||||
The paging routine does the following:
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
; Entry: AH=read page
|
||||
; AL=write page
|
||||
;
|
||||
; NOTE: This runs in protected mode! Don't mess with the segment registers!
|
||||
; This code must be relocatable and may not reference any data!
|
||||
;
|
||||
; Exit: VGA configured.
|
||||
; AX,BX,CX,DX,SI,DI may be trashed
|
||||
;--------------------------------------------------------------------------
|
||||
|
||||
The old style graphics driver structure remained unchanged for the first 16
|
||||
color drivers developed for LIBGRX. The only difference is that the additional
|
||||
15 bits in the third word of the header were given new meanings. (The 256
|
||||
color DJGPP library only used one bit to encode the capability to map
|
||||
different pages for reading and writing.) The values of these new bitfields
|
||||
were assigned as to stay compatible with the existing 256 color drivers. (I.e.
|
||||
the 0 value in every bitfield selects the 256 color VGA option.) The
|
||||
definition of these bits (from "grdriver.h"):
|
||||
|
||||
#define GRD_NEW_DRIVER 0x0008 /* NEW FORMAT DRIVER IF THIS IS SET */
|
||||
|
||||
#define GRD_PAGING_MASK 0x0007 /* mask for paging modes */
|
||||
#define GRD_NO_RW 0x0000 /* standard paging, no separate R/W */
|
||||
#define GRD_RW_64K 0x0001 /* two separate 64K R/W pages */
|
||||
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
|
||||
/* THE FOLLOWING THREE OPTIONS ARE NOT SUPPORTED AT THIS TIME */
|
||||
#define GRD_RW_32K 0x0002 /* two separate 32Kb pages */
|
||||
#define GRD_MAP_128K 0x0003 /* 128Kb memory map -- some Tridents
|
||||
can do it (1024x768x16 without
|
||||
paging!!!)
|
||||
#define GRD_MAP_EXTMEM 0x0004 /* Can be mapped extended, above 1M.
|
||||
Some Tseng 4000-s can do it, NO
|
||||
PAGING AT ALL!!!! */
|
||||
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
|
||||
|
||||
#define GRD_TYPE_MASK 0xf000 /* adapter type mask */
|
||||
#define GRD_VGA 0x0000 /* vga */
|
||||
#define GRD_EGA 0x1000 /* ega */
|
||||
#define GRD_HERC 0x2000 /* hercules */
|
||||
#define GRD_8514A 0x3000 /* 8514/A or compatible */
|
||||
#define GRD_S3 0x4000 /* S3 graphics accelerator */
|
||||
|
||||
#define GRD_PLANE_MASK 0x0f00 /* bitplane number mask */
|
||||
#define GRD_8_PLANES 0x0000 /* 8 planes = 256 colors */
|
||||
#define GRD_4_PLANES 0x0100 /* 4 planes = 16 colors */
|
||||
#define GRD_1_PLANE 0x0200 /* 1 plane = 2 colors */
|
||||
#define GRD_16_PLANES 0x0300 /* VGA with 32K colors */
|
||||
#define GRD_8_X_PLANES 0x0400 /* VGA in mode X w/ 256 colors */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define GRD_MEM_MASK 0x00f0 /* memory size mask */
|
||||
#define GRD_64K 0x0010 /* 64K display memory */
|
||||
#define GRD_128K 0x0020 /* 128K display memory */
|
||||
#define GRD_256K 0x0030 /* 256K display memory */
|
||||
#define GRD_512K 0x0040 /* 512K display memory */
|
||||
#define GRD_1024K 0x0050 /* 1MB display memory */
|
||||
#define GRD_192K 0x0060 /* 192K -- some 640x480 EGA-s */
|
||||
#define GRD_M_NOTSPEC 0x0000 /* memory amount not specified */
|
||||
|
||||
An old style driver has the 'GRD_NEW_DRIVER' bit cleared. It can work with
|
||||
previous versions of GO32. Of course for 16 color support the application has
|
||||
to be linked with the LIBGRX library instead of the original 256 color
|
||||
library.
|
||||
|
||||
The following additional old format graphics drivers are supplied with the
|
||||
LIBGRX graphics library:
|
||||
|
||||
EGA16.GRD 16 color EGA driver (640x350x16 max. resolution)
|
||||
VGA16.GRD 16 color standard VGA driver (640x480x16 max.
|
||||
resolution)
|
||||
TSENG4KN.GRD same as DJGPP's Tseng ET 4000 256 color driver, but
|
||||
with added support for the 100x40 text mode. (max:
|
||||
1024x768x256)
|
||||
TSENG416.GRD Tseng ET 4000 16 color driver. (max: 1024x768x16)
|
||||
TRID89N.GRD Trident 8900 256 color driver. This driver has an
|
||||
updated paging routine which seems to fix some
|
||||
previous problems on boards with recent enough
|
||||
chipsets. (max: 1024x768x256)
|
||||
TRID8916.GRD: Trident 8900 16 color driver (max: 1024x768x16)
|
||||
|
||||
|
||||
New driver format
|
||||
|
||||
The disadvantage of the old driver format is that the number of colors is not
|
||||
programmable. The new driver format solves this problem and it also gives the
|
||||
application program a way to query the driver for a list of the supported text
|
||||
and graphics modes. For this the driver header was extended as follows:
|
||||
|
||||
struct new_driver_header {
|
||||
u_short mode_set_routine_offset;
|
||||
u_short paging_routine_offset;
|
||||
u_short driver_mode_flag; /* flag word, see bits below */
|
||||
u_short default_text_width;
|
||||
u_short default_text_height;
|
||||
u_short default_graphics_width;
|
||||
u_short default_graphics_height;
|
||||
u_short default_color_number; /* NEW, may be set from environment */
|
||||
u_short init_routine_offset; /* NEW, call once after drvr loaded */
|
||||
u_short text_mode_table_offset; /* NEW, table of supported text modes */
|
||||
u_short graphics_mode_table_offset; /* NEW, table of supported graphics modes */
|
||||
};
|
||||
|
||||
'text_mode_table_offset' points to a table with entries as follows:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct text_mode_entry {
|
||||
u_short columns;
|
||||
u_short rows;
|
||||
u_short number_of_colors; /* in text mode it is mainly here to make
|
||||
GCC happy with the alignments */
|
||||
u_char BIOS_mode; /* BIOS mode number. Mode not available on
|
||||
the current card if this field is 0xff. */
|
||||
u_char special; /* if non zero then the driver does some
|
||||
special hacks to set it up (like
|
||||
the 50 row mode on a standard VGA) */
|
||||
};
|
||||
|
||||
The end of the table is marked by an all 0 entry. The table entries are sorted
|
||||
by increasing size. The field 'graphics_mode_table_offset' points to a table
|
||||
with entries as follows:
|
||||
|
||||
struct graphics_mode_entry {
|
||||
u_short width;
|
||||
u_short height;
|
||||
u_short number_of_colors;
|
||||
u_char BIOS_mode; /* BIOS mode number. Mode not available on
|
||||
the current card if this field is 0xff.
|
||||
(This may happen for example if the card
|
||||
is not fully populated with RAM) */
|
||||
u_char special; /* if non zero then the driver does some
|
||||
special hacks to set it up (like
|
||||
setting up the 32768 color mode on
|
||||
some ET4000 cards) */
|
||||
};
|
||||
|
||||
The end of the table is marked by an all 0 entry. The table is sorted by
|
||||
increasing color number and within the same color modes by increasing size.
|
||||
|
||||
If the driver is of the new type then it also supports an initialization
|
||||
routine. This is called once after the driver is loaded. The initialization
|
||||
routine can do one or more of the following:
|
||||
|
||||
(1) Check whether the video card is of the expected type
|
||||
|
||||
(2) Determine the amount of video memory on board.
|
||||
|
||||
(3) Determine which of the modes in the text and graphics mode tables are
|
||||
actually available (due to video RAM and possibly DAC [32768 colors!!]
|
||||
limitations) and mark the unavailable entries in the tables.
|
||||
|
||||
To use the new format drivers a recent version of GO32 (1.06, after the middle
|
||||
of April 1992) has to be used. Such versions should recognize the "nc
|
||||
<number>" option field in the GO32 environment variable which specifies the
|
||||
default number of colors for the driver.
|
||||
|
||||
The following new format drivers have been included with the LIBGRX library
|
||||
(new drivers have the ".GRN" extension):
|
||||
|
||||
STDEGA.GRN standard EGA 16 color driver
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
STDVGA.GRN standard VGA 16 and 256 color driver
|
||||
ET4000.GRN Tseng ET 4000 16 256 and 32768 color driver
|
||||
TR8900.GRN Trident 8900 16 and 256 color driver
|
||||
ATIULTRA.GRN Driver for the ATI ULTRA board. This board actually
|
||||
contains two graphics adapters: a 512 KByte SVGA board
|
||||
and a 8514/A compatible accelerator. The driver was
|
||||
programmed to use the VGA part for text, 16 color
|
||||
graphics, and low resolution 256 color graphics modes
|
||||
and the 8514/A part for high resolution 256 color
|
||||
modes. This driver should work with any VGA+8514/A
|
||||
(the 8514/A MUST have 1MB memory for 1024x768
|
||||
resolution) combination as long as the ATI-specific
|
||||
modes of the VGA part are not used.
|
||||
STEALTH.GRN Driver for the Diamond Stealth S3 graphics accelerator
|
||||
board. The driver was programmed to use VGA-style video RAM
|
||||
access for text, 16 color graphics, and low resolution 256
|
||||
color graphics modes and the S3 accelarator functions for
|
||||
high resolution 256 color modes. Currently no 32768 color
|
||||
modes are supported on S3 boards. This driver should work
|
||||
with other S3-based boards which have a VESA BIOS.
|
||||
|
||||
|
||||
Creating a driver for an unsupported board
|
||||
|
||||
You can only use EGA or VGA boards in 16 256 or 32768 color modes with the
|
||||
graphics library. In the near future there will be support for Hercules boards
|
||||
as well. SUPPORT IS NOT PLANNED FOR: BOARDS WITH ON-BOARD GRAPHICS PROCESSORS
|
||||
(TIGA, 8514A, etc...) To create a driver for an unsupported EGA or VGA board
|
||||
you will need the followings:
|
||||
|
||||
(1) An assembler (TASM or MASM), a linker (TLINK or LINK) and a utility to
|
||||
convert .EXE files to the .COM format (EXE2BIN). See also the 'makefile'
|
||||
in the 'drivers' sub-directory.
|
||||
(2) A documentation of the board containing the supported BIOS mode numbers
|
||||
and resolutions.
|
||||
(3) If the driver needs to support modes which use a memory map bigger than
|
||||
64K then you also need a piece of code which does page switching on your
|
||||
board. (Any mode above 800x600 in 16 colors or 320x200 in 256 colors
|
||||
DOES USE paging.) Possible sources:
|
||||
- a working, tested 256 color original DJGPP driver (if you just
|
||||
want to convert it to the new format).
|
||||
- VGAKIT.ZIP (available from various archive sites, like wuarchive,
|
||||
simtel, etc...)
|
||||
- various books on the subject.
|
||||
|
||||
It is best to start with the source of a driver supporting similar resolutions
|
||||
as your board. Use the proper format driver, i.e. if you want a new format
|
||||
driver start with a new original, etc... Typically the driver sources are
|
||||
relatively well commented. What you need to do is:
|
||||
|
||||
(1) possibly change the option word at the head of the driver to indicate
|
||||
the number of colors (old format only), the amount of memory on board,
|
||||
the memory mapping capabilities of the board.
|
||||
(2) change the mode setting code to use the proper BIOS mode numbers. In the
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
old format drivers these are somewhat scattered throughout the code, in
|
||||
the new format drivers you need to edit a few tables only.
|
||||
(3) Replace the paging routine with the one suitable for your board. If your
|
||||
driver supports 16 color resolutions beyond 800x600 then you have to
|
||||
make sure that upon exit from the paging routine the graphics controller
|
||||
port's (0x3ce) index register is reset to 8. (See the paging routine in
|
||||
"TR8900.ASM".) If the paging mechanism does not use any register
|
||||
accessed through the graphics controller port, then you don't need to
|
||||
worry about this.
|
104
thirdparty/grx249/doc/old/readme.20
vendored
Normal file
104
thirdparty/grx249/doc/old/readme.20
vendored
Normal file
|
@ -0,0 +1,104 @@
|
|||
****************
|
||||
** README.NEW **
|
||||
****************
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
This is an updated (beta) version of the GRX v2.0 graphics library.
|
||||
|
||||
New features are :
|
||||
|
||||
- Pattern Filled functions
|
||||
|
||||
ex.: GrPatternFilledCircle(xc,yc,r,p);
|
||||
|
||||
- Patterned Line functions
|
||||
|
||||
ex.: GrPatternedCircle(xc,yc,r,lp);
|
||||
|
||||
- Custom Line functions
|
||||
|
||||
ex.: GrCustomLine(x1,y1,x2,y2,lo);
|
||||
|
||||
- User Coordinates functions
|
||||
|
||||
ex.: GrUsrFilledEllipse(xc,yc,xa,ya,c);
|
||||
|
||||
These features have been ported to GRX v2.0 from previous versions
|
||||
in the GRX v1.03. However some functions had to be entirely rewritten
|
||||
for compatibility with the new version of the library.
|
||||
|
||||
For more informations on these functions, see the documentation located
|
||||
in the 'doc/' subdirectory, or edit the 'grx20.h' file to see how to use
|
||||
the functions.
|
||||
|
||||
|
||||
Library
|
||||
-------
|
||||
|
||||
A compiled version of the library (with Djgpp v2.01) is supplied with
|
||||
this upgrade and is located in the lib/ subdirectory as the 'libgrx20.a'
|
||||
file. The file 'libgrx20.bk2' also present is a backup of the library
|
||||
of the previous version of GRX20 (without the new features).
|
||||
|
||||
The library can be recompiled by 'make' in the root directory :
|
||||
|
||||
make libs
|
||||
|
||||
If you don't want these new features, you can compile the previous
|
||||
version of the library with the command line
|
||||
|
||||
make previous
|
||||
|
||||
In case of bugs, this can be useful.
|
||||
|
||||
After compiling the library, you can clean the directory (by deleting
|
||||
all the objects files in the 'src/' subdirectory with the command line
|
||||
|
||||
make clean
|
||||
|
||||
so you keep only the archive file on your disk. It can save a little
|
||||
amount of memory.
|
||||
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
With the line command
|
||||
|
||||
make install
|
||||
|
||||
in the root directory of GRX20 'make' will copy the include files in the
|
||||
'include/' directory of DJGPP and the library file in the 'lib/' directory.
|
||||
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
For compiling the tests programs, just type the line command
|
||||
|
||||
make test
|
||||
|
||||
This will compile the library and the tests programs supplied in the
|
||||
'test/' subdirectory of GRX20. These tests are those supplied with the
|
||||
previous version. No tests are already available for the new features
|
||||
of the library. But testing these shouldn't be very difficult ...
|
||||
|
||||
Check your bookmarks, maybe I can release some tests soon !
|
||||
|
||||
|
||||
Conclusion
|
||||
----------
|
||||
|
||||
I have not completely tested the library, but it passed all the tests
|
||||
I made on it (and there were a lot of tests). However, if you encounter
|
||||
some problems in using these new functions, you may contact me at this
|
||||
address :
|
||||
goffioul@emic.ucl.ac.be
|
||||
|
||||
Please send the most reduced code which shows the bug with your message,
|
||||
so I can test it for myself.
|
||||
|
||||
I hope you'll enjoy these new features which I missed sometimes (and
|
||||
I think I was not the only one ...).
|
157
thirdparty/grx249/doc/old/readme.22
vendored
Normal file
157
thirdparty/grx249/doc/old/readme.22
vendored
Normal file
|
@ -0,0 +1,157 @@
|
|||
Hi,
|
||||
|
||||
the official public release GRX v2.2 is available from
|
||||
|
||||
http://www.techfak.uni-kiel.de/~hsc/GRX/grx22.zip
|
||||
|
||||
and soon from any SimTel mirror in the DJGPP/v2tk
|
||||
directory.
|
||||
|
||||
Thanks to a lot of work by
|
||||
|
||||
Csaba Biegl (csaba@vuse.vanderbilt.edu)
|
||||
|
||||
of course and
|
||||
|
||||
Mauro Condarelli (mc5686@mclink.it)
|
||||
Christian Domp (alma.student.uni-kl.de)
|
||||
Michael Goffioul (goffioul@emic.ucl.ac.be)
|
||||
Sven Hilscher (Sven@rufus.central.de)
|
||||
Andrzej Lawa [FidoNet: Andrzej Lawa 2:480/19.77]
|
||||
Ulrich Leodolter (ulrich@lab1.psy.univie.ac.at)
|
||||
Hartmut Schirmer (hsc@techfak.uni-kiel.de)
|
||||
Daniel Skarda (0rfelyus@atrey.karlin.mff.cuni.cz)
|
||||
|
||||
and others (see doc/credits.doc) the GRX library is now
|
||||
greatly enhanced.
|
||||
|
||||
|
||||
Compared with the grx20.zip from DJ-dirs this release provides:
|
||||
---------------------------------------------------------------
|
||||
- user coordinates (by Michael)
|
||||
- pattern filling (by Michael)
|
||||
- custom lines (by Michael)
|
||||
- Linux support [svgalib && X11 (Ulrich) support and other
|
||||
things Csaba mentions in credits.doc ]
|
||||
- reorganized font support (Csaba)
|
||||
- linkable bitmap fonts (Csaba)
|
||||
- Borland vector fonts (Csaba)
|
||||
- VESA 2.0 and svgalib linear frame buffer support
|
||||
- VESA 2.0 8bit DAC support
|
||||
- various driver speed ups
|
||||
- slightly changed color interface (by Michael for better
|
||||
MGUI support)
|
||||
- GNU-Pascal support (by Sven)
|
||||
|
||||
|
||||
What's currently untested:
|
||||
--------------------------
|
||||
- LFB32H frame driver
|
||||
- svgalib linear frame buffer support
|
||||
- X11 driver is supposed to work but couldn't test this
|
||||
- svgalib/X11 on non i386 platforms
|
||||
|
||||
|
||||
What's missing:
|
||||
---------------
|
||||
- documentation
|
||||
- VESA 2.0 protected mode virtual screen support
|
||||
|
||||
|
||||
Installation for DJGPP:
|
||||
-----------------------
|
||||
Unpack the grx22.zip archive in your DJGPP v2 root directory
|
||||
by 'pkunzip -d grx22.zip' or 'unzip grx22.zip'
|
||||
|
||||
Edit your DJGPP.ENV file.
|
||||
a. delete all references to GRX v2.0 or v2.1
|
||||
b. In the [cpp] section append
|
||||
;%DJDIR%/contrib/grx22/include
|
||||
to C_INCLUDE_PATH and CPLUS_INCLUDE_PATH variables
|
||||
c. In the [gcc] section append
|
||||
;%DJDIR%/contrib/grx22/lib
|
||||
to the LIBRARY_PATH entry
|
||||
d. GNU-Pascal users need to change [gpc-cpp] and
|
||||
[gpc] sections too.
|
||||
e. Make sure the GRXFONT environment variable is set,
|
||||
otherwise add
|
||||
+GRXFONT=%DJDIR%/contrib/grx22/fonts
|
||||
at top of DJGPP.ENV
|
||||
|
||||
Check GRX v2.2
|
||||
a. go to DJDIR/contrib/grx22 and check makedefs.gnu and
|
||||
makedefs.dj2 for your system requirements (default
|
||||
should work well on average system )
|
||||
b. go to the test subdir and build the test files:
|
||||
make -f makefile.dj2
|
||||
c. run the tests
|
||||
|
||||
Recompile your own programs with GRX v2.2!
|
||||
|
||||
|
||||
Installation for Linux:
|
||||
-----------------------
|
||||
Unpack the grx22.zip archive in a temporary directory
|
||||
using 'unzip -L -a grx22.zip'. Make sure all .fnt
|
||||
files where extracted in binary mode! Go to contrib
|
||||
subdir and move the grx22 tree to /usr/src
|
||||
|
||||
Delete the DJGPP .a file in the grx22/lib subdir.
|
||||
|
||||
Many GRX based programs need to access the font file.
|
||||
Either make the /usr/src/grx22/fonts subdir readable
|
||||
to anyone running GRX programs or copy the fonts subdir
|
||||
to a place where anyone can access it (I placed the
|
||||
fonts in /usr/local/grx-fonts on my system)
|
||||
Make sure the GRXFONT environment variable points to
|
||||
the fonts directory.
|
||||
|
||||
In /usr/src/grx22 check the default settings in
|
||||
makedefs.gnu and makedefs.x11
|
||||
|
||||
To build the SVGALIB based GRX v2.2 run
|
||||
make -f makefile.lnx
|
||||
|
||||
To build the X11 based GRX v2.2 run
|
||||
make -f makefile.x11
|
||||
|
||||
Check the by running the (static linked) test programs.
|
||||
|
||||
If everything works well, copy the .a and .so library
|
||||
files to a system lib dir, eg. /usr/local/lib and
|
||||
generate symbolic links for the shared libraries:
|
||||
libgrx20.so -> libgrx20.so.2.2.0
|
||||
libgrx20X.so -> libgrx20X.so.2.2.0
|
||||
|
||||
Copy the files from grx22/include and grx22/compat to
|
||||
an include dir (eg. /usr/local/include)
|
||||
|
||||
Make sure all installed files are readable everyone
|
||||
compiling/running GRX based programs.
|
||||
|
||||
Now GRX v2.2 should be ready for your programs !
|
||||
|
||||
|
||||
Important:
|
||||
----------
|
||||
|
||||
Due to slight changes in grx20.h you'll have to recompile
|
||||
your programs. Just relinking it won't work in most cases.
|
||||
|
||||
|
||||
Help:
|
||||
-----
|
||||
If you find a bug in GRX v2.2, if GRX doesn't work on
|
||||
your system or if you have any other question concerning
|
||||
GRX, please contact me by e-mail:
|
||||
|
||||
hsc@techfak.uni-kiel.de
|
||||
|
||||
For DJGPP based systems you might also check the DJGPP
|
||||
news group:
|
||||
|
||||
comp.os.msdos.djgpp
|
||||
|
||||
|
||||
|
||||
Hartmut Schirmer
|
120
thirdparty/grx249/doc/old/readme.23
vendored
Normal file
120
thirdparty/grx249/doc/old/readme.23
vendored
Normal file
|
@ -0,0 +1,120 @@
|
|||
GRX installation instructions
|
||||
=============================
|
||||
|
||||
Requirements:
|
||||
-------------
|
||||
|
||||
The source files: grx23.zip
|
||||
The fonts : grx23fnt.zip
|
||||
This document : grx23rme.1st
|
||||
|
||||
Currently GRX directly supports the following platforms:
|
||||
|
||||
DOS / DJGPP v1.12 (GCC 2.6.3)
|
||||
DOS / DJGPP v2.01 (GCC 2.6.3, 2.7.2 and 2.8.1)
|
||||
DOS / Borland C++ (v2.0, v3.1 and v4.52 checked)
|
||||
DOS / Turbo C (v1.0)
|
||||
DOS / Watcom C++ (v11.0 checked, 32bit only)
|
||||
Linux / svgalib (GCC 2.7.2, 2.8.1)
|
||||
Linux / X11R6 (GCC 2.7.2, 2.8.1)
|
||||
Solaris / X11R5 (GCC 2.7.2, SUN cc v4.1)
|
||||
|
||||
GRX should work on any X11R5 (or later) system after a few
|
||||
changes in makedefs.gnu and makedefs.x11
|
||||
|
||||
Most makefiles (DJGPP and Unix systems) require GNU make
|
||||
|
||||
|
||||
A. Unzip the GRX archives
|
||||
-------------------------
|
||||
|
||||
1) create a directory for the GRX file tree. Examples:
|
||||
DJGPP: eg. DJGPP/contrib/grx23
|
||||
Linux: /usr/src/grx-2.3
|
||||
2) unzip the GRX source archive in the GRX dir:
|
||||
DOS : pkunzip -d grx23.zip
|
||||
Unix : unzip grx23.zip
|
||||
3) unzip the GRX font archive in the same base dir:
|
||||
DOS : pkunzip -d grx2fnt.zip
|
||||
Unix : unzip grx2fnt.zip
|
||||
|
||||
|
||||
B. Set the environment variables
|
||||
--------------------------------
|
||||
|
||||
1) set the default driver and graphics mode info:
|
||||
SET GRX20DRV=<driver> gw <width> gh <height> nc <colors>
|
||||
(very useful but not required)
|
||||
Available drivers are for
|
||||
DOS : stdvga, stdega, et4000, cl5426, mach64, ati28800, VESA,
|
||||
memory
|
||||
Linux: svgalib, memory
|
||||
X11 : xwin, memory
|
||||
|
||||
2) set the GRX font dir.
|
||||
SET GRXFONT=<directory for the GRX fonts>
|
||||
This is required for GRX graphics text output. Path: <GRX base>/fonts
|
||||
NOTE: You can define a default font directory when compiling GRX.
|
||||
E.g, if you installed the fonts in /usr/local/lib/grx/fonts add
|
||||
CCOPT += -DGRX_DEFAULT_FONT_PATH=\"/usr/local/lib/grx/fonts\"
|
||||
to makedefs.gnu (Linux / GNU-make example)
|
||||
|
||||
|
||||
C. Compiling GRX
|
||||
----------------
|
||||
|
||||
This is only required if there's no pre-compiled GRX for your system
|
||||
or you want to change GRX or the library configuration.
|
||||
|
||||
1) Go to GRX base dir and check the makefile and makedefs file
|
||||
for your system setup
|
||||
2) Switch to src sub dir and check the makefile
|
||||
3) run make -f <your makefile>
|
||||
(some system may need additional arguments here !)
|
||||
4) if every thing worked fine go to <GRX base>/test, check the makefile
|
||||
and build all test files / examples:
|
||||
make -f <your makefile>
|
||||
|
||||
|
||||
D. Testing GRX
|
||||
--------------
|
||||
|
||||
1) go to <GRX base>/bin and run the modetest program. If you don't have
|
||||
a modetest (or modtst16) binary, do step C4 first.
|
||||
2) Build and run the other examples (see C4)
|
||||
|
||||
|
||||
E. Installing GRX for your compiler
|
||||
-----------------------------------
|
||||
|
||||
You'll either need to 1: copy some GRX files to places where your compiler
|
||||
will find them or 2: change your compiler setup so it will find the GRX
|
||||
files in there default place.
|
||||
|
||||
1) Copy the library from <GRX base>/lib/<your system> to the compiler
|
||||
library directory.
|
||||
Copy the header files from <GRX base>/include to your compiler include
|
||||
directory
|
||||
2) See compiler documentation. Either change the default compiler behaviour
|
||||
(eg., change djgpp.env) or use command line switches to tell the
|
||||
compiler where to find the GRX files.
|
||||
|
||||
|
||||
F. Problems
|
||||
-----------
|
||||
|
||||
If you have problems installing or running GRX check
|
||||
|
||||
http://www.techfak.uni-kiel.de/~hsc/GRX/
|
||||
|
||||
for updates, pre-compiled libs, ...
|
||||
|
||||
If this doesn't help, check your system/compiler FAQ (eg., the
|
||||
DJGPP v2 FAQ is at http://www.delorie.com/djgpp/v2faq)
|
||||
|
||||
Check out the DJGPP newsgroup comp.os.msdos.djgpp (archive at
|
||||
http://www.delorie.com/djgpp/mail-archives)
|
||||
|
||||
Send a problem report to comp.os.msdos.djgpp or me
|
||||
(hsc@techfak.uni-kiel.de)
|
||||
|
76
thirdparty/grx249/doc/old/tests.doc
vendored
Normal file
76
thirdparty/grx249/doc/old/tests.doc
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
Introduction
|
||||
============
|
||||
|
||||
This document gives a brief description of the test programs in the
|
||||
'tests' sub-directory.
|
||||
|
||||
The test programs were not intended as a flashy demo of the capabilities
|
||||
of LIBGRX. Their purpose is to test the various services of the library.
|
||||
The general syntax of their usage is:
|
||||
|
||||
go32 <prog> [<width> <height> [<color>]] <additional arguments>
|
||||
-- or for the Turbo C tests --
|
||||
<prog> [<width> <height> [<color>]] <additional arguments>
|
||||
|
||||
The test programs typically display several screens, hitting any key
|
||||
will advance to the next screen. In a few cases the keyboard is used
|
||||
differently, these programs will be described below.
|
||||
|
||||
|
||||
Description of the test programs:
|
||||
=================================
|
||||
|
||||
MODETEST:
|
||||
perform video adapter speed test and test the basic primitives
|
||||
of the library.
|
||||
|
||||
WINTEST, WINCLIP, CLIPTEST:
|
||||
test graphics contexts sub-contexts and clipping
|
||||
|
||||
FRAMTEST:
|
||||
demo of the framed box primitive
|
||||
|
||||
BLITTEST:
|
||||
test the bit block transfer function. First it tests the bitblt
|
||||
primitive for 64 possible alignment cases in planar modes (8
|
||||
possible alignments for the source and destination each). It does
|
||||
this test both for forward and backward copy (it depends on
|
||||
whether the source address is bigger than the destination) and
|
||||
for a system RAM graphics context source. A wide and a narrow
|
||||
test pattern is used. After finishing the basic tests the program
|
||||
gives a demo of tiling the screen with a pattern similar to the
|
||||
one in FRAMTEST.
|
||||
|
||||
RGBTEST:
|
||||
tests the 256 color RGB mode.
|
||||
|
||||
COLOROPS:
|
||||
tests the four write modes: SET, XOR, OR, AND
|
||||
|
||||
CURSTEST:
|
||||
tests the graphics cursor drawing routines, Keyboard usage:
|
||||
u U (up) \
|
||||
d D (down) move the cursor
|
||||
l L (left) capitals faster
|
||||
r R (right) /
|
||||
q exit program
|
||||
|
||||
MOUSETST:
|
||||
test the mouse cursor and the rubberband cursor options.
|
||||
|
||||
POLYTEST:
|
||||
test the polygon filling algorithm. It takes the coordinates
|
||||
of the polygons from the data file "polytest.dat"
|
||||
|
||||
CIRCTEST:
|
||||
test the circle drawing algorithm with a circle, horizontal and
|
||||
vertical main axis ellipse. It draws the exact points (calculated
|
||||
using FP arithmetics) in red. The 'q' key aborts the test.
|
||||
|
||||
TESTPATT:
|
||||
tests the pattern filled graphics primitives.
|
||||
|
||||
|
||||
NOTE: these programs can also be used as examples for the usage of the
|
||||
library. As always: CONSULT THE SOURCE!!!!
|
||||
|
80
thirdparty/grx249/doc/problems.htm
vendored
Normal file
80
thirdparty/grx249/doc/problems.htm
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Known GRX problems and things that must be improved</h1>
|
||||
<h2>General:</h2>
|
||||
<ul>
|
||||
<li>The memory driver allocates all planes in one chunk instead
|
||||
of using real planes.
|
||||
<p></p>
|
||||
</li>
|
||||
<li>Printing in 1200dpi on Laserjet supporting PCL6 doesn't work.
|
||||
</li>
|
||||
</ul>
|
||||
<h2>Win32 driver:</h2>
|
||||
<ul>
|
||||
<li>Drawline can be faster. Now when we paint a long diagonal line,
|
||||
the
|
||||
invalidate rect is very big.
|
||||
<p></p>
|
||||
</li>
|
||||
<li>Add a 16 bpp framedriver.
|
||||
<p></p>
|
||||
</li>
|
||||
<li>The printing code doesn't work correctly.
|
||||
</li>
|
||||
</ul>
|
||||
<h2>X11 driver:</h2>
|
||||
<ul>
|
||||
<li>Try to make GrPixel faster.
|
||||
<p></p>
|
||||
</li>
|
||||
<li>The driver can't respond to PAINT events, so it has problems with
|
||||
XFree86 v4 because the backing-store is not enabled by default. The
|
||||
best solution is to have a context to save the actual window (and the
|
||||
GrPixel problem can be solved too). The workaround is to add next lines
|
||||
to the /etc/X11/XF86Config-4 file, in the Device section:
|
||||
<p> Option "BackingStore"
|
||||
</p>
|
||||
<p> Option "SaveUnders"
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
<h2>Linux console framebuffer driver:</h2>
|
||||
<ul>
|
||||
<li>Try to change modes if the underlaying framebuffer driver allow
|
||||
it.
|
||||
<p></p>
|
||||
</li>
|
||||
<li>Complete the alternate direct mouse driver (now it only handles
|
||||
PS/2 and IMPS2 mice).
|
||||
<p></p>
|
||||
</li>
|
||||
<li>Use the alternate input driver even when the Svgalib driver is
|
||||
included,
|
||||
so virtual consoles can be switched.
|
||||
</li>
|
||||
</ul>
|
||||
<h2>Linux console SVGALIB driver:</h2>
|
||||
<ul>
|
||||
<li>Nedded alternate framedrivers for 1 and 4 bpp modes. The actual
|
||||
ones are
|
||||
using inport/outport instructions and doesn't work with svgalib 1.9.x
|
||||
and
|
||||
even with 1.4.x if the linux framebuffer is enabled.
|
||||
<p></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h2>VGA DOS driver:</h2>
|
||||
<ul>
|
||||
<li>It can be improved a lot, replacing the generic funtions it uses.
|
||||
<p></p>
|
||||
</li>
|
||||
<li>BitBlt to screen doens't work in 4bpp modes if the screen is not
|
||||
set as the default context.
|
||||
</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
326
thirdparty/grx249/doc/readme.bgi
vendored
Normal file
326
thirdparty/grx249/doc/readme.bgi
vendored
Normal file
|
@ -0,0 +1,326 @@
|
|||
|
||||
BCC2GRX - Interfacing Borland based graphics programs to LIBGRX
|
||||
Copyright (C) 1993-97 by Hartmut Schirmer
|
||||
Copyright (C) 2002 by Dimitar Zhekov
|
||||
|
||||
This library is now part of the GRX graphics library.
|
||||
|
||||
Contact : grx@gnu.de
|
||||
|
||||
1. Introduction and overview
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
The BCC2GRX was created to allow users of LIBGRX to compile graphics
|
||||
programs written for Borland-C++ and Turbo-C graphics interface. C code
|
||||
can be directly compiled and linked with BCC2GRX.
|
||||
|
||||
Using LIBGRX based graphics gives you some advantages :
|
||||
|
||||
- 32 bit linear memory model (except for Turbo-C and BCC / DOS)
|
||||
- high resolution and high color graphics modes supported
|
||||
- easy way to support new graphics adapters
|
||||
- LIBGRX and BCC2GRX are free software
|
||||
- most ported applications run faster
|
||||
|
||||
The current BCC2GRX (v2.3) does only a few error checks since it is
|
||||
assumed the program was extensively tested before porting it to GRX.
|
||||
BCC2GRX is not a convenient platform to develop new BGI programs. Of
|
||||
course you should use native LIBGRX in such cases!
|
||||
|
||||
|
||||
2. Differences between BGI and BCC2GRX
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
BCC2GRX is based on LIBGRX instead of using an .bgi driver. This
|
||||
introduces some differences compared with the Borland GI. The (known)
|
||||
differences are listed below.
|
||||
|
||||
- Most LIBGRX platforms are 32 bit. An int will take 4 bytes instead of
|
||||
2 with Turbo-C and BCC for DOS. If you need a 16 bit integer, change
|
||||
the definition from int to short which is 16 bit on all systems.
|
||||
- WHITE is a function not constant with BCC2GRX. This may cause
|
||||
problems in switch () statements.
|
||||
(You may use
|
||||
#define WHITE 15
|
||||
#include <libbcc.h>
|
||||
to improve compatibility.)
|
||||
- BCC2GRX can not use .bgi drivers. Installing an user driver and the
|
||||
register(far)bgidriver will always cause an error.
|
||||
- registerfarbgifont() and registerbgifont() are the same. Both take a
|
||||
void* to the character font (whole file with header !)
|
||||
- initgraph()/detectgraph() work slightly different. See below for
|
||||
details.
|
||||
- getmodenames() and other functions may be called before initgraph()
|
||||
- character files won't be flushed at closegraph()
|
||||
- NOT_PUT isn't supported.
|
||||
- some constants may differ in value
|
||||
- BCC2GRX's outtext() and outtextxy() do correct clipping
|
||||
- some graphics primitives slightly differ in behaviour between BGI and
|
||||
LIBGRX. Eg. the "saucer" in bccbgi.c putimage()/getimage() demo
|
||||
looks a little different.
|
||||
- the BCC2GRX header file is <libbcc.h>. You must change the #include
|
||||
statements since BCC2GRX is incompatible with <graphics.h>. For
|
||||
programs compatible with both Borland GI and BCC2GRX, conditional
|
||||
compilation may be used:
|
||||
#if defined(__MSDOS__) && defined(__TURBOC__)
|
||||
# include <graphics.h>
|
||||
#else
|
||||
# include <libbcc.h>
|
||||
#endif
|
||||
and such programs should be linked with the respective library,
|
||||
either Borland or GRX (but not both).
|
||||
- the color constants like REG, GREEN, etc. won't work in graphics
|
||||
modes with more than 256 colors. Use _ega_color(RED),
|
||||
_ega_color(GREEN), etc to get the right colors
|
||||
|
||||
|
||||
3. Some useful internals of BCC2GRX
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Since LIBGRX provides a flexible and powerful set of graphics primitives,
|
||||
some of the basic routines are defined within bccgrx.h using "__inline__
|
||||
static" functions when using a GNU-C compiler. It compiles these functions
|
||||
like macros, but you can refer to their addresses. There is one exeption to
|
||||
this rule: When compiling code based on a pascal program, a macro is used
|
||||
for getaspectratio since the pascal and C graphics interfaces use different
|
||||
calling types.
|
||||
|
||||
BGI has something called a 'viewport'. There are two very different
|
||||
behaviors depending on the clipping flag:
|
||||
|
||||
If clipping is on, one introduces something like a subscreen where
|
||||
(nearly) all drawing operations are done.
|
||||
Otherwise the origin of the drawing coordinate system is shifted from
|
||||
the top left corner to some other point on screen.
|
||||
|
||||
BCC2GRX always adds the origin shift to all operations. If clipping is
|
||||
requested, GrSetClipBox() is called and LIBGRX restricts drawing to the
|
||||
selected subscreen.
|
||||
|
||||
One may wonder why BCC2GRX has it's own drawpoly() function instead of
|
||||
using the LIBGRX function. In BGI a polygon isn't really a polygon but may
|
||||
be a union of several unconnected closed polygons. In more detail:
|
||||
|
||||
If the start point of a polygon is reached again, the next point
|
||||
is the start point of a new polygon. No connection line is drawn.
|
||||
|
||||
So one may draw several closed polygons at once. I don't know whether this
|
||||
behavior of the BGI is a bug or a feature, but BCC2GRX is at least
|
||||
compatible ...
|
||||
|
||||
|
||||
4. initgraph()/detectgraph()/closegraph()
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
It's recommended to use something like the following code to
|
||||
initialize the graphics interface :
|
||||
|
||||
int gd, gm, err;
|
||||
gd = DETECT; /* or detectgraph(&gd,&gm); */
|
||||
initgraph(&gd,&gm,PATH_TO_CHR_FILES);
|
||||
err = graphresult();
|
||||
if (err != grOk) ...
|
||||
|
||||
This code sets up the default graphics mode defined in the GO32 or GRX20DRV
|
||||
environment variable. This code will work with Borland and GRX based BGI
|
||||
code without change. BCC2GRX will treat all gd values as 'DETECT' and set
|
||||
up the GRX default graphics mode.
|
||||
|
||||
BCC2GRX provides two new functions to select the graphics mode:
|
||||
|
||||
void set_BGI_mode(int *graphdriver, int *graphmode);
|
||||
and
|
||||
void set_BGI_mode_whc(int *graphdriver, int *graphmode,
|
||||
int width, int height, int colors);
|
||||
|
||||
If your code requires one of the standard BGI modes, use set_BGI_mode()
|
||||
with BCC2GRX:
|
||||
|
||||
gd = VGA; gm = VGAHI;
|
||||
#ifdef __GNUC__
|
||||
set_BGI_mode( &gd, &gm);
|
||||
#endif
|
||||
initgraph( &gd, &gm, "");
|
||||
|
||||
All resolutions including the SVGA modes may be set up by calling the
|
||||
set_BGI_mode_whc() function:
|
||||
|
||||
#ifdef __GNUC__
|
||||
set_BGI_mode_whc( &gd, &gm, 640, 480, 1<<24);
|
||||
#else
|
||||
/* BCC stuff invoking a SVGA mode, needs nonstd BGI driver */
|
||||
#endif
|
||||
initgraph( &gd, &gm, "");
|
||||
|
||||
The BCC2GRX requests the desired resolution from LIBGRX by calling
|
||||
|
||||
GrSetMode( GR_width_height_color_graphics, ...)
|
||||
|
||||
If there is no such mode in the current driver, a related one may be set up
|
||||
by LIBGRX. If you program needs a special resolution (say eg. Hercules
|
||||
720x348) you should check getmaxx() and getmaxy() after initgraph().
|
||||
|
||||
Please note that
|
||||
- set_BGI_mode(HERCMONO, HERCMONOHI) uses 720x350x16 on VGA cards,
|
||||
- all drivers != NATIVE_GRX behave like DETECT with BCC2GRX,
|
||||
- set_BGI_mode[_whc]() sets up local variables used by initgraph() and
|
||||
setgraphmode(). You may change the resolution after initgraph() done
|
||||
by
|
||||
gd = DETECT;
|
||||
initgraph(&gd, &gm, "");
|
||||
/* Default graphics mode */
|
||||
....
|
||||
#if defined(__TURBOC__) && defined(__MSDOS__)
|
||||
/* Borland GI stuff to set up 1024x768x256 mode */
|
||||
gm = ... ;
|
||||
#else
|
||||
set_BGI_mode_whc(&gd, &gm, 1024, 768, 256);
|
||||
#endif
|
||||
setgraphmode( gm);
|
||||
/* Now in 1024x768x256 mode */
|
||||
|
||||
Starting with BCC2GRX v2.0 there are new functions:
|
||||
|
||||
getmodemaxcolor(int mode), getmodemaxx(int mode), getmodemaxy(int mode)
|
||||
|
||||
which may be called at any time, even before initgraph(). A program may
|
||||
require true rgb support (32k colors or more) and at least 800x600 pixels.
|
||||
The new getmodemax*() functions may be used for flexible setup:
|
||||
|
||||
int gd=DETECT, gm;
|
||||
#if defined(__BCC2GRX__) && (__BCC2GRX__>=0x200)
|
||||
#define XR 800
|
||||
#define YR 600
|
||||
#define CR (1<<15)
|
||||
int lo,hi,x=0,y=0,c=0,i;
|
||||
detectgraph(&gd,&gm);
|
||||
getmoderange(gd, &lo, &hi); gm=-1;
|
||||
for (i=hi;i>=lo;--i)
|
||||
if (getmodemaxcolor(i)>=CR) {
|
||||
if (getmodemaxx(i)==XR && getmodemaxy(i)==YR) {
|
||||
gm = i; /* enough colors and exact geometry */
|
||||
break; /* ==> done */
|
||||
}
|
||||
if (getmodemaxx(i)>=XR && getmodemaxy(i)>=YR)
|
||||
gm = i;
|
||||
} else break; /* no success */
|
||||
if (gm<0) {
|
||||
puts("Sorry, no sufficient video mode available\n");
|
||||
exit(1);
|
||||
}
|
||||
#undef XR
|
||||
#undef YR
|
||||
#undef CR
|
||||
#endif
|
||||
initgraph(&gd,&gm,"");
|
||||
|
||||
The above example exploits the BCC2GRX ordering of modes:
|
||||
less colors first, less total pixel count earlier, or
|
||||
decide by horizontal width
|
||||
Eg.:
|
||||
640x480x16 // 16 < 256 available colors
|
||||
320x200x256 // 64000 < 128000 total pixel
|
||||
640x200x256 // 128000 < 172800 total pixel
|
||||
360x480x256 // 360 < 480 horizontal pixel
|
||||
480x360x256 // 172800 < 480000 total pixel
|
||||
800x600x256 // 256 < 16M available colors
|
||||
640x480x16M
|
||||
|
||||
closegraph() doesn't free any allocated memory (eg. vector fonts).
|
||||
|
||||
The paging routines setactivepage() and setvisualpage() are functional for
|
||||
GRX v2 base BCC2GRX. Just call set_BGI_mode_pages() before calling
|
||||
initgraph():
|
||||
|
||||
set_BGI_mode_pages(2); /* 1 or 2 valid ! */
|
||||
initgraph(...);
|
||||
if (graphresult() == grOk && get_BGI_mode_pages() > 1) {
|
||||
/* Do cool paging stuff */
|
||||
}
|
||||
|
||||
You can't check paging without switching into graphics mode!
|
||||
Translating BCC modes by set_BGI_mode() will disable paging!
|
||||
|
||||
|
||||
5. Using fonts
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
The BCC2GRX v1.2 or newer can link vector fonts into the .exe file.
|
||||
The standard fonts are in the libbcc*.a:
|
||||
|
||||
_bold_font, _euro_font, _goth_font, _lcom_font
|
||||
_litt_font, _sans_font, _scri_font, _simp_font
|
||||
_trip_font, _tscr_font
|
||||
|
||||
Call registerbgifont() to enable font usage:
|
||||
|
||||
registerbgifont( &_bold_font);
|
||||
registerbgifont( &_euro_font);
|
||||
registerbgifont( &_goth_font);
|
||||
registerbgifont( &_lcom_font);
|
||||
registerbgifont( &_litt_font);
|
||||
registerbgifont( &_sans_font);
|
||||
registerbgifont( &_scri_font);
|
||||
registerbgifont( &_simp_font);
|
||||
registerbgifont( &_trip_font);
|
||||
registerbgifont( &_tscr_font);
|
||||
|
||||
Of course you can also link non standard fonts:
|
||||
|
||||
- copy the .chr file(s) to bcc2grx/src
|
||||
- goto bcc2grx and type 'make'
|
||||
- add
|
||||
extern int _<font_name>_font;
|
||||
registerbgifont( &_<font_name>_font);
|
||||
to your source
|
||||
|
||||
The actual BCC2GRX handels the 11 standard and up to 10 user fonts. If you
|
||||
need more user fonts, you should change the definition of LastUserFont in
|
||||
text.c!
|
||||
|
||||
Starting with BCC2GRX v1.2 you can also use the LIBGRX bitmapped fonts.
|
||||
Just get a font handle and set the new text style. Eg. you may want to use
|
||||
the 8x16 VGA font in high resolution graphics:
|
||||
|
||||
font_handle = installuserfont( "pc8x16.fnt");
|
||||
settextstyle( font_handle, HORIZ_DIR, 1);
|
||||
|
||||
See test/ttext.c for more examples.
|
||||
|
||||
Please note that GRX 2.x can't scale bitmap fonts at drawing level any
|
||||
longer. Before drawing a magnified DEFAULT_FONT, BCC2GRX will first set up
|
||||
the required new font and keeps a pointer for later use. Due to this, you
|
||||
might notice a slight delay the first time you request a magnified font.
|
||||
|
||||
The new GRX 2.x may use Borland vector fonts as native fonts. Managing the
|
||||
resulting bitmap fonts would use much more memory than linking the font
|
||||
rendering code twice, so I decided not to use the GRX font API.
|
||||
|
||||
Every font will be loaded only once and stay in (virtual) memory until the
|
||||
program terminates. If this behaviour doesn't work with your program (eg.
|
||||
something like a font editor) or you get short of memory loading hundreds
|
||||
of fonts, please tell me about.
|
||||
|
||||
|
||||
8. What's new in this release?
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
New copyright terms: same license as the rest of GRX.
|
||||
Updated for GRX 1.03 / .vdr drivers / 64K && 16M color modes
|
||||
More robust library internal function naming
|
||||
BLACK now is a constant
|
||||
Several (minor) bug fixes
|
||||
Updated for GRX v2
|
||||
libbcc.h won't include GRX stuff any more
|
||||
added version control __BCC2GRX__
|
||||
Linux support
|
||||
setactivepage()/setvisualpage() with GRX v2
|
||||
|
||||
For a more complete list of changes and new features check src/changes.
|
||||
|
||||
|
||||
9. LIBGRX 2.4.5 and later
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Starting with LIBGRX 2.4.5, BCC2GRX supports Turbo-C and BCC. The
|
||||
documentation has been updated accordingly.
|
31
thirdparty/grx249/doc/tex/grx2.tex
vendored
Normal file
31
thirdparty/grx249/doc/tex/grx2.tex
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename grx249um.inf
|
||||
@settitle GRX 2.4.9 User's Manual
|
||||
@c %**end of header
|
||||
|
||||
@dircategory Libraries
|
||||
@direntry
|
||||
* GRX: (grx). The GRX Graphics Library.
|
||||
@end direntry
|
||||
|
||||
@setchapternewpage odd
|
||||
@paragraphindent 0
|
||||
|
||||
@titlepage
|
||||
@sp 10
|
||||
@comment The title is printed in a large font.
|
||||
@title GRX 2.4.9 User's Manual
|
||||
@subtitle A 2D graphics library for DOS, Linux, X11 and Win32
|
||||
|
||||
@c The following two commands start the copyright page.
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
|
||||
@end titlepage
|
||||
|
||||
@include grx2_0.tex
|
||||
|
||||
@contents
|
||||
@bye
|
||||
|
2516
thirdparty/grx249/doc/tex/grx2_0.tex
vendored
Normal file
2516
thirdparty/grx249/doc/tex/grx2_0.tex
vendored
Normal file
File diff suppressed because it is too large
Load diff
7
thirdparty/grx249/doc/tex/makinf.bat
vendored
Executable file
7
thirdparty/grx249/doc/tex/makinf.bat
vendored
Executable file
|
@ -0,0 +1,7 @@
|
|||
makeinfo --no-split grx2.tex
|
||||
makeinfo --html --no-split grx2.tex
|
||||
d2u grx*
|
||||
texi2dvi grx2.tex
|
||||
dvips grx2
|
||||
d2u grx2.ps
|
||||
texi2dvi --pdf grx2.tex
|
2
thirdparty/grx249/doc/tex/readme
vendored
Normal file
2
thirdparty/grx249/doc/tex/readme
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
Here are files I use to generate the grxvvvum.[inf/html/dvi/pdf] file before every release.
|
||||
It is no necesary to do nothing with them.
|
53
thirdparty/grx249/doc/watcom.txt
vendored
Normal file
53
thirdparty/grx249/doc/watcom.txt
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
WATCOM C++ 11.0 Port of GRX2.2x
|
||||
Contact - Gary Sands (gsands@stbni.co.uk)
|
||||
The port has been caried out for a 32-bit library for DOS4GW binaries.
|
||||
|
||||
Compilation
|
||||
--------------------------------------------
|
||||
NOW HAVE REAL MAKE FILES.
|
||||
The project and target files were a real pain to maintain!
|
||||
Run "WMAKE -F MAKEFILE.WAT" in the GRX base directory to
|
||||
build the library and test executables. The library builds
|
||||
to "LIB/WATCOM32" and the tests build to "BIN". Run
|
||||
"WMAKE -F MAKEFILE.WAT CLEAN" to delete the object and
|
||||
link files. You may see a few warnings from the test
|
||||
programs - DON'T PANIC. The WATCOM compiler is just very
|
||||
pedantic.
|
||||
|
||||
Running "WMAKE DEBUG=1 -F MAKEFILE.WAT" should make a
|
||||
debug build of the library.
|
||||
|
||||
If you want to make your own .PRJ and .TGT files for the IDE
|
||||
remember to compile everything with __MSDOS__ and
|
||||
SMALL_STACK defined (-d option in source options). There
|
||||
may be a few more definitions necessary. Check the top level
|
||||
makefile to see what the compiler options are if you have
|
||||
problems or see a large amount of warning messages.
|
||||
|
||||
What works
|
||||
--------------------------------------------
|
||||
All the test programs shipped with GRX2.29 should work.
|
||||
VBE2 Protected Mode Interface and Linear Frame Buffer Support now
|
||||
compile and work. Don't forget to copy any .DAT files the test
|
||||
programs need to the "BIN" directory.
|
||||
|
||||
What does not work
|
||||
--------------------------------------------
|
||||
16-bit Real Mode Library - I have not looked at it yet.
|
||||
// Added a few fixes for 16-bit mode but not finished. HSC
|
||||
|
||||
What needs to be done
|
||||
--------------------------------------------
|
||||
Speed enhancements - need Watcom versions of the DJGPP/GNU inline
|
||||
assembly routines. In particular the line drawing and fill algorithms.
|
||||
Some of the fills have been written by Hartmut. He has put a lot of
|
||||
effort turning my hacks for Watcom into a structured part of GRX and
|
||||
deserves most of the credit for this port.
|
||||
|
||||
** REMEMBER THAT THE DEFAULT STACK SIZE IS 3K SO YOU MAY HAVE TO
|
||||
ADJUST THAT IN THE LINKER OPTIONS OF YOUR EXECUTABLE - This is less
|
||||
of a problem now if you define SMALL_STACK **
|
||||
|
||||
And of course best of luck using GRX with Watcom!
|
||||
|
||||
|
BIN
thirdparty/grx249/fonts/char11.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char11.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char11b.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char11b.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char11bi.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char11bi.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char11i.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char11i.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char14.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char14.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char14b.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char14b.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char14bi.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char14bi.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char14i.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char14i.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char16.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char16.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char16b.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char16b.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char16bi.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char16bi.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char16i.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char16i.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char18.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char18.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char18b.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char18b.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char18bi.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char18bi.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char18i.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char18i.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char23.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char23.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
thirdparty/grx249/fonts/char23b.fnt
(Stored with Git LFS)
vendored
Normal file
BIN
thirdparty/grx249/fonts/char23b.fnt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue