Here we go again.
This commit is contained in:
commit
e2c517b529
52 changed files with 18583 additions and 0 deletions
30
.gitattributes
vendored
Normal file
30
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#
|
||||
# Roo/E, the Kangaroo Punch Portable GUI Toolkit
|
||||
# Copyright (C) 2026 Scott Duensing
|
||||
#
|
||||
# http://kangaroopunch.com
|
||||
#
|
||||
#
|
||||
# This file is part of Roo/E.
|
||||
#
|
||||
# Roo/E is free software: you can redistribute it and/or modify it under the
|
||||
# terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# Roo/E 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 Affero General Public License
|
||||
# along with Roo/E. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
*.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
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.EXE filter=lfs diff=lfs merge=lfs -text
|
||||
*.a filter=lfs diff=lfs merge=lfs -text
|
||||
28
.gitignore
vendored
Normal file
28
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#
|
||||
# Roo/E, the Kangaroo Punch Portable GUI Toolkit
|
||||
# Copyright (C) 2026 Scott Duensing
|
||||
#
|
||||
# http://kangaroopunch.com
|
||||
#
|
||||
#
|
||||
# This file is part of Roo/E.
|
||||
#
|
||||
# Roo/E is free software: you can redistribute it and/or modify it under the
|
||||
# terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# Roo/E 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 Affero General Public License
|
||||
# along with Roo/E. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
.idea/
|
||||
bin/
|
||||
obj/
|
||||
|
||||
*~
|
||||
BIN
3rdparty/CWSDPMI/CWSDSTUB.EXE
(Stored with Git LFS)
vendored
Normal file
BIN
3rdparty/CWSDPMI/CWSDSTUB.EXE
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
3rdparty/CWSDPMI/csdpmi7b.zip
(Stored with Git LFS)
vendored
Normal file
BIN
3rdparty/CWSDPMI/csdpmi7b.zip
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
3rdparty/CWSDPMI/csdpmi7s.zip
(Stored with Git LFS)
vendored
Normal file
BIN
3rdparty/CWSDPMI/csdpmi7s.zip
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
133
3rdparty/memwatch/FAQ
vendored
Normal file
133
3rdparty/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
3rdparty/memwatch/Makefile
vendored
Normal file
2
3rdparty/memwatch/Makefile
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
test:
|
||||
$(CC) -DMEMWATCH -DMW_STDIO test.c memwatch.c
|
||||
99
3rdparty/memwatch/README
vendored
Normal file
99
3rdparty/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
3rdparty/memwatch/USING
vendored
Normal file
213
3rdparty/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
3rdparty/memwatch/gpl.txt
vendored
Normal file
340
3rdparty/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.
|
||||
2667
3rdparty/memwatch/memwatch.c
vendored
Normal file
2667
3rdparty/memwatch/memwatch.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
710
3rdparty/memwatch/memwatch.h
vendored
Normal file
710
3rdparty/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
3rdparty/memwatch/memwatch.lsm
vendored
Normal file
15
3rdparty/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
3rdparty/memwatch/test.c
vendored
Normal file
116
3rdparty/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!"
|
||||
BIN
3rdparty/pthreads/fpth314b.zip
(Stored with Git LFS)
vendored
Normal file
BIN
3rdparty/pthreads/fpth314b.zip
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
BIN
3rdparty/pthreads/fpth314s.zip
(Stored with Git LFS)
vendored
Normal file
BIN
3rdparty/pthreads/fpth314s.zip
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
677
3rdparty/pthreads/include/pthread.h
vendored
Normal file
677
3rdparty/pthreads/include/pthread.h
vendored
Normal file
|
|
@ -0,0 +1,677 @@
|
|||
/* Copyright (C) 1992-2000 the Florida State University
|
||||
Distributed by the Florida State University under the terms of the
|
||||
GNU Library General Public License.
|
||||
|
||||
This file is part of Pthreads.
|
||||
|
||||
Pthreads 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 (version 2).
|
||||
|
||||
Pthreads is distributed "AS IS" 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 Pthreads; see the file COPYING. If not, write
|
||||
to the Free Software Foundation, 675 Mass Ave, Cambridge,
|
||||
MA 02139, USA.
|
||||
|
||||
Report problems and direct all questions to:
|
||||
|
||||
pthreads-bugs@ada.cs.fsu.edu
|
||||
|
||||
@(#)pthread.h 3.14 11/8/00
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _pthread_pthread_h
|
||||
#define _pthread_pthread_h
|
||||
|
||||
/*
|
||||
* Pthreads interface definition
|
||||
*/
|
||||
|
||||
#include <pthread/config.h>
|
||||
#include <pthread/signal.h>
|
||||
#ifdef SOLARIS_NP
|
||||
#if defined(_POSIX_PTHREAD_SEMANTICS_NP) && !defined(_POSIX_PTHREAD_SEMANTICS)
|
||||
#define _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
#if defined(__PRAGMA_REDEFINE_EXTNAME_NP) && !defined(__PRAGMA_REDEFINE_EXTNAME)
|
||||
#define __PRAGMA_REDEFINE_EXTNAME
|
||||
#endif
|
||||
#include <pthread/types.h>
|
||||
#endif
|
||||
#include <pthread/unistd.h>
|
||||
/*#include <pthread/signal.h> moved up */
|
||||
#include <stdio.h>
|
||||
#include <pthread/limits.h>
|
||||
#include <sys/time.h> /* needed for struct timeval */
|
||||
#ifdef _M_UNIX
|
||||
/*
|
||||
* Bug in latest SCO 3.2: gettimeofday return neg. value after alarm
|
||||
*/
|
||||
#undef timerisset
|
||||
#define timerisset(tp) ((tp)->tv_sec > 0 || (tp)->tv_usec > 0)
|
||||
#endif /* _M_UNIX */
|
||||
#include <pthread/errno.h>
|
||||
#include <pthread/asm.h>
|
||||
|
||||
/*
|
||||
* When setjmp.h is included using SCO, sigjmp_buf will only be defined, if
|
||||
* additional defines have been done, here _POSIX_SOURCE is used:
|
||||
*/
|
||||
#ifdef _M_UNIX
|
||||
#ifndef _POSIX_SOURCE
|
||||
#define _POSIX_SOURCE
|
||||
#include <setjmp.h>
|
||||
#undef _POSIX_SOURCE
|
||||
#else /* _POSIX_SOURCE */
|
||||
#include <setjmp.h>
|
||||
#endif /* _POSIX_SOURCE */
|
||||
#else /* !_M_UNIX */
|
||||
#include <setjmp.h>
|
||||
#endif /* !_M_UNIX */
|
||||
|
||||
#ifdef IO_NP
|
||||
#if defined(__FreeBSD__) || defined(_M_UNIX) || defined(__linux__) || defined(__dos__)
|
||||
#include <sys/types.h>
|
||||
#else /* !__FreeBSD__ && !_M_UNIX && !__linux__ && !__dos__ */
|
||||
#include <sys/asynch.h>
|
||||
#include <sys/types.h>
|
||||
#endif /* !__FreeBSD__ && !_M_UNIX && !__linux__ && !__dos__ */
|
||||
#endif /* IO_NP */
|
||||
#if defined(MALLOC_NP) || defined(STAND_ALONE)
|
||||
#include <malloc.h>
|
||||
#ifdef malloc
|
||||
#undef malloc
|
||||
#endif
|
||||
#ifdef calloc
|
||||
#undef calloc
|
||||
#endif
|
||||
#ifdef free
|
||||
#undef free
|
||||
#endif
|
||||
#ifdef cfree
|
||||
#undef cfree
|
||||
#endif
|
||||
#endif /* MALLOC_NP */
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#include <pthread/fre_setjmp.h>
|
||||
#elif defined(__dos__)
|
||||
#include <pthread/dos_setjmp.h>
|
||||
#elif defined(__linux__)
|
||||
#include <pthread/lin_setjmp.h>
|
||||
#elif defined(_M_UNIX)
|
||||
#include <pthread/sco_setjmp.h>
|
||||
#endif
|
||||
|
||||
/* contentionscope attribute values */
|
||||
#define PTHREAD_SCOPE_SYSTEM 0
|
||||
#define PTHREAD_SCOPE_PROCESS 1
|
||||
|
||||
/* creation modes */
|
||||
#define PTHREAD_CREATE_JOINABLE 0
|
||||
#define PTHREAD_CREATE_DETACHED 1
|
||||
|
||||
/* inheritsched attribute values */
|
||||
#define PTHREAD_INHERIT_SCHED 0
|
||||
#define PTHREAD_EXPLICIT_SCHED 1
|
||||
|
||||
/* Allow variable stack sizes */
|
||||
#ifndef _POSIX_THREAD_ATTR_STACKSIZE
|
||||
#define _POSIX_THREAD_ATTR_STACKSIZE
|
||||
#endif
|
||||
|
||||
#if defined (__GNUC__) || defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
|
||||
|
||||
#ifndef _C_PROTOTYPE
|
||||
#define _C_PROTOTYPE(arglist) arglist
|
||||
#endif /* !_C_PROTOTYPE */
|
||||
|
||||
typedef void *any_t;
|
||||
|
||||
#else /* !(defined (__GNUC__) || defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)) */
|
||||
|
||||
#ifndef _C_PROTOTYPE
|
||||
#define _C_PROTOTYPE(arglist) ()
|
||||
#endif /* !_C_PROTOTYPE */
|
||||
|
||||
typedef char *any_t;
|
||||
|
||||
#ifndef const
|
||||
#define const
|
||||
#endif
|
||||
|
||||
#ifndef volatile
|
||||
#define volatile
|
||||
#endif
|
||||
|
||||
#endif /* defined(__GNUC__) || defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) */
|
||||
|
||||
#ifdef __linux__
|
||||
#include <rpc/types.h>
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#if !defined(__sys_stdtypes_h) && !defined(_SIZE_T) && !defined(__FreeBSD__) && !defined(_M_UNIX) && !defined(__linux__) && !defined(__dos__)
|
||||
typedef unsigned int size_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Mutex objects.
|
||||
*/
|
||||
|
||||
typedef int pthread_protocol_t;
|
||||
|
||||
typedef struct pthread_queue {
|
||||
struct pthread *head;
|
||||
struct pthread *tail;
|
||||
} *pthread_queue_t;
|
||||
|
||||
typedef struct {
|
||||
struct pthread_queue queue;
|
||||
char lock;
|
||||
struct pthread *owner;
|
||||
int flags;
|
||||
#ifdef _POSIX_THREADS_PRIO_PROTECT
|
||||
int prioceiling;
|
||||
pthread_protocol_t protocol;
|
||||
int prev_max_ceiling_prio;
|
||||
#endif
|
||||
} pthread_mutex_t;
|
||||
|
||||
typedef struct {
|
||||
int flags;
|
||||
#ifdef _POSIX_THREADS_PRIO_PROTECT
|
||||
int prioceiling;
|
||||
pthread_protocol_t protocol;
|
||||
#endif
|
||||
} pthread_mutexattr_t;
|
||||
|
||||
#ifdef _POSIX_THREADS_PRIO_PROTECT
|
||||
#define PTHREAD_MUTEX_INITIALIZER { \
|
||||
{ 0, 0 }, /* queue */ \
|
||||
0, /* lock */ \
|
||||
0, /* owner */ \
|
||||
1, /* flags */ \
|
||||
0, /* prioceiling */ \
|
||||
PTHREAD_PRIO_NONE /* protocol */ \
|
||||
}
|
||||
#else
|
||||
#define PTHREAD_MUTEX_INITIALIZER { \
|
||||
{ 0, 0 }, /* queue */ \
|
||||
0, /* lock */ \
|
||||
0, /* owner */ \
|
||||
1 /* flags */ \
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************/
|
||||
/* Mutex Attributes Functions */
|
||||
/* Mutex Functions */
|
||||
/******************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int pthread_mutex_lock _C_PROTOTYPE((pthread_mutex_t *__mutex));
|
||||
extern int pthread_mutex_trylock _C_PROTOTYPE((pthread_mutex_t *__mutex));
|
||||
extern int pthread_mutex_unlock _C_PROTOTYPE((pthread_mutex_t *__mutex));
|
||||
extern int pthread_mutex_init _C_PROTOTYPE((pthread_mutex_t *__mutex,
|
||||
pthread_mutexattr_t *__attr));
|
||||
extern int pthread_mutex_destroy _C_PROTOTYPE((pthread_mutex_t *__mutex));
|
||||
extern int pthread_mutex_setprioceiling
|
||||
_C_PROTOTYPE((pthread_mutex_t *__mutex,
|
||||
int __prioceiling));
|
||||
extern int pthread_mutex_getprioceiling
|
||||
_C_PROTOTYPE((pthread_mutex_t __mutex,
|
||||
int *__prioceiling));
|
||||
extern int pthread_mutexattr_init _C_PROTOTYPE((pthread_mutexattr_t *__attr));
|
||||
extern int pthread_mutexattr_destroy
|
||||
_C_PROTOTYPE((pthread_mutexattr_t *__attr));
|
||||
extern int pthread_mutexattr_setprotocol
|
||||
_C_PROTOTYPE((pthread_mutexattr_t *__attr,
|
||||
pthread_protocol_t __protocol));
|
||||
extern int pthread_mutexattr_getprotocol
|
||||
_C_PROTOTYPE((pthread_mutexattr_t *__attr,
|
||||
int *__protocol));
|
||||
|
||||
extern int pthread_mutexattr_setprioceiling
|
||||
_C_PROTOTYPE((pthread_mutexattr_t *__attr,
|
||||
int __prioceiling));
|
||||
extern int pthread_mutexattr_getprioceiling
|
||||
_C_PROTOTYPE((pthread_mutexattr_t *__attr,
|
||||
int *__prioceiling));
|
||||
extern int pthread_mutexattr_getpshared
|
||||
_C_PROTOTYPE((pthread_mutexattr_t *__attr,
|
||||
int *__pshared));
|
||||
extern int pthread_mutexattr_setpshared
|
||||
_C_PROTOTYPE((pthread_mutexattr_t *__attr,
|
||||
int __pshared));
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Once Objects.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
short init;
|
||||
short exec;
|
||||
pthread_mutex_t mutex;
|
||||
} pthread_once_t;
|
||||
|
||||
#define PTHREAD_ONCE_INIT {FALSE,FALSE,PTHREAD_MUTEX_INITIALIZER};
|
||||
|
||||
/*
|
||||
* Condition variables.
|
||||
*/
|
||||
typedef struct {
|
||||
struct pthread_queue queue;
|
||||
int flags;
|
||||
int waiters;
|
||||
pthread_mutex_t *mutex;
|
||||
} pthread_cond_t;
|
||||
|
||||
typedef struct {
|
||||
int flags;
|
||||
} pthread_condattr_t;
|
||||
|
||||
#define PTHREAD_COND_INITIALIZER { \
|
||||
{ 0, 0 }, /* queue */ \
|
||||
1, /* flags */ \
|
||||
0, /* waiters */ \
|
||||
0 /* mutex */ \
|
||||
}
|
||||
|
||||
/*******************************/
|
||||
/* Condition Functions */
|
||||
/*Condition Attribute Functions*/
|
||||
/*******************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int pthread_cond_destroy _C_PROTOTYPE((pthread_cond_t *__cond));
|
||||
extern int pthread_cond_init _C_PROTOTYPE((pthread_cond_t *__cond,
|
||||
pthread_condattr_t *__attr));
|
||||
extern int pthread_condattr_init _C_PROTOTYPE((pthread_condattr_t *__attr));
|
||||
extern int pthread_condattr_destroy _C_PROTOTYPE((pthread_condattr_t *__attr));
|
||||
extern int pthread_cond_wait _C_PROTOTYPE((pthread_cond_t *__cond,
|
||||
pthread_mutex_t *__mutex));
|
||||
extern int pthread_cond_timedwait _C_PROTOTYPE((pthread_cond_t *__cond,
|
||||
pthread_mutex_t *__mutex,
|
||||
struct timespec *__timeout));
|
||||
extern int pthread_cond_signal _C_PROTOTYPE((pthread_cond_t *__cond));
|
||||
extern int pthread_cond_broadcast _C_PROTOTYPE((pthread_cond_t *__cond));
|
||||
extern int pthread_condattr_getpshared
|
||||
_C_PROTOTYPE((pthread_condattr_t *__attr,
|
||||
int *__pshared));
|
||||
extern int pthread_condattr_setpshared
|
||||
_C_PROTOTYPE((pthread_condattr_t *__attr,
|
||||
int __pshared));
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Threads.
|
||||
*/
|
||||
|
||||
typedef any_t (*pthread_func_t) _C_PROTOTYPE((any_t __arg));
|
||||
typedef void (*pthread_sighandler_t) _C_PROTOTYPE((int));
|
||||
|
||||
struct sched_param {
|
||||
int sched_priority;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int flags;
|
||||
#ifdef _POSIX_THREAD_ATTR_STACKSIZE
|
||||
int stacksize;
|
||||
#endif
|
||||
int contentionscope;
|
||||
int inheritsched;
|
||||
int detachstate;
|
||||
int sched;
|
||||
struct sched_param param;
|
||||
struct timespec starttime, deadline, period;
|
||||
} pthread_attr_t;
|
||||
|
||||
typedef struct {
|
||||
int state;
|
||||
pthread_queue_t queue;
|
||||
pthread_cond_t *cond;
|
||||
} pthread_suspend_t;
|
||||
|
||||
/*
|
||||
* Queue indices
|
||||
*/
|
||||
#define PRIMARY_QUEUE 0
|
||||
#define ALL_QUEUE 1
|
||||
/* this slot may be used by the TIMER_QUEUE with index 2 */
|
||||
#define NUM_QUEUES 3
|
||||
|
||||
typedef int pthread_key_t;
|
||||
|
||||
typedef struct pthread_cleanup *pthread_cleanup_t;
|
||||
|
||||
typedef struct pthread {
|
||||
#if defined (__FreeBSD__) || defined (_M_UNIX) || defined(__linux__) || defined(__dos__)
|
||||
SYS_SIGJMP_BUF context; /* save area for context switch */
|
||||
SYS_SIGJMP_BUF body; /* save area for pthread_body */
|
||||
#else
|
||||
sigjmp_buf context; /* save area for context switch */
|
||||
sigjmp_buf body; /* save area for pthread_body */
|
||||
#endif
|
||||
volatile int terrno; /* thread-specific errno */
|
||||
volatile int ret; /* return value (EINTR --> -1) */
|
||||
char *stack_base; /* bottom of run-time stack */
|
||||
int state; /* thread state, -> pthread_asm.h */
|
||||
struct pthread *next[NUM_QUEUES]; /* links for queues */
|
||||
int num_timers; /* number of timers for thread */
|
||||
struct timeval interval; /* time left for SCHED_RR */
|
||||
struct p_siginfo sig_info[NNSIG]; /* info for user handlers */
|
||||
int sig; /* latest received signal */
|
||||
int code; /* latest received signal code */
|
||||
int osp, opc, obp; /* save area for old context sw */
|
||||
struct context_t *nscp; /* UNIX signal context (new sig) */
|
||||
struct context_t *scp; /* UNIX signal context (current) */
|
||||
struct pthread_queue joinq; /* queue to await termination */
|
||||
pthread_cond_t *cond; /* cond var. if in cond_wait */
|
||||
pthread_queue_t queue;/* primary queue thread is contained in */
|
||||
sigset_t mask; /* set of signals thread has masked out */
|
||||
sigset_t pending; /* set of signals pending on thread */
|
||||
sigset_t sigwaitset; /* set of signals thread is waiting for */
|
||||
pthread_func_t func; /* actual function to call upon activation */
|
||||
any_t arg; /* argument list to above function */
|
||||
any_t result; /* return value of above function */
|
||||
any_t key[_POSIX_DATAKEYS_MAX]; /* thread specific data */
|
||||
pthread_cleanup_t cleanup_top; /* stack of cleanup handlers */
|
||||
pthread_attr_t attr; /* attributes */
|
||||
int base_prio; /* Base priority of thread */
|
||||
int max_ceiling_prio; /* Max of ceiling prio among locked mutexes */
|
||||
int new_prio; /* New Priority */
|
||||
pthread_suspend_t suspend; /* save area for thread suspend */
|
||||
#if defined(IO_NP) && !defined(__FreeBSD__) && !defined(__dos__)
|
||||
#if !defined(__linux__) && !defined(_M_UNIX)
|
||||
volatile struct aio_result_t resultp;/*result of asynchronous I/O ops*/
|
||||
#endif /* !__linux__ && !_M_UNIX */
|
||||
#ifdef USE_POLL_NP
|
||||
int wait_on_select; /* more information in fds */
|
||||
int nfds; /* pertinent file desc. set width */
|
||||
int how_many; /* how many amoung 0 .. width -1 */
|
||||
struct pollfd* fds; /* poll events */
|
||||
#else /* !USE_POLL_NP */
|
||||
int wait_on_select; /* more information in fds */
|
||||
int width; /* pertinent file desc. set width */
|
||||
int how_many; /* how many amoung 0 .. width -1 */
|
||||
fd_set readfds; /* read file descriptor set */
|
||||
fd_set writefds; /* write file descriptor set */
|
||||
fd_set exceptfds; /* except. file descriptor set */
|
||||
#endif /* !USE_POLL_NP */
|
||||
#endif /* IO_NP && !__FreeBSD__ && !__dos__ */
|
||||
#ifdef STAND_ALONE_NP
|
||||
pthread_func_t timer_func; /* function to be called on timeout*/
|
||||
any_t timer_arg; /* arg of above function */
|
||||
struct timespec tp; /* wake-up time */
|
||||
int dummy; /* filler for stack alignment */
|
||||
#else /* !STAND_ALONE_NP */
|
||||
struct timeval tp; /* wake-up time */
|
||||
#endif /* !STAND_ALONE_NP */
|
||||
} *pthread_t;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#define IO_SIZE_T size_t
|
||||
#elif defined (__dos__)
|
||||
#define IO_SIZE_T size_t
|
||||
#define SIGSUSPEND_CONST const
|
||||
#define SIGACTION_CONST const
|
||||
#define SIGPROCMASK_CONST const
|
||||
#define SIGWAIT_CONST const
|
||||
#define LONGJMP_CONST
|
||||
#define SIGLONGJMP_CONST
|
||||
#elif defined (__linux__)
|
||||
#define IO_SIZE_T size_t
|
||||
#elif defined (_M_UNIX)
|
||||
#define IO_SIZE_T size_t
|
||||
#else
|
||||
#if defined(__GNUC__) && defined(_PARAMS)
|
||||
#define IO_SIZE_T __SIZE_TYPE__
|
||||
/*
|
||||
* for gcc 2.5.8 or before use:
|
||||
* #define IO_SIZE_T unsigned int
|
||||
*/
|
||||
#define SIGSUSPEND_CONST
|
||||
#define SIGACTION_CONST const
|
||||
#define SIGPROCMASK_CONST const
|
||||
#define SIGWAIT_CONST const
|
||||
#define LONGJMP_CONST
|
||||
#define SIGLONGJMP_CONST
|
||||
#else
|
||||
/*
|
||||
* for older gcc, remove "const" for "SIGPROCMASK_CONST"
|
||||
*/
|
||||
#define IO_SIZE_T size_t
|
||||
#define SIGSUSPEND_CONST const
|
||||
#define SIGACTION_CONST const
|
||||
#define SIGPROCMASK_CONST const
|
||||
#define SIGWAIT_CONST const
|
||||
#define LONGJMP_CONST
|
||||
#define SIGLONGJMP_CONST
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/******************************/
|
||||
/* Thread Functions */
|
||||
/* Thread Attribute Functions */
|
||||
/******************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern pthread_t pthread_self _C_PROTOTYPE ((void));
|
||||
extern void pthread_init _C_PROTOTYPE ((void));
|
||||
extern int pthread_create _C_PROTOTYPE((pthread_t *___thread,
|
||||
pthread_attr_t *__attr,
|
||||
pthread_func_t __func,
|
||||
any_t __arg));
|
||||
extern int pthread_equal _C_PROTOTYPE((pthread_t __t1,
|
||||
pthread_t __t2));
|
||||
extern int pthread_detach _C_PROTOTYPE((pthread_t ___thread));
|
||||
extern int pthread_join _C_PROTOTYPE((pthread_t ___thread,
|
||||
any_t *__status));
|
||||
extern int sched_yield _C_PROTOTYPE((void));
|
||||
extern void pthread_exit _C_PROTOTYPE((any_t __status));
|
||||
extern int pthread_attr_init _C_PROTOTYPE((pthread_attr_t *__attr));
|
||||
extern int pthread_attr_destroy _C_PROTOTYPE((pthread_attr_t *__attr));
|
||||
extern int pthread_getschedparam _C_PROTOTYPE((pthread_t ___thread,
|
||||
int *__policy,
|
||||
struct sched_param *__param));
|
||||
extern int pthread_setschedparam _C_PROTOTYPE((pthread_t ___thread,
|
||||
int __policy,
|
||||
struct sched_param *__param));
|
||||
extern int pthread_attr_setstacksize _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
size_t __stacksize));
|
||||
extern int pthread_attr_getstacksize _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
size_t *__stacksize));
|
||||
extern int pthread_attr_setscope _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
int __contentionscope));
|
||||
extern int pthread_attr_setinheritsched _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
int __inheritsched));
|
||||
extern int pthread_attr_setschedpolicy _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
int __policy));
|
||||
extern int pthread_attr_setschedparam _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
struct sched_param *__param));
|
||||
extern int pthread_attr_getscope _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
int *__contentionscope));
|
||||
extern int pthread_attr_getinheritsched _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
int *__inheritsched));
|
||||
extern int pthread_attr_getschedpolicy _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
int *__policy));
|
||||
extern int pthread_attr_getschedparam _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
struct sched_param *__param));
|
||||
|
||||
extern int pthread_attr_getstarttime_np _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
struct timespec *__tp));
|
||||
extern int pthread_attr_setstarttime_np _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
struct timespec *__tp));
|
||||
extern int pthread_attr_getdeadline_np _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
struct timespec *__tp));
|
||||
extern int pthread_attr_setdeadline_np _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
struct timespec *__tp,
|
||||
pthread_func_t func));
|
||||
extern int pthread_attr_getperiod_np _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
struct timespec *__tp));
|
||||
extern int pthread_attr_setperiod_np _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
struct timespec *__tp,
|
||||
pthread_func_t func));
|
||||
|
||||
extern int pthread_key_create _C_PROTOTYPE((pthread_key_t *__key,
|
||||
void (*__func)
|
||||
(any_t __value)));
|
||||
extern int pthread_key_delete _C_PROTOTYPE((pthread_key_t __key));
|
||||
extern int pthread_setspecific _C_PROTOTYPE((pthread_key_t __key,
|
||||
any_t __value));
|
||||
extern any_t pthread_getspecific _C_PROTOTYPE((pthread_key_t __key));
|
||||
extern void pthread_cleanup_push _C_PROTOTYPE((void (*__func)
|
||||
(any_t __value),
|
||||
any_t __arg));
|
||||
extern void pthread_cleanup_pop _C_PROTOTYPE((int __execute));
|
||||
extern int sched_get_priority_max _C_PROTOTYPE((int __policy));
|
||||
extern int sched_get_priority_min _C_PROTOTYPE((int __policy));
|
||||
extern int pthread_attr_setdetachstate _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
int __detachstate));
|
||||
extern int pthread_attr_getdetachstate _C_PROTOTYPE((pthread_attr_t *__attr,
|
||||
int *__detachstate));
|
||||
extern int pthread_once _C_PROTOTYPE((pthread_once_t *__once_c,
|
||||
void (*__func) (void)));
|
||||
|
||||
/*
|
||||
* implementation-defined extensions
|
||||
*/
|
||||
extern void pthread_setsigcontext_np _C_PROTOTYPE((struct context_t *__scp,
|
||||
jmp_buf __env,
|
||||
int __val));
|
||||
extern int pthread_lock_stack_np _C_PROTOTYPE((pthread_t __p));
|
||||
|
||||
extern int pthread_suspend_np _C_PROTOTYPE((pthread_t __t));
|
||||
extern int pthread_resume_np _C_PROTOTYPE((pthread_t __t));
|
||||
|
||||
/******************************/
|
||||
/* Signal Functions */
|
||||
/******************************/
|
||||
|
||||
extern int sigwait _C_PROTOTYPE((SIGWAIT_CONST sigset_t *__set,
|
||||
int *__sig));
|
||||
extern int sigprocmask _C_PROTOTYPE((int __how,
|
||||
SIGPROCMASK_CONST sigset_t *__set,
|
||||
sigset_t *__oset));
|
||||
extern int pthread_sigmask _C_PROTOTYPE((int __how,
|
||||
SIGPROCMASK_CONST sigset_t *__set,
|
||||
sigset_t *__oset));
|
||||
extern int sigpending _C_PROTOTYPE((sigset_t *__set));
|
||||
extern int sigsuspend _C_PROTOTYPE((SIGSUSPEND_CONST sigset_t *__set));
|
||||
extern int pause _C_PROTOTYPE((void));
|
||||
#ifdef __dos__
|
||||
/* we use a macro to rename these so we can still call the system
|
||||
functions, since we don't have system-call hooks under DJGPP. */
|
||||
#define raise(sig) pthread_dummy_raise(sig)
|
||||
#define sigprocmask(sig, set1, set2) pthread_dummy_sigprocmask(sig, set1, set2)
|
||||
#define sigsuspend(set) pthread_dummy_sigsuspend(set)
|
||||
#endif
|
||||
#if defined(M_UNIX)
|
||||
#undef raise
|
||||
#endif
|
||||
extern int raise _C_PROTOTYPE((int __sig));
|
||||
extern int pthread_kill _C_PROTOTYPE((pthread_t ___thread,
|
||||
int __sig));
|
||||
extern int pthread_cancel _C_PROTOTYPE((pthread_t ___thread));
|
||||
extern int pthread_setcancelstate _C_PROTOTYPE((int __state, int *__oldstate));
|
||||
extern int pthread_setcanceltype _C_PROTOTYPE((int __type, int *__oldtype));
|
||||
extern void pthread_testcancel _C_PROTOTYPE((void));
|
||||
extern int sigaction _C_PROTOTYPE((int __sig,
|
||||
SIGACTION_CONST struct sigaction *__act,
|
||||
struct sigaction *__oact));
|
||||
#if defined(__FreeBSD__) || defined(_M_UNIX) || defined(__linux__) || defined(__dos__)
|
||||
extern pthread_sighandler_t signal
|
||||
_C_PROTOTYPE((int __sig,
|
||||
pthread_sighandler_t handler));
|
||||
#else
|
||||
#if defined(SOLARIS_NP) && defined(__cplusplus)
|
||||
extern void (*signal(int, void (*)(int)))(int);
|
||||
#else
|
||||
extern void (*signal())();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* yet to come...
|
||||
extern unsigned int alarm _C_PROTOTYPE((unsigned int __seconds));
|
||||
*/
|
||||
extern int nanosleep _C_PROTOTYPE((const struct timespec *__rqtp,
|
||||
struct timespec *__rmtp));
|
||||
extern unsigned int sleep _C_PROTOTYPE((unsigned int __seconds));
|
||||
extern int clock_gettime _C_PROTOTYPE((int __clock_id,
|
||||
struct timespec *__tp));
|
||||
|
||||
/******************************/
|
||||
/* Low-Level Functions */
|
||||
/******************************/
|
||||
|
||||
#ifndef __dos__
|
||||
#ifdef setjmp
|
||||
#undef setjmp
|
||||
#endif
|
||||
#ifdef longjmp
|
||||
#undef longjmp
|
||||
#endif
|
||||
#ifdef sigsetjmp
|
||||
#undef sigsetjmp
|
||||
#endif
|
||||
#ifdef siglongjmp
|
||||
#undef siglongjmp
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern int setjmp _C_PROTOTYPE((jmp_buf __env));
|
||||
extern void longjmp _C_PROTOTYPE((LONGJMP_CONST jmp_buf __env,
|
||||
int __val));
|
||||
extern int sigsetjmp _C_PROTOTYPE((sigjmp_buf __env,
|
||||
int __savemask));
|
||||
extern void siglongjmp _C_PROTOTYPE((SIGLONGJMP_CONST sigjmp_buf __env,
|
||||
int __val));
|
||||
|
||||
/******************************/
|
||||
/* I/O Functions */
|
||||
/******************************/
|
||||
|
||||
#if !defined(__DJGPP__)
|
||||
extern int read _C_PROTOTYPE((int __fd,
|
||||
void *__buf,
|
||||
IO_SIZE_T __nbytes));
|
||||
extern int write _C_PROTOTYPE((int __fd,
|
||||
const void *__buf,
|
||||
IO_SIZE_T __nbytes));
|
||||
#endif /* !__DJGPP__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#define PTHREAD_CANCELED (void *)-1
|
||||
|
||||
#endif /* !_pthread_pthread_h */
|
||||
111
3rdparty/pthreads/include/pthread/asm.h
vendored
Normal file
111
3rdparty/pthreads/include/pthread/asm.h
vendored
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
/* Copyright (C) 1992-2000 the Florida State University
|
||||
Distributed by the Florida State University under the terms of the
|
||||
GNU Library General Public License.
|
||||
|
||||
This file is part of Pthreads.
|
||||
|
||||
Pthreads 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 (version 2).
|
||||
|
||||
Pthreads is distributed "AS IS" 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 Pthreads; see the file COPYING. If not, write
|
||||
to the Free Software Foundation, 675 Mass Ave, Cambridge,
|
||||
MA 02139, USA.
|
||||
|
||||
Report problems and direct all questions to:
|
||||
|
||||
pthreads-bugs@ada.cs.fsu.edu
|
||||
|
||||
@(#)asm.h 3.14 11/8/00
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _pthread_pthread_asm_h
|
||||
#define _pthread_pthread_asm_h
|
||||
|
||||
/*
|
||||
* sched attribute values
|
||||
*/
|
||||
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#define SCHED_FIFO 0
|
||||
#define SCHED_RR 1
|
||||
#define SCHED_OTHER 2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If we have Priority Ceilings, then we have Priority Inheritance
|
||||
*/
|
||||
#ifdef _POSIX_THREADS_PRIO_PROTECT
|
||||
#define _POSIX_THREADS_PRIO_INHERIT
|
||||
#define PTHREAD_PRIO_NONE 0
|
||||
#define PTHREAD_PRIO_INHERIT 1
|
||||
#define PTHREAD_PRIO_PROTECT 2
|
||||
#endif
|
||||
|
||||
#ifndef SIG_BLOCK
|
||||
/* sigprocmask flags */
|
||||
#define SIG_BLOCK 0x0001
|
||||
#define SIG_UNBLOCK 0x0002
|
||||
#define SIG_SETMASK 0x0004
|
||||
#endif /* SIG_BLOCK */
|
||||
|
||||
#define HEAP_SIZE 1024*1024
|
||||
|
||||
/*
|
||||
* timer set modes
|
||||
*/
|
||||
#define ABS_TIME 0x01
|
||||
#define REL_TIME 0x02
|
||||
#define SYNC_TIME (ABS_TIME | REL_TIME)
|
||||
#define RR_TIME 0x04
|
||||
#define DL_TIME 0x08
|
||||
#define ANY_TIME (SYNC_TIME | RR_TIME | DL_TIME)
|
||||
#define ALL_TIME (0x10 | ANY_TIME)
|
||||
|
||||
/*
|
||||
* Thread status bits.
|
||||
*/
|
||||
#define T_MAIN 0x1
|
||||
#define T_RETURNED 0x2
|
||||
#define T_DETACHED 0x4
|
||||
#define T_RUNNING 0x8
|
||||
#define T_BLOCKED 0x10
|
||||
#define T_CONDTIMER 0x20
|
||||
#define T_SIGWAIT 0x40
|
||||
#define T_SYNCTIMER 0x80
|
||||
#define T_SIGSUSPEND 0x100
|
||||
#define T_CONTROLLED 0x200
|
||||
#define T_INTR_POINT 0x400
|
||||
#define T_ASYNCTIMER 0x800
|
||||
#define T_LOCKED 0x1000
|
||||
#define T_IO_OVER 0x2000
|
||||
#define T_EXITING 0x4000
|
||||
#define T_SUSPEND 0x8000
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Offset added to pc by ret and retl instruction on SPARC.
|
||||
* When a call instruction is issued, the address of the call
|
||||
* instruction is saved as the return address. When executing
|
||||
* a ret/retl a constant of 8 is added to the pc to return
|
||||
* to the instruction following the call *and* the daley slot.
|
||||
* Below, we want to jump to a function through the dispatcher
|
||||
* which uses ret/retl. Thus, we need to provide the address of
|
||||
* the function *minus* 8.
|
||||
*/
|
||||
#if defined(__FreeBSD__) || defined(_M_UNIX) || defined(__linux__)
|
||||
#define RETURN_OFFSET 0
|
||||
#else
|
||||
#define RETURN_OFFSET 8
|
||||
#endif
|
||||
|
||||
#endif /* !_pthread_pthread_asm_h */
|
||||
64
3rdparty/pthreads/include/pthread/config.h
vendored
Normal file
64
3rdparty/pthreads/include/pthread/config.h
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/* Copyright (C) 1992, 1993, 1994, 1995, 1996 the Florida State University
|
||||
Distributed by the Florida State University under the terms of the
|
||||
GNU Library General Public License.
|
||||
|
||||
This file is part of Pthreads.
|
||||
|
||||
Pthreads 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 (version 2).
|
||||
|
||||
Pthreads is distributed "AS IS" 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 Pthreads; see the file COPYING. If not, write
|
||||
to the Free Software Foundation, 675 Mass Ave, Cambridge,
|
||||
MA 02139, USA.
|
||||
|
||||
Report problems and direct all questions to:
|
||||
|
||||
pthreads-bugs@ada.cs.fsu.edu
|
||||
|
||||
%@(#)config_header.c 3.14% %11/8/00%
|
||||
*/
|
||||
|
||||
/*
|
||||
* configuration header file to identify compile options
|
||||
*/
|
||||
|
||||
#ifndef C_INTERFACE_NP
|
||||
#define C_INTERFACE_NP
|
||||
#endif
|
||||
|
||||
#ifndef SRP_NP
|
||||
#define SRP_NP
|
||||
#endif
|
||||
|
||||
#ifndef __dos__
|
||||
#define __dos__
|
||||
#endif
|
||||
|
||||
#ifndef _POSIX
|
||||
#define _POSIX
|
||||
#endif
|
||||
|
||||
#ifndef CLEANUP_HEAP_NP
|
||||
#define CLEANUP_HEAP_NP
|
||||
#endif
|
||||
|
||||
#ifndef C_CONTEXT_SWITCH_NP
|
||||
#define C_CONTEXT_SWITCH_NP
|
||||
#endif
|
||||
|
||||
#ifndef RELEASE_NP
|
||||
#define RELEASE_NP 5
|
||||
#endif
|
||||
|
||||
#ifndef _M_UNIX
|
||||
#if defined(M_UNIX) || defined(__M_UNIX)
|
||||
#define _M_UNIX
|
||||
#endif
|
||||
#endif
|
||||
73
3rdparty/pthreads/include/pthread/dos_setjmp.h
vendored
Normal file
73
3rdparty/pthreads/include/pthread/dos_setjmp.h
vendored
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/* Copyright (C) 1992-2000 the Florida State University
|
||||
Distributed by the Florida State University under the terms of the
|
||||
GNU Library General Public License.
|
||||
|
||||
This file is part of Pthreads.
|
||||
|
||||
Pthreads 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 (version 2).
|
||||
|
||||
Pthreads is distributed "AS IS" 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 Pthreads; see the file COPYING. If not, write
|
||||
to the Free Software Foundation, 675 Mass Ave, Cambridge,
|
||||
MA 02139, USA.
|
||||
|
||||
Report problems and direct all questions to:
|
||||
|
||||
pthreads-bugs@ada.cs.fsu.edu
|
||||
|
||||
@(#)dos_setjmp.h 1.1 07 Apr 1996
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _PTHREAD_SETJMP_H_
|
||||
#define _PTHREAD_SETJMP_H_
|
||||
|
||||
#ifndef _ANSI_SOURCE
|
||||
#include <pthread/signal.h>
|
||||
|
||||
typedef int pthread_sigjmp_buf[44]; /* see src/dos/setjmp.S */
|
||||
#endif /* !_ANSI_SOURCE */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
/* For DOS, the libc exception handler routine must be free to call its
|
||||
own setjmp/longjmp functions--which use a different format buffer from
|
||||
ours. Thus, we must not replace the existing setjmp/longjmp functions.
|
||||
|
||||
We kludge our way around this by using macros to redefine the function
|
||||
names. This is a potential sore spot if linked with binaries that do
|
||||
not include pthread.h!
|
||||
|
||||
These macros are also defined in src/dos/setjmp.S. */
|
||||
|
||||
#undef setjmp
|
||||
#undef longjmp
|
||||
#undef sigsetjmp
|
||||
#undef siglongjmp
|
||||
#define setjmp pt_setjmp
|
||||
#define longjmp pt_longjmp
|
||||
#define sigsetjmp pt_sigsetjmp
|
||||
#define siglongjmp pt_siglongjmp
|
||||
|
||||
|
||||
#ifndef _ANSI_SOURCE
|
||||
int pthread_sigsetjmp __P((pthread_sigjmp_buf, int, int));
|
||||
void pthread_siglongjmp __P((pthread_sigjmp_buf, int, int));
|
||||
|
||||
#define SYS_SIGSETJMP pthread_sigsetjmp
|
||||
#define SYS_SIGLONGJMP pthread_siglongjmp
|
||||
#define SYS_SIGJMP_BUF pthread_sigjmp_buf
|
||||
#endif /* !_ANSI_SOURCE */
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_PTHREAD_SETJMP_H_ */
|
||||
41
3rdparty/pthreads/include/pthread/errno.h
vendored
Normal file
41
3rdparty/pthreads/include/pthread/errno.h
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/* Copyright (C) 1992-2000 the Florida State University
|
||||
Distributed by the Florida State University under the terms of the
|
||||
GNU Library General Public License.
|
||||
|
||||
This file is part of Pthreads.
|
||||
|
||||
Pthreads 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 (version 2).
|
||||
|
||||
Pthreads is distributed "AS IS" 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 Pthreads; see the file COPYING. If not, write
|
||||
to the Free Software Foundation, 675 Mass Ave, Cambridge,
|
||||
MA 02139, USA.
|
||||
|
||||
Report problems and direct all questions to:
|
||||
|
||||
pthreads-bugs@ada.cs.fsu.edu
|
||||
|
||||
@(#)errno.h 3.14 11/8/00
|
||||
*/
|
||||
|
||||
#ifndef _pthread_errno_h
|
||||
#define _pthread_errno_h
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef ENOSYS
|
||||
#define ENOSYS EREMCHG+1
|
||||
#endif
|
||||
|
||||
#ifndef ENOTSUP
|
||||
#define ENOTSUP ENOSYS+1
|
||||
#endif
|
||||
|
||||
#endif /* !__pthread_errno_h */
|
||||
49
3rdparty/pthreads/include/pthread/fre_setjmp.h
vendored
Normal file
49
3rdparty/pthreads/include/pthread/fre_setjmp.h
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/* Copyright (C) 1992-2000 the Florida State University
|
||||
Distributed by the Florida State University under the terms of the
|
||||
GNU Library General Public License.
|
||||
|
||||
This file is part of Pthreads.
|
||||
|
||||
Pthreads 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 (version 2).
|
||||
|
||||
Pthreads is distributed "AS IS" 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 Pthreads; see the file COPYING. If not, write
|
||||
to the Free Software Foundation, 675 Mass Ave, Cambridge,
|
||||
MA 02139, USA.
|
||||
|
||||
Report problems and direct all questions to:
|
||||
|
||||
pthreads-bugs@ada.cs.fsu.edu
|
||||
|
||||
@(#)fre_setjmp.h 3.14 11/8/00
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _PTHREAD_SETJMP_H_
|
||||
#define _PTHREAD_SETJMP_H_
|
||||
|
||||
#ifndef _ANSI_SOURCE
|
||||
typedef int pthread_sigjmp_buf[68];
|
||||
#endif /* !_ANSI_SOURCE */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
#ifndef _ANSI_SOURCE
|
||||
int pthread_sigsetjmp __P((pthread_sigjmp_buf, int, int));
|
||||
void pthread_siglongjmp __P((pthread_sigjmp_buf, int, int));
|
||||
|
||||
#define SYS_SIGSETJMP pthread_sigsetjmp
|
||||
#define SYS_SIGLONGJMP pthread_siglongjmp
|
||||
#define SYS_SIGJMP_BUF pthread_sigjmp_buf
|
||||
#endif /* !_ANSI_SOURCE */
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_PTHREAD_SETJMP_H_ */
|
||||
150
3rdparty/pthreads/include/pthread/int_types.h
vendored
Normal file
150
3rdparty/pthreads/include/pthread/int_types.h
vendored
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
* Copyright (c) 1996 by Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_INT_TYPES_H
|
||||
#define _SYS_INT_TYPES_H
|
||||
|
||||
#pragma ident "@(#)int_types.h 1.4 96/09/25 SMI"
|
||||
|
||||
/*
|
||||
* This file, <sys/int_types.h>, is part of the Sun Microsystems implementation
|
||||
* of <inttypes.h> as proposed in the ISO/JTC1/SC22/WG14 C committee's working
|
||||
* draft for the revision of the current ISO C standard, ISO/IEC 9899:1990
|
||||
* Programming language - C.
|
||||
*
|
||||
* Programs/Modules should not directly include this file. Access to the
|
||||
* types defined in this file should be through the inclusion of one of the
|
||||
* following files:
|
||||
*
|
||||
* <sys/types.h> Provides only the "_t" types defined in this
|
||||
* file which is a subset of the contents of
|
||||
* <inttypes.h>. (This can be appropriate for
|
||||
* all programs/modules except those claiming
|
||||
* ANSI-C conformance.)
|
||||
*
|
||||
* <sys/inttypes.h> Provides the Kernel and Driver appropriate
|
||||
* components of <inttypes.h>.
|
||||
*
|
||||
* <inttypes.h> For use by applications.
|
||||
*
|
||||
* See these files for more details.
|
||||
*
|
||||
* Use at your own risk. As of February 1996, the committee is squarely
|
||||
* behind the fixed sized types; the "least" and "fast" types are still being
|
||||
* discussed. The probability that the "fast" types may be removed before
|
||||
* the standard is finalized is high enough that they are not currently
|
||||
* implemented. The unimplemented "fast" types are of the form
|
||||
* [u]int_fast[0-9]*_t and [u]intfast_t.
|
||||
*/
|
||||
|
||||
#include <sys/isa_defs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Basic / Extended integer types
|
||||
*
|
||||
* The following defines the basic fixed-size integer types.
|
||||
*
|
||||
* Implementations are free to typedef them to Standard C integer types or
|
||||
* extensions that they support. If an implementation does not support one
|
||||
* of the particular integer data types below, then it should not define the
|
||||
* typedefs and macros corresponding to that data type. Note that int8_t
|
||||
* is not defined in -Xs mode on ISAs for which the ABI specifies "char"
|
||||
* as an unsigned entity because there is not way to defined an eight bit
|
||||
* signed integral.
|
||||
*/
|
||||
#if defined(_CHAR_IS_SIGNED)
|
||||
typedef char int8_t;
|
||||
#else
|
||||
#if defined(__STDC__)
|
||||
typedef signed char int8_t;
|
||||
#endif
|
||||
#endif
|
||||
typedef short int16_t;
|
||||
typedef int int32_t;
|
||||
#ifdef _LP64
|
||||
typedef long int64_t;
|
||||
#else /* _ILP32 */
|
||||
#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
|
||||
typedef long long int64_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
#ifdef _LP64
|
||||
typedef unsigned long uint64_t;
|
||||
#else /* _ILP32 */
|
||||
#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
|
||||
typedef unsigned long long uint64_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* intmax_t and uintmax_t are to be the longest (in number of bits) signed
|
||||
* and unsigned integer types supported by the implementation.
|
||||
*/
|
||||
#if defined(_LP64) || (__STDC__ - 0 == 0 && !defined(_NO_LONGLONG))
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
#else
|
||||
typedef int32_t intmax_t;
|
||||
typedef uint32_t uintmax_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* intptr_t and uintptr_t are signed and unsigned integer types large enough
|
||||
* to hold any data pointer; that is, data pointers can be assigned into or
|
||||
* from these integer types without losing precision.
|
||||
*/
|
||||
#ifdef _LP64
|
||||
typedef long intptr_t;
|
||||
typedef unsigned long uintptr_t;
|
||||
#else
|
||||
typedef int intptr_t;
|
||||
typedef unsigned int uintptr_t;
|
||||
#endif /* _LP64 */
|
||||
|
||||
/*
|
||||
* The following define the smallest integer types that can hold the
|
||||
* specified number of bits.
|
||||
*/
|
||||
#if defined(_CHAR_IS_SIGNED)
|
||||
typedef char int_least8_t;
|
||||
#else
|
||||
#if defined(__STDC__)
|
||||
typedef signed char int_least8_t;
|
||||
#endif
|
||||
#endif
|
||||
typedef short int_least16_t;
|
||||
typedef int int_least32_t;
|
||||
#ifdef _LP64
|
||||
typedef long int_least64_t;
|
||||
#else /* _ILP32 */
|
||||
#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
|
||||
typedef long long int_least64_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef unsigned char uint_least8_t;
|
||||
typedef unsigned short uint_least16_t;
|
||||
typedef unsigned int uint_least32_t;
|
||||
#ifdef _LP64
|
||||
typedef unsigned long uint_least64_t;
|
||||
#else /* _ILP32 */
|
||||
#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
|
||||
typedef unsigned long long uint_least64_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_INT_TYPES_H */
|
||||
44
3rdparty/pthreads/include/pthread/limits.h
vendored
Normal file
44
3rdparty/pthreads/include/pthread/limits.h
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/* Copyright (C) 1992-2000 the Florida State University
|
||||
Distributed by the Florida State University under the terms of the
|
||||
GNU Library General Public License.
|
||||
|
||||
This file is part of Pthreads.
|
||||
|
||||
Pthreads 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 (version 2).
|
||||
|
||||
Pthreads is distributed "AS IS" 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 Pthreads; see the file COPYING. If not, write
|
||||
to the Free Software Foundation, 675 Mass Ave, Cambridge,
|
||||
MA 02139, USA.
|
||||
|
||||
Report problems and direct all questions to:
|
||||
|
||||
pthreads-bugs@ada.cs.fsu.edu
|
||||
|
||||
@(#)limits.h 3.14 11/8/00
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _pthread_limits_h
|
||||
#define _pthread_limits_h
|
||||
|
||||
#ifndef STAND_ALONE_NP
|
||||
#include <limits.h>
|
||||
#endif /* STAND_ALONE_NP */
|
||||
|
||||
#ifndef _POSIX_DATAKEYS_MAX
|
||||
#define _POSIX_DATAKEYS_MAX 256
|
||||
#endif
|
||||
|
||||
#ifndef _POSIX_TIMER_MAX
|
||||
#define _POSIX_TIMER_MAX 128
|
||||
#endif
|
||||
|
||||
#endif /* !_pthread_limits_h */
|
||||
49
3rdparty/pthreads/include/pthread/lin_setjmp.h
vendored
Normal file
49
3rdparty/pthreads/include/pthread/lin_setjmp.h
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/* Copyright (C) 1992-2000 the Florida State University
|
||||
Distributed by the Florida State University under the terms of the
|
||||
GNU Library General Public License.
|
||||
|
||||
This file is part of Pthreads.
|
||||
|
||||
Pthreads 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 (version 2).
|
||||
|
||||
Pthreads is distributed "AS IS" 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 Pthreads; see the file COPYING. If not, write
|
||||
to the Free Software Foundation, 675 Mass Ave, Cambridge,
|
||||
MA 02139, USA.
|
||||
|
||||
Report problems and direct all questions to:
|
||||
|
||||
pthreads-bugs@ada.cs.fsu.edu
|
||||
|
||||
@(#)lin_setjmp.h 3.14 11/8/00
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _PTHREAD_SETJMP_H_
|
||||
#define _PTHREAD_SETJMP_H_
|
||||
|
||||
#ifndef _ANSI_SOURCE
|
||||
typedef int pthread_sigjmp_buf[68];
|
||||
#endif /* !_ANSI_SOURCE */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
#ifndef _ANSI_SOURCE
|
||||
int pthread_sigsetjmp __P((pthread_sigjmp_buf, int, int));
|
||||
void pthread_siglongjmp __P((pthread_sigjmp_buf, int, int));
|
||||
|
||||
#define SYS_SIGSETJMP pthread_sigsetjmp
|
||||
#define SYS_SIGLONGJMP pthread_siglongjmp
|
||||
#define SYS_SIGJMP_BUF pthread_sigjmp_buf
|
||||
#endif /* !_ANSI_SOURCE */
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_PTHREAD_SETJMP_H_ */
|
||||
53
3rdparty/pthreads/include/pthread/sco_setjmp.h
vendored
Normal file
53
3rdparty/pthreads/include/pthread/sco_setjmp.h
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/* Copyright (C) 1992-2000 the Florida State University
|
||||
Distributed by the Florida State University under the terms of the
|
||||
GNU Library General Public License.
|
||||
|
||||
This file is part of Pthreads.
|
||||
|
||||
Pthreads 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 (version 2).
|
||||
|
||||
Pthreads is distributed "AS IS" 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 Pthreads; see the file COPYING. If not, write
|
||||
to the Free Software Foundation, 675 Mass Ave, Cambridge,
|
||||
MA 02139, USA.
|
||||
|
||||
Report problems and direct all questions to:
|
||||
|
||||
pthreads-bugs@ada.cs.fsu.edu
|
||||
|
||||
@(#)sco_setjmp.h 3.14 11/8/00
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _PTHREAD_SETJMP_H_
|
||||
#define _PTHREAD_SETJMP_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(SCO5_NP)
|
||||
typedef int pthread_sigjmp_buf[_SIGJBLEN];
|
||||
#else
|
||||
typedef int pthread_sigjmp_buf[68];
|
||||
#endif
|
||||
|
||||
extern int pthread_sigsetjmp (pthread_sigjmp_buf, int, int);
|
||||
extern void pthread_siglongjmp (pthread_sigjmp_buf, int, int);
|
||||
|
||||
#define SYS_SIGSETJMP pthread_sigsetjmp
|
||||
#define SYS_SIGLONGJMP pthread_siglongjmp
|
||||
#define SYS_SIGJMP_BUF pthread_sigjmp_buf
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* !_PTHREAD_SETJMP_H_ */
|
||||
251
3rdparty/pthreads/include/pthread/signal-sol.h
vendored
Normal file
251
3rdparty/pthreads/include/pthread/signal-sol.h
vendored
Normal file
|
|
@ -0,0 +1,251 @@
|
|||
/* Copyright (c) 1988 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998-1999, by Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _SIGNAL_H
|
||||
#define _SIGNAL_H
|
||||
|
||||
#pragma ident "@(#)signal.h 1.38 99/08/10 SMI" /* SVr4.0 1.5.3.4 */
|
||||
|
||||
#include <sys/feature_tests.h>
|
||||
|
||||
#if defined(__EXTENSIONS__) || __STDC__ == 0 || \
|
||||
defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
#include <sys/types.h> /* need pid_t/uid_t/size_t/clock_t/caddr_t/pthread_t */
|
||||
#endif
|
||||
|
||||
#if defined(SOLARIS_NP) && #if RELEASE_NP > 56
|
||||
#include <iso/signal_iso.h>
|
||||
#endif
|
||||
#include <sys/signal.h>
|
||||
|
||||
/*
|
||||
* Allow global visibility for symbols defined in
|
||||
* C++ "std" namespace in <iso/signal_iso.h>.
|
||||
*/
|
||||
#if __cplusplus >= 199711L
|
||||
using std::sig_atomic_t;
|
||||
using std::signal;
|
||||
using std::raise;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__STDC__)
|
||||
|
||||
extern const char **_sys_siglistp; /* signal descriptions */
|
||||
extern const int _sys_siglistn; /* # of signal descriptions */
|
||||
|
||||
#if defined(__EXTENSIONS__) || \
|
||||
(!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE))
|
||||
#define _sys_siglist _sys_siglistp
|
||||
#define _sys_nsig _sys_siglistn
|
||||
#endif
|
||||
|
||||
#if defined(__EXTENSIONS__) || __STDC__ == 0 || \
|
||||
defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
extern int kill(pid_t, int);
|
||||
extern int sigaction(int, const struct sigaction *, struct sigaction *);
|
||||
#ifndef _KERNEL
|
||||
extern int sigaddset(sigset_t *, int);
|
||||
extern int sigdelset(sigset_t *, int);
|
||||
extern int sigemptyset(sigset_t *);
|
||||
extern int sigfillset(sigset_t *);
|
||||
extern int sigismember(const sigset_t *, int);
|
||||
#endif
|
||||
extern int sigpending(sigset_t *);
|
||||
extern int sigprocmask(int, const sigset_t *, sigset_t *);
|
||||
extern int sigsuspend(const sigset_t *);
|
||||
#endif /* defined(__EXTENSIONS__) || __STDC__ == 0 ... */
|
||||
|
||||
#if defined(__EXTENSIONS__) || (__STDC__ == 0 && \
|
||||
!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE))
|
||||
#include <sys/procset.h>
|
||||
extern int gsignal(int);
|
||||
extern int (*ssignal(int, int (*)(int)))(int);
|
||||
extern int sigsend(idtype_t, id_t, int);
|
||||
extern int sigsendset(const procset_t *, int);
|
||||
extern int sig2str(int, char *);
|
||||
extern int str2sig(const char *, int *);
|
||||
#define SIG2STR_MAX 32
|
||||
#endif /* defined(__EXTENSIONS__) || (__STDC__ == 0 ... */
|
||||
|
||||
#if defined(__EXTENSIONS__) || (__STDC__ == 0 && \
|
||||
!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
|
||||
defined(_XPG4_2)
|
||||
extern void (*bsd_signal(int, void (*)(int)))(int);
|
||||
extern int killpg(pid_t, int);
|
||||
extern int siginterrupt(int, int);
|
||||
extern int sigaltstack(const stack_t *, stack_t *);
|
||||
extern int sighold(int);
|
||||
extern int sigignore(int);
|
||||
extern int sigpause(int);
|
||||
extern int sigrelse(int);
|
||||
extern void (*sigset(int, void (*)(int)))(int);
|
||||
extern int sigstack(struct sigstack *, struct sigstack *);
|
||||
#endif /* defined(__EXTENSIONS__) || (__STDC__ == 0 ... */
|
||||
|
||||
#if defined(__EXTENSIONS__) || (__STDC__ == 0 && \
|
||||
!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
|
||||
(_POSIX_C_SOURCE > 2)
|
||||
#include <sys/siginfo.h>
|
||||
#include <time.h>
|
||||
#ifndef SOLARIS_NP
|
||||
extern int pthread_kill(pthread_t, int);
|
||||
#endif
|
||||
extern int pthread_sigmask(int, const sigset_t *, sigset_t *);
|
||||
extern int sigwaitinfo(const sigset_t *, siginfo_t *);
|
||||
extern int sigtimedwait(const sigset_t *, siginfo_t *, const struct timespec *);
|
||||
extern int sigqueue(pid_t, int, const union sigval);
|
||||
#endif /* defined(__EXTENSIONS__) || (__STDC__ == 0 ... */
|
||||
|
||||
#else /* __STDC__ */
|
||||
|
||||
extern char **_sys_siglistp; /* signal descriptions */
|
||||
extern int _sys_siglistn; /* # of signal descriptions */
|
||||
|
||||
#define _sys_siglist _sys_siglistp
|
||||
#define _sys_nsig _sys_siglistn
|
||||
|
||||
extern void(*signal())();
|
||||
extern int raise();
|
||||
|
||||
extern int kill();
|
||||
extern int sigaction();
|
||||
#ifndef _KERNEL
|
||||
extern int sigaddset();
|
||||
extern int sigdelset();
|
||||
extern int sigemptyset();
|
||||
extern int sigfillset();
|
||||
extern int sigismember();
|
||||
#endif
|
||||
extern int sigpending();
|
||||
extern int sigprocmask();
|
||||
extern int sigsuspend();
|
||||
|
||||
#if defined(__EXTENSIONS__) || \
|
||||
(!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
|
||||
defined(_XPG4_2)
|
||||
extern void (*bsd_signal())();
|
||||
extern int killpg();
|
||||
extern int siginterrupt();
|
||||
extern int sigstack();
|
||||
#endif /* defined(__EXTENSIONS__) ... */
|
||||
|
||||
#if defined(__EXTENSIONS__) || \
|
||||
(!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE))
|
||||
extern int gsignal();
|
||||
extern int (*ssignal)();
|
||||
extern int sigsend();
|
||||
extern int sigsendset();
|
||||
extern int sig2str();
|
||||
extern int str2sig();
|
||||
#define SIG2STR_MAX 32
|
||||
#endif
|
||||
|
||||
#if defined(__EXTENSIONS__) || \
|
||||
(!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
|
||||
defined(_XPG4_2)
|
||||
extern int sigaltstack();
|
||||
extern int sighold();
|
||||
extern int sigignore();
|
||||
extern int sigpause();
|
||||
extern int sigrelse();
|
||||
extern void (*sigset())();
|
||||
#endif
|
||||
|
||||
#if defined(__EXTENSIONS__) || \
|
||||
(!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
|
||||
(_POSIX_C_SOURCE > 2)
|
||||
#include <sys/siginfo.h>
|
||||
#include <sys/time.h>
|
||||
extern int pthread_kill();
|
||||
extern int pthread_sigmask();
|
||||
extern int sigwaitinfo();
|
||||
extern int sigtimedwait();
|
||||
extern int sigqueue();
|
||||
#endif
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
/*
|
||||
* sigwait() prototype is defined here.
|
||||
*/
|
||||
|
||||
#if defined(__EXTENSIONS__) || (__STDC__ == 0 && \
|
||||
!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
|
||||
(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
|
||||
|
||||
#if defined(__STDC__)
|
||||
|
||||
#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
|
||||
|
||||
#ifdef __PRAGMA_REDEFINE_EXTNAME
|
||||
extern int sigwait(const sigset_t *, int *);
|
||||
#pragma redefine_extname sigwait __posix_sigwait
|
||||
#else /* __PRAGMA_REDEFINE_EXTNAME */
|
||||
|
||||
static int
|
||||
sigwait(const sigset_t *__setp, int *__signo)
|
||||
{
|
||||
extern int __posix_sigwait(const sigset_t *, int *);
|
||||
return (__posix_sigwait(__setp, __signo));
|
||||
}
|
||||
#endif /* __PRAGMA_REDEFINE_EXTNAME */
|
||||
|
||||
#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
|
||||
|
||||
#ifndef SOLARIS_NP
|
||||
extern int sigwait(sigset_t *);
|
||||
#endif
|
||||
|
||||
#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
|
||||
|
||||
|
||||
#else /* __STDC__ */
|
||||
|
||||
|
||||
#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
|
||||
|
||||
#ifdef __PRAGMA_REDEFINE_EXTNAME
|
||||
extern int sigwait();
|
||||
#pragma redefine_extname sigwait __posix_sigwait
|
||||
#else /* __PRAGMA_REDEFINE_EXTNAME */
|
||||
|
||||
static int
|
||||
sigwait(__setp, __signo)
|
||||
sigset_t *__setp;
|
||||
int *__signo;
|
||||
{
|
||||
extern int __posix_sigwait();
|
||||
return (__posix_sigwait(__setp, __signo));
|
||||
}
|
||||
#endif /* __PRAGMA_REDEFINE_EXTNAME */
|
||||
|
||||
#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
|
||||
|
||||
extern int sigwait();
|
||||
|
||||
#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#endif /* defined(__EXTENSIONS__) || (__STDC__ == 0 ... */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SIGNAL_H */
|
||||
493
3rdparty/pthreads/include/pthread/signal.h
vendored
Normal file
493
3rdparty/pthreads/include/pthread/signal.h
vendored
Normal file
|
|
@ -0,0 +1,493 @@
|
|||
/* Copyright (C) 1992-2000 the Florida State University
|
||||
Distributed by the Florida State University under the terms of the
|
||||
GNU Library General Public License.
|
||||
|
||||
This file is part of Pthreads.
|
||||
|
||||
Pthreads 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 (version 2).
|
||||
|
||||
Pthreads is distributed "AS IS" 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 Pthreads; see the file COPYING. If not, write
|
||||
to the Free Software Foundation, 675 Mass Ave, Cambridge,
|
||||
MA 02139, USA.
|
||||
|
||||
Report problems and direct all questions to:
|
||||
|
||||
pthreads-bugs@ada.cs.fsu.edu
|
||||
|
||||
@(#)signal.h 3.14 11/8/00
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _pthread_signal_h
|
||||
#define _pthread_signal_h
|
||||
|
||||
#ifndef __signal_h
|
||||
|
||||
#ifdef LOCORE
|
||||
#undef LOCORE
|
||||
#endif
|
||||
|
||||
#ifdef SVR4_NP
|
||||
#ifdef SOLARIS_NP
|
||||
|
||||
#include <sys/feature_tests.h>
|
||||
|
||||
#if RELEASE_NP > 56
|
||||
|
||||
/* from <sys/siginfo.h> */
|
||||
#ifndef _SIGVAL
|
||||
#define _SIGVAL
|
||||
union sigval {
|
||||
int sival_int; /* integer value */
|
||||
void *sival_ptr; /* pointer value */
|
||||
};
|
||||
#endif /* _SIGVAL */
|
||||
|
||||
/* from <time.h>: */
|
||||
#ifndef _SIGEVENT
|
||||
#define _SIGEVENT
|
||||
struct sigevent {
|
||||
int sigev_notify; /* notification mode */
|
||||
int sigev_signo; /* signal number */
|
||||
union sigval sigev_value; /* signal value */
|
||||
void (*sigev_notify_function)(union sigval);
|
||||
#ifdef SOLARIS_NP
|
||||
int *sigev_notify_attributes;
|
||||
#else
|
||||
pthread_attr_t *sigev_notify_attributes;
|
||||
#endif
|
||||
int __sigev_pad2;
|
||||
};
|
||||
#endif /* _SIGEVENT */
|
||||
|
||||
#define pthread_t int
|
||||
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
#undef pthread_t
|
||||
|
||||
#endif
|
||||
#include <siginfo.h>
|
||||
#include <ucontext.h>
|
||||
#else /* !SVR4_NP */
|
||||
#include "stdtypes.h"
|
||||
#endif /* !SVR4_NP */
|
||||
|
||||
#ifdef _M_UNIX
|
||||
#if defined(__STDC__) && !defined(SCO5_NP)
|
||||
#undef __STDC__
|
||||
#include <sys/signal.h>
|
||||
#define __STDC__ 10
|
||||
#else /* !__STDC__ */
|
||||
#include <sys/signal.h>
|
||||
#endif /* !__STDC__ */
|
||||
#else /* !_M_UNIX */
|
||||
#if defined(__linux__) && !defined(__KERNEL__)
|
||||
#define _BITS_PTHREADTYPES_H
|
||||
#define _BITS_SIGTHREAD_H
|
||||
#include <time.h>
|
||||
#include <pthread/unistd.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef __USE_BSD
|
||||
#define __USE_BSD
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#else /* !__KERNEL__ */
|
||||
#ifdef SOLARIS_NP
|
||||
#include "signal-sol.h"
|
||||
#else
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#endif /* !__KERNEL__ */
|
||||
#endif /* !_M_UNIX */
|
||||
|
||||
#if !defined(__FreeBSD__) && !defined(_M_UNIX) && !defined(__linux__) && !defined (__dos__)
|
||||
#if !defined(__signal_h) && !defined(_SIGNAL_H) && !defined(__SIGNAL_H)
|
||||
#define __signal_h
|
||||
|
||||
#ifndef _sys_signal_h
|
||||
typedef unsigned int sigset_t;
|
||||
#endif
|
||||
|
||||
struct sigaction {
|
||||
void (*sa_handler)();
|
||||
sigset_t sa_mask;
|
||||
int sa_flags;
|
||||
};
|
||||
#endif /* __signal_h */
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
#ifndef SIGMAX
|
||||
#define SIGMAX _NSIG
|
||||
#endif
|
||||
|
||||
#ifndef NSIG
|
||||
#define NSIG SIGMAX
|
||||
#endif
|
||||
|
||||
#ifdef __SIGRTMIN
|
||||
#define NNSIG __SIGRTMIN+1
|
||||
#else
|
||||
#define NNSIG NSIG+1
|
||||
#endif
|
||||
|
||||
#ifndef CLOCK_REALTIME
|
||||
#define CLOCK_REALTIME 0
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#include <sys/time.h>
|
||||
#elif defined(__dos__)
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#define ts_sec tv_sec
|
||||
#define ts_nsec tv_nsec
|
||||
|
||||
#ifndef TIMEVAL_TO_TIMESPEC
|
||||
#if !defined(__linux__) || !defined(_ASMi386_SIGCONTEXT_H)
|
||||
#if !defined(__SI_MAX_SIZE) && !defined(_STRUCT_TIMESPEC)
|
||||
struct timespec {
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
#endif
|
||||
#endif /* !defined(__linux) || !defined(SIGCLD) */
|
||||
#endif /* !TIMEVAL_TO_TIMESPEC */
|
||||
#else /* CLOCK_REALTIME */
|
||||
#define ts_sec tv_sec
|
||||
#define ts_nsec tv_nsec
|
||||
#endif /* CLOCK_REALTIME */
|
||||
|
||||
#define PTHREAD_CANCEL_ENABLE SIG_UNBLOCK
|
||||
#define PTHREAD_CANCEL_DISABLE SIG_BLOCK
|
||||
#define PTHREAD_CANCEL_DEFERRED 0
|
||||
#define PTHREAD_CANCEL_ASYNCHRONOUS 1
|
||||
|
||||
#ifdef si_value
|
||||
#undef si_value
|
||||
#endif
|
||||
|
||||
union p_sigval {
|
||||
int sigval_int;
|
||||
void *sigval_ptr;
|
||||
};
|
||||
|
||||
struct p_siginfo {
|
||||
int si_signo;
|
||||
int si_code;
|
||||
union p_sigval si_value;
|
||||
};
|
||||
|
||||
/*
|
||||
* This defines the implementation-dependent context structure provided
|
||||
* as the third parameter to user handlers installed by sigaction().
|
||||
* It should be a copy of the first part of the BSD sigcontext structure.
|
||||
* The second half should not be accessed since it is only present if
|
||||
* a _sigtramp instance is present right below the user handler on the
|
||||
* thread's stack. For SVR4, we will have to build this structure from scratch.
|
||||
*/
|
||||
|
||||
#ifdef SOLARIS_NP
|
||||
|
||||
#include <vm/faultcode.h>
|
||||
|
||||
struct context_t {
|
||||
u_long sc_flags;
|
||||
struct ucontext *sc_link;
|
||||
sigset_t sc_mask; /* per-thread signal mask to be restored */
|
||||
stack_t sc_stack;
|
||||
int sc_filler;
|
||||
greg_t sc_psr;
|
||||
greg_t sc_pc; /* program counter to be restored */
|
||||
greg_t sc_npc; /* next pc (see below) */
|
||||
greg_t sc_y;
|
||||
greg_t sc_g1;
|
||||
greg_t sc_g2;
|
||||
greg_t sc_g3;
|
||||
greg_t sc_g4;
|
||||
greg_t sc_g5;
|
||||
greg_t sc_g6;
|
||||
greg_t sc_g7;
|
||||
greg_t sc_o0;
|
||||
greg_t sc_o1;
|
||||
greg_t sc_o2;
|
||||
greg_t sc_o3;
|
||||
greg_t sc_o4;
|
||||
greg_t sc_o5;
|
||||
greg_t sc_sp; /* stack pointer to be restored */
|
||||
greg_t sc_o7;
|
||||
};
|
||||
|
||||
#else /* !SOLARIS_NP */
|
||||
#ifdef SVR4_NP
|
||||
|
||||
struct context_t {
|
||||
This needs to be defined !
|
||||
};
|
||||
|
||||
#else /* !SVR4_NP */
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#define context_t sigcontext
|
||||
/*typedef struct sigcontext context_t;*/
|
||||
#define p_sigval sigval
|
||||
#define siginfo p_siginfo
|
||||
typedef struct siginfo siginfo_t;
|
||||
#elif defined(__dos__)
|
||||
#include <setjmp.h>
|
||||
|
||||
#ifdef __DJGPP__
|
||||
#include <sys/version.h>
|
||||
#endif
|
||||
#if __DJGPP__ >= 2 && __DJGPP_MINOR__ >= 5
|
||||
#define context_t __jmp_buf
|
||||
#else
|
||||
/* Hate to do it, but since the dj include files don't define this
|
||||
in such a way that I can get to it, I have to repeat the definition
|
||||
here. This is subject to change with new releases of djgpp; let the
|
||||
buyer beware. */
|
||||
|
||||
struct context_t {
|
||||
unsigned long __eax, __ebx, __ecx, __edx, __esi;
|
||||
unsigned long __edi, __ebp, __esp, __eip, __eflags;
|
||||
unsigned short __cs, __ds, __es, __fs, __gs, __ss;
|
||||
unsigned long __sigmask; /* for POSIX signals only */
|
||||
unsigned long __signum; /* for expansion */
|
||||
unsigned char __fpu_state[108]; /* for future use */
|
||||
};
|
||||
#endif
|
||||
|
||||
#define sc_sp __esp
|
||||
#define sc_fp __ebp
|
||||
#define sc_pc __eip
|
||||
#define sc_ps __eflags
|
||||
#define sc_mask __sigmask
|
||||
#define p_sigval sigval
|
||||
#define siginfo p_siginfo
|
||||
typedef struct siginfo siginfo_t;
|
||||
#elif defined(__linux__)
|
||||
#define context_t sigcontext_struct
|
||||
#define sc_sp esp
|
||||
#define sc_fp ebp
|
||||
#define sc_pc eip
|
||||
#define sc_ps eflags
|
||||
#define sc_mask oldmask
|
||||
#define p_sigval sigval
|
||||
#define siginfo p_siginfo
|
||||
#define FC_PROT 1
|
||||
#ifndef __SI_MAX_SIZE
|
||||
typedef struct siginfo siginfo_t;
|
||||
#endif
|
||||
|
||||
#undef sigmask
|
||||
#undef sigemptyset
|
||||
#undef sigfillset
|
||||
#undef sigaddset
|
||||
#undef sigdelset
|
||||
#undef sigismember
|
||||
|
||||
/*
|
||||
* Linux 2.x already defines these operations but we need to
|
||||
* use the __sig*() interface instead of the system call since e.g.
|
||||
* __sigaction() uses POSIX sigset_t (32 ints) while
|
||||
* SYS_sigaction uses Linux kernel sigset_t (4 bytes).
|
||||
*/
|
||||
#if defined(_SIGSET_NWORDS)
|
||||
#define sigmask(n) ((unsigned int)1 << ((n) - 1))
|
||||
#define sigemptyset(set) ((set)->__val[0] = 0)
|
||||
#define sigfillset(set) ((set)->__val[0] = -1)
|
||||
#define sigaddset(set, signo) ((set)->__val[0] |= sigmask(signo))
|
||||
#define sigdelset(set, signo) ((set)->__val[0] &= ~sigmask(signo))
|
||||
#define sigismember(set, signo) ((set)->__val[0] & sigmask(signo))
|
||||
#else
|
||||
#include <asm/sigcontext.h>
|
||||
#define sigmask(n) ((unsigned int)1 << ((n) - 1))
|
||||
#define sigemptyset(set) (*(set) = (sigset_t) 0)
|
||||
#define sigfillset(set) (*(set) = (sigset_t) -1)
|
||||
#define sigaddset(set, signo) (*(set) |= sigmask(signo))
|
||||
#define sigdelset(set, signo) (*(set) &= ~sigmask(signo))
|
||||
#define sigismember(set, signo) (*(set) & sigmask(signo))
|
||||
#endif
|
||||
|
||||
#elif defined (_M_UNIX)
|
||||
#if defined(SCO5_NP)
|
||||
#include <sys/user.h>
|
||||
#include <ucontext.h>
|
||||
#ifndef _GREG_T
|
||||
#define _GREG_T
|
||||
typedef long greg_t;
|
||||
#endif
|
||||
|
||||
#define context_t ucontext
|
||||
|
||||
# define sc_sp uc_mcontext.regs[UESP]
|
||||
# define sc_fp uc_mcontext.regs[EBP]
|
||||
# define sc_pc uc_mcontext.regs[EIP]
|
||||
# define sc_ps uc_flags
|
||||
# define sc_mask uc_sigmask
|
||||
#else /* !SCO5_NP */
|
||||
#define context_t sigcontext
|
||||
#define p_sigval sigval
|
||||
#define siginfo p_siginfo
|
||||
#ifndef __M_UNIX__
|
||||
typedef struct siginfo siginfo_t;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Location of the users' stored registers relative to EAX.
|
||||
* Usage is u.u_ar0[XX].
|
||||
*
|
||||
* NOTE: ERR is the error code.
|
||||
*/
|
||||
|
||||
#define SCO_SS 18
|
||||
#define SCO_UESP 17
|
||||
#define SCO_EFL 16
|
||||
#define SCO_CS 15
|
||||
#define SCO_EIP 14
|
||||
#define SCO_ERR 13
|
||||
#define SCO_TRAPNO 12
|
||||
#define SCO_EAX 11
|
||||
#define SCO_ECX 10
|
||||
#define SCO_EDX 9
|
||||
#define SCO_EBX 8
|
||||
#define SCO_ESP 7
|
||||
#define SCO_EBP 6
|
||||
#define SCO_ESI 5
|
||||
#define SCO_EDI 4
|
||||
#define SCO_DS 3
|
||||
#define SCO_ES 2
|
||||
#define SCO_FS 1
|
||||
#define SCO_GS 0
|
||||
#endif
|
||||
|
||||
|
||||
# define sc_sp sc_UESP
|
||||
# define sc_fp sc_EBP
|
||||
# define sc_pc sc_EIP
|
||||
# define sc_ps sc_EFL
|
||||
|
||||
struct sigcontext {
|
||||
unsigned int sc_GS; /* 0 */
|
||||
unsigned int sc_FS; /* 1 */
|
||||
unsigned int sc_ES; /* 2 */
|
||||
unsigned int sc_DS; /* 3 */
|
||||
unsigned int sc_EDI; /* 4 */
|
||||
unsigned int sc_ESI; /* 5 */
|
||||
unsigned int sc_EBP; /* 6 */
|
||||
unsigned int sc_ESP; /* 7 */
|
||||
unsigned int sc_EBX; /* 8 */
|
||||
unsigned int sc_EDX; /* 9 */
|
||||
unsigned int sc_ECX; /* 10 */
|
||||
unsigned int sc_EAX; /* 11 */
|
||||
unsigned int sc_TRAPNO; /* 12 */
|
||||
unsigned int sc_ERR; /* 13 */
|
||||
unsigned int sc_EIP; /* 14 */
|
||||
unsigned int sc_CS; /* 15 */
|
||||
unsigned int sc_EFL; /* 16 */
|
||||
unsigned int sc_UESP; /* 17 */
|
||||
unsigned int sc_SS; /* 18 */
|
||||
unsigned int *piFPContext;
|
||||
unsigned int *weitek_offset;
|
||||
sigset_t sc_mask;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Send an interrupt to process.
|
||||
* Pass the signal number as an argument to the user signal handler.
|
||||
* Also pushed on the user stack is all of the user registers and the
|
||||
* ret addr for a piece of code that calls back into the kernel
|
||||
* (after executing the user's signal handler) to restore the
|
||||
* context of the user process. Last, but not least, put on the
|
||||
* signal mask, for sigclean to restore after execution of the
|
||||
* handler (POSIX).
|
||||
*/
|
||||
|
||||
/*
|
||||
** From Nick Logan:
|
||||
** After the signal number, the register are pushed onto the user stack in an
|
||||
** array indexed by the values in /usr/include/sys/reg.h. If an FPU is used the
|
||||
** FP registers are then saved on the stack.
|
||||
**
|
||||
** Note that this could change in any release, and you use it at your
|
||||
** own risk!
|
||||
*/
|
||||
#endif /* !SCO5_NP */
|
||||
#else
|
||||
#define p_sigval sigval
|
||||
#define siginfo p_siginfo
|
||||
typedef struct siginfo siginfo_t;
|
||||
|
||||
typedef int greg_t;
|
||||
|
||||
struct context_t {
|
||||
greg_t sc_onstack;/* ignored */
|
||||
sigset_t sc_mask; /* per-thread signal mask to be restored */
|
||||
greg_t sc_sp; /* stack pointer to be restored */
|
||||
greg_t sc_pc; /* program counter to be restored */
|
||||
greg_t sc_npc; /* next pc, only used if _sigtramp present
|
||||
* on thread's stack, ignored o.w.
|
||||
* should usually be pc+4
|
||||
*/
|
||||
greg_t sc_g1;
|
||||
greg_t sc_o0;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif /* !SVR4_NP */
|
||||
#endif /* !SOLARIS_NP */
|
||||
|
||||
#ifndef SA_SIGINFO
|
||||
#define SA_SIGINFO 0
|
||||
#endif
|
||||
|
||||
#ifndef SA_ONESHOT
|
||||
#define SA_ONESHOT 0
|
||||
#endif
|
||||
|
||||
#ifndef SA_NOMASK
|
||||
#define SA_NOMASK 0
|
||||
#endif
|
||||
|
||||
#ifndef SA_ONSTACK
|
||||
#define SA_ONSTACK SV_ONSTACK
|
||||
#endif /* !SA_ONSTACK */
|
||||
|
||||
#ifndef BUS_OBJERR
|
||||
#define BUS_OBJERR FC_OBJERR
|
||||
#endif /* !BUS_OBJERR */
|
||||
|
||||
#ifndef BUS_CODE
|
||||
#define BUS_CODE(x) FC_CODE(x)
|
||||
#endif
|
||||
|
||||
#ifndef SIGCANCEL
|
||||
#ifdef __dos__
|
||||
#define SIGCANCEL NSIG-1 /* To get arounnd a bug in djgpp v2 */
|
||||
#else
|
||||
#ifdef SCO5
|
||||
#define SIGCANCEL (NSIG-1)
|
||||
#else
|
||||
#ifdef __SIGRTMIN
|
||||
#define SIGCANCEL __SIGRTMIN
|
||||
#else
|
||||
#define SIGCANCEL NSIG
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __signal_h */
|
||||
|
||||
#endif /* !_pthread_signal_h */
|
||||
82
3rdparty/pthreads/include/pthread/stdtypes.h
vendored
Normal file
82
3rdparty/pthreads/include/pthread/stdtypes.h
vendored
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/* Copyright (C) 1992-2000 the Florida State University
|
||||
Distributed by the Florida State University under the terms of the
|
||||
GNU Library General Public License.
|
||||
|
||||
This file is part of Pthreads.
|
||||
|
||||
Pthreads 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 (version 2).
|
||||
|
||||
Pthreads is distributed "AS IS" 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 Pthreads; see the file COPYING. If not, write
|
||||
to the Free Software Foundation, 675 Mass Ave, Cambridge,
|
||||
MA 02139, USA.
|
||||
|
||||
Report problems and direct all questions to:
|
||||
|
||||
pthreads-bugs@ada.cs.fsu.edu
|
||||
|
||||
@(#)stdtypes.h 3.14 11/8/00
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _pthread_stdtypes_h
|
||||
#define _pthread_stdtypes_h
|
||||
|
||||
#if !defined(__FreeBSD__) && !defined(_M_UNIX) && !defined(__linux__) && !defined(__dos__)
|
||||
/* we don't want any of these since we already have them
|
||||
*/
|
||||
#ifndef __sys_stdtypes_h
|
||||
#define __sys_stdtypes_h
|
||||
|
||||
#if defined(STAND_ALONE_NP) && defined(sun4e_NP)
|
||||
#ifndef _TYPES_
|
||||
#define _TYPES_
|
||||
|
||||
/*
|
||||
* substitutes used types of #include <sys/types.h>
|
||||
* to avoid wrong definition of size_t
|
||||
*/
|
||||
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned int u_int;
|
||||
typedef char * caddr_t;
|
||||
typedef char * addr_t;
|
||||
|
||||
#endif /* !_TYPES_ */
|
||||
#endif /* STAND_ALONE_NP && sun4e_NP */
|
||||
|
||||
typedef unsigned int sigset_t; /* signal mask - may change */
|
||||
|
||||
typedef unsigned int speed_t; /* tty speeds */
|
||||
typedef unsigned long tcflag_t; /* tty line disc modes */
|
||||
typedef unsigned char cc_t; /* tty control char */
|
||||
typedef int pid_t; /* process id */
|
||||
|
||||
typedef unsigned short mode_t; /* file mode bits */
|
||||
typedef short nlink_t; /* links to a file */
|
||||
|
||||
typedef long clock_t; /* units=ticks (typically 60/sec) */
|
||||
typedef long time_t; /* value = secs since epoch */
|
||||
|
||||
#ifdef __GNUC__
|
||||
typedef long unsigned int size_t; /* ??? */
|
||||
#else /* !__GNUC__ */
|
||||
typedef unsigned int size_t; /* ??? */
|
||||
#endif /* !__GNUC__ */
|
||||
typedef int ptrdiff_t; /* result of subtracting two pointers */
|
||||
|
||||
typedef unsigned short wchar_t; /* big enough for biggest char set */
|
||||
|
||||
#endif /* !__sys_stdtypes_h */
|
||||
#elif defined (_M_UNIX)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#endif /* !_pthread_stdtypes_h */
|
||||
577
3rdparty/pthreads/include/pthread/types.h
vendored
Normal file
577
3rdparty/pthreads/include/pthread/types.h
vendored
Normal file
|
|
@ -0,0 +1,577 @@
|
|||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-1999 by Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_TYPES_H
|
||||
#define _SYS_TYPES_H
|
||||
|
||||
#pragma ident "@(#)types.h 1.65 99/11/15 SMI"
|
||||
|
||||
#include <sys/isa_defs.h>
|
||||
#include <sys/feature_tests.h>
|
||||
|
||||
/*
|
||||
* Machine dependent definitions moved to <sys/machtypes.h>.
|
||||
*/
|
||||
#include <sys/machtypes.h>
|
||||
|
||||
/*
|
||||
* Include fixed width type declarations proposed by the ISO/JTC1/SC22/WG14 C
|
||||
* committee's working draft for the revision of the current ISO C standard,
|
||||
* ISO/IEC 9899:1990 Programming language - C. These are not currently
|
||||
* required by any standard but constitute a useful, general purpose set
|
||||
* of type definitions which is namespace clean with respect to all standards.
|
||||
*/
|
||||
#ifdef SOLARIS_NP
|
||||
#ifdef __STDC__
|
||||
#undef __STDC__
|
||||
#define __STDC__NP
|
||||
#endif
|
||||
#define __STDC__ 0
|
||||
#include "int_types.h"
|
||||
#ifndef _FILE_OFFSET_BITS
|
||||
#define _FILE_OFFSET_BITS 32
|
||||
#endif
|
||||
#else
|
||||
#ifdef _KERNEL
|
||||
#include <sys/inttypes.h>
|
||||
#else /* _KERNEL */
|
||||
#include <sys/int_types.h>
|
||||
#endif /* _KERNEL */
|
||||
#endif
|
||||
|
||||
#if defined(_KERNEL) || defined(_SYSCALL32)
|
||||
#include <sys/types32.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following protects users who use other than Sun compilers
|
||||
* (eg, GNU C) that don't support long long, and need to include
|
||||
* this header file.
|
||||
*/
|
||||
#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
|
||||
typedef long long longlong_t;
|
||||
typedef unsigned long long u_longlong_t;
|
||||
#else
|
||||
/* used to reserve space and generate alignment */
|
||||
typedef union {
|
||||
double _d;
|
||||
int32_t _l[2];
|
||||
} longlong_t;
|
||||
typedef union {
|
||||
double _d;
|
||||
uint32_t _l[2];
|
||||
} u_longlong_t;
|
||||
#endif /* __STDC__ - 0 == 0 && !defined(_NO_LONGLONG) */
|
||||
|
||||
/*
|
||||
* These types (t_{u}scalar_t) exist because the XTI/TPI/DLPI standards had
|
||||
* to use them instead of int32_t and uint32_t because DEC had
|
||||
* shipped 64-bit wide.
|
||||
*/
|
||||
#if defined(_LP64) || defined(_I32LPx)
|
||||
typedef int32_t t_scalar_t;
|
||||
typedef uint32_t t_uscalar_t;
|
||||
#else
|
||||
typedef long t_scalar_t; /* historical versions */
|
||||
typedef unsigned long t_uscalar_t;
|
||||
#endif /* defined(_LP64) || defined(_I32LPx) */
|
||||
|
||||
/*
|
||||
* POSIX Extensions
|
||||
*/
|
||||
typedef unsigned char uchar_t;
|
||||
typedef unsigned short ushort_t;
|
||||
typedef unsigned int uint_t;
|
||||
typedef unsigned long ulong_t;
|
||||
|
||||
typedef char *caddr_t; /* ?<core address> type */
|
||||
typedef long daddr_t; /* <disk address> type */
|
||||
typedef short cnt_t; /* ?<count> type */
|
||||
|
||||
#if defined(_ILP32) /* only used in i386 code */
|
||||
typedef ulong_t paddr_t; /* <physical address> type */
|
||||
#elif defined(__ia64) /* XXX Fix me */
|
||||
typedef uint_t paddr_t;
|
||||
#endif
|
||||
|
||||
#ifndef _PTRDIFF_T
|
||||
#define _PTRDIFF_T
|
||||
#if defined(_LP64) || defined(_I32LPx)
|
||||
typedef long ptrdiff_t; /* pointer difference */
|
||||
#else
|
||||
typedef int ptrdiff_t; /* (historical version) */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* VM-related types
|
||||
*/
|
||||
typedef ulong_t pfn_t; /* page frame number */
|
||||
typedef ulong_t pgcnt_t; /* number of pages */
|
||||
typedef long spgcnt_t; /* signed number of pages */
|
||||
|
||||
typedef uchar_t use_t; /* use count for swap. */
|
||||
typedef short sysid_t;
|
||||
typedef short index_t;
|
||||
typedef void *timeout_id_t; /* opaque handle from timeout(9F) */
|
||||
typedef void *bufcall_id_t; /* opaque handle from bufcall(9F) */
|
||||
|
||||
/*
|
||||
* The size of off_t and related types depends on the setting of
|
||||
* _FILE_OFFSET_BITS. (Note that other system headers define other types
|
||||
* related to those defined here.)
|
||||
*
|
||||
* If _LARGEFILE64_SOURCE is defined, variants of these types that are
|
||||
* explicitly 64 bits wide become available.
|
||||
*/
|
||||
#ifndef _OFF_T
|
||||
#define _OFF_T
|
||||
|
||||
#if defined(_LP64) || _FILE_OFFSET_BITS == 32
|
||||
typedef long off_t; /* offsets within files */
|
||||
#elif _FILE_OFFSET_BITS == 64
|
||||
typedef longlong_t off_t; /* offsets within files */
|
||||
#endif
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE)
|
||||
#ifdef _LP64
|
||||
typedef off_t off64_t; /* offsets within files */
|
||||
#else
|
||||
typedef longlong_t off64_t; /* offsets within files */
|
||||
#endif
|
||||
#endif /* _LARGEFILE64_SOURCE */
|
||||
|
||||
#endif /* _OFF_T */
|
||||
|
||||
#if defined(_LP64) || _FILE_OFFSET_BITS == 32
|
||||
typedef ulong_t ino_t; /* expanded inode type */
|
||||
typedef long blkcnt_t; /* count of file blocks */
|
||||
typedef ulong_t fsblkcnt_t; /* count of file system blocks */
|
||||
typedef ulong_t fsfilcnt_t; /* count of files */
|
||||
#elif _FILE_OFFSET_BITS == 64
|
||||
typedef u_longlong_t ino_t; /* expanded inode type */
|
||||
typedef longlong_t blkcnt_t; /* count of file blocks */
|
||||
typedef u_longlong_t fsblkcnt_t; /* count of file system blocks */
|
||||
typedef u_longlong_t fsfilcnt_t; /* count of files */
|
||||
#endif
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE)
|
||||
#ifdef _LP64
|
||||
typedef ino_t ino64_t; /* expanded inode type */
|
||||
typedef blkcnt_t blkcnt64_t; /* count of file blocks */
|
||||
typedef fsblkcnt_t fsblkcnt64_t; /* count of file system blocks */
|
||||
typedef fsfilcnt_t fsfilcnt64_t; /* count of files */
|
||||
#else
|
||||
typedef u_longlong_t ino64_t; /* expanded inode type */
|
||||
typedef longlong_t blkcnt64_t; /* count of file blocks */
|
||||
typedef u_longlong_t fsblkcnt64_t; /* count of file system blocks */
|
||||
typedef u_longlong_t fsfilcnt64_t; /* count of files */
|
||||
#endif
|
||||
#endif /* _LARGEFILE64_SOURCE */
|
||||
|
||||
#ifdef _LP64
|
||||
typedef int blksize_t; /* used for block sizes */
|
||||
#else
|
||||
typedef long blksize_t; /* used for block sizes */
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
typedef enum { _B_FALSE, _B_TRUE } boolean_t;
|
||||
#else
|
||||
typedef enum { B_FALSE, B_TRUE } boolean_t;
|
||||
#endif /* defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) */
|
||||
|
||||
/*
|
||||
* The [u]pad64_t is to be used in structures such that those structures
|
||||
* may be accessed by code produced by compilation environments which don't
|
||||
* support a 64 bit integral datatype. This intention is not to allow
|
||||
* use of these fields in such environments, but to maintain the alignment
|
||||
* and offsets of the structure.
|
||||
*/
|
||||
#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
|
||||
typedef int64_t pad64_t;
|
||||
typedef uint64_t upad64_t;
|
||||
#else
|
||||
typedef union {
|
||||
double _d;
|
||||
int32_t _l[2];
|
||||
} pad64_t;
|
||||
typedef union {
|
||||
double _d;
|
||||
uint32_t _l[2];
|
||||
} upad64_t;
|
||||
#endif
|
||||
|
||||
typedef longlong_t offset_t;
|
||||
typedef u_longlong_t u_offset_t;
|
||||
typedef u_longlong_t len_t;
|
||||
typedef longlong_t diskaddr_t;
|
||||
|
||||
/*
|
||||
* Definitions remaining from previous partial support for 64-bit file
|
||||
* offsets. This partial support for devices greater than 2gb requires
|
||||
* compiler support for long long.
|
||||
*/
|
||||
#ifdef _LONG_LONG_LTOH
|
||||
typedef union {
|
||||
offset_t _f; /* Full 64 bit offset value */
|
||||
struct {
|
||||
int32_t _l; /* lower 32 bits of offset value */
|
||||
int32_t _u; /* upper 32 bits of offset value */
|
||||
} _p;
|
||||
} lloff_t;
|
||||
#endif
|
||||
|
||||
#ifdef _LONG_LONG_HTOL
|
||||
typedef union {
|
||||
offset_t _f; /* Full 64 bit offset value */
|
||||
struct {
|
||||
int32_t _u; /* upper 32 bits of offset value */
|
||||
int32_t _l; /* lower 32 bits of offset value */
|
||||
} _p;
|
||||
} lloff_t;
|
||||
#endif
|
||||
|
||||
#ifdef _LONG_LONG_LTOH
|
||||
typedef union {
|
||||
diskaddr_t _f; /* Full 64 bit disk address value */
|
||||
struct {
|
||||
int32_t _l; /* lower 32 bits of disk address value */
|
||||
int32_t _u; /* upper 32 bits of disk address value */
|
||||
} _p;
|
||||
} lldaddr_t;
|
||||
#endif
|
||||
|
||||
#ifdef _LONG_LONG_HTOL
|
||||
typedef union {
|
||||
diskaddr_t _f; /* Full 64 bit disk address value */
|
||||
struct {
|
||||
int32_t _u; /* upper 32 bits of disk address value */
|
||||
int32_t _l; /* lower 32 bits of disk address value */
|
||||
} _p;
|
||||
} lldaddr_t;
|
||||
#endif
|
||||
|
||||
typedef uint_t k_fltset_t; /* kernel fault set type */
|
||||
|
||||
/*
|
||||
* The following type is for various kinds of identifiers. The
|
||||
* actual type must be the same for all since some system calls
|
||||
* (such as sigsend) take arguments that may be any of these
|
||||
* types. The enumeration type idtype_t defined in sys/procset.h
|
||||
* is used to indicate what type of id is being specified.
|
||||
*/
|
||||
#if defined(_LP64) || defined(_I32LPx)
|
||||
typedef int id_t; /* A process id, */
|
||||
/* process group id, */
|
||||
/* session id, */
|
||||
/* scheduling class id, */
|
||||
/* user id, or group id */
|
||||
#else
|
||||
typedef long id_t; /* (historical version) */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Type useconds_t is an unsigned integral type capable of storing
|
||||
* values at least in the range of zero to 1,000,000.
|
||||
*/
|
||||
typedef uint_t useconds_t; /* Time, in microseconds */
|
||||
|
||||
#ifndef _SUSECONDS_T
|
||||
#define _SUSECONDS_T
|
||||
typedef long suseconds_t; /* signed # of microseconds */
|
||||
#endif /* _SUSECONDS_T */
|
||||
|
||||
/*
|
||||
* Typedefs for dev_t components.
|
||||
*/
|
||||
#if defined(_LP64) || defined(_I32LPx)
|
||||
typedef uint_t major_t; /* major part of device number */
|
||||
typedef uint_t minor_t; /* minor part of device number */
|
||||
#else
|
||||
typedef ulong_t major_t; /* (historical version) */
|
||||
typedef ulong_t minor_t; /* (historical version) */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The data type of a thread priority.
|
||||
*/
|
||||
typedef short pri_t;
|
||||
|
||||
/*
|
||||
* For compatibility reasons the following typedefs (prefixed o_)
|
||||
* can't grow regardless of the EFT definition. Although,
|
||||
* applications should not explicitly use these typedefs
|
||||
* they may be included via a system header definition.
|
||||
* WARNING: These typedefs may be removed in a future
|
||||
* release.
|
||||
* ex. the definitions in s5inode.h remain small
|
||||
* to preserve compatibility in the S5
|
||||
* file system type.
|
||||
*/
|
||||
typedef ushort_t o_mode_t; /* old file attribute type */
|
||||
typedef short o_dev_t; /* old device type */
|
||||
typedef ushort_t o_uid_t; /* old UID type */
|
||||
typedef o_uid_t o_gid_t; /* old GID type */
|
||||
typedef short o_nlink_t; /* old file link type */
|
||||
typedef short o_pid_t; /* old process id type */
|
||||
typedef ushort_t o_ino_t; /* old inode type */
|
||||
|
||||
|
||||
/*
|
||||
* POSIX and XOPEN Declarations
|
||||
*/
|
||||
typedef int key_t; /* IPC key type */
|
||||
#if defined(_LP64) || defined(_I32LPx)
|
||||
typedef uint_t mode_t; /* file attribute type */
|
||||
#else
|
||||
typedef ulong_t mode_t; /* (historical version) */
|
||||
#endif
|
||||
|
||||
#ifndef _UID_T
|
||||
#define _UID_T
|
||||
#if defined(_LP64) || defined(_I32LPx)
|
||||
typedef int uid_t; /* UID type */
|
||||
#else
|
||||
typedef long uid_t; /* (historical version) */
|
||||
#endif
|
||||
#endif /* _UID_T */
|
||||
|
||||
typedef uid_t gid_t; /* GID type */
|
||||
|
||||
/*
|
||||
* POSIX definitions are same as defined in thread.h and synch.h.
|
||||
* Any changes made to here should be reflected in corresponding
|
||||
* files as described in comments.
|
||||
*/
|
||||
#ifndef SOLARIS_NP
|
||||
typedef unsigned int pthread_t; /* = thread_t in thread.h */
|
||||
typedef unsigned int pthread_key_t; /* = thread_key_t in thread.h */
|
||||
|
||||
typedef struct _pthread_mutex { /* = mutex_t in synch.h */
|
||||
struct {
|
||||
uint16_t __pthread_mutex_flag1;
|
||||
uint8_t __pthread_mutex_flag2;
|
||||
uint8_t __pthread_mutex_ceiling;
|
||||
uint32_t __pthread_mutex_type;
|
||||
} __pthread_mutex_flags;
|
||||
union {
|
||||
struct {
|
||||
uint8_t __pthread_mutex_pad[8];
|
||||
} __pthread_mutex_lock64;
|
||||
upad64_t __pthread_mutex_owner64;
|
||||
} __pthread_mutex_lock;
|
||||
upad64_t __pthread_mutex_data;
|
||||
} pthread_mutex_t;
|
||||
|
||||
typedef struct _pthread_cond { /* = cond_t in synch.h */
|
||||
struct {
|
||||
uint8_t __pthread_cond_flag[4];
|
||||
uint32_t __pthread_cond_type;
|
||||
} __pthread_cond_flags;
|
||||
upad64_t __pthread_cond_data;
|
||||
} pthread_cond_t;
|
||||
|
||||
/*
|
||||
* UNIX 98 Extension
|
||||
*/
|
||||
typedef struct _pthread_rwlock { /* = rwlock_t in synch.h */
|
||||
int32_t __pthread_rwlock_readers;
|
||||
uint16_t __pthread_rwlock_type;
|
||||
uint16_t __pthread_rwlock_magic;
|
||||
upad64_t __pthread_rwlock_pad1[3];
|
||||
upad64_t __pthread_rwlock_pad2[2];
|
||||
upad64_t __pthread_rwlock_pad3[2];
|
||||
} pthread_rwlock_t;
|
||||
|
||||
/*
|
||||
* attributes for threads, dynamically allocated by library
|
||||
*/
|
||||
typedef struct _pthread_attr {
|
||||
void *__pthread_attrp;
|
||||
} pthread_attr_t;
|
||||
|
||||
|
||||
/*
|
||||
* attributes for mutex, dynamically allocated by library
|
||||
*/
|
||||
typedef struct _pthread_mutexattr {
|
||||
void *__pthread_mutexattrp;
|
||||
} pthread_mutexattr_t;
|
||||
|
||||
|
||||
/*
|
||||
* attributes for cond, dynamically allocated by library
|
||||
*/
|
||||
typedef struct _pthread_condattr {
|
||||
void *__pthread_condattrp;
|
||||
} pthread_condattr_t;
|
||||
|
||||
/*
|
||||
* pthread_once
|
||||
*/
|
||||
typedef struct _once {
|
||||
upad64_t __pthread_once_pad[4];
|
||||
} pthread_once_t;
|
||||
|
||||
/*
|
||||
* UNIX 98 Extensions
|
||||
* attributes for rwlock, dynamically allocated by library
|
||||
*/
|
||||
typedef struct _pthread_rwlockattr {
|
||||
void *__pthread_rwlockattrp;
|
||||
} pthread_rwlockattr_t;
|
||||
#endif
|
||||
|
||||
typedef ulong_t dev_t; /* expanded device type */
|
||||
|
||||
#if defined(_LP64) || defined(_I32LPx)
|
||||
typedef uint_t nlink_t; /* file link type */
|
||||
typedef int pid_t; /* process id type */
|
||||
#else
|
||||
typedef ulong_t nlink_t; /* (historical version) */
|
||||
typedef long pid_t; /* (historical version) */
|
||||
#endif
|
||||
|
||||
#ifndef _SIZE_T
|
||||
#define _SIZE_T
|
||||
#if defined(_LP64) || defined(_I32LPx)
|
||||
typedef ulong_t size_t; /* size of something in bytes */
|
||||
#else
|
||||
typedef uint_t size_t; /* (historical version) */
|
||||
#endif
|
||||
#endif /* _SIZE_T */
|
||||
|
||||
#ifndef _SSIZE_T
|
||||
#define _SSIZE_T
|
||||
#if defined(_LP64) || defined(_I32LPx)
|
||||
typedef long ssize_t; /* size of something in bytes or -1 */
|
||||
#else
|
||||
typedef int ssize_t; /* (historical version) */
|
||||
#endif
|
||||
#endif /* _SSIZE_T */
|
||||
|
||||
#ifndef _TIME_T
|
||||
#define _TIME_T
|
||||
typedef long time_t; /* time of day in seconds */
|
||||
#endif /* _TIME_T */
|
||||
|
||||
#ifndef _CLOCK_T
|
||||
#define _CLOCK_T
|
||||
typedef long clock_t; /* relative time in a specified resolution */
|
||||
#endif /* ifndef _CLOCK_T */
|
||||
|
||||
#ifndef _CLOCKID_T
|
||||
#define _CLOCKID_T
|
||||
typedef int clockid_t; /* clock identifier type */
|
||||
#endif /* ifndef _CLOCKID_T */
|
||||
|
||||
#ifndef _TIMER_T
|
||||
#define _TIMER_T
|
||||
typedef int timer_t; /* timer identifier type */
|
||||
#endif /* ifndef _TIMER_T */
|
||||
|
||||
#if defined(__EXTENSIONS__) || \
|
||||
(!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE))
|
||||
|
||||
/* BEGIN CSTYLED */
|
||||
typedef unsigned char unchar;
|
||||
typedef unsigned short ushort;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long ulong;
|
||||
/* END CSTYLED */
|
||||
|
||||
#if defined(_KERNEL)
|
||||
|
||||
#define SHRT_MIN (-32768) /* min value of a "short int" */
|
||||
#define SHRT_MAX 32767 /* max value of a "short int" */
|
||||
#define USHRT_MAX 65535 /* max of "unsigned short int" */
|
||||
#define INT_MIN (-2147483647-1) /* min value of an "int" */
|
||||
#define INT_MAX 2147483647 /* max value of an "int" */
|
||||
#define UINT_MAX 4294967295U /* max value of an "unsigned int" */
|
||||
#if defined(_LP64)
|
||||
#define LONG_MIN (-9223372036854775807L-1L)
|
||||
/* min value of a "long int" */
|
||||
#define LONG_MAX 9223372036854775807L
|
||||
/* max value of a "long int" */
|
||||
#define ULONG_MAX 18446744073709551615UL
|
||||
/* max of "unsigned long int" */
|
||||
#else /* _ILP32 */
|
||||
#define LONG_MIN (-2147483647L-1L)
|
||||
/* min value of a "long int" */
|
||||
#define LONG_MAX 2147483647L /* max value of a "long int" */
|
||||
#define ULONG_MAX 4294967295UL /* max of "unsigned long int" */
|
||||
#endif
|
||||
|
||||
#endif /* defined(_KERNEL) */
|
||||
|
||||
#define P_MYPID ((pid_t)0)
|
||||
|
||||
/*
|
||||
* The following is the value of type id_t to use to indicate the
|
||||
* caller's current id. See procset.h for the type idtype_t
|
||||
* which defines which kind of id is being specified.
|
||||
*/
|
||||
#define P_MYID (-1)
|
||||
#define NOPID (pid_t)(-1)
|
||||
|
||||
#ifndef NODEV
|
||||
#define NODEV (dev_t)(-1l)
|
||||
#ifdef _SYSCALL32
|
||||
#define NODEV32 (dev32_t)(-1)
|
||||
#endif /* _SYSCALL32 */
|
||||
#endif /* NODEV */
|
||||
|
||||
/*
|
||||
* The following value of type pfn_t is used to indicate
|
||||
* invalid page frame number.
|
||||
*/
|
||||
#define PFN_INVALID ((pfn_t)-1)
|
||||
|
||||
/* BEGIN CSTYLED */
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned short u_short;
|
||||
typedef unsigned int u_int;
|
||||
typedef unsigned long u_long;
|
||||
typedef struct _quad { int val[2]; } quad_t; /* used by UFS */
|
||||
typedef quad_t quad; /* used by UFS */
|
||||
/* END CSTYLED */
|
||||
|
||||
/*
|
||||
* Nested include for BSD/sockets source compatibility.
|
||||
* (The select macros used to be defined here).
|
||||
*/
|
||||
#include <sys/select.h>
|
||||
|
||||
#endif /* defined(__EXTENSIONS__) || (!defined(_POSIX_C_SOURCE) && ... */
|
||||
|
||||
/*
|
||||
* _VOID was defined to be either void or char but this is not
|
||||
* required because previous SunOS compilers have accepted the void
|
||||
* type. However, because many system header and source files use the
|
||||
* void keyword, the volatile keyword, and ANSI C function prototypes,
|
||||
* non-ANSI compilers cannot compile the system anyway. The _VOID macro
|
||||
* should therefore not be used and remains for source compatibility
|
||||
* only.
|
||||
*/
|
||||
/* CSTYLED */
|
||||
#define _VOID void
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_TYPES_H */
|
||||
83
3rdparty/pthreads/include/pthread/unistd.h
vendored
Normal file
83
3rdparty/pthreads/include/pthread/unistd.h
vendored
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/* Copyright (C) 1992-2000 the Florida State University
|
||||
Distributed by the Florida State University under the terms of the
|
||||
GNU Library General Public License.
|
||||
|
||||
This file is part of Pthreads.
|
||||
|
||||
Pthreads 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 (version 2).
|
||||
|
||||
Pthreads is distributed "AS IS" 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 Pthreads; see the file COPYING. If not, write
|
||||
to the Free Software Foundation, 675 Mass Ave, Cambridge,
|
||||
MA 02139, USA.
|
||||
|
||||
Report problems and direct all questions to:
|
||||
|
||||
pthreads-bugs@ada.cs.fsu.edu
|
||||
|
||||
@(#)unistd.h 3.14 11/8/00
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _pthread_unistd_h
|
||||
#define _pthread_unistd_h
|
||||
|
||||
#ifdef LOCORE
|
||||
|
||||
#if defined(__linux__) || defined(__dos__)
|
||||
#ifndef __ELF__
|
||||
#define NAME(x) _/**/x
|
||||
#else
|
||||
#define NAME(x) x
|
||||
#endif
|
||||
#endif /* __linux__ */
|
||||
|
||||
#else /* !LOCORE */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
/*
|
||||
* We need to figure out (from header files) what system we are running on.
|
||||
*/
|
||||
#if !defined(_M_UNIX) && !defined(__linux__) && !defined(__dos__)
|
||||
#ifdef _UNISTD_H
|
||||
#ifndef SOLARIS_NP
|
||||
#define SOLARIS_NP
|
||||
#define SVR4_NP
|
||||
#endif
|
||||
#elif defined(SOLARIS_NP) || defined(SVR4_NP)
|
||||
#undef SOLARIS_NP
|
||||
#undef SVR4_NP
|
||||
#endif /* _UNISTD_H */
|
||||
#endif /* !_M_UNIX && !__linux__ && !__dos__ */
|
||||
|
||||
#endif /* !LOCORE */
|
||||
|
||||
#ifndef _POSIX_THREADS
|
||||
#define _POSIX_THREADS
|
||||
#endif /* !_POSIX_THREADS */
|
||||
#ifndef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#define _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#endif /* !_POSIX_THREAD_PRIORITY_SCHEDULING */
|
||||
#ifndef _POSIX_THREAD_ATTR_STACKSIZE
|
||||
#define _POSIX_THREAD_ATTR_STACKSIZE
|
||||
#endif /* !_POSIX_THREAD_ATTR_STACKSIZE */
|
||||
#ifdef SRP_NP
|
||||
#ifndef _POSIX_THREADS_PRIO_PROTECT
|
||||
#define _POSIX_THREADS_PRIO_PROTECT
|
||||
#endif /* !_POSIX_THREADS_PRIO_PROTECT */
|
||||
#else /* !SRP_NP */
|
||||
#undef _POSIX_THREADS_PRIO_PROTECT
|
||||
#endif /* !SRP_NP */
|
||||
#undef _POSIX_THREADS_PROCESS_SHARED
|
||||
#undef _POSIX_THREADS_PRIO_INHERIT
|
||||
#undef _POSIX_REENTRANT_FUNCTIONS
|
||||
|
||||
#endif /* !_pthread_unistd_h */
|
||||
BIN
3rdparty/pthreads/lib/libgthreads.a
(Stored with Git LFS)
vendored
Normal file
BIN
3rdparty/pthreads/lib/libgthreads.a
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
1895
3rdparty/stb_ds.h
vendored
Normal file
1895
3rdparty/stb_ds.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
7897
3rdparty/stb_image.h
vendored
Normal file
7897
3rdparty/stb_image.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
55
LICENSE
Normal file
55
LICENSE
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#
|
||||
# Roo/E, the Kangaroo Punch Portable GUI Toolkit
|
||||
# Copyright (C) 2026 Scott Duensing
|
||||
#
|
||||
# http://kangaroopunch.com
|
||||
#
|
||||
#
|
||||
# This file is part of Roo/E.
|
||||
#
|
||||
# Roo/E is free software: you can redistribute it and/or modify it under the
|
||||
# terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# Roo/E 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 Affero General Public License
|
||||
# along with Roo/E. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
Third Party Library Licenses:
|
||||
|
||||
|
||||
MemWatch
|
||||
--------
|
||||
http://www.linkdata.se/sourcecode/memwatch/
|
||||
GPL2
|
||||
|
||||
|
||||
PThreads
|
||||
--------
|
||||
https://www.delorie.com/pub/djgpp/current/v2tk/
|
||||
LGPL2
|
||||
|
||||
|
||||
SDL2
|
||||
----
|
||||
https://www.libsdl.org/
|
||||
BSD 3-Clause
|
||||
|
||||
|
||||
stb_ds.h
|
||||
--------
|
||||
https://github.com/nothings/stb
|
||||
Public Domain
|
||||
|
||||
|
||||
stb_image.h
|
||||
-----------
|
||||
https://github.com/nothings/stb
|
||||
Public Domain
|
||||
129
Makefile
Normal file
129
Makefile
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
#
|
||||
# Roo/E, the Kangaroo Punch Portable GUI Toolkit
|
||||
# Copyright (C) 2026 Scott Duensing
|
||||
#
|
||||
# http://kangaroopunch.com
|
||||
#
|
||||
#
|
||||
# This file is part of Roo/E.
|
||||
#
|
||||
# Roo/E is free software: you can redistribute it and/or modify it under the
|
||||
# terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# Roo/E 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 Affero General Public License
|
||||
# along with Roo/E. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
# Tools
|
||||
CC := gcc
|
||||
AR := ar
|
||||
DXE3GEN := dxe3gen
|
||||
EXE2COFF := exe2coff
|
||||
|
||||
# Compiler Settings
|
||||
CFLAGS := -DPLATFORM_DOS -Wall
|
||||
LDFLAGS :=
|
||||
|
||||
# Output Directories
|
||||
OBJ := obj
|
||||
BIN := bin
|
||||
DYN := $(BIN)/dyn
|
||||
APP := $(BIN)/app
|
||||
SDK := $(BIN)/sdk
|
||||
FNT := $(BIN)/fonts
|
||||
FIN := font/in
|
||||
|
||||
# Include Paths
|
||||
INC := ../include include 3rdparty 3rdparty/pthreads/include
|
||||
|
||||
# Font Compiler Source and Target - NOTE: This is a Linux binary!
|
||||
FONT_ELF := font
|
||||
FONT_SRC := $(shell find font/src -name '*.c')
|
||||
FONT_OBJ := $(FONT_SRC:%=$(OBJ)/%.o)
|
||||
FONT_LIB := -lm
|
||||
|
||||
# Roo/E Dynamic Libraries
|
||||
DYNS_EXE := stbimage.dyn
|
||||
DYNS_SRC := $(shell find dyn/stbimage -name '*.c')
|
||||
DYNS_OBJ := $(DYNS_SRC:%=$(OBJ)/%.o)
|
||||
DYNS_LIB :=
|
||||
|
||||
# Roo/E Source and Target
|
||||
ROOE_EXE := roo_e.exe
|
||||
ROOE_SRC := $(shell find roo_e -name '*.c')
|
||||
ROOE_OBJ := $(ROOE_SRC:%=$(OBJ)/%.o)
|
||||
ROOE_LIB := 3rdparty/pthreads/lib/libgthreads.a -lgcc
|
||||
|
||||
# MultiPlayer Game Client
|
||||
MPGC_EXE := kpsmpgc.app
|
||||
MPGC_SRC := $(shell find kpsmpgc -name '*.c')
|
||||
MPGC_OBJ := $(MPGC_SRC:%=$(OBJ)/%.o)
|
||||
MPGC_LIB :=
|
||||
|
||||
FONTS := $(FNT)/vga4x8.fnt $(FNT)/vga8x8.fnt $(FNT)/vga8x14.fnt $(FNT)/vga8x16.fnt
|
||||
|
||||
# Wiring
|
||||
FONT_PNGS := $(subst $(FNT),$(FIN),$(FONTS))
|
||||
FONT_PNGS := $(subst .fnt,.png,$(FONTS_PNGS))
|
||||
INC_FLAGS := $(addprefix -I,$(INC))
|
||||
CFLAGS += $(INC_FLAGS)
|
||||
|
||||
# Force User to Run This Using Toolchains
|
||||
.PHONY: use_build_script
|
||||
use_build_script:
|
||||
@echo "Use build.sh to cross-compile, not make."
|
||||
|
||||
# Build Everything
|
||||
.PHONY: dos
|
||||
dos: $(BIN)/$(ROOE_EXE) $(APP)/$(MPGC_EXE) $(DYN)/$(DYNS_EXE)
|
||||
|
||||
.PHONY: linux
|
||||
linux: $(FONTS)
|
||||
|
||||
# Remove Everything
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(OBJ) $(BIN)
|
||||
|
||||
# Font Compiler Target
|
||||
$(BIN)/$(FONT_ELF): $(FONT_OBJ) Makefile
|
||||
mkdir -p $(dir $@) $(BIN)/fonts
|
||||
$(CC) $(FONT_OBJ) -o $@ $(LDFLAGS) $(FONT_LIB)
|
||||
|
||||
$(FONTS) &: $(FIN)/vga4x8.png $(FIN)/vga4x8.png $(FIN)/vga4x8.png $(FIN)/vga4x8.png $(BIN)/$(FONT_ELF)
|
||||
cd $(BIN) && ./$(FONT_ELF)
|
||||
|
||||
# Roo/E Target
|
||||
$(BIN)/$(ROOE_EXE): $(ROOE_OBJ) Makefile
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) $(ROOE_OBJ) -o $@ $(LDFLAGS) $(ROOE_LIB)
|
||||
# Embed the DPMI Server
|
||||
$(EXE2COFF) $(BIN)/$(ROOE_EXE)
|
||||
cat 3rdparty/CWSDPMI/CWSDSTUB.EXE $(basename $(BIN)/$(ROOE_EXE)) > $(BIN)/$(ROOE_EXE)
|
||||
rm $(basename $(BIN)/$(ROOE_EXE))
|
||||
|
||||
# MPGC Target
|
||||
$(APP)/$(MPGC_EXE): $(MPGC_OBJ) Makefile
|
||||
mkdir -p $(dir $@)
|
||||
$(DXE3GEN) -o $@ $(MPGC_OBJ) -U $(LDFLAGS) $(MPGC_LIB)
|
||||
|
||||
# DYNS Target
|
||||
$(DYN)/$(DYNS_EXE): $(DYNS_OBJ) Makefile
|
||||
mkdir -p $(dir $@)
|
||||
$(AR) rcs $(OBJ)/$(DYNS_EXE).a $(DYNS_OBJ)
|
||||
$(DXE3GEN) -o $@ -Y $@.a --whole-archive -U $(OBJ)/$(DYNS_EXE).a $(LDFLAGS) $(DYNS_LIB)
|
||||
mkdir -p $(SDK)
|
||||
mv $(DYN)/$(DYNS_EXE).a $(SDK)/.
|
||||
|
||||
# Build C Files
|
||||
$(OBJ)/%.c.o: %.c
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
661
agpl30.txt
Normal file
661
agpl30.txt
Normal file
|
|
@ -0,0 +1,661 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
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
|
||||
them 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.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey 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;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If 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 convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero 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 that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
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.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
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.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
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
|
||||
state 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 Affero 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 Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
32
build.sh
Executable file
32
build.sh
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Roo/E, the Kangaroo Punch Portable GUI Toolkit
|
||||
# Copyright (C) 2026 Scott Duensing
|
||||
#
|
||||
# http://kangaroopunch.com
|
||||
#
|
||||
#
|
||||
# This file is part of Roo/E.
|
||||
#
|
||||
# Roo/E is free software: you can redistribute it and/or modify it under the
|
||||
# terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# Roo/E 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 Affero General Public License
|
||||
# along with Roo/E. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
# Linux side first.
|
||||
make linux
|
||||
|
||||
# Now do the DOS part.
|
||||
eval "$(../toolchains/toolchains.sh use x86 dos)"
|
||||
make dos
|
||||
39
dyn/stbimage/stbimage.c
Normal file
39
dyn/stbimage/stbimage.c
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/* Roo/E, the Kangaroo Punch Portable GUI Toolkit
|
||||
* Copyright (C) 2026 Scott Duensing
|
||||
*
|
||||
* http://kangaroopunch.com
|
||||
*
|
||||
*
|
||||
* This file is part of Roo/E.
|
||||
*
|
||||
* Roo/E is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, either version 3 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* Roo/E 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 Affero General Public License
|
||||
* along with Roo/E. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h"
|
||||
|
||||
|
||||
int dynStart(void) {
|
||||
printf("stb_image starting!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int dynStop(void) {
|
||||
printf("stb_image stopping!\n");
|
||||
return 0;
|
||||
}
|
||||
28
env.sh
Executable file
28
env.sh
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Roo/E, the Kangaroo Punch Portable GUI Toolkit
|
||||
# Copyright (C) 2026 Scott Duensing
|
||||
#
|
||||
# http://kangaroopunch.com
|
||||
#
|
||||
#
|
||||
# This file is part of Roo/E.
|
||||
#
|
||||
# Roo/E is free software: you can redistribute it and/or modify it under the
|
||||
# terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# Roo/E 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 Affero General Public License
|
||||
# along with Roo/E. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
eval "$(../toolchains/toolchains.sh use x86 dos)"
|
||||
export C_INCLUDE_PATH=${HOME}/code/toolchains/x-tools/djgpp/i586-pc-msdosdjgpp/sys-include
|
||||
BIN
font/in/vga4x8.png
(Stored with Git LFS)
Normal file
BIN
font/in/vga4x8.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
font/in/vga8x14.png
(Stored with Git LFS)
Normal file
BIN
font/in/vga8x14.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
font/in/vga8x16.png
(Stored with Git LFS)
Normal file
BIN
font/in/vga8x16.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
font/in/vga8x8.png
(Stored with Git LFS)
Normal file
BIN
font/in/vga8x8.png
(Stored with Git LFS)
Normal file
Binary file not shown.
100
font/src/main.c
Normal file
100
font/src/main.c
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
/* Roo/E, the Kangaroo Punch Portable GUI Toolkit
|
||||
* Copyright (C) 2026 Scott Duensing
|
||||
*
|
||||
* http://kangaroopunch.com
|
||||
*
|
||||
*
|
||||
* This file is part of Roo/E.
|
||||
*
|
||||
* Roo/E is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, either version 3 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* Roo/E 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 Affero General Public License
|
||||
* along with Roo/E. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
#define MEMWATCH
|
||||
#include "memwatch/memwatch.h"
|
||||
#endif
|
||||
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#define STBI_ONLY_PNG
|
||||
#include "stb_image.h"
|
||||
|
||||
#include "stddclmr.h"
|
||||
|
||||
|
||||
void makeFont(char *source, char *target, int pixelsW, int pixelsH, int charsW, int charCount);
|
||||
|
||||
|
||||
void makeFont(char *source, char *target, int pixelsW, int pixelsH, int charsW, int charCount) {
|
||||
unsigned char *font = NULL;
|
||||
unsigned char data = 0;
|
||||
FILE *out = NULL;
|
||||
int bits = 0;
|
||||
int x;
|
||||
int y;
|
||||
int n;
|
||||
int w;
|
||||
int h;
|
||||
|
||||
// Load font atlas from disk.
|
||||
font = stbi_load(source, (int *)&w, (int *)&h, (int *)&n, 3);
|
||||
if (!font) return;
|
||||
|
||||
// Create data file for font.
|
||||
out = fopen(target, "wb");
|
||||
if (!out) {
|
||||
stbi_image_free(font);
|
||||
return;
|
||||
}
|
||||
|
||||
// Provide some metadata for enhancement later.
|
||||
fputc(pixelsW, out); // Width of characters in pixels
|
||||
fputc(pixelsH, out); // Height of characters in pixels
|
||||
fputc(charsW, out); // Number of characters per row
|
||||
fputc(charCount - 1, out); // Number of characters - 1
|
||||
|
||||
// Convert bitmap to actual bits.
|
||||
for (y=0; y<h; y++) {
|
||||
for (x=0; x<w; x++) {
|
||||
data <<= 1;
|
||||
data |= (font[(y * w * 3) + (x * 3)] != 0);
|
||||
bits++;
|
||||
if (bits > 7) {
|
||||
bits = 0;
|
||||
fputc(data, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(out);
|
||||
|
||||
// Clean up.
|
||||
stbi_image_free(font);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
// Run this in DOS from the BIN folder.
|
||||
makeFont("../font/in/vga4x8.png", "fonts/vga4x8.fnt", 4, 8, 16, 256);
|
||||
makeFont("../font/in/vga8x8.png", "fonts/vga8x8.fnt", 8, 8, 16, 256);
|
||||
makeFont("../font/in/vga8x14.png", "fonts/vga8x14.fnt", 8, 14, 16, 256);
|
||||
makeFont("../font/in/vga8x16.png", "fonts/vga8x16.fnt", 8, 16, 16, 256);
|
||||
|
||||
return 0;
|
||||
}
|
||||
BIN
icon.png
(Stored with Git LFS)
Normal file
BIN
icon.png
(Stored with Git LFS)
Normal file
Binary file not shown.
120
include/stddclmr.h
Normal file
120
include/stddclmr.h
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* Roo/E, the Kangaroo Punch Portable GUI Toolkit
|
||||
* Copyright (C) 2026 Scott Duensing
|
||||
*
|
||||
* http://kangaroopunch.com
|
||||
*
|
||||
*
|
||||
* This file is part of Roo/E.
|
||||
*
|
||||
* Roo/E is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, either version 3 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* Roo/E 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 Affero General Public License
|
||||
* along with Roo/E. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#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
|
||||
45
kpsmpgc/main.c
Normal file
45
kpsmpgc/main.c
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/* Roo/E, the Kangaroo Punch Portable GUI Toolkit
|
||||
* Copyright (C) 2026 Scott Duensing
|
||||
*
|
||||
* http://kangaroopunch.com
|
||||
*
|
||||
*
|
||||
* This file is part of Roo/E.
|
||||
*
|
||||
* Roo/E is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, either version 3 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* Roo/E 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 Affero General Public License
|
||||
* along with Roo/E. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "stb_image.h"
|
||||
|
||||
|
||||
void __attribute__((constructor)) registerApp(void) {
|
||||
printf("App Loaded!\n");
|
||||
}
|
||||
|
||||
|
||||
void __attribute__((destructor)) unregisterApp(void) {
|
||||
printf("App Unloaded!\n");
|
||||
}
|
||||
|
||||
|
||||
int appMain(const int argc, char* argv[]) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
printf("App running!\n");
|
||||
printf("stbi_failure_reason: [%s]\n", stbi_failure_reason());
|
||||
return 0;
|
||||
}
|
||||
47
notes.txt
Normal file
47
notes.txt
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
Roo/E, the Kangaroo Punch Portable GUI Toolkit
|
||||
Copyright (C) 2022-2025 Scott Duensing
|
||||
|
||||
http://kangaroopunch.com
|
||||
|
||||
|
||||
GOALS
|
||||
~~~~~
|
||||
Roo/E is designed to run on any platform that provides at least keyboard and
|
||||
mouse input with a bitmapped display. The current mimimum target is a 486
|
||||
running MS-DOS with a VESA 2.0 compliant SVGA display.
|
||||
|
||||
Unlike most low-end windowing systems, Roo/E should provide "solid" rendering
|
||||
at all times. Dragging and resizing windows should not result in wireframe
|
||||
representations of the window, nor should window operations interrupt or pause
|
||||
the content in the windows.
|
||||
|
||||
Minimized windows display a live view of the entire window contents so users
|
||||
can continue to monitor their activity.
|
||||
|
||||
Widgets and other window contents should instantly appear. No watching them
|
||||
being drawn to the display.
|
||||
|
||||
Roo/E should be thread friendly.
|
||||
|
||||
|
||||
IMPLEMENTATION
|
||||
~~~~~~~~~~~~~~
|
||||
In order to reach these goals, Roo/E trades memory for speed. Many surface
|
||||
caches are used to reduce the amount of redraw needed at any given time.
|
||||
|
||||
When new windows are defined, they specify the maximum bounds of their
|
||||
content. This means no endlessly scrolling windows as is common in word
|
||||
processors and web browsers. On creation, a new off-screen surface is
|
||||
created with these maximum bounds. This allows widgets to be drawn in the
|
||||
window without consideration for clipping. Just keep it inside the window!
|
||||
|
||||
The "window manager" handles window chrome and blitting window contents to yet
|
||||
another surface. This cached surface is updated when anything in the window is
|
||||
"damaged".
|
||||
|
||||
Finally, these chromed surfaces (or icons if minimized) are positioned and
|
||||
dirty rectangles are calculated. Dirty rectangles are then merged, if
|
||||
possible, to reduce the number of blits required to update the display. This
|
||||
rectangle list is then blitted from the apporpriate cached surfaces to the
|
||||
actual display. This results in the entire display being redrawn but with no
|
||||
overdraw.
|
||||
223
roo_e/main.c
Normal file
223
roo_e/main.c
Normal file
|
|
@ -0,0 +1,223 @@
|
|||
/*
|
||||
* Roo/E, the Kangaroo Punch Portable GUI Toolkit
|
||||
* Copyright (C) 2026 Scott Duensing
|
||||
*
|
||||
* http://kangaroopunch.com
|
||||
*
|
||||
*
|
||||
* This file is part of Roo/E.
|
||||
*
|
||||
* Roo/E is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, either version 3 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* Roo/E 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 Affero General Public License
|
||||
* along with Roo/E. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <dlfcn.h>
|
||||
#include <dirent.h>
|
||||
#include <math.h>
|
||||
#include "pthread.h"
|
||||
|
||||
// ReSharper disable once CppUnusedIncludeDirective
|
||||
#include "stddclmr.h"
|
||||
#include "util.h"
|
||||
|
||||
#define STB_DS_IMPLEMENTATION
|
||||
#include "stb_ds.h"
|
||||
|
||||
|
||||
int startApp(const char *appName, int argc, char *argv[]);
|
||||
|
||||
|
||||
#ifdef PLATFORM_DOS
|
||||
#include <sys/dxe.h>
|
||||
void *dxeResolver(const char *symbol);
|
||||
static int lastResort(void);
|
||||
typedef unsigned int word __attribute__((mode(word)));
|
||||
typedef unsigned int pointer __attribute__((mode(pointer)));
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wbuiltin-declaration-mismatch"
|
||||
struct __emutls_object // NOLINT
|
||||
{
|
||||
word size;
|
||||
word align;
|
||||
union {
|
||||
pointer offset;
|
||||
void *ptr;
|
||||
} loc;
|
||||
void *templ;
|
||||
};
|
||||
void *__emutls_get_address(struct __emutls_object *); // NOLINT
|
||||
#pragma GCC diagnostic pop
|
||||
DXE_EXPORT_TABLE(exports)
|
||||
// dxe
|
||||
DXE_EXPORT(dlclose)
|
||||
DXE_EXPORT(dlopen)
|
||||
DXE_EXPORT(dlregsym)
|
||||
DXE_EXPORT(dlstatbind)
|
||||
DXE_EXPORT(dlstatunbind)
|
||||
// math
|
||||
DXE_EXPORT(ldexp)
|
||||
DXE_EXPORT(pow)
|
||||
// stb_ds
|
||||
DXE_EXPORT(stbds_arrfreef)
|
||||
DXE_EXPORT(stbds_arrgrowf)
|
||||
DXE_EXPORT(stbds_hash_bytes)
|
||||
DXE_EXPORT(stbds_hash_string)
|
||||
DXE_EXPORT(stbds_hmdel_key)
|
||||
DXE_EXPORT(stbds_hmfree_func)
|
||||
DXE_EXPORT(stbds_hmget_key)
|
||||
DXE_EXPORT(stbds_hmget_key_ts)
|
||||
DXE_EXPORT(stbds_hmput_default)
|
||||
DXE_EXPORT(stbds_hmput_key)
|
||||
DXE_EXPORT(stbds_rand_seed)
|
||||
DXE_EXPORT(stbds_shmode_func)
|
||||
DXE_EXPORT(stbds_stralloc)
|
||||
DXE_EXPORT(stbds_strreset)
|
||||
// stdio
|
||||
DXE_EXPORT(fclose)
|
||||
DXE_EXPORT(feof)
|
||||
DXE_EXPORT(ferror)
|
||||
DXE_EXPORT(fgetc)
|
||||
DXE_EXPORT(fopen)
|
||||
DXE_EXPORT(fread)
|
||||
DXE_EXPORT(fseek)
|
||||
DXE_EXPORT(ftell)
|
||||
DXE_EXPORT(printf)
|
||||
DXE_EXPORT(puts)
|
||||
DXE_EXPORT(ungetc)
|
||||
// stdlib
|
||||
DXE_EXPORT(free)
|
||||
DXE_EXPORT(malloc)
|
||||
DXE_EXPORT(realloc)
|
||||
// string
|
||||
DXE_EXPORT(memcpy)
|
||||
DXE_EXPORT(memset)
|
||||
DXE_EXPORT(strcmp)
|
||||
DXE_EXPORT(strncmp)
|
||||
DXE_EXPORT(strtol)
|
||||
// Compiler stuff.
|
||||
DXE_EXPORT(__dj_assert)
|
||||
DXE_EXPORT(__emutls_get_address)
|
||||
DXE_EXPORT_END
|
||||
|
||||
void *dxeResolver(const char *symbol) {
|
||||
union {
|
||||
int (*from)(void);
|
||||
void *to;
|
||||
} funcPtrCast;
|
||||
|
||||
printf("%s: undefined symbol in dynamic module!\n", symbol);
|
||||
|
||||
funcPtrCast.from = lastResort;
|
||||
return funcPtrCast.to; // NOLINT
|
||||
}
|
||||
|
||||
static int lastResort(void) {
|
||||
printf("Last resort function called!\n");
|
||||
return 0;
|
||||
}
|
||||
#endif // PLATFORM_DOS
|
||||
|
||||
|
||||
int startApp(const char *appName, const int argc, char *argv[]) {
|
||||
void *dxe = NULL;
|
||||
int result = -1;
|
||||
char *filename = NULL;
|
||||
int (*appMain)(const int argc, char *argv[]);
|
||||
|
||||
union {
|
||||
void *from;
|
||||
int (*to)(const int argc, char *argv[]);
|
||||
} appPtrCast;
|
||||
|
||||
dlerror(); // Clear any existing error.
|
||||
filename = utilCreateString("app/%s.app", appName);
|
||||
dxe = dlopen(filename, RTLD_LAZY);
|
||||
if (!dxe) {
|
||||
printf("Unable to load %s! %s\n", filename, dlerror());
|
||||
} else {
|
||||
appPtrCast.from = dlsym(dxe, "_appMain");
|
||||
appMain = appPtrCast.to; // NOLINT
|
||||
result = appMain(argc, argv);
|
||||
}
|
||||
|
||||
dlclose(dxe);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int main(const int argc, char *argv[]) {
|
||||
|
||||
void *dxe = NULL;
|
||||
DIR *dir = NULL;
|
||||
struct dirent *dirent = NULL;
|
||||
char *filename = NULL;
|
||||
int (*dynInit)(void);
|
||||
int result;
|
||||
|
||||
union {
|
||||
void *from;
|
||||
int (*to)(void);
|
||||
} dynPtrCast;
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
#ifdef PLATFORM_DOS
|
||||
// Set the error callback function.
|
||||
_dlsymresolver = dxeResolver;
|
||||
// Register the symbols exported into dynamic modules.
|
||||
dlregsym(exports);
|
||||
#endif // PLATFORM_DOS
|
||||
|
||||
// Load libraries.
|
||||
debug("Loading dynamic libraries.\n");
|
||||
if ((dir = opendir("dyn/")) == NULL) {
|
||||
printf("Unable to open dyn directory!\n");
|
||||
exit(1);
|
||||
}
|
||||
while ((dirent = readdir(dir))) {
|
||||
if ((dirent->d_type == DT_REG) || (dirent->d_type == DT_LNK)) {
|
||||
if (utilEndsWith(dirent->d_name, ".dyn", false)) {
|
||||
filename = utilCreateString("dyn/%s", dirent->d_name);
|
||||
dlerror(); // Clear any existing error.
|
||||
dxe = dlopen(filename,RTLD_LAZY | RTLD_GLOBAL);
|
||||
if (!dxe) {
|
||||
printf("Unable to load %s! %s\n", filename, dlerror());
|
||||
exit(1);
|
||||
}
|
||||
debug("Loaded %s.\n", filename);
|
||||
dynPtrCast.from = dlsym(dxe, "_dynStart");
|
||||
if (dynPtrCast.from != NULL) {
|
||||
dynInit = dynPtrCast.to; // NOLINT
|
||||
debug("Starting %s.\n", filename);
|
||||
result = dynInit();
|
||||
if (result != 0) {
|
||||
printf("%s failed to start!\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
free(filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
|
||||
// Load the Shell.
|
||||
result = startApp("kpsmpgc", 0, NULL);
|
||||
|
||||
return result;
|
||||
}
|
||||
80
roo_e/util.c
Normal file
80
roo_e/util.c
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/* Roo/E, the Kangaroo Punch Portable GUI Toolkit
|
||||
* Copyright (C) 2026 Scott Duensing
|
||||
*
|
||||
* http://kangaroopunch.com
|
||||
*
|
||||
*
|
||||
* This file is part of Roo/E.
|
||||
*
|
||||
* Roo/E is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, either version 3 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* Roo/E 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 Affero General Public License
|
||||
* along with Roo/E. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
char *utilCreateString(char *format, ...) {
|
||||
va_list args;
|
||||
char *string;
|
||||
|
||||
va_start(args, format);
|
||||
string = utilCreateStringVArgs(format, args);
|
||||
va_end(args);
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
|
||||
__attribute__((__format__(__printf__, 1, 0)))
|
||||
char *utilCreateStringVArgs(char *format, va_list args) {
|
||||
va_list argsCopy;
|
||||
int32_t size = 0;
|
||||
char *buffer = NULL;
|
||||
|
||||
va_copy(argsCopy, args);
|
||||
size = vsnprintf(NULL, 0, format, argsCopy) + 1;
|
||||
va_end(argsCopy);
|
||||
buffer = calloc(1, (size_t)size);
|
||||
if (buffer) {
|
||||
vsnprintf(buffer, (size_t)size, format, args);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
bool utilEndsWith(const char *haystack, const char *needle, const bool caseSensitive) {
|
||||
size_t h = strlen(haystack);
|
||||
size_t n = strlen(needle);
|
||||
|
||||
if (h < n) return false;
|
||||
|
||||
while (n > 0) {
|
||||
h--;
|
||||
n--;
|
||||
if (caseSensitive) {
|
||||
if (haystack[h] != needle[n]) return false;
|
||||
} else {
|
||||
if ((toupper(haystack[h]) != toupper(needle[n]))) return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
49
roo_e/util.h
Normal file
49
roo_e/util.h
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/* Roo/E, the Kangaroo Punch Portable GUI Toolkit
|
||||
* Copyright (C) 2026 Scott Duensing
|
||||
*
|
||||
* http://kangaroopunch.com
|
||||
*
|
||||
*
|
||||
* This file is part of Roo/E.
|
||||
*
|
||||
* Roo/E is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, either version 3 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* Roo/E 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 Affero General Public License
|
||||
* along with Roo/E. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UTIL_H
|
||||
#define UTIL_H
|
||||
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#define debug printf
|
||||
|
||||
#ifndef va_copy
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define va_copy(dest, src) __builtin_va_copy(dest, src)
|
||||
#else
|
||||
#define va_copy(dest, src) (dest = src)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
char *utilCreateString(char *format, ...);
|
||||
char *utilCreateStringVArgs(char *format, va_list args);
|
||||
bool utilEndsWith(const char *haystack, const char *needle, bool caseSensitive);
|
||||
|
||||
|
||||
#endif // UTIL_H
|
||||
Loading…
Add table
Reference in a new issue