Adding menuetlibc back to its place in /programs/develop/libraries

This version of menuetlibc was taken from revision 4743, right before I made any changes

git-svn-id: svn://kolibrios.org@4973 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
right-hearted 2014-06-12 10:43:21 +00:00
parent 989f9f99a2
commit 6496d04506
1183 changed files with 107270 additions and 0 deletions

View File

@ -0,0 +1,128 @@
13.03.2010 - diamond (version 0.2.9)
- fix structure for sysfn 9
- mgcc options changed to size optimization
- stack size increased from 16K to 128K
- include files are compatible with VC now
- correct return status of linuxtools/*; make stops on error
- compatibility with gcc4
- compatibility with 64-bit host systems
28.08.2007 - vectoroc
- added:
__menuet__debug_out_byte
__menuet__debug_out
__kolibri__cofflib_getproc
__kolibri__cofflib_load
- Now execution of any program starts at 'main' function (not 'app_main'!)
27.08.2007
- access() for root directory works now
- some bugfixes
05.03.2007
- Implemented fstat()
- fopen(...,"w") works as it must work
- malloc/realloc use dynamic memory when static one is over
23.02.2007
- Added: remove/unlink, ftruncate/chsize, stupid implementation of rename
xx.02.2007 - diamond (here and in the future)
- Modifications for KolibriOS
- Build on linux, cygwin, mingw
7.05.2004 (version 0.2.8)
- Many bugfixes
- SDL 1.2.7 fixes
18.04.2004
- Again bugfixes
- SDL 1.2.7
07.09.2003
- Removed dpmi.h and go32.h (they were wasting space)
- Moved libmcoff to main library distribution
05.09.2003
- Fixed bug in sbrk
17.08.2003 (version 0.2.6a)
- OS (Linux and DJGPP) independent compilation process
- Library can be extracted to any other directory than / (in Linux) or
drive where DJGPP is (in DOS).
- MENUETDEV library tells where is library extracted (look @ README.first).
02.08.2003 (version 0.2.6)
- Fixed exit() and crt1.c (returning from app_main caused fault)
- Added transparent paths (so e.g. chdir("/hd/1/menuetos");
f=fopen("../xyz","rb"); works)
- Fixed getcwd
- Fixed chdir
- Changed TODO
- SDL didn't have much bugs. C library was buggy and caused SDL to fault ;)
Now most things work.
01.08.2003
- Fixed clock and date support so gettimeofday (and functions that use
it work, too)
- Fixed some assembly code in menuetos support
- Changed assert and unimp to dump error to debug board
- Changed abort to dump error to debug board
- Added __libclog_printf and __libclog_vprintf functions which allow
writing to debug board
- I've got libSDL,freetype,libSDLimage,libSDLdraw,libz,libjpg and libpng
working ;) SDL needs more fixes and speedups (due to slow code in MenuetOS
support. Ok, but it works.)
26.04.2003
- Bugfix in malloc
- Finally got filesystem working
- Fixed putimage function (arguments to interrupt were in wrong order)
- This is stable release !!!! (finally I got libjpeg working :)
25.12.2002
- Some bugfixes
- Added some math functions
- Networking stuff rewritten
28.11.2002
- Fixed and added some stuff
- New app: binary clock
- Removed all inport*,outport*,etc. since they are not needed, because
Menuet will kill app which is trying to do I/O using, e.g. inb %dx,%al
- Ported libAVLTree,libmpeg,libjpeg,libelf (but they have to be downloaded
separately).
15.11.2002
- Modifed compilation engine to better
So there are many small makefiles instead of big one.
- Modified .s files and assembly blocks to declare (and call)
symbols with or without underscores (depends on /menuetos/config.h)
- Added networking stuff (what Menuet supports now)
11.10.2002
- Fixed some lines in I/O stuff
- Modified fflush to flush file to disk
- Added support for syscalls: sound and direct screen access
- Final stable release 0.2.2
10.10.2002:
- Added DOS I/O stuff, so you can use fopen/fclose/fread/fwrite/etc. now !!!
(At last GCC and many other GNU tools can be ported !).
- Fixed some bugs
- Added command line argument support
- Added makefile for .a library and makefile for C++ applications
- Added some more examples
24.8.2002:
- Modified some src/libc/ansi/stdio/f*.c
- Ported libz and libpng
22.8.2002 :
- Modified to compile in Linux. You can't use DJGPP anymore.
- Created some linuxtools mgcc,mld,mgcc which execute gcc,ld and g++
with specific parameters for applications.
- Moved console stuff to libcon.a not to mess code
??? -
I don't remember when I created it :))))

View File

@ -0,0 +1,28 @@
include osrules.mak
all: genconfig
@echo Building library for $(VERSION_OS)
gcc mkversion.c -o mkversion$(EXESUFFIX)
ifdef ON_MINGW
mkversion$(EXESUFFIX) < version > include/libc/version.h
else
./mkversion$(EXESUFFIX) < version > include/libc/version.h
endif
make -C linuxtools
make -C src depend
make -C src
make -C stub
make -C programs
genconfig:
ifdef ON_MINGW
@echo #$(NEED_UNDERSCORES) NEEDS_UNDERSCORES> config.h
else
@echo "#$(NEED_UNDERSCORES) NEEDS_UNDERSCORES" > config.h
endif
clean:
make -C src clean
make -C linuxtools clean
make -C stub clean
make -C programs clean
$(RM) mkversion$(EXESUFFIX)

View File

@ -0,0 +1,481 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -0,0 +1,97 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL.h,v 1.8 2004/01/04 16:49:07 slouken Exp $";
#endif
/* Main include header for the SDL library */
#ifndef _SDL_H
#define _SDL_H
#include "SDL_main.h"
#include "SDL_types.h"
#include "SDL_getenv.h"
#include "SDL_error.h"
#include "SDL_rwops.h"
#include "SDL_timer.h"
#include "SDL_audio.h"
#include "SDL_cdrom.h"
#include "SDL_joystick.h"
#include "SDL_events.h"
#include "SDL_video.h"
#include "SDL_byteorder.h"
#include "SDL_version.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* As of version 0.5, SDL is loaded dynamically into the application */
/* These are the flags which may be passed to SDL_Init() -- you should
specify the subsystems which you will be using in your application.
*/
#define SDL_INIT_TIMER 0x00000001
#define SDL_INIT_AUDIO 0x00000010
#define SDL_INIT_VIDEO 0x00000020
#define SDL_INIT_CDROM 0x00000100
#define SDL_INIT_JOYSTICK 0x00000200
#define SDL_INIT_NOPARACHUTE 0x00100000 /* Don't catch fatal signals */
#define SDL_INIT_EVENTTHREAD 0x01000000 /* Not supported on all OS's */
#define SDL_INIT_EVERYTHING 0x0000FFFF
/* This function loads the SDL dynamically linked library and initializes
* the subsystems specified by 'flags' (and those satisfying dependencies)
* Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
* signal handlers for some commonly ignored fatal signals (like SIGSEGV)
*/
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
/* This function initializes specific SDL subsystems */
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
/* This function cleans up specific SDL subsystems */
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
/* This function returns mask of the specified subsystems which have
been initialized.
If 'flags' is 0, it returns a mask of all initialized subsystems.
*/
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
/* This function cleans up all initialized subsystems and unloads the
* dynamically linked library. You should call it upon all exit conditions.
*/
extern DECLSPEC void SDLCALL SDL_Quit(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_H */

View File

@ -0,0 +1,60 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_active.h,v 1.6 2004/01/04 16:49:07 slouken Exp $";
#endif
/* Include file for SDL application focus event handling */
#ifndef _SDL_active_h
#define _SDL_active_h
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* The available application states */
#define SDL_APPMOUSEFOCUS 0x01 /* The app has mouse coverage */
#define SDL_APPINPUTFOCUS 0x02 /* The app has input focus */
#define SDL_APPACTIVE 0x04 /* The application is active */
/* Function prototypes */
/*
* This function returns the current state of the application, which is a
* bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and
* SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to
* see your application, otherwise it has been iconified or disabled.
*/
extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_active_h */

View File

@ -0,0 +1,259 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_audio.h,v 1.7 2004/01/04 16:49:07 slouken Exp $";
#endif
/* Access to the raw audio mixing buffer for the SDL library */
#ifndef _SDL_audio_h
#define _SDL_audio_h
#include <stdio.h>
#include "SDL_main.h"
#include "SDL_types.h"
#include "SDL_error.h"
#include "SDL_rwops.h"
#include "SDL_byteorder.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* The calculated values in this structure are calculated by SDL_OpenAudio() */
typedef struct {
int freq; /* DSP frequency -- samples per second */
Uint16 format; /* Audio data format */
Uint8 channels; /* Number of channels: 1 mono, 2 stereo */
Uint8 silence; /* Audio buffer silence value (calculated) */
Uint16 samples; /* Audio buffer size in samples (power of 2) */
Uint16 padding; /* Necessary for some compile environments */
Uint32 size; /* Audio buffer size in bytes (calculated) */
/* This function is called when the audio device needs more data.
'stream' is a pointer to the audio data buffer
'len' is the length of that buffer in bytes.
Once the callback returns, the buffer will no longer be valid.
Stereo samples are stored in a LRLRLR ordering.
*/
void (*callback)(void *userdata, Uint8 *stream, int len);
void *userdata;
} SDL_AudioSpec;
/* Audio format flags (defaults to LSB byte order) */
#define AUDIO_U8 0x0008 /* Unsigned 8-bit samples */
#define AUDIO_S8 0x8008 /* Signed 8-bit samples */
#define AUDIO_U16LSB 0x0010 /* Unsigned 16-bit samples */
#define AUDIO_S16LSB 0x8010 /* Signed 16-bit samples */
#define AUDIO_U16MSB 0x1010 /* As above, but big-endian byte order */
#define AUDIO_S16MSB 0x9010 /* As above, but big-endian byte order */
#define AUDIO_U16 AUDIO_U16LSB
#define AUDIO_S16 AUDIO_S16LSB
/* Native audio byte ordering */
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define AUDIO_U16SYS AUDIO_U16LSB
#define AUDIO_S16SYS AUDIO_S16LSB
#else
#define AUDIO_U16SYS AUDIO_U16MSB
#define AUDIO_S16SYS AUDIO_S16MSB
#endif
/* A structure to hold a set of audio conversion filters and buffers */
typedef struct SDL_AudioCVT {
int needed; /* Set to 1 if conversion possible */
Uint16 src_format; /* Source audio format */
Uint16 dst_format; /* Target audio format */
double rate_incr; /* Rate conversion increment */
Uint8 *buf; /* Buffer to hold entire audio data */
int len; /* Length of original audio buffer */
int len_cvt; /* Length of converted audio buffer */
int len_mult; /* buffer must be len*len_mult big */
double len_ratio; /* Given len, final size is len*len_ratio */
void (*filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
int filter_index; /* Current audio conversion function */
} SDL_AudioCVT;
/* Function prototypes */
/* These functions are used internally, and should not be used unless you
* have a specific need to specify the audio driver you want to use.
* You should normally use SDL_Init() or SDL_InitSubSystem().
*/
extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
/* This function fills the given character buffer with the name of the
* current audio driver, and returns a pointer to it if the audio driver has
* been initialized. It returns NULL if no driver has been initialized.
*/
extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
/*
* This function opens the audio device with the desired parameters, and
* returns 0 if successful, placing the actual hardware parameters in the
* structure pointed to by 'obtained'. If 'obtained' is NULL, the audio
* data passed to the callback function will be guaranteed to be in the
* requested format, and will be automatically converted to the hardware
* audio format if necessary. This function returns -1 if it failed
* to open the audio device, or couldn't set up the audio thread.
*
* When filling in the desired audio spec structure,
* 'desired->freq' should be the desired audio frequency in samples-per-second.
* 'desired->format' should be the desired audio format.
* 'desired->samples' is the desired size of the audio buffer, in samples.
* This number should be a power of two, and may be adjusted by the audio
* driver to a value more suitable for the hardware. Good values seem to
* range between 512 and 8096 inclusive, depending on the application and
* CPU speed. Smaller values yield faster response time, but can lead
* to underflow if the application is doing heavy processing and cannot
* fill the audio buffer in time. A stereo sample consists of both right
* and left channels in LR ordering.
* Note that the number of samples is directly related to time by the
* following formula: ms = (samples*1000)/freq
* 'desired->size' is the size in bytes of the audio buffer, and is
* calculated by SDL_OpenAudio().
* 'desired->silence' is the value used to set the buffer to silence,
* and is calculated by SDL_OpenAudio().
* 'desired->callback' should be set to a function that will be called
* when the audio device is ready for more data. It is passed a pointer
* to the audio buffer, and the length in bytes of the audio buffer.
* This function usually runs in a separate thread, and so you should
* protect data structures that it accesses by calling SDL_LockAudio()
* and SDL_UnlockAudio() in your code.
* 'desired->userdata' is passed as the first parameter to your callback
* function.
*
* The audio device starts out playing silence when it's opened, and should
* be enabled for playing by calling SDL_PauseAudio(0) when you are ready
* for your audio callback function to be called. Since the audio driver
* may modify the requested size of the audio buffer, you should allocate
* any local mixing buffers after you open the audio device.
*/
extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
/*
* Get the current audio state:
*/
typedef enum {
SDL_AUDIO_STOPPED = 0,
SDL_AUDIO_PLAYING,
SDL_AUDIO_PAUSED
} SDL_audiostatus;
extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void);
/*
* This function pauses and unpauses the audio callback processing.
* It should be called with a parameter of 0 after opening the audio
* device to start playing sound. This is so you can safely initialize
* data for your callback function after opening the audio device.
* Silence will be written to the audio device during the pause.
*/
extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
/*
* This function loads a WAVE from the data source, automatically freeing
* that source if 'freesrc' is non-zero. For example, to load a WAVE file,
* you could do:
* SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
*
* If this function succeeds, it returns the given SDL_AudioSpec,
* filled with the audio data format of the wave data, and sets
* 'audio_buf' to a malloc()'d buffer containing the audio data,
* and sets 'audio_len' to the length of that audio buffer, in bytes.
* You need to free the audio buffer with SDL_FreeWAV() when you are
* done with it.
*
* This function returns NULL and sets the SDL error message if the
* wave file cannot be opened, uses an unknown data format, or is
* corrupt. Currently raw and MS-ADPCM WAVE files are supported.
*/
extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
/* Compatibility convenience function -- loads a WAV from a file */
#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
/*
* This function frees data previously allocated with SDL_LoadWAV_RW()
*/
extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf);
/*
* This function takes a source format and rate and a destination format
* and rate, and initializes the 'cvt' structure with information needed
* by SDL_ConvertAudio() to convert a buffer of audio data from one format
* to the other.
* This function returns 0, or -1 if there was an error.
*/
extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
Uint16 src_format, Uint8 src_channels, int src_rate,
Uint16 dst_format, Uint8 dst_channels, int dst_rate);
/* Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(),
* created an audio buffer cvt->buf, and filled it with cvt->len bytes of
* audio data in the source format, this function will convert it in-place
* to the desired format.
* The data conversion may expand the size of the audio data, so the buffer
* cvt->buf should be allocated after the cvt structure is initialized by
* SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long.
*/
extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt);
/*
* This takes two audio buffers of the playing audio format and mixes
* them, performing addition, volume adjustment, and overflow clipping.
* The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
* for full audio volume. Note this does not change hardware volume.
* This is provided for convenience -- you can mix your own audio data.
*/
#define SDL_MIX_MAXVOLUME 128
extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume);
/*
* The lock manipulated by these functions protects the callback function.
* During a LockAudio/UnlockAudio pair, you can be guaranteed that the
* callback function is not running. Do not call these from the callback
* function or you will cause deadlock.
*/
extern DECLSPEC void SDLCALL SDL_LockAudio(void);
extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
/*
* This function shuts down audio processing and closes the audio device.
*/
extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_audio_h */

View File

@ -0,0 +1,120 @@
/*
SDL_bdf - renders BDF fonts
Copyright (C) 2002-2003 Andre de Leiradella
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For information about SDL_bdf contact leiradella@bigfoot.com
Version 1.0: first public release.
Version 1.1: removed SDL dependecies, now SDL_bdf can be used with any graphics
library.
Version 1.2: fixed BDF_SizeH and BDF_SizeEntitiesH to return the correct sizes.
*/
#ifndef __SDL_bdf_h__
#define __SDL_bdf_h__
#ifdef __cplusplus
extern "C" {
#endif
/* Error codes. */
/* No error. */
#define BDF_OK 0
/* Not enough memory reading BDF font. */
#define BDF_MEMORYERROR 1
/* Error reading BDF font. */
#define BDF_READERROR 2
/* Can only handle BDF font varsions up to 2.2. */
#define BDF_WRONGVERSION 3
/* Can only handle horizontal BDF fonts. */
#define BDF_CANNOTHANDLEVERTICAL 4
/* Character found past end of BDF font. */
#define BDF_TOOMANYCHARACTERS 5
/* BDF font is missing characters. */
#define BDF_TOOFEWCHARACTERS 6
/* Error parsing BDF font. */
#define BDF_PARSEERROR 7
/* A BDF character. */
typedef struct {
char *name;
int code;
int dwx0, dwy0;
int dwx1, dwy1;
int bbw, bbh, bbxoff0x, bbyoff0y, wbytes;
unsigned char *bits;
} BDF_Char;
/* A BDF font. */
typedef struct {
int metricsSet, numChars;
BDF_Char *chars;
BDF_Char *code[256];
} BDF_Font;
/*
Function to put a pixel on the surface, it receives a pointer to the surface
(whatever format it may be), the x and y coordinates and the color.
*/
typedef void (*BDF_PutPixel)(void *, int, int, unsigned int);
/*
Function to read a byte, it receives an user defined void pointer and must
return a value in the range [0..255] or -1 to indicate EOF.
*/
typedef int (*BDF_ReadByte)(void *);
/*
Opens a BDF font, it receives the function that will produce the stream of
bytes, the user defined void pointer that will be passed to getbyte and a
pointer to an int that will receive the error code. Returns the BDF font.
*/
extern BDF_Font *BDF_OpenFont(BDF_ReadByte getbyte, void *info, int *error);
/*
Closes the font and frees all associated memory.
*/
extern void BDF_CloseFont(BDF_Font *font);
/*
Determines the size of the horizontal text, returns the width and height of the
smallest rectangle that can acomodate the rendered text and the start position
in x0 and y0 on where the text must be rendered to exactly fit the rectangle.
This is because the render functions take the y parameter as the baseline of
the text to allow different fonts (e.g. normal and italic) to be mixed in the
same line. It handles NULL pointers for pieces of information you don't want.
*/
extern void BDF_SizeH(BDF_Font *font, char *text, int *x0, int *y0, int *width, int *height);
/*
Same as above but accepts entities in the form &...;
*/
extern void BDF_SizeEntitiesH(BDF_Font *font, char *text, int *x0, int *y0, int *width, int *height);
/*
Draws the text at the given surface starting at position (x, y). It calls
putpixel with the surface, coordinates and color to draw the pixel (doesn't
clip). Returns the next x coordinate to continue to render more text. Only
accepts characters in the range [0..255].
*/
extern int BDF_DrawH(void *surface, BDF_PutPixel putpixel, BDF_Font *font, char *text, int x, int y, unsigned int color);
/*
Same as above but accepts entities in the form &...;
*/
extern int BDF_DrawEntitiesH(void *, BDF_PutPixel, BDF_Font *, char *, int, int, unsigned int);
#ifdef __cplusplus
};
#endif
#endif

View File

@ -0,0 +1,54 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_byteorder.h,v 1.8 2004/01/04 16:49:07 slouken Exp $";
#endif
/* Macros for determining the byte-order of this platform */
#ifndef _SDL_byteorder_h
#define _SDL_byteorder_h
/* The two types of endianness */
#define SDL_LIL_ENDIAN 1234
#define SDL_BIG_ENDIAN 4321
/* Pardon the mess, I'm trying to determine the endianness of this host.
I'm doing it by preprocessor defines rather than some sort of configure
script so that application code can use this too. The "right" way would
be to dynamically generate this file on install, but that's a lot of work.
*/
#if defined(__i386__) || defined(__ia64__) || defined(WIN32) || \
(defined(__alpha__) || defined(__alpha)) || \
defined(__arm__) || \
(defined(__mips__) && defined(__MIPSEL__)) || \
defined(__SYMBIAN32__) || \
defined(__x86_64__) || \
defined(__LITTLE_ENDIAN__)
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#else
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#endif
#endif /* _SDL_byteorder_h */

View File

@ -0,0 +1,175 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_cdrom.h,v 1.6 2004/01/04 16:49:07 slouken Exp $";
#endif
/* This is the CD-audio control API for Simple DirectMedia Layer */
#ifndef _SDL_cdrom_h
#define _SDL_cdrom_h
#include "SDL_types.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* In order to use these functions, SDL_Init() must have been called
with the SDL_INIT_CDROM flag. This causes SDL to scan the system
for CD-ROM drives, and load appropriate drivers.
*/
/* The maximum number of CD-ROM tracks on a disk */
#define SDL_MAX_TRACKS 99
/* The types of CD-ROM track possible */
#define SDL_AUDIO_TRACK 0x00
#define SDL_DATA_TRACK 0x04
/* The possible states which a CD-ROM drive can be in. */
typedef enum {
CD_TRAYEMPTY,
CD_STOPPED,
CD_PLAYING,
CD_PAUSED,
CD_ERROR = -1
} CDstatus;
/* Given a status, returns true if there's a disk in the drive */
#define CD_INDRIVE(status) ((int)status > 0)
typedef struct {
Uint8 id; /* Track number */
Uint8 type; /* Data or audio track */
Uint16 unused;
Uint32 length; /* Length, in frames, of this track */
Uint32 offset; /* Offset, in frames, from start of disk */
} SDL_CDtrack;
/* This structure is only current as of the last call to SDL_CDStatus() */
typedef struct SDL_CD {
int id; /* Private drive identifier */
CDstatus status; /* Current drive status */
/* The rest of this structure is only valid if there's a CD in drive */
int numtracks; /* Number of tracks on disk */
int cur_track; /* Current track position */
int cur_frame; /* Current frame offset within current track */
SDL_CDtrack track[SDL_MAX_TRACKS+1];
} SDL_CD;
/* Conversion functions from frames to Minute/Second/Frames and vice versa */
#define CD_FPS 75
#define FRAMES_TO_MSF(f, M,S,F) { \
int value = f; \
*(F) = value%CD_FPS; \
value /= CD_FPS; \
*(S) = value%60; \
value /= 60; \
*(M) = value; \
}
#define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F))
/* CD-audio API functions: */
/* Returns the number of CD-ROM drives on the system, or -1 if
SDL_Init() has not been called with the SDL_INIT_CDROM flag.
*/
extern DECLSPEC int SDLCALL SDL_CDNumDrives(void);
/* Returns a human-readable, system-dependent identifier for the CD-ROM.
Example:
"/dev/cdrom"
"E:"
"/dev/disk/ide/1/master"
*/
extern DECLSPEC const char * SDLCALL SDL_CDName(int drive);
/* Opens a CD-ROM drive for access. It returns a drive handle on success,
or NULL if the drive was invalid or busy. This newly opened CD-ROM
becomes the default CD used when other CD functions are passed a NULL
CD-ROM handle.
Drives are numbered starting with 0. Drive 0 is the system default CD-ROM.
*/
extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive);
/* This function returns the current status of the given drive.
If the drive has a CD in it, the table of contents of the CD and current
play position of the CD will be stored in the SDL_CD structure.
*/
extern DECLSPEC CDstatus SDLCALL SDL_CDStatus(SDL_CD *cdrom);
/* Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks'
tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play
until the end of the CD. This function will skip data tracks.
This function should only be called after calling SDL_CDStatus() to
get track information about the CD.
For example:
// Play entire CD:
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
// Play last track:
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0);
}
// Play first and second track and 10 seconds of third track:
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
SDL_CDPlayTracks(cdrom, 0, 0, 2, 10);
This function returns 0, or -1 if there was an error.
*/
extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom,
int start_track, int start_frame, int ntracks, int nframes);
/* Play the given CD starting at 'start' frame for 'length' frames.
It returns 0, or -1 if there was an error.
*/
extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length);
/* Pause play -- returns 0, or -1 on error */
extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom);
/* Resume play -- returns 0, or -1 on error */
extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom);
/* Stop play -- returns 0, or -1 on error */
extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom);
/* Eject CD-ROM -- returns 0, or -1 on error */
extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom);
/* Closes the handle for the CD-ROM drive */
extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_video_h */

View File

@ -0,0 +1,27 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_copying.h,v 1.5 2004/01/04 16:49:07 slouken Exp $";
#endif

View File

@ -0,0 +1,78 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_cpuinfo.h,v 1.5 2004/01/24 05:47:18 slouken Exp $";
#endif
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* CPU feature detection for SDL */
#ifndef _SDL_cpuinfo_h
#define _SDL_cpuinfo_h
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* This function returns true if the CPU has the RDTSC instruction
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC();
/* This function returns true if the CPU has MMX features
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX();
/* This function returns true if the CPU has MMX Ext. features
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt();
/* This function returns true if the CPU has 3DNow features
*/
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow();
/* This function returns true if the CPU has 3DNow! Ext. features
*/
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt();
/* This function returns true if the CPU has SSE features
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE();
/* This function returns true if the CPU has SSE2 features
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2();
/* This function returns true if the CPU has AltiVec features
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec();
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_cpuinfo_h */

View File

@ -0,0 +1,114 @@
/*!
\file SDL_draw.h
\author Mario Palomo Torrero <mpalomo@ihman.com>
\author Jose M. de la Huerga Fernández
\author Pepe González Mora
\date 05-2002
Drawing primitives for SDL. Main header file.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SDL_DRAW_H
#define SDL_DRAW_H
#include "SDL.h"
#include "begin_code.h"
#ifdef __cplusplus
extern "C" {
#endif
extern DECLSPEC void Draw_Init(void);
extern DECLSPEC
void (*Draw_Pixel)(SDL_Surface *super,
Sint16 x, Sint16 y, Uint32 color);
extern DECLSPEC
void (*Draw_Line)(SDL_Surface *super,
Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2,
Uint32 color);
extern DECLSPEC
void (*Draw_Circle)(SDL_Surface *super,
Sint16 x0, Sint16 y0, Uint16 r,
Uint32 color);
extern DECLSPEC
void (*Draw_FillCircle)(SDL_Surface *super,
Sint16 x0, Sint16 y0, Uint16 r,
Uint32 color);
extern DECLSPEC
void (*Draw_HLine)(SDL_Surface *super,
Sint16 x0,Sint16 y0, Sint16 x1,
Uint32 color);
extern DECLSPEC
void (*Draw_VLine)(SDL_Surface *super,
Sint16 x0,Sint16 y0, Sint16 y1,
Uint32 color);
extern DECLSPEC
void (*Draw_Rect)(SDL_Surface *super,
Sint16 x,Sint16 y, Uint16 w,Uint16 h,
Uint32 color);
/* We wrap SDL_FillRect with the SDL_draw name convention */
#define Draw_FillRect(SUPER, X, Y, W, H, COLOR) \
do { \
SDL_Rect r = {(X), (Y), (W), (H)}; \
SDL_FillRect((SUPER), &r, (COLOR)); \
}while(0)
extern DECLSPEC
void (*Draw_Ellipse)(SDL_Surface *super,
Sint16 x0, Sint16 y0,
Uint16 Xradius, Uint16 Yradius,
Uint32 color);
extern DECLSPEC
void (*Draw_FillEllipse)(SDL_Surface *super,
Sint16 x0, Sint16 y0,
Uint16 Xradius, Uint16 Yradius,
Uint32 color);
extern DECLSPEC
void (*Draw_Round)(SDL_Surface *super,
Sint16 x0,Sint16 y0, Uint16 w,Uint16 h,
Uint16 corner, Uint32 color);
extern DECLSPEC
void (*Draw_FillRound)(SDL_Surface *super,
Sint16 x0,Sint16 y0, Uint16 w,Uint16 h,
Uint16 corner, Uint32 color);
/* We'll use SDL for reporting errors */
#define Draw_SetError SDL_SetError
#define Draw_GetError SDL_GetError
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "close_code.h"
#endif /* SDL_DRAW_H */

View File

@ -0,0 +1,152 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_endian.h,v 1.6 2004/01/04 16:49:07 slouken Exp $";
#endif
/* Functions for reading and writing endian-specific values */
#ifndef _SDL_endian_h
#define _SDL_endian_h
/* These functions read and write data of the specified endianness,
dynamically translating to the host machine endianness.
e.g.: If you want to read a 16 bit value on big-endian machine from
an open file containing little endian values, you would use:
value = SDL_ReadLE16(rp);
Note that the read/write functions use SDL_RWops pointers
instead of FILE pointers. This allows you to read and write
endian values from large chunks of memory as well as files
and other data sources.
*/
#include <stdio.h>
#include "SDL_types.h"
#include "SDL_rwops.h"
#include "SDL_byteorder.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* The macros used to swap values */
/* Try to use superfast macros on systems that support them */
#ifndef __MENUETOS__
#ifdef linux
#include <asm/byteorder.h>
#ifdef __arch__swab16
#define SDL_Swap16 __arch__swab16
#endif
#ifdef __arch__swab32
#define SDL_Swap32 __arch__swab32
#endif
#endif /* linux */
#endif
/* Use inline functions for compilers that support them, and static
functions for those that do not. Because these functions become
static for compilers that do not support inline functions, this
header should only be included in files that actually use them.
*/
#ifndef SDL_Swap16
static __inline__ Uint16 SDL_Swap16(Uint16 D) {
return((D<<8)|(D>>8));
}
#endif
#ifndef SDL_Swap32
static __inline__ Uint32 SDL_Swap32(Uint32 D) {
return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000FF00)|(D>>24));
}
#endif
#ifdef SDL_HAS_64BIT_TYPE
#ifndef SDL_Swap64
static __inline__ Uint64 SDL_Swap64(Uint64 val) {
Uint32 hi, lo;
/* Separate into high and low 32-bit values and swap them */
lo = (Uint32)(val&0xFFFFFFFF);
val >>= 32;
hi = (Uint32)(val&0xFFFFFFFF);
val = SDL_Swap32(lo);
val <<= 32;
val |= SDL_Swap32(hi);
return(val);
}
#endif
#else
#ifndef SDL_Swap64
/* This is mainly to keep compilers from complaining in SDL code.
If there is no real 64-bit datatype, then compilers will complain about
the fake 64-bit datatype that SDL provides when it compiles user code.
*/
#define SDL_Swap64(X) (X)
#endif
#endif /* SDL_HAS_64BIT_TYPE */
/* Byteswap item from the specified endianness to the native endianness */
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define SDL_SwapLE16(X) (X)
#define SDL_SwapLE32(X) (X)
#define SDL_SwapLE64(X) (X)
#define SDL_SwapBE16(X) SDL_Swap16(X)
#define SDL_SwapBE32(X) SDL_Swap32(X)
#define SDL_SwapBE64(X) SDL_Swap64(X)
#else
#define SDL_SwapLE16(X) SDL_Swap16(X)
#define SDL_SwapLE32(X) SDL_Swap32(X)
#define SDL_SwapLE64(X) SDL_Swap64(X)
#define SDL_SwapBE16(X) (X)
#define SDL_SwapBE32(X) (X)
#define SDL_SwapBE64(X) (X)
#endif
/* Read an item of the specified endianness and return in native format */
extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src);
extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src);
extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src);
extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src);
extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src);
extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src);
/* Write an item of native format to the specified endianness */
extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value);
extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value);
extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value);
extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value);
extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value);
extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_endian_h */

View File

@ -0,0 +1,62 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_error.h,v 1.6 2004/01/04 16:49:07 slouken Exp $";
#endif
/* Simple error message routines for SDL */
#ifndef _SDL_error_h
#define _SDL_error_h
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* Public functions */
extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...);
extern DECLSPEC char * SDLCALL SDL_GetError(void);
extern DECLSPEC void SDLCALL SDL_ClearError(void);
/* Private error message function - used internally */
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
typedef enum {
SDL_ENOMEM,
SDL_EFREAD,
SDL_EFWRITE,
SDL_EFSEEK,
SDL_LASTERROR
} SDL_errorcode;
extern void SDL_Error(SDL_errorcode code);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_error_h */

View File

@ -0,0 +1,334 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_events.h,v 1.9 2004/02/18 03:57:13 slouken Exp $";
#endif
/* Include file for SDL event handling */
#ifndef _SDL_events_h
#define _SDL_events_h
#include "SDL_types.h"
#include "SDL_active.h"
#include "SDL_keyboard.h"
#include "SDL_mouse.h"
#include "SDL_joystick.h"
#include "SDL_quit.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* Event enumerations */
enum { SDL_NOEVENT = 0, /* Unused (do not remove) */
SDL_ACTIVEEVENT, /* Application loses/gains visibility */
SDL_KEYDOWN, /* Keys pressed */
SDL_KEYUP, /* Keys released */
SDL_MOUSEMOTION, /* Mouse moved */
SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */
SDL_MOUSEBUTTONUP, /* Mouse button released */
SDL_JOYAXISMOTION, /* Joystick axis motion */
SDL_JOYBALLMOTION, /* Joystick trackball motion */
SDL_JOYHATMOTION, /* Joystick hat position change */
SDL_JOYBUTTONDOWN, /* Joystick button pressed */
SDL_JOYBUTTONUP, /* Joystick button released */
SDL_QUIT, /* User-requested quit */
SDL_SYSWMEVENT, /* System specific event */
SDL_EVENT_RESERVEDA, /* Reserved for future use.. */
SDL_EVENT_RESERVEDB, /* Reserved for future use.. */
SDL_VIDEORESIZE, /* User resized video mode */
SDL_VIDEOEXPOSE, /* Screen needs to be redrawn */
SDL_EVENT_RESERVED2, /* Reserved for future use.. */
SDL_EVENT_RESERVED3, /* Reserved for future use.. */
SDL_EVENT_RESERVED4, /* Reserved for future use.. */
SDL_EVENT_RESERVED5, /* Reserved for future use.. */
SDL_EVENT_RESERVED6, /* Reserved for future use.. */
SDL_EVENT_RESERVED7, /* Reserved for future use.. */
/* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
SDL_USEREVENT = 24,
/* This last event is only for bounding internal arrays
It is the number of bits in the event mask datatype -- Uint32
*/
SDL_NUMEVENTS = 32
};
/* Predefined event masks */
#define SDL_EVENTMASK(X) (1<<(X))
enum {
SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT),
SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)|
SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION),
SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION),
SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION),
SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP),
SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)|
SDL_EVENTMASK(SDL_JOYBALLMOTION)|
SDL_EVENTMASK(SDL_JOYHATMOTION)|
SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
SDL_EVENTMASK(SDL_JOYBUTTONUP),
SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE),
SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE),
SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
};
#define SDL_ALLEVENTS 0xFFFFFFFF
/* Application visibility event structure */
typedef struct {
Uint8 type; /* SDL_ACTIVEEVENT */
Uint8 gain; /* Whether given states were gained or lost (1/0) */
Uint8 state; /* A mask of the focus states */
} SDL_ActiveEvent;
/* Keyboard event structure */
typedef struct {
Uint8 type; /* SDL_KEYDOWN or SDL_KEYUP */
Uint8 which; /* The keyboard device index */
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
SDL_keysym keysym;
} SDL_KeyboardEvent;
/* Mouse motion event structure */
typedef struct {
Uint8 type; /* SDL_MOUSEMOTION */
Uint8 which; /* The mouse device index */
Uint8 state; /* The current button state */
Uint16 x, y; /* The X/Y coordinates of the mouse */
Sint16 xrel; /* The relative motion in the X direction */
Sint16 yrel; /* The relative motion in the Y direction */
} SDL_MouseMotionEvent;
/* Mouse button event structure */
typedef struct {
Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
Uint8 which; /* The mouse device index */
Uint8 button; /* The mouse button index */
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
Uint16 x, y; /* The X/Y coordinates of the mouse at press time */
} SDL_MouseButtonEvent;
/* Joystick axis motion event structure */
typedef struct {
Uint8 type; /* SDL_JOYAXISMOTION */
Uint8 which; /* The joystick device index */
Uint8 axis; /* The joystick axis index */
Sint16 value; /* The axis value (range: -32768 to 32767) */
} SDL_JoyAxisEvent;
/* Joystick trackball motion event structure */
typedef struct {
Uint8 type; /* SDL_JOYBALLMOTION */
Uint8 which; /* The joystick device index */
Uint8 ball; /* The joystick trackball index */
Sint16 xrel; /* The relative motion in the X direction */
Sint16 yrel; /* The relative motion in the Y direction */
} SDL_JoyBallEvent;
/* Joystick hat position change event structure */
typedef struct {
Uint8 type; /* SDL_JOYHATMOTION */
Uint8 which; /* The joystick device index */
Uint8 hat; /* The joystick hat index */
Uint8 value; /* The hat position value:
SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
Note that zero means the POV is centered.
*/
} SDL_JoyHatEvent;
/* Joystick button event structure */
typedef struct {
Uint8 type; /* SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
Uint8 which; /* The joystick device index */
Uint8 button; /* The joystick button index */
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
} SDL_JoyButtonEvent;
/* The "window resized" event
When you get this event, you are responsible for setting a new video
mode with the new width and height.
*/
typedef struct {
Uint8 type; /* SDL_VIDEORESIZE */
int w; /* New width */
int h; /* New height */
} SDL_ResizeEvent;
/* The "screen redraw" event */
typedef struct {
Uint8 type; /* SDL_VIDEOEXPOSE */
} SDL_ExposeEvent;
/* The "quit requested" event */
typedef struct {
Uint8 type; /* SDL_QUIT */
} SDL_QuitEvent;
/* A user-defined event type */
typedef struct {
Uint8 type; /* SDL_USEREVENT through SDL_NUMEVENTS-1 */
int code; /* User defined event code */
void *data1; /* User defined data pointer */
void *data2; /* User defined data pointer */
} SDL_UserEvent;
/* If you want to use this event, you should include SDL_syswm.h */
struct SDL_SysWMmsg;
typedef struct SDL_SysWMmsg SDL_SysWMmsg;
typedef struct {
Uint8 type;
SDL_SysWMmsg *msg;
} SDL_SysWMEvent;
/* General event structure */
typedef union {
Uint8 type;
SDL_ActiveEvent active;
SDL_KeyboardEvent key;
SDL_MouseMotionEvent motion;
SDL_MouseButtonEvent button;
SDL_JoyAxisEvent jaxis;
SDL_JoyBallEvent jball;
SDL_JoyHatEvent jhat;
SDL_JoyButtonEvent jbutton;
SDL_ResizeEvent resize;
SDL_ExposeEvent expose;
SDL_QuitEvent quit;
SDL_UserEvent user;
SDL_SysWMEvent syswm;
} SDL_Event;
/* Function prototypes */
/* Pumps the event loop, gathering events from the input devices.
This function updates the event queue and internal input device state.
This should only be run in the thread that sets the video mode.
*/
extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
/* Checks the event queue for messages and optionally returns them.
If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
the back of the event queue.
If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front
of the event queue, matching 'mask', will be returned and will not
be removed from the queue.
If 'action' is SDL_GETEVENT, up to 'numevents' events at the front
of the event queue, matching 'mask', will be returned and will be
removed from the queue.
This function returns the number of events actually stored, or -1
if there was an error. This function is thread-safe.
*/
typedef enum {
SDL_ADDEVENT,
SDL_PEEKEVENT,
SDL_GETEVENT
} SDL_eventaction;
/* */
extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents,
SDL_eventaction action, Uint32 mask);
/* Polls for currently pending events, and returns 1 if there are any pending
events, or 0 if there are none available. If 'event' is not NULL, the next
event is removed from the queue and stored in that area.
*/
extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event);
/* Waits indefinitely for the next available event, returning 1, or 0 if there
was an error while waiting for events. If 'event' is not NULL, the next
event is removed from the queue and stored in that area.
*/
extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event);
/* Add an event to the event queue.
This function returns 0 on success, or -1 if the event queue was full
or there was some other error.
*/
extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
/*
This function sets up a filter to process all events before they
change internal state and are posted to the internal event queue.
The filter is protypted as:
*/
typedef int (*SDL_EventFilter)(const SDL_Event *event);
/*
If the filter returns 1, then the event will be added to the internal queue.
If it returns 0, then the event will be dropped from the queue, but the
internal state will still be updated. This allows selective filtering of
dynamically arriving events.
WARNING: Be very careful of what you do in the event filter function, as
it may run in a different thread!
There is one caveat when dealing with the SDL_QUITEVENT event type. The
event filter is only called when the window manager desires to close the
application window. If the event filter returns 1, then the window will
be closed, otherwise the window will remain open if possible.
If the quit event is generated by an interrupt signal, it will bypass the
internal queue and be delivered to the application at the next event poll.
*/
extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter);
/*
Return the current event filter - can be used to "chain" filters.
If there is no event filter set, this function returns NULL.
*/
extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void);
/*
This function allows you to set the state of processing certain events.
If 'state' is set to SDL_IGNORE, that event will be automatically dropped
from the event queue and will not event be filtered.
If 'state' is set to SDL_ENABLE, that event will be processed normally.
If 'state' is set to SDL_QUERY, SDL_EventState() will return the
current processing state of the specified event.
*/
#define SDL_QUERY -1
#define SDL_IGNORE 0
#define SDL_DISABLE 0
#define SDL_ENABLE 1
extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_events_h */

View File

@ -0,0 +1,102 @@
/*
SDL_flic - renders FLIC animations
Copyright (C) 2003 Andre de Leiradella
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For information about SDL_flic contact leiradella@bigfoot.com
Version 1.0: first public release.
Version 1.1: fixed bug to set *error to FLI_OK when returning successfully from FLI_Open
added function FLI_Reset to reset the animation to the first frame
Version 1.2: added function FLI_Skip to skip the current frame without rendering
FLI_Animation->surface is now correctly locked and unlocked
the rwops stream is now part of the FLI_Animation structure and is closed inside FLI_Close
renamed FLI_Reset to FLI_Rewind
added function FLI_Version that returns the library version
*/
#ifndef __SDL_flic_h__
#define __SDL_flic_h__
#include <SDL.h>
#include <setjmp.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Supported formats. */
#define FLI_FLI 0xAF11
#define FLI_FLC 0xAF12
/* Error codes. */
/* No error. */
#define FLI_OK 0
/* Error reading the file. */
#define FLI_READERROR 1
/* Invalid frame size (corrupted file). */
#define FLI_CORRUPTEDFILE 2
/* Error in SDL operation. */
#define FLI_SDLERROR 3
/* Out of memory. */
#define FLI_OUTOFMEMORY 4
/*
The animation structure, all members are read-only, don't try to longjmp to
error.
*/
typedef struct {
Uint32 format, numframes, width, height, depth, delay, offframe1, nextframe, offnextframe;
/* rwops is where the animation is read from. */
SDL_RWops *rwops;
/* surface is where the frames is rendered to. */
SDL_Surface *surface;
/* error is used to longjmp in case of error so to avoid a chain of if's. */
jmp_buf error;
} FLI_Animation;
/*
Returns the library version in the format MAJOR << 16 | MINOR.
*/
extern int FLI_Version(void);
/*
Opens a FLIC animation and return a pointer to it. rwops is left at the same
point it was before the the call. error receives the result of the call.
*/
extern FLI_Animation *FLI_Open(SDL_RWops *rwops, int *error);
/*
Closes the animation, closes the stream and frees all used memory.
*/
extern void FLI_Close(FLI_Animation *flic);
/*
Renders the next frame of the animation returning an int to indicate if it was
successfull or not.
*/
extern int FLI_NextFrame(FLI_Animation *flic);
/*
Rewinds the animation to the first frame.
*/
extern int FLI_Rewind(FLI_Animation *flic);
/*
Skips the current frame of the animation without rendering it.
*/
extern int FLI_Skip(FLI_Animation *flic);
#ifdef __cplusplus
};
#endif
#endif

View File

@ -0,0 +1,30 @@
/* Not all environments have a working getenv()/putenv() */
#if defined(macintosh) || defined(_WIN32_WCE)
#define NEED_SDL_GETENV
#endif
#ifdef NEED_SDL_GETENV
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* Put a variable of the form "name=value" into the environment */
extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
#define putenv(X) SDL_putenv(X)
/* Retrieve a variable named "name" from the environment */
extern DECLSPEC char * SDLCALL SDL_getenv(const char *name);
#define getenv(X) SDL_getenv(X)
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* NEED_GETENV */

View File

@ -0,0 +1,93 @@
/*
IMGLIB: An example image loading library for use with SDL
Copyright (C) 1999 Sam Lantinga
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
Sam Lantinga
5635-34 Springhouse Dr.
Pleasanton, CA 94588 (USA)
slouken@devolution.com
*/
/* A simple library to load images of various formats as SDL surfaces */
#ifndef _IMG_h
#define _IMG_h
#include "SDL.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* Load an image from an SDL data source.
The 'type' may be one of: "BMP", "GIF", "PNG", etc.
If the image format supports a transparent pixel, SDL will set the
colorkey for the surface. You can enable RLE acceleration on the
surface afterwards by calling:
SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
*/
extern DECLSPEC SDL_Surface *IMG_LoadTyped_RW(SDL_RWops *src, int freesrc,
char *type);
/* Convenience functions */
extern DECLSPEC SDL_Surface *IMG_Load(const char *file);
extern DECLSPEC SDL_Surface *IMG_Load_RW(SDL_RWops *src, int freesrc);
/* Invert the alpha of a surface for use with OpenGL
This function is now a no-op, and only provided for backwards compatibility.
*/
extern DECLSPEC int IMG_InvertAlpha(int on);
/* Functions to detect a file type, given a seekable source */
extern DECLSPEC int IMG_isBMP(SDL_RWops *src);
extern DECLSPEC int IMG_isPNM(SDL_RWops *src);
extern DECLSPEC int IMG_isXPM(SDL_RWops *src);
extern DECLSPEC int IMG_isXCF(SDL_RWops *src);
extern DECLSPEC int IMG_isPCX(SDL_RWops *src);
extern DECLSPEC int IMG_isGIF(SDL_RWops *src);
extern DECLSPEC int IMG_isJPG(SDL_RWops *src);
extern DECLSPEC int IMG_isTIF(SDL_RWops *src);
extern DECLSPEC int IMG_isPNG(SDL_RWops *src);
/* Individual loading functions */
extern DECLSPEC SDL_Surface *IMG_LoadBMP_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface *IMG_LoadPNM_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface *IMG_LoadXCF_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface *IMG_LoadPCX_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface *IMG_LoadGIF_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface *IMG_LoadTIF_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface *IMG_LoadTGA_RW(SDL_RWops *src);
/* We'll use SDL for reporting errors */
#define IMG_SetError SDL_SetError
#define IMG_GetError SDL_GetError
/* used internally, NOT an exported function */
extern DECLSPEC int IMG_string_equals(const char *str1, const char *str2);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _IMG_h */

View File

@ -0,0 +1,171 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_joystick.h,v 1.6 2004/01/04 16:49:07 slouken Exp $";
#endif
/* Include file for SDL joystick event handling */
#ifndef _SDL_joystick_h
#define _SDL_joystick_h
#include "SDL_types.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* In order to use these functions, SDL_Init() must have been called
with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
for joysticks, and load appropriate drivers.
*/
/* The joystick structure used to identify an SDL joystick */
struct _SDL_Joystick;
typedef struct _SDL_Joystick SDL_Joystick;
/* Function prototypes */
/*
* Count the number of joysticks attached to the system
*/
extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
/*
* Get the implementation dependent name of a joystick.
* This can be called before any joysticks are opened.
* If no name can be found, this function returns NULL.
*/
extern DECLSPEC const char * SDLCALL SDL_JoystickName(int device_index);
/*
* Open a joystick for use - the index passed as an argument refers to
* the N'th joystick on the system. This index is the value which will
* identify this joystick in future joystick events.
*
* This function returns a joystick identifier, or NULL if an error occurred.
*/
extern DECLSPEC SDL_Joystick * SDLCALL SDLCALL SDL_JoystickOpen(int device_index);
/*
* Returns 1 if the joystick has been opened, or 0 if it has not.
*/
extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index);
/*
* Get the device index of an opened joystick.
*/
extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick *joystick);
/*
* Get the number of general axis controls on a joystick
*/
extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick);
/*
* Get the number of trackballs on a joystick
* Joystick trackballs have only relative motion events associated
* with them and their state cannot be polled.
*/
extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick);
/*
* Get the number of POV hats on a joystick
*/
extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick);
/*
* Get the number of buttons on a joystick
*/
extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick);
/*
* Update the current state of the open joysticks.
* This is called automatically by the event loop if any joystick
* events are enabled.
*/
extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
/*
* Enable/disable joystick event polling.
* If joystick events are disabled, you must call SDL_JoystickUpdate()
* yourself and check the state of the joystick when you want joystick
* information.
* The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE.
*/
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
/*
* Get the current state of an axis control on a joystick
* The state is a value ranging from -32768 to 32767.
* The axis indices start at index 0.
*/
extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);
/*
* Get the current state of a POV hat on a joystick
* The return value is one of the following positions:
*/
#define SDL_HAT_CENTERED 0x00
#define SDL_HAT_UP 0x01
#define SDL_HAT_RIGHT 0x02
#define SDL_HAT_DOWN 0x04
#define SDL_HAT_LEFT 0x08
#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
/*
* The hat indices start at index 0.
*/
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat);
/*
* Get the ball axis change since the last poll
* This returns 0, or -1 if you passed it invalid parameters.
* The ball indices start at index 0.
*/
extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
/*
* Get the current state of a button on a joystick
* The button indices start at index 0.
*/
extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button);
/*
* Close a joystick previously opened with SDL_JoystickOpen()
*/
extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_joystick_h */

View File

@ -0,0 +1,124 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_keyboard.h,v 1.6 2004/01/04 16:49:07 slouken Exp $";
#endif
/* Include file for SDL keyboard event handling */
#ifndef _SDL_keyboard_h
#define _SDL_keyboard_h
#include "SDL_types.h"
#include "SDL_keysym.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* Keysym structure
- The scancode is hardware dependent, and should not be used by general
applications. If no hardware scancode is available, it will be 0.
- The 'unicode' translated character is only available when character
translation is enabled by the SDL_EnableUNICODE() API. If non-zero,
this is a UNICODE character corresponding to the keypress. If the
high 9 bits of the character are 0, then this maps to the equivalent
ASCII character:
char ch;
if ( (keysym.unicode & 0xFF80) == 0 ) {
ch = keysym.unicode & 0x7F;
} else {
An international character..
}
*/
typedef struct {
Uint8 scancode; /* hardware specific scancode */
SDLKey sym; /* SDL virtual keysym */
SDLMod mod; /* current key modifiers */
Uint16 unicode; /* translated character */
} SDL_keysym;
/* This is the mask which refers to all hotkey bindings */
#define SDL_ALL_HOTKEYS 0xFFFFFFFF
/* Function prototypes */
/*
* Enable/Disable UNICODE translation of keyboard input.
* This translation has some overhead, so translation defaults off.
* If 'enable' is 1, translation is enabled.
* If 'enable' is 0, translation is disabled.
* If 'enable' is -1, the translation state is not changed.
* It returns the previous state of keyboard translation.
*/
extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
/*
* Enable/Disable keyboard repeat. Keyboard repeat defaults to off.
* 'delay' is the initial delay in ms between the time when a key is
* pressed, and keyboard repeat begins.
* 'interval' is the time in ms between keyboard repeat events.
*/
#define SDL_DEFAULT_REPEAT_DELAY 500
#define SDL_DEFAULT_REPEAT_INTERVAL 30
/*
* If 'delay' is set to 0, keyboard repeat is disabled.
*/
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
/*
* Get a snapshot of the current state of the keyboard.
* Returns an array of keystates, indexed by the SDLK_* syms.
* Used:
* Uint8 *keystate = SDL_GetKeyState(NULL);
* if ( keystate[SDLK_RETURN] ) ... <RETURN> is pressed.
*/
extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys);
/*
* Get the current key modifier state
*/
extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
/*
* Set the current key modifier state
* This does not change the keyboard state, only the key modifier flags.
*/
extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
/*
* Get the name of an SDL virtual keysym
*/
extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_keyboard_h */

View File

@ -0,0 +1,316 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_keysym.h,v 1.6 2004/01/04 16:49:07 slouken Exp $";
#endif
#ifndef _SDL_keysym_h
#define _SDL_keysym_h
/* What we really want is a mapping of every raw key on the keyboard.
To support international keyboards, we use the range 0xA1 - 0xFF
as international virtual keycodes. We'll follow in the footsteps of X11...
The names of the keys
*/
typedef enum {
/* The keyboard syms have been cleverly chosen to map to ASCII */
SDLK_UNKNOWN = 0,
SDLK_FIRST = 0,
SDLK_BACKSPACE = 8,
SDLK_TAB = 9,
SDLK_CLEAR = 12,
SDLK_RETURN = 13,
SDLK_PAUSE = 19,
SDLK_ESCAPE = 27,
SDLK_SPACE = 32,
SDLK_EXCLAIM = 33,
SDLK_QUOTEDBL = 34,
SDLK_HASH = 35,
SDLK_DOLLAR = 36,
SDLK_AMPERSAND = 38,
SDLK_QUOTE = 39,
SDLK_LEFTPAREN = 40,
SDLK_RIGHTPAREN = 41,
SDLK_ASTERISK = 42,
SDLK_PLUS = 43,
SDLK_COMMA = 44,
SDLK_MINUS = 45,
SDLK_PERIOD = 46,
SDLK_SLASH = 47,
SDLK_0 = 48,
SDLK_1 = 49,
SDLK_2 = 50,
SDLK_3 = 51,
SDLK_4 = 52,
SDLK_5 = 53,
SDLK_6 = 54,
SDLK_7 = 55,
SDLK_8 = 56,
SDLK_9 = 57,
SDLK_COLON = 58,
SDLK_SEMICOLON = 59,
SDLK_LESS = 60,
SDLK_EQUALS = 61,
SDLK_GREATER = 62,
SDLK_QUESTION = 63,
SDLK_AT = 64,
/*
Skip uppercase letters
*/
SDLK_LEFTBRACKET = 91,
SDLK_BACKSLASH = 92,
SDLK_RIGHTBRACKET = 93,
SDLK_CARET = 94,
SDLK_UNDERSCORE = 95,
SDLK_BACKQUOTE = 96,
SDLK_a = 97,
SDLK_b = 98,
SDLK_c = 99,
SDLK_d = 100,
SDLK_e = 101,
SDLK_f = 102,
SDLK_g = 103,
SDLK_h = 104,
SDLK_i = 105,
SDLK_j = 106,
SDLK_k = 107,
SDLK_l = 108,
SDLK_m = 109,
SDLK_n = 110,
SDLK_o = 111,
SDLK_p = 112,
SDLK_q = 113,
SDLK_r = 114,
SDLK_s = 115,
SDLK_t = 116,
SDLK_u = 117,
SDLK_v = 118,
SDLK_w = 119,
SDLK_x = 120,
SDLK_y = 121,
SDLK_z = 122,
SDLK_DELETE = 127,
/* End of ASCII mapped keysyms */
/* International keyboard syms */
SDLK_WORLD_0 = 160, /* 0xA0 */
SDLK_WORLD_1 = 161,
SDLK_WORLD_2 = 162,
SDLK_WORLD_3 = 163,
SDLK_WORLD_4 = 164,
SDLK_WORLD_5 = 165,
SDLK_WORLD_6 = 166,
SDLK_WORLD_7 = 167,
SDLK_WORLD_8 = 168,
SDLK_WORLD_9 = 169,
SDLK_WORLD_10 = 170,
SDLK_WORLD_11 = 171,
SDLK_WORLD_12 = 172,
SDLK_WORLD_13 = 173,
SDLK_WORLD_14 = 174,
SDLK_WORLD_15 = 175,
SDLK_WORLD_16 = 176,
SDLK_WORLD_17 = 177,
SDLK_WORLD_18 = 178,
SDLK_WORLD_19 = 179,
SDLK_WORLD_20 = 180,
SDLK_WORLD_21 = 181,
SDLK_WORLD_22 = 182,
SDLK_WORLD_23 = 183,
SDLK_WORLD_24 = 184,
SDLK_WORLD_25 = 185,
SDLK_WORLD_26 = 186,
SDLK_WORLD_27 = 187,
SDLK_WORLD_28 = 188,
SDLK_WORLD_29 = 189,
SDLK_WORLD_30 = 190,
SDLK_WORLD_31 = 191,
SDLK_WORLD_32 = 192,
SDLK_WORLD_33 = 193,
SDLK_WORLD_34 = 194,
SDLK_WORLD_35 = 195,
SDLK_WORLD_36 = 196,
SDLK_WORLD_37 = 197,
SDLK_WORLD_38 = 198,
SDLK_WORLD_39 = 199,
SDLK_WORLD_40 = 200,
SDLK_WORLD_41 = 201,
SDLK_WORLD_42 = 202,
SDLK_WORLD_43 = 203,
SDLK_WORLD_44 = 204,
SDLK_WORLD_45 = 205,
SDLK_WORLD_46 = 206,
SDLK_WORLD_47 = 207,
SDLK_WORLD_48 = 208,
SDLK_WORLD_49 = 209,
SDLK_WORLD_50 = 210,
SDLK_WORLD_51 = 211,
SDLK_WORLD_52 = 212,
SDLK_WORLD_53 = 213,
SDLK_WORLD_54 = 214,
SDLK_WORLD_55 = 215,
SDLK_WORLD_56 = 216,
SDLK_WORLD_57 = 217,
SDLK_WORLD_58 = 218,
SDLK_WORLD_59 = 219,
SDLK_WORLD_60 = 220,
SDLK_WORLD_61 = 221,
SDLK_WORLD_62 = 222,
SDLK_WORLD_63 = 223,
SDLK_WORLD_64 = 224,
SDLK_WORLD_65 = 225,
SDLK_WORLD_66 = 226,
SDLK_WORLD_67 = 227,
SDLK_WORLD_68 = 228,
SDLK_WORLD_69 = 229,
SDLK_WORLD_70 = 230,
SDLK_WORLD_71 = 231,
SDLK_WORLD_72 = 232,
SDLK_WORLD_73 = 233,
SDLK_WORLD_74 = 234,
SDLK_WORLD_75 = 235,
SDLK_WORLD_76 = 236,
SDLK_WORLD_77 = 237,
SDLK_WORLD_78 = 238,
SDLK_WORLD_79 = 239,
SDLK_WORLD_80 = 240,
SDLK_WORLD_81 = 241,
SDLK_WORLD_82 = 242,
SDLK_WORLD_83 = 243,
SDLK_WORLD_84 = 244,
SDLK_WORLD_85 = 245,
SDLK_WORLD_86 = 246,
SDLK_WORLD_87 = 247,
SDLK_WORLD_88 = 248,
SDLK_WORLD_89 = 249,
SDLK_WORLD_90 = 250,
SDLK_WORLD_91 = 251,
SDLK_WORLD_92 = 252,
SDLK_WORLD_93 = 253,
SDLK_WORLD_94 = 254,
SDLK_WORLD_95 = 255, /* 0xFF */
/* Numeric keypad */
SDLK_KP0 = 256,
SDLK_KP1 = 257,
SDLK_KP2 = 258,
SDLK_KP3 = 259,
SDLK_KP4 = 260,
SDLK_KP5 = 261,
SDLK_KP6 = 262,
SDLK_KP7 = 263,
SDLK_KP8 = 264,
SDLK_KP9 = 265,
SDLK_KP_PERIOD = 266,
SDLK_KP_DIVIDE = 267,
SDLK_KP_MULTIPLY = 268,
SDLK_KP_MINUS = 269,
SDLK_KP_PLUS = 270,
SDLK_KP_ENTER = 271,
SDLK_KP_EQUALS = 272,
/* Arrows + Home/End pad */
SDLK_UP = 273,
SDLK_DOWN = 274,
SDLK_RIGHT = 275,
SDLK_LEFT = 276,
SDLK_INSERT = 277,
SDLK_HOME = 278,
SDLK_END = 279,
SDLK_PAGEUP = 280,
SDLK_PAGEDOWN = 281,
/* Function keys */
SDLK_F1 = 282,
SDLK_F2 = 283,
SDLK_F3 = 284,
SDLK_F4 = 285,
SDLK_F5 = 286,
SDLK_F6 = 287,
SDLK_F7 = 288,
SDLK_F8 = 289,
SDLK_F9 = 290,
SDLK_F10 = 291,
SDLK_F11 = 292,
SDLK_F12 = 293,
SDLK_F13 = 294,
SDLK_F14 = 295,
SDLK_F15 = 296,
/* Key state modifier keys */
SDLK_NUMLOCK = 300,
SDLK_CAPSLOCK = 301,
SDLK_SCROLLOCK = 302,
SDLK_RSHIFT = 303,
SDLK_LSHIFT = 304,
SDLK_RCTRL = 305,
SDLK_LCTRL = 306,
SDLK_RALT = 307,
SDLK_LALT = 308,
SDLK_RMETA = 309,
SDLK_LMETA = 310,
SDLK_LSUPER = 311, /* Left "Windows" key */
SDLK_RSUPER = 312, /* Right "Windows" key */
SDLK_MODE = 313, /* "Alt Gr" key */
SDLK_COMPOSE = 314, /* Multi-key compose key */
/* Miscellaneous function keys */
SDLK_HELP = 315,
SDLK_PRINT = 316,
SDLK_SYSREQ = 317,
SDLK_BREAK = 318,
SDLK_MENU = 319,
SDLK_POWER = 320, /* Power Macintosh power key */
SDLK_EURO = 321, /* Some european keyboards */
SDLK_UNDO = 322, /* Atari keyboard has Undo */
/* Add any other keys here */
SDLK_LAST
} SDLKey;
/* Enumeration of valid key mods (possibly OR'd together) */
typedef enum {
KMOD_NONE = 0x0000,
KMOD_LSHIFT= 0x0001,
KMOD_RSHIFT= 0x0002,
KMOD_LCTRL = 0x0040,
KMOD_RCTRL = 0x0080,
KMOD_LALT = 0x0100,
KMOD_RALT = 0x0200,
KMOD_LMETA = 0x0400,
KMOD_RMETA = 0x0800,
KMOD_NUM = 0x1000,
KMOD_CAPS = 0x2000,
KMOD_MODE = 0x4000,
KMOD_RESERVED = 0x8000
} SDLMod;
#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
#define KMOD_META (KMOD_LMETA|KMOD_RMETA)
#endif /* _SDL_keysym_h */

View File

@ -0,0 +1,76 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_loadso.h,v 1.5 2004/01/04 16:49:07 slouken Exp $";
#endif
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* System dependent library loading routines */
/* Some things to keep in mind:
- These functions only work on C function names. Other languages may
have name mangling and intrinsic language support that varies from
compiler to compiler.
- Make sure you declare your function pointers with the same calling
convention as the actual library function. Your code will crash
mysteriously if you do not do this.
- Avoid namespace collisions. If you load a symbol from the library,
it is not defined whether or not it goes into the global symbol
namespace for the application. If it does and it conflicts with
symbols in your code or other shared libraries, you will not get
the results you expect. :)
*/
#ifndef _SDL_loadso_h
#define _SDL_loadso_h
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* This function dynamically loads a shared object and returns a pointer
* to the object handle (or NULL if there was an error).
* The 'sofile' parameter is a system dependent name of the object file.
*/
extern DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile);
/* Given an object handle, this function looks up the address of the
* named function in the shared object and returns it. This address
* is no longer valid after calling SDL_UnloadObject().
*/
extern DECLSPEC void * SDLCALL SDL_LoadFunction(void *handle, const char *name);
/* Unload a shared object from memory */
extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_loadso_h */

View File

@ -0,0 +1,101 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_main.h,v 1.12 2004/01/04 16:49:07 slouken Exp $";
#endif
#ifndef _SDL_main_h
#define _SDL_main_h
/* Redefine main() on Win32 and MacOS so that it is called by winmain.c */
#if defined(WIN32) || defined(_WIN32) || \
(defined(__MWERKS__) && !defined(__BEOS__)) || \
defined(macintosh) || defined(__APPLE__) || \
defined(__SYMBIAN32__) || defined(QWS)
#ifdef __cplusplus
#define C_LINKAGE "C"
#else
#define C_LINKAGE
#endif /* __cplusplus */
/* The application's main() function must be called with C linkage,
and should be declared like this:
#ifdef __cplusplus
extern "C"
#endif
int main(int argc, char *argv[])
{
}
*/
#define main SDL_main
/* The prototype for the application's main() function */
extern C_LINKAGE int SDL_main(int argc, char *argv[]);
/* From the SDL library code -- needed for registering the app on Win32 */
#if defined(WIN32)
#include "SDL_types.h"
#include "begin_code.h"
#ifdef __cplusplus
extern "C" {
#endif
/* This should be called from your WinMain() function, if any */
extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst);
/* This can also be called, but is no longer necessary */
extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif
/* From the SDL library code -- needed for registering QuickDraw on MacOS */
#if defined(macintosh)
#include "begin_code.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declaration so we don't need to include QuickDraw.h */
struct QDGlobals;
/* This should be called from your main() function, if any */
extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd);
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif
#endif /* Need to redefine main()? */
#endif /* _SDL_main_h */

View File

@ -0,0 +1,235 @@
/*
MIXERLIB: An audio mixer library based on the SDL library
Copyright (C) 1997-1999 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
5635-34 Springhouse Dr.
Pleasanton, CA 94588 (USA)
slouken@devolution.com
*/
#ifndef _MIXER_H_
#define _MIXER_H_
#include "SDL_types.h"
#include "SDL_rwops.h"
#include "SDL_audio.h"
#include "SDL_byteorder.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* The default mixer has 8 simultaneous mixing channels */
#ifndef MIX_CHANNELS
#define MIX_CHANNELS 8
#endif
/* Good default values for a PC soundcard */
#define MIX_DEFAULT_FREQUENCY 22050
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define MIX_DEFAULT_FORMAT AUDIO_S16LSB
#else
#define MIX_DEFAULT_FORMAT AUDIO_S16MSB
#endif
#define MIX_DEFAULT_CHANNELS 2
#define MIX_MAX_VOLUME 128 /* Volume of a chunk */
/* The internal format for an audio chunk */
typedef struct {
int allocated;
Uint8 *abuf;
Uint32 alen;
Uint8 volume; /* Per-sample volume, 0-128 */
} Mix_Chunk;
/* The different fading types supported */
typedef enum {
MIX_NO_FADING,
MIX_FADING_OUT,
MIX_FADING_IN
} Mix_Fading;
/* The internal format for a music chunk interpreted via mikmod */
typedef struct _Mix_Music Mix_Music;
/* Open the mixer with a certain audio format */
extern DECLSPEC int Mix_OpenAudio(int frequency, Uint16 format, int channels,
int chunksize);
/* Dynamically change the number of channels managed by the mixer.
If decreasing the number of channels, the upper channels are
stopped.
This function returns the new number of allocated channels.
*/
extern DECLSPEC int Mix_AllocateChannels(int numchans);
/* Find out what the actual audio device parameters are.
This function returns 1 if the audio has been opened, 0 otherwise.
*/
extern DECLSPEC int Mix_QuerySpec(int *frequency,Uint16 *format,int *channels);
/* Load a wave file or a music (.mod .s3m .it .xm) file */
extern DECLSPEC Mix_Chunk *Mix_LoadWAV_RW(SDL_RWops *src, int freesrc);
#define Mix_LoadWAV(file) Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1)
extern DECLSPEC Mix_Music *Mix_LoadMUS(const char *file);
#if 0 /* This hasn't been hooked into music.c yet */
/* Load a music file from an SDL_RWop object (MikMod-specific currently)
Matt Campbell (matt@campbellhome.dhs.org) April 2000 */
extern DECLSPEC Mix_Music *Mix_LoadMUS_RW(SDL_RWops *rw);
#endif
/* Load a wave file of the mixer format from a memory buffer */
extern DECLSPEC Mix_Chunk *Mix_QuickLoad_WAV(Uint8 *mem);
/* Free an audio chunk previously loaded */
extern DECLSPEC void Mix_FreeChunk(Mix_Chunk *chunk);
extern DECLSPEC void Mix_FreeMusic(Mix_Music *music);
/* Set a function that is called after all mixing is performed.
This can be used to provide real-time visual display of the audio stream
or add a custom mixer filter for the stream data.
*/
extern DECLSPEC void Mix_SetPostMix(void (*mix_func)
(void *udata, Uint8 *stream, int len), void *arg);
/* Add your own music player or additional mixer function.
If 'mix_func' is NULL, the default music player is re-enabled.
*/
extern DECLSPEC void Mix_HookMusic(void (*mix_func)
(void *udata, Uint8 *stream, int len), void *arg);
/* Add your own callback when the music has finished playing.
*/
extern DECLSPEC void Mix_HookMusicFinished(void (*music_finished)(void));
/* Get a pointer to the user data for the current music hook */
extern DECLSPEC void *Mix_GetMusicHookData(void);
/* Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate
them dynamically to the next sample if requested with a -1 value below.
Returns the number of reserved channels.
*/
extern DECLSPEC int Mix_ReserveChannels(int num);
/* Channel grouping functions */
/* Attach a tag to a channel. A tag can be assigned to several mixer
channels, to form groups of channels.
If 'tag' is -1, the tag is removed (actually -1 is the tag used to
represent the group of all the channels).
Returns true if everything was OK.
*/
extern DECLSPEC int Mix_GroupChannel(int which, int tag);
/* Assign several consecutive channels to a group */
extern DECLSPEC int Mix_GroupChannels(int from, int to, int tag);
/* Finds the first available channel in a group of channels */
extern DECLSPEC int Mix_GroupAvailable(int tag);
/* Returns the number of channels in a group. This is also a subtle
way to get the total number of channels when 'tag' is -1
*/
extern DECLSPEC int Mix_GroupCount(int tag);
/* Finds the "oldest" sample playing in a group of channels */
extern DECLSPEC int Mix_GroupOldest(int tag);
/* Finds the "most recent" (i.e. last) sample playing in a group of channels */
extern DECLSPEC int Mix_GroupNewer(int tag);
/* Play an audio chunk on a specific channel.
If the specified channel is -1, play on the first free channel.
If 'loops' is greater than zero, loop the sound that many times.
If 'loops' is -1, loop inifinitely (~65000 times).
Returns which channel was used to play the sound.
*/
#define Mix_PlayChannel(channel,chunk,loops) Mix_PlayChannelTimed(channel,chunk,loops,-1)
/* The same as above, but the sound is played at most 'ticks' milliseconds */
extern DECLSPEC int Mix_PlayChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ticks);
extern DECLSPEC int Mix_PlayMusic(Mix_Music *music, int loops);
/* Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions */
extern DECLSPEC int Mix_FadeInMusic(Mix_Music *music, int loops, int ms);
#define Mix_FadeInChannel(channel,chunk,loops,ms) Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1)
extern DECLSPEC int Mix_FadeInChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ms, int ticks);
/* Set the volume in the range of 0-128 of a specific channel or chunk.
If the specified channel is -1, set volume for all channels.
Returns the original volume.
If the specified volume is -1, just return the current volume.
*/
extern DECLSPEC int Mix_Volume(int channel, int volume);
extern DECLSPEC int Mix_VolumeChunk(Mix_Chunk *chunk, int volume);
extern DECLSPEC int Mix_VolumeMusic(int volume);
/* Halt playing of a particular channel */
extern DECLSPEC int Mix_HaltChannel(int channel);
extern DECLSPEC int Mix_HaltGroup(int tag);
extern DECLSPEC int Mix_HaltMusic(void);
/* Change the expiration delay for a particular channel.
The sample will stop playing after the 'ticks' milliseconds have elapsed,
or remove the expiration if 'ticks' is -1
*/
extern DECLSPEC int Mix_ExpireChannel(int channel, int ticks);
/* Halt a channel, fading it out progressively till it's silent
The ms parameter indicates the number of milliseconds the fading
will take.
*/
extern DECLSPEC int Mix_FadeOutChannel(int which, int ms);
extern DECLSPEC int Mix_FadeOutGroup(int tag, int ms);
extern DECLSPEC int Mix_FadeOutMusic(int ms);
/* Query the fading status of a channel */
extern DECLSPEC Mix_Fading Mix_FadingMusic(void);
extern DECLSPEC Mix_Fading Mix_FadingChannel(int which);
/* Pause/Resume a particular channel */
extern DECLSPEC void Mix_Pause(int channel);
extern DECLSPEC void Mix_Resume(int channel);
extern DECLSPEC int Mix_Paused(int channel);
/* Pause/Resume the music stream */
extern DECLSPEC void Mix_PauseMusic(void);
extern DECLSPEC void Mix_ResumeMusic(void);
extern DECLSPEC void Mix_RewindMusic(void);
extern DECLSPEC int Mix_PausedMusic(void);
/* Check the status of a specific channel.
If the specified channel is -1, check all channels.
*/
extern DECLSPEC int Mix_Playing(int channel);
extern DECLSPEC int Mix_PlayingMusic(void);
/* Stop music and set external music playback command */
extern DECLSPEC int Mix_SetMusicCMD(const char *command);
/* Close the mixer, halting all playing audio */
extern DECLSPEC void Mix_CloseAudio(void);
/* We'll use SDL for reporting errors */
#define Mix_SetError SDL_SetError
#define Mix_GetError SDL_GetError
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _MIXER_H_ */

View File

@ -0,0 +1,140 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_mouse.h,v 1.7 2004/01/04 16:49:07 slouken Exp $";
#endif
/* Include file for SDL mouse event handling */
#ifndef _SDL_mouse_h
#define _SDL_mouse_h
#include "SDL_types.h"
#include "SDL_video.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
typedef struct WMcursor WMcursor; /* Implementation dependent */
typedef struct {
SDL_Rect area; /* The area of the mouse cursor */
Sint16 hot_x, hot_y; /* The "tip" of the cursor */
Uint8 *data; /* B/W cursor data */
Uint8 *mask; /* B/W cursor mask */
Uint8 *save[2]; /* Place to save cursor area */
WMcursor *wm_cursor; /* Window-manager cursor */
} SDL_Cursor;
/* Function prototypes */
/*
* Retrieve the current state of the mouse.
* The current button state is returned as a button bitmask, which can
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
* current mouse cursor position. You can pass NULL for either x or y.
*/
extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
/*
* Retrieve the current state of the mouse.
* The current button state is returned as a button bitmask, which can
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
* mouse deltas since the last call to SDL_GetRelativeMouseState().
*/
extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
/*
* Set the position of the mouse cursor (generates a mouse motion event)
*/
extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
/*
* Create a cursor using the specified data and mask (in MSB format).
* The cursor width must be a multiple of 8 bits.
*
* The cursor is created in black and white according to the following:
* data mask resulting pixel on screen
* 0 1 White
* 1 1 Black
* 0 0 Transparent
* 1 0 Inverted color if possible, black if not.
*
* Cursors created with this function must be freed with SDL_FreeCursor().
*/
extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor
(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
/*
* Set the currently active cursor to the specified one.
* If the cursor is currently visible, the change will be immediately
* represented on the display.
*/
extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
/*
* Returns the currently active cursor.
*/
extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void);
/*
* Deallocates a cursor created with SDL_CreateCursor().
*/
extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor);
/*
* Toggle whether or not the cursor is shown on the screen.
* The cursor start off displayed, but can be turned off.
* SDL_ShowCursor() returns 1 if the cursor was being displayed
* before the call, or 0 if it was not. You can query the current
* state by passing a 'toggle' value of -1.
*/
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
/* Used as a mask when testing buttons in buttonstate
Button 1: Left mouse button
Button 2: Middle mouse button
Button 3: Right mouse button
Button 4: Mouse wheel up (may also be a real button)
Button 5: Mouse wheel down (may also be a real button)
*/
#define SDL_BUTTON(X) (SDL_PRESSED<<(X-1))
#define SDL_BUTTON_LEFT 1
#define SDL_BUTTON_MIDDLE 2
#define SDL_BUTTON_RIGHT 3
#define SDL_BUTTON_WHEELUP 4
#define SDL_BUTTON_WHEELDOWN 5
#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_mouse_h */

View File

@ -0,0 +1,166 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_mutex.h,v 1.7 2004/01/04 16:49:07 slouken Exp $";
#endif
#ifndef _SDL_mutex_h
#define _SDL_mutex_h
/* Functions to provide thread synchronization primitives
These are independent of the other SDL routines.
*/
#include "SDL_main.h"
#include "SDL_types.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* Synchronization functions which can time out return this value
if they time out.
*/
#define SDL_MUTEX_TIMEDOUT 1
/* This is the timeout value which corresponds to never time out */
#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Mutex functions */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* The SDL mutex structure, defined in SDL_mutex.c */
struct SDL_mutex;
typedef struct SDL_mutex SDL_mutex;
/* Create a mutex, initialized unlocked */
extern DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void);
/* Lock the mutex (Returns 0, or -1 on error) */
#define SDL_LockMutex(m) SDL_mutexP(m)
extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex);
/* Unlock the mutex (Returns 0, or -1 on error)
It is an error to unlock a mutex that has not been locked by
the current thread, and doing so results in undefined behavior.
*/
#define SDL_UnlockMutex(m) SDL_mutexV(m)
extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex *mutex);
/* Destroy a mutex */
extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Semaphore functions */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* The SDL semaphore structure, defined in SDL_sem.c */
struct SDL_semaphore;
typedef struct SDL_semaphore SDL_sem;
/* Create a semaphore, initialized with value, returns NULL on failure. */
extern DECLSPEC SDL_sem * SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
/* Destroy a semaphore */
extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem);
/* This function suspends the calling thread until the semaphore pointed
* to by sem has a positive count. It then atomically decreases the semaphore
* count.
*/
extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem);
/* Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds,
SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem);
/* Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if
the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in
the allotted time, and -1 on error.
On some platforms this function is implemented by looping with a delay
of 1 ms, and so should be avoided if possible.
*/
extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms);
/* Atomically increases the semaphore's count (not blocking), returns 0,
or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem);
/* Returns the current count of the semaphore */
extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Condition variable functions */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* The SDL condition variable structure, defined in SDL_cond.c */
struct SDL_cond;
typedef struct SDL_cond SDL_cond;
/* Create a condition variable */
extern DECLSPEC SDL_cond * SDLCALL SDL_CreateCond(void);
/* Destroy a condition variable */
extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond);
/* Restart one of the threads that are waiting on the condition variable,
returns 0 or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond);
/* Restart all threads that are waiting on the condition variable,
returns 0 or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond);
/* Wait on the condition variable, unlocking the provided mutex.
The mutex must be locked before entering this function!
Returns 0 when it is signaled, or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mut);
/* Waits for at most 'ms' milliseconds, and returns 0 if the condition
variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not
signaled in the allotted time, and -1 on error.
On some platforms this function is implemented by looping with a delay
of 1 ms, and so should be avoided if possible.
*/
extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_mutex_h */

View File

@ -0,0 +1,11 @@
#ifndef _SDLname_h_
#define _SDLname_h_
#if defined(__STDC__) || defined(__cplusplus)
#define NeedFunctionPrototypes 1
#endif
#define SDL_NAME(X) SDL_##X
#endif /* _SDLname_h_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_quit.h,v 1.5 2004/01/04 16:49:07 slouken Exp $";
#endif
/* Include file for SDL quit event handling */
#ifndef _SDL_quit_h
#define _SDL_quit_h
/*
An SDL_QUITEVENT is generated when the user tries to close the application
window. If it is ignored or filtered out, the window will remain open.
If it is not ignored or filtered, it is queued normally and the window
is allowed to close. When the window is closed, screen updates will
complete, but have no effect.
SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
and SIGTERM (system termination request), if handlers do not already
exist, that generate SDL_QUITEVENT events as well. There is no way
to determine the cause of an SDL_QUITEVENT, but setting a signal
handler in your application will override the default generation of
quit events for that signal.
*/
/* There are no functions directly affecting the quit event */
#define SDL_QuitRequested() \
(SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK))
#endif /* _SDL_quit_h */

View File

@ -0,0 +1,114 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_rwops.h,v 1.7 2004/01/04 16:49:07 slouken Exp $";
#endif
/* This file provides a general interface for SDL to read and write
data sources. It can easily be extended to files, memory, etc.
*/
#ifndef _SDL_RWops_h
#define _SDL_RWops_h
#include <stdio.h>
#include "SDL_types.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* This is the read/write operation structure -- very basic */
typedef struct SDL_RWops {
/* Seek to 'offset' relative to whence, one of stdio's whence values:
SEEK_SET, SEEK_CUR, SEEK_END
Returns the final offset in the data source.
*/
int (*seek)(struct SDL_RWops *context, int offset, int whence);
/* Read up to 'num' objects each of size 'objsize' from the data
source to the area pointed at by 'ptr'.
Returns the number of objects read, or -1 if the read failed.
*/
int (*read)(struct SDL_RWops *context, void *ptr, int size, int maxnum);
/* Write exactly 'num' objects each of size 'objsize' from the area
pointed at by 'ptr' to data source.
Returns 'num', or -1 if the write failed.
*/
int (*write)(struct SDL_RWops *context, const void *ptr, int size, int num);
/* Close and free an allocated SDL_FSops structure */
int (*close)(struct SDL_RWops *context);
Uint32 type;
union {
struct {
int autoclose;
FILE *fp;
} stdio;
struct {
Uint8 *base;
Uint8 *here;
Uint8 *stop;
} mem;
struct {
void *data1;
} unknown;
} hidden;
} SDL_RWops;
/* Functions to create SDL_RWops structures from various data sources */
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode);
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose);
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size);
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromConstMem(const void *mem, int size);
extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void);
extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area);
/* Macros to easily read and write from an SDL_RWops structure */
#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, SEEK_CUR)
#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
#define SDL_RWclose(ctx) (ctx)->close(ctx)
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_RWops_h */

View File

@ -0,0 +1,184 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_syswm.h,v 1.12 2004/01/04 16:49:08 slouken Exp $";
#endif
/* Include file for SDL custom system window manager hooks */
#ifndef _SDL_syswm_h
#define _SDL_syswm_h
#include "SDL_version.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* Your application has access to a special type of event 'SDL_SYSWMEVENT',
which contains window-manager specific information and arrives whenever
an unhandled window event occurs. This event is ignored by default, but
you can enable it with SDL_EventState()
*/
#ifdef SDL_PROTOTYPES_ONLY
struct SDL_SysWMinfo;
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
#else
/* This is the structure for custom window manager events */
#if (defined(unix) || defined(__unix__) || defined(_AIX) || defined(__OpenBSD__)) && \
(!defined(DISABLE_X11) && !defined(__CYGWIN32__) && !defined(ENABLE_NANOX))
/* AIX is unix, of course, but the native compiler CSet doesn't define unix */
#include <X11/Xlib.h>
#include <X11/Xatom.h>
/* These are the various supported subsystems under UNIX */
typedef enum {
SDL_SYSWM_X11
} SDL_SYSWM_TYPE;
/* The UNIX custom event structure */
struct SDL_SysWMmsg {
SDL_version version;
SDL_SYSWM_TYPE subsystem;
union {
XEvent xevent;
} event;
};
/* The UNIX custom window manager information structure.
When this structure is returned, it holds information about which
low level system it is using, and will be one of SDL_SYSWM_TYPE.
*/
typedef struct {
SDL_version version;
SDL_SYSWM_TYPE subsystem;
union {
struct {
Display *display; /* The X11 display */
Window window; /* The X11 display window */
/* These locking functions should be called around
any X11 functions using the display variable.
They lock the event thread, so should not be
called around event functions or from event filters.
*/
void (*lock_func)(void);
void (*unlock_func)(void);
/* Introduced in SDL 1.0.2 */
Window fswindow; /* The X11 fullscreen window */
Window wmwindow; /* The X11 managed input window */
} x11;
} info;
} SDL_SysWMinfo;
#elif defined(ENABLE_NANOX)
#include <microwin/nano-X.h>
/* The generic custom event structure */
struct SDL_SysWMmsg {
SDL_version version;
int data;
};
/* The windows custom window manager information structure */
typedef struct {
SDL_version version ;
GR_WINDOW_ID window ; /* The display window */
} SDL_SysWMinfo;
#elif defined(WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
/* The windows custom event structure */
struct SDL_SysWMmsg {
SDL_version version;
HWND hwnd; /* The window for the message */
UINT msg; /* The type of message */
WPARAM wParam; /* WORD message parameter */
LPARAM lParam; /* LONG message parameter */
};
/* The windows custom window manager information structure */
typedef struct {
SDL_version version;
HWND window; /* The Win32 display window */
HGLRC hglrc; /* The OpenGL context, if any */
} SDL_SysWMinfo;
#elif defined(__riscos__)
/* RISC OS custom event structure */
struct SDL_SysWMmsg {
SDL_version version;
int eventCode; /* The window for the message */
int pollBlock[64];
};
/* The RISCOS custom window manager information structure */
typedef struct {
SDL_version version;
int wimpVersion; /* Wimp version running under */
int taskHandle; /* The RISCOS task handle */
int window; /* The RISCOS display window */
} SDL_SysWMinfo;
#else
/* The generic custom event structure */
struct SDL_SysWMmsg {
SDL_version version;
int data;
};
/* The generic custom window manager information structure */
typedef struct {
SDL_version version;
int data;
} SDL_SysWMinfo;
#endif /* OS type */
#endif /* SDL_PROTOTYPES_ONLY */
/* Function prototypes */
/*
* This function gives you custom hooks into the window manager information.
* It fills the structure pointed to by 'info' with custom information and
* returns 1 if the function is implemented. If it's not implemented, or
* the version member of the 'info' structure is invalid, it returns 0.
*/
extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_syswm_h */

View File

@ -0,0 +1,79 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_thread.h,v 1.6 2004/01/04 16:49:08 slouken Exp $";
#endif
#ifndef _SDL_thread_h
#define _SDL_thread_h
/* Header for the SDL thread management routines
These are independent of the other SDL routines.
*/
#include "SDL_main.h"
#include "SDL_types.h"
/* Thread synchronization primitives */
#include "SDL_mutex.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* The SDL thread structure, defined in SDL_thread.c */
struct SDL_Thread;
typedef struct SDL_Thread SDL_Thread;
/* Create a thread */
extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data);
/* Get the 32-bit thread identifier for the current thread */
extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void);
/* Get the 32-bit thread identifier for the specified thread,
equivalent to SDL_ThreadID() if the specified thread is NULL.
*/
extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread);
/* Wait for a thread to finish.
The return code for the thread function is placed in the area
pointed to by 'status', if 'status' is not NULL.
*/
extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status);
/* Forcefully kill a thread without worrying about its state */
extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_thread_h */

View File

@ -0,0 +1,118 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_timer.h,v 1.6 2004/01/04 16:49:08 slouken Exp $";
#endif
#ifndef _SDL_timer_h
#define _SDL_timer_h
/* Header for the SDL time management routines */
#include "SDL_main.h"
#include "SDL_types.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* This is the OS scheduler timeslice, in milliseconds */
#define SDL_TIMESLICE 10
/* This is the maximum resolution of the SDL timer on all platforms */
#define TIMER_RESOLUTION 10 /* Experimentally determined */
/* Get the number of milliseconds since the SDL library initialization.
* Note that this value wraps if the program runs for more than ~49 days.
*/
extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
/* Wait a specified number of milliseconds before returning */
extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
/* Function prototype for the timer callback function */
typedef Uint32 (SDLCALL *SDL_TimerCallback)(Uint32 interval);
/* Set a callback to run after the specified number of milliseconds has
* elapsed. The callback function is passed the current timer interval
* and returns the next timer interval. If the returned value is the
* same as the one passed in, the periodic alarm continues, otherwise a
* new alarm is scheduled. If the callback returns 0, the periodic alarm
* is cancelled.
*
* To cancel a currently running timer, call SDL_SetTimer(0, NULL);
*
* The timer callback function may run in a different thread than your
* main code, and so shouldn't call any functions from within itself.
*
* The maximum resolution of this timer is 10 ms, which means that if
* you request a 16 ms timer, your callback will run approximately 20 ms
* later on an unloaded system. If you wanted to set a flag signaling
* a frame update at 30 frames per second (every 33 ms), you might set a
* timer for 30 ms:
* SDL_SetTimer((33/10)*10, flag_update);
*
* If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init().
*
* Under UNIX, you should not use raise or use SIGALRM and this function
* in the same program, as it is implemented using setitimer(). You also
* should not use this function in multi-threaded applications as signals
* to multi-threaded apps have undefined behavior in some implementations.
*/
extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback);
/* New timer API, supports multiple timers
* Written by Stephane Peter <megastep@lokigames.com>
*/
/* Function prototype for the new timer callback function.
* The callback function is passed the current timer interval and returns
* the next timer interval. If the returned value is the same as the one
* passed in, the periodic alarm continues, otherwise a new alarm is
* scheduled. If the callback returns 0, the periodic alarm is cancelled.
*/
typedef Uint32 (SDLCALL *SDL_NewTimerCallback)(Uint32 interval, void *param);
/* Definition of the timer ID type */
typedef struct _SDL_TimerID *SDL_TimerID;
/* Add a new timer to the pool of timers already running.
Returns a timer ID, or NULL when an error occurs.
*/
extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param);
/* Remove one of the multiple timers knowing its ID.
* Returns a boolean value indicating success.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_timer_h */

View File

@ -0,0 +1,176 @@
/*
SDL_ttf: A companion library to SDL for working with TrueType (tm) fonts
Copyright (C) 1997 Sam Lantinga
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
Sam Lantinga
5635-34 Springhouse Dr.
Pleasanton, CA 94588 (USA)
slouken@devolution.com
*/
/* This library is a wrapper around the excellent FreeType 1.0 library,
available at:
http://www.physiol.med.tu-muenchen.de/~robert/freetype.html
*/
#ifndef _SDLttf_h
#define _SDLttf_h
#include "SDL.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* The internal structure containing font information */
typedef struct _TTF_Font TTF_Font;
/* Initialize the TTF engine - returns 0 if successful, -1 on error */
extern DECLSPEC int TTF_Init(void);
/* Open a font file and create a font of the specified point size */
extern DECLSPEC TTF_Font *TTF_OpenFont(const char *file, int ptsize);
/* Set and retrieve the font style
This font style is implemented by modifying the font glyphs, and
doesn't reflect any inherent properties of the truetype font file.
*/
#define TTF_STYLE_NORMAL 0x00
#define TTF_STYLE_BOLD 0x01
#define TTF_STYLE_ITALIC 0x02
#define TTF_STYLE_UNDERLINE 0x04
extern DECLSPEC int TTF_GetFontStyle(TTF_Font *font);
extern DECLSPEC void TTF_SetFontStyle(TTF_Font *font, int style);
/* Get the total height of the font - usually equal to point size */
extern DECLSPEC int TTF_FontHeight(TTF_Font *font);
/* Get the offset from the baseline to the top of the font
This is a positive value, relative to the baseline.
*/
extern DECLSPEC int TTF_FontAscent(TTF_Font *font);
/* Get the offset from the baseline to the bottom of the font
This is a negative value, relative to the baseline.
*/
extern DECLSPEC int TTF_FontDescent(TTF_Font *font);
/* Get the recommended spacing between lines of text for this font */
extern DECLSPEC int TTF_FontLineSkip(TTF_Font *font);
/* Get the metrics (dimensions) of a glyph */
extern DECLSPEC int TTF_GlyphMetrics(TTF_Font *font, Uint16 ch,
int *minx, int *maxx,
int *miny, int *maxy, int *advance);
/* Get the dimensions of a rendered string of text */
extern DECLSPEC int TTF_SizeText(TTF_Font *font, const char *text, int *w, int *h);
extern DECLSPEC int TTF_SizeUTF8(TTF_Font *font, const char *text, int *w, int *h);
extern DECLSPEC int TTF_SizeUNICODE(TTF_Font *font, const Uint16 *text, int *w, int *h);
/* Create an 8-bit palettized surface and render the given text at
fast quality with the given font and color. The 0 pixel is the
colorkey, giving a transparent background, and the 1 pixel is set
to the text color.
This function returns the new surface, or NULL if there was an error.
*/
extern DECLSPEC SDL_Surface *TTF_RenderText_Solid(TTF_Font *font,
const char *text, SDL_Color fg);
extern DECLSPEC SDL_Surface *TTF_RenderUTF8_Solid(TTF_Font *font,
const char *text, SDL_Color fg);
extern DECLSPEC SDL_Surface *TTF_RenderUNICODE_Solid(TTF_Font *font,
const Uint16 *text, SDL_Color fg);
/* Create an 8-bit palettized surface and render the given glyph at
fast quality with the given font and color. The 0 pixel is the
colorkey, giving a transparent background, and the 1 pixel is set
to the text color. The glyph is rendered without any padding or
centering in the X direction, and aligned normally in the Y direction.
This function returns the new surface, or NULL if there was an error.
*/
extern DECLSPEC SDL_Surface *TTF_RenderGlyph_Solid(TTF_Font *font,
Uint16 ch, SDL_Color fg);
/* Create an 8-bit palettized surface and render the given text at
high quality with the given font and colors. The 0 pixel is background,
while other pixels have varying degrees of the foreground color.
This function returns the new surface, or NULL if there was an error.
*/
extern DECLSPEC SDL_Surface *TTF_RenderText_Shaded(TTF_Font *font,
const char *text, SDL_Color fg, SDL_Color bg);
extern DECLSPEC SDL_Surface *TTF_RenderUTF8_Shaded(TTF_Font *font,
const char *text, SDL_Color fg, SDL_Color bg);
extern DECLSPEC SDL_Surface *TTF_RenderUNICODE_Shaded(TTF_Font *font,
const Uint16 *text, SDL_Color fg, SDL_Color bg);
/* Create an 8-bit palettized surface and render the given glyph at
high quality with the given font and colors. The 0 pixel is background,
while other pixels have varying degrees of the foreground color.
The glyph is rendered without any padding or centering in the X
direction, and aligned normally in the Y direction.
This function returns the new surface, or NULL if there was an error.
*/
extern DECLSPEC SDL_Surface *TTF_RenderGlyph_Shaded(TTF_Font *font,
Uint16 ch, SDL_Color fg, SDL_Color bg);
/* Create a 32-bit ARGB surface and render the given text at high quality,
using alpha blending to dither the font with the given color.
This function returns the new surface, or NULL if there was an error.
*/
extern DECLSPEC SDL_Surface *TTF_RenderText_Blended(TTF_Font *font,
const char *text, SDL_Color fg);
extern DECLSPEC SDL_Surface *TTF_RenderUTF8_Blended(TTF_Font *font,
const char *text, SDL_Color fg);
extern DECLSPEC SDL_Surface *TTF_RenderUNICODE_Blended(TTF_Font *font,
const Uint16 *text, SDL_Color fg);
/* Create a 32-bit ARGB surface and render the given glyph at high quality,
using alpha blending to dither the font with the given color.
The glyph is rendered without any padding or centering in the X
direction, and aligned normally in the Y direction.
This function returns the new surface, or NULL if there was an error.
*/
extern DECLSPEC SDL_Surface *TTF_RenderGlyph_Blended(TTF_Font *font,
Uint16 ch, SDL_Color fg);
/* For compatibility with previous versions, here are the old functions */
#define TTF_RenderText(font, text, fg, bg) \
TTF_RenderText_Shaded(font, text, fg, bg)
#define TTF_RenderUTF8(font, text, fg, bg) \
TTF_RenderUTF8_Shaded(font, text, fg, bg)
#define TTF_RenderUNICODE(font, text, fg, bg) \
TTF_RenderUNICODE_Shaded(font, text, fg, bg)
/* Close an opened font file */
extern DECLSPEC void TTF_CloseFont(TTF_Font *font);
/* De-initialize the TTF engine */
extern DECLSPEC void TTF_Quit(void);
/* We'll use SDL for reporting errors */
#define TTF_SetError SDL_SetError
#define TTF_GetError SDL_GetError
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
};
#endif
#include "close_code.h"
#endif /* _SDLttf_h */

View File

@ -0,0 +1,110 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_types.h,v 1.11 2004/01/04 16:49:08 slouken Exp $";
#endif
/* General data types used by the SDL library */
#ifndef _SDL_types_h
#define _SDL_types_h
/* The number of elements in a table */
#define SDL_TABLESIZE(table) (sizeof(table)/sizeof(table[0]))
/* Basic data types */
typedef enum {
SDL_FALSE = 0,
SDL_TRUE = 1
} SDL_bool;
typedef unsigned char Uint8;
typedef signed char Sint8;
typedef unsigned short Uint16;
typedef signed short Sint16;
typedef unsigned int Uint32;
typedef signed int Sint32;
/* Figure out how to support 64-bit datatypes */
#if !defined(__STRICT_ANSI__)
#if defined(__GNUC__) || defined(__MWERKS__) || defined(__SUNPRO_C) || defined(__DECC)
#define SDL_HAS_64BIT_TYPE long long
#elif defined(_MSC_VER) /* VC++ */
#define SDL_HAS_64BIT_TYPE __int64
#endif
#endif /* !__STRICT_ANSI__ */
/* The 64-bit type isn't available on EPOC/Symbian OS */
#ifdef __SYMBIAN32__
#undef SDL_HAS_64BIT_TYPE
#endif
/* The 64-bit datatype isn't supported on all platforms */
#ifdef SDL_HAS_64BIT_TYPE
#ifndef H_MMBASIC
typedef unsigned SDL_HAS_64BIT_TYPE Uint64;
#endif
typedef SDL_HAS_64BIT_TYPE Sint64;
#else
/* This is really just a hack to prevent the compiler from complaining */
typedef struct {
Uint32 hi;
Uint32 lo;
} Uint64, Sint64;
#endif
/* Make sure the types really have the right sizes */
#define SDL_COMPILE_TIME_ASSERT(name, x) \
typedef int SDL_dummy_ ## name[(x) * 2 - 1]
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
/* Check to make sure enums are the size of ints, for structure packing.
For both Watcom C/C++ and Borland C/C++ the compiler option that makes
enums having the size of an int must be enabled.
This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
*/
/* Enable enums always int in CodeWarrior (for MPW use "-enum int") */
#ifdef __MWERKS__
#pragma enumsalwaysint on
#endif
typedef enum {
DUMMY_ENUM_VALUE
} SDL_DUMMY_ENUM;
SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
#undef SDL_COMPILE_TIME_ASSERT
/* General keyboard/mouse state definitions */
enum { SDL_PRESSED = 0x01, SDL_RELEASED = 0x00 };
#endif

View File

@ -0,0 +1,90 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_version.h,v 1.12 2004/01/04 16:49:08 slouken Exp $";
#endif
/* This header defines the current SDL version */
#ifndef _SDL_version_h
#define _SDL_version_h
#include "SDL_types.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
*/
#define SDL_MAJOR_VERSION 1
#define SDL_MINOR_VERSION 2
#define SDL_PATCHLEVEL 7
typedef struct {
Uint8 major;
Uint8 minor;
Uint8 patch;
} SDL_version;
/* This macro can be used to fill a version structure with the compile-time
* version of the SDL library.
*/
#define SDL_VERSION(X) \
{ \
(X)->major = SDL_MAJOR_VERSION; \
(X)->minor = SDL_MINOR_VERSION; \
(X)->patch = SDL_PATCHLEVEL; \
}
/* This macro turns the version numbers into a numeric value:
(1,2,3) -> (1203)
This assumes that there will never be more than 100 patchlevels
*/
#define SDL_VERSIONNUM(X, Y, Z) \
(X)*1000 + (Y)*100 + (Z)
/* This is the version number macro for the current SDL version */
#define SDL_COMPILEDVERSION \
SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
/* This macro will evaluate to true if compiled with SDL at least X.Y.Z */
#define SDL_VERSION_ATLEAST(X, Y, Z) \
(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
/* This function gets the version of the dynamically linked SDL library.
it should NOT be used to fill a version structure, instead you should
use the SDL_Version() macro.
*/
extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_version_h */

View File

@ -0,0 +1,897 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_video.h,v 1.17 2004/01/04 16:49:08 slouken Exp $";
#endif
/* Header file for access to the SDL raw framebuffer window */
#ifndef _SDL_video_h
#define _SDL_video_h
#include <stdio.h>
#include "SDL_types.h"
#include "SDL_mutex.h"
#include "SDL_rwops.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* Transparency definitions: These define alpha as the opacity of a surface */
#define SDL_ALPHA_OPAQUE 255
#define SDL_ALPHA_TRANSPARENT 0
/* Useful data types */
typedef struct {
Sint16 x, y;
Uint16 w, h;
} SDL_Rect;
typedef struct {
Uint8 r;
Uint8 g;
Uint8 b;
Uint8 unused;
} SDL_Color;
#define SDL_Colour SDL_Color
typedef struct {
int ncolors;
SDL_Color *colors;
} SDL_Palette;
/* Everything in the pixel format structure is read-only */
typedef struct SDL_PixelFormat {
SDL_Palette *palette;
Uint8 BitsPerPixel;
Uint8 BytesPerPixel;
Uint8 Rloss;
Uint8 Gloss;
Uint8 Bloss;
Uint8 Aloss;
Uint8 Rshift;
Uint8 Gshift;
Uint8 Bshift;
Uint8 Ashift;
Uint32 Rmask;
Uint32 Gmask;
Uint32 Bmask;
Uint32 Amask;
/* RGB color key information */
Uint32 colorkey;
/* Alpha value information (per-surface alpha) */
Uint8 alpha;
} SDL_PixelFormat;
/* typedef for private surface blitting functions */
struct SDL_Surface;
typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect,
struct SDL_Surface *dst, SDL_Rect *dstrect);
/* This structure should be treated as read-only, except for 'pixels',
which, if not NULL, contains the raw pixel data for the surface.
*/
typedef struct SDL_Surface {
Uint32 flags; /* Read-only */
SDL_PixelFormat *format; /* Read-only */
int w, h; /* Read-only */
Uint16 pitch; /* Read-only */
void *pixels; /* Read-write */
int offset; /* Private */
/* Hardware-specific surface info */
struct private_hwdata *hwdata;
/* clipping information */
SDL_Rect clip_rect; /* Read-only */
Uint32 unused1; /* for binary compatibility */
/* Allow recursive locks */
Uint32 locked; /* Private */
/* info for fast blit mapping to other surfaces */
struct SDL_BlitMap *map; /* Private */
/* format version, bumped at every change to invalidate blit maps */
unsigned int format_version; /* Private */
/* Reference count -- used when freeing surface */
int refcount; /* Read-mostly */
} SDL_Surface;
/* These are the currently supported flags for the SDL_surface */
/* Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */
#define SDL_SWSURFACE 0x00000000 /* Surface is in system memory */
#define SDL_HWSURFACE 0x00000001 /* Surface is in video memory */
#define SDL_ASYNCBLIT 0x00000004 /* Use asynchronous blits if possible */
/* Available for SDL_SetVideoMode() */
#define SDL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */
#define SDL_HWPALETTE 0x20000000 /* Surface has exclusive palette */
#define SDL_DOUBLEBUF 0x40000000 /* Set up double-buffered video mode */
#define SDL_FULLSCREEN 0x80000000 /* Surface is a full screen display */
#define SDL_OPENGL 0x00000002 /* Create an OpenGL rendering context */
#define SDL_OPENGLBLIT 0x0000000A /* Create an OpenGL rendering context and use it for blitting */
#define SDL_RESIZABLE 0x00000010 /* This video mode may be resized */
#define SDL_NOFRAME 0x00000020 /* No window caption or edge frame */
/* Used internally (read-only) */
#define SDL_HWACCEL 0x00000100 /* Blit uses hardware acceleration */
#define SDL_SRCCOLORKEY 0x00001000 /* Blit uses a source color key */
#define SDL_RLEACCELOK 0x00002000 /* Private flag */
#define SDL_RLEACCEL 0x00004000 /* Surface is RLE encoded */
#define SDL_SRCALPHA 0x00010000 /* Blit uses source alpha blending */
#define SDL_PREALLOC 0x01000000 /* Surface uses preallocated memory */
/* Evaluates to true if the surface needs to be locked before access */
#define SDL_MUSTLOCK(surface) \
(surface->offset || \
((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0))
/* Useful for determining the video hardware capabilities */
typedef struct {
Uint32 hw_available :1; /* Flag: Can you create hardware surfaces? */
Uint32 wm_available :1; /* Flag: Can you talk to a window manager? */
Uint32 UnusedBits1 :6;
Uint32 UnusedBits2 :1;
Uint32 blit_hw :1; /* Flag: Accelerated blits HW --> HW */
Uint32 blit_hw_CC :1; /* Flag: Accelerated blits with Colorkey */
Uint32 blit_hw_A :1; /* Flag: Accelerated blits with Alpha */
Uint32 blit_sw :1; /* Flag: Accelerated blits SW --> HW */
Uint32 blit_sw_CC :1; /* Flag: Accelerated blits with Colorkey */
Uint32 blit_sw_A :1; /* Flag: Accelerated blits with Alpha */
Uint32 blit_fill :1; /* Flag: Accelerated color fill */
Uint32 UnusedBits3 :16;
Uint32 video_mem; /* The total amount of video memory (in K) */
SDL_PixelFormat *vfmt; /* Value: The format of the video surface */
} SDL_VideoInfo;
/* The most common video overlay formats.
For an explanation of these pixel formats, see:
http://www.webartz.com/fourcc/indexyuv.htm
For information on the relationship between color spaces, see:
http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
*/
#define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U (3 planes) */
#define SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V (3 planes) */
#define SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
#define SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
#define SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
/* The YUV hardware video overlay */
typedef struct SDL_Overlay {
Uint32 format; /* Read-only */
int w, h; /* Read-only */
int planes; /* Read-only */
Uint16 *pitches; /* Read-only */
Uint8 **pixels; /* Read-write */
/* Hardware-specific surface info */
struct private_yuvhwfuncs *hwfuncs;
struct private_yuvhwdata *hwdata;
/* Special flags */
Uint32 hw_overlay :1; /* Flag: This overlay hardware accelerated? */
Uint32 UnusedBits :31;
} SDL_Overlay;
/* Public enumeration for setting the OpenGL window attributes. */
typedef enum {
SDL_GL_RED_SIZE,
SDL_GL_GREEN_SIZE,
SDL_GL_BLUE_SIZE,
SDL_GL_ALPHA_SIZE,
SDL_GL_BUFFER_SIZE,
SDL_GL_DOUBLEBUFFER,
SDL_GL_DEPTH_SIZE,
SDL_GL_STENCIL_SIZE,
SDL_GL_ACCUM_RED_SIZE,
SDL_GL_ACCUM_GREEN_SIZE,
SDL_GL_ACCUM_BLUE_SIZE,
SDL_GL_ACCUM_ALPHA_SIZE,
SDL_GL_STEREO,
SDL_GL_MULTISAMPLEBUFFERS,
SDL_GL_MULTISAMPLESAMPLES
} SDL_GLattr;
/* flags for SDL_SetPalette() */
#define SDL_LOGPAL 0x01
#define SDL_PHYSPAL 0x02
/* Function prototypes */
/* These functions are used internally, and should not be used unless you
* have a specific need to specify the video driver you want to use.
* You should normally use SDL_Init() or SDL_InitSubSystem().
*
* SDL_VideoInit() initializes the video subsystem -- sets up a connection
* to the window manager, etc, and determines the current video mode and
* pixel format, but does not initialize a window or graphics mode.
* Note that event handling is activated by this routine.
*
* If you use both sound and video in your application, you need to call
* SDL_Init() before opening the sound device, otherwise under Win32 DirectX,
* you won't be able to set full-screen display modes.
*/
extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags);
extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
/* This function fills the given character buffer with the name of the
* video driver, and returns a pointer to it if the video driver has
* been initialized. It returns NULL if no driver has been initialized.
*/
extern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
/*
* This function returns a pointer to the current display surface.
* If SDL is doing format conversion on the display surface, this
* function returns the publicly visible surface, not the real video
* surface.
*/
extern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void);
/*
* This function returns a read-only pointer to information about the
* video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt'
* member of the returned structure will contain the pixel format of the
* "best" video mode.
*/
extern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void);
/*
* Check to see if a particular video mode is supported.
* It returns 0 if the requested mode is not supported under any bit depth,
* or returns the bits-per-pixel of the closest available mode with the
* given width and height. If this bits-per-pixel is different from the
* one used when setting the video mode, SDL_SetVideoMode() will succeed,
* but will emulate the requested bits-per-pixel with a shadow surface.
*
* The arguments to SDL_VideoModeOK() are the same ones you would pass to
* SDL_SetVideoMode()
*/
extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags);
/*
* Return a pointer to an array of available screen dimensions for the
* given format and video flags, sorted largest to smallest. Returns
* NULL if there are no dimensions available for a particular format,
* or (SDL_Rect **)-1 if any dimension is okay for the given format.
*
* If 'format' is NULL, the mode list will be for the format given
* by SDL_GetVideoInfo()->vfmt
*/
extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags);
/*
* Set up a video mode with the specified width, height and bits-per-pixel.
*
* If 'bpp' is 0, it is treated as the current display bits per pixel.
*
* If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the
* requested bits-per-pixel, but will return whatever video pixel format is
* available. The default is to emulate the requested pixel format if it
* is not natively available.
*
* If SDL_HWSURFACE is set in 'flags', the video surface will be placed in
* video memory, if possible, and you may have to call SDL_LockSurface()
* in order to access the raw framebuffer. Otherwise, the video surface
* will be created in system memory.
*
* If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle
* updates asynchronously, but you must always lock before accessing pixels.
* SDL will wait for updates to complete before returning from the lock.
*
* If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee
* that the colors set by SDL_SetColors() will be the colors you get.
* Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all
* of the colors exactly the way they are requested, and you should look
* at the video surface structure to determine the actual palette.
* If SDL cannot guarantee that the colors you request can be set,
* i.e. if the colormap is shared, then the video surface may be created
* under emulation in system memory, overriding the SDL_HWSURFACE flag.
*
* If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set
* a fullscreen video mode. The default is to create a windowed mode
* if the current graphics system has a window manager.
* If the SDL library is able to set a fullscreen video mode, this flag
* will be set in the surface that is returned.
*
* If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up
* two surfaces in video memory and swap between them when you call
* SDL_Flip(). This is usually slower than the normal single-buffering
* scheme, but prevents "tearing" artifacts caused by modifying video
* memory while the monitor is refreshing. It should only be used by
* applications that redraw the entire screen on every update.
*
* If SDL_RESIZABLE is set in 'flags', the SDL library will allow the
* window manager, if any, to resize the window at runtime. When this
* occurs, SDL will send a SDL_VIDEORESIZE event to you application,
* and you must respond to the event by re-calling SDL_SetVideoMode()
* with the requested size (or another size that suits the application).
*
* If SDL_NOFRAME is set in 'flags', the SDL library will create a window
* without any title bar or frame decoration. Fullscreen video modes have
* this flag set automatically.
*
* This function returns the video framebuffer surface, or NULL if it fails.
*
* If you rely on functionality provided by certain video flags, check the
* flags of the returned surface to make sure that functionality is available.
* SDL will fall back to reduced functionality if the exact flags you wanted
* are not available.
*/
extern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode
(int width, int height, int bpp, Uint32 flags);
/*
* Makes sure the given list of rectangles is updated on the given screen.
* If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire
* screen.
* These functions should not be called while 'screen' is locked.
*/
extern DECLSPEC void SDLCALL SDL_UpdateRects
(SDL_Surface *screen, int numrects, SDL_Rect *rects);
extern DECLSPEC void SDLCALL SDL_UpdateRect
(SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h);
/*
* On hardware that supports double-buffering, this function sets up a flip
* and returns. The hardware will wait for vertical retrace, and then swap
* video buffers before the next video surface blit or lock will return.
* On hardware that doesn not support double-buffering, this is equivalent
* to calling SDL_UpdateRect(screen, 0, 0, 0, 0);
* The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when
* setting the video mode for this function to perform hardware flipping.
* This function returns 0 if successful, or -1 if there was an error.
*/
extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen);
/*
* Set the gamma correction for each of the color channels.
* The gamma values range (approximately) between 0.1 and 10.0
*
* If this function isn't supported directly by the hardware, it will
* be emulated using gamma ramps, if available. If successful, this
* function returns 0, otherwise it returns -1.
*/
extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
/*
* Set the gamma translation table for the red, green, and blue channels
* of the video hardware. Each table is an array of 256 16-bit quantities,
* representing a mapping between the input and output for that channel.
* The input is the index into the array, and the output is the 16-bit
* gamma value at that index, scaled to the output color precision.
*
* You may pass NULL for any of the channels to leave it unchanged.
* If the call succeeds, it will return 0. If the display driver or
* hardware does not support gamma translation, or otherwise fails,
* this function will return -1.
*/
extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue);
/*
* Retrieve the current values of the gamma translation tables.
*
* You must pass in valid pointers to arrays of 256 16-bit quantities.
* Any of the pointers may be NULL to ignore that channel.
* If the call succeeds, it will return 0. If the display driver or
* hardware does not support gamma translation, or otherwise fails,
* this function will return -1.
*/
extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue);
/*
* Sets a portion of the colormap for the given 8-bit surface. If 'surface'
* is not a palettized surface, this function does nothing, returning 0.
* If all of the colors were set as passed to SDL_SetColors(), it will
* return 1. If not all the color entries were set exactly as given,
* it will return 0, and you should look at the surface palette to
* determine the actual color palette.
*
* When 'surface' is the surface associated with the current display, the
* display colormap will be updated with the requested colors. If
* SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors()
* will always return 1, and the palette is guaranteed to be set the way
* you desire, even if the window colormap has to be warped or run under
* emulation.
*/
extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface,
SDL_Color *colors, int firstcolor, int ncolors);
/*
* Sets a portion of the colormap for a given 8-bit surface.
* 'flags' is one or both of:
* SDL_LOGPAL -- set logical palette, which controls how blits are mapped
* to/from the surface,
* SDL_PHYSPAL -- set physical palette, which controls how pixels look on
* the screen
* Only screens have physical palettes. Separate change of physical/logical
* palettes is only possible if the screen has SDL_HWPALETTE set.
*
* The return value is 1 if all colours could be set as requested, and 0
* otherwise.
*
* SDL_SetColors() is equivalent to calling this function with
* flags = (SDL_LOGPAL|SDL_PHYSPAL).
*/
extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags,
SDL_Color *colors, int firstcolor,
int ncolors);
/*
* Maps an RGB triple to an opaque pixel value for a given pixel format
*/
extern DECLSPEC Uint32 SDLCALL SDL_MapRGB
(SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b);
/*
* Maps an RGBA quadruple to a pixel value for a given pixel format
*/
extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(SDL_PixelFormat *format,
Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/*
* Maps a pixel value into the RGB components for a given pixel format
*/
extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt,
Uint8 *r, Uint8 *g, Uint8 *b);
/*
* Maps a pixel value into the RGBA components for a given pixel format
*/
extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt,
Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
/*
* Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
* If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
* If the depth is greater than 8 bits, the pixel format is set using the
* flags '[RGB]mask'.
* If the function runs out of memory, it will return NULL.
*
* The 'flags' tell what kind of surface to create.
* SDL_SWSURFACE means that the surface should be created in system memory.
* SDL_HWSURFACE means that the surface should be created in video memory,
* with the same format as the display surface. This is useful for surfaces
* that will not change much, to take advantage of hardware acceleration
* when being blitted to the display surface.
* SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with
* this surface, but you must always lock it before accessing the pixels.
* SDL will wait for current blits to finish before returning from the lock.
* SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits.
* If the hardware supports acceleration of colorkey blits between
* two surfaces in video memory, SDL will try to place the surface in
* video memory. If this isn't possible or if there is no hardware
* acceleration available, the surface will be placed in system memory.
* SDL_SRCALPHA means that the surface will be used for alpha blits and
* if the hardware supports hardware acceleration of alpha blits between
* two surfaces in video memory, to place the surface in video memory
* if possible, otherwise it will be placed in system memory.
* If the surface is created in video memory, blits will be _much_ faster,
* but the surface format must be identical to the video surface format,
* and the only way to access the pixels member of the surface is to use
* the SDL_LockSurface() and SDL_UnlockSurface() calls.
* If the requested surface actually resides in video memory, SDL_HWSURFACE
* will be set in the flags member of the returned surface. If for some
* reason the surface could not be placed in video memory, it will not have
* the SDL_HWSURFACE flag set, and will be created in system memory instead.
*/
#define SDL_AllocSurface SDL_CreateRGBSurface
extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface
(Uint32 flags, int width, int height, int depth,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
int width, int height, int depth, int pitch,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface);
/*
* SDL_LockSurface() sets up a surface for directly accessing the pixels.
* Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
* to and read from 'surface->pixels', using the pixel format stored in
* 'surface->format'. Once you are done accessing the surface, you should
* use SDL_UnlockSurface() to release it.
*
* Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
* to 0, then you can read and write to the surface at any time, and the
* pixel format of the surface will not change. In particular, if the
* SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you
* will not need to lock the display surface before accessing it.
*
* No operating system or library calls should be made between lock/unlock
* pairs, as critical system locks may be held during this time.
*
* SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
*/
extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface);
extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
/*
* Load a surface from a seekable SDL data source (memory or file.)
* If 'freesrc' is non-zero, the source will be closed after being read.
* Returns the new surface, or NULL if there was an error.
* The new surface should be freed with SDL_FreeSurface().
*/
extern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc);
/* Convenience macro -- load a surface from a file */
#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
/*
* Save a surface to a seekable SDL data source (memory or file.)
* If 'freedst' is non-zero, the source will be closed after being written.
* Returns 0 if successful or -1 if there was an error.
*/
extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
(SDL_Surface *surface, SDL_RWops *dst, int freedst);
/* Convenience macro -- save a surface to a file */
#define SDL_SaveBMP(surface, file) \
SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
/*
* Sets the color key (transparent pixel) in a blittable surface.
* If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL),
* 'key' will be the transparent pixel in the source image of a blit.
* SDL_RLEACCEL requests RLE acceleration for the surface if present,
* and removes RLE acceleration if absent.
* If 'flag' is 0, this function clears any current color key.
* This function returns 0, or -1 if there was an error.
*/
extern DECLSPEC int SDLCALL SDL_SetColorKey
(SDL_Surface *surface, Uint32 flag, Uint32 key);
/*
* This function sets the alpha value for the entire surface, as opposed to
* using the alpha component of each pixel. This value measures the range
* of transparency of the surface, 0 being completely transparent to 255
* being completely opaque. An 'alpha' value of 255 causes blits to be
* opaque, the source pixels copied to the destination (the default). Note
* that per-surface alpha can be combined with colorkey transparency.
*
* If 'flag' is 0, alpha blending is disabled for the surface.
* If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface.
* OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the
* surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed.
*
* The 'alpha' parameter is ignored for surfaces that have an alpha channel.
*/
extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha);
/*
* Sets the clipping rectangle for the destination surface in a blit.
*
* If the clip rectangle is NULL, clipping will be disabled.
* If the clip rectangle doesn't intersect the surface, the function will
* return SDL_FALSE and blits will be completely clipped. Otherwise the
* function returns SDL_TRUE and blits to the surface will be clipped to
* the intersection of the surface area and the clipping rectangle.
*
* Note that blits are automatically clipped to the edges of the source
* and destination surfaces.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect);
/*
* Gets the clipping rectangle for the destination surface in a blit.
* 'rect' must be a pointer to a valid rectangle which will be filled
* with the correct values.
*/
extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect);
/*
* Creates a new surface of the specified format, and then copies and maps
* the given surface to it so the blit of the converted surface will be as
* fast as possible. If this function fails, it returns NULL.
*
* The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those
* semantics. You can also pass SDL_RLEACCEL in the flags parameter and
* SDL will try to RLE accelerate colorkey and alpha blits in the resulting
* surface.
*
* This function is used internally by SDL_DisplayFormat().
*/
extern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface
(SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags);
/*
* This performs a fast blit from the source surface to the destination
* surface. It assumes that the source and destination rectangles are
* the same size. If either 'srcrect' or 'dstrect' are NULL, the entire
* surface (src or dst) is copied. The final blit rectangles are saved
* in 'srcrect' and 'dstrect' after all clipping is performed.
* If the blit is successful, it returns 0, otherwise it returns -1.
*
* The blit function should not be called on a locked surface.
*
* The blit semantics for surfaces with and without alpha and colorkey
* are defined as follows:
*
* RGBA->RGB:
* SDL_SRCALPHA set:
* alpha-blend (using alpha-channel).
* SDL_SRCCOLORKEY ignored.
* SDL_SRCALPHA not set:
* copy RGB.
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
* RGB values of the source colour key, ignoring alpha in the
* comparison.
*
* RGB->RGBA:
* SDL_SRCALPHA set:
* alpha-blend (using the source per-surface alpha value);
* set destination alpha to opaque.
* SDL_SRCALPHA not set:
* copy RGB, set destination alpha to source per-surface alpha value.
* both:
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
* source colour key.
*
* RGBA->RGBA:
* SDL_SRCALPHA set:
* alpha-blend (using the source alpha channel) the RGB values;
* leave destination alpha untouched. [Note: is this correct?]
* SDL_SRCCOLORKEY ignored.
* SDL_SRCALPHA not set:
* copy all of RGBA to the destination.
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
* RGB values of the source colour key, ignoring alpha in the
* comparison.
*
* RGB->RGB:
* SDL_SRCALPHA set:
* alpha-blend (using the source per-surface alpha value).
* SDL_SRCALPHA not set:
* copy RGB.
* both:
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
* source colour key.
*
* If either of the surfaces were in video memory, and the blit returns -2,
* the video memory was lost, so it should be reloaded with artwork and
* re-blitted:
while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
while ( SDL_LockSurface(image) < 0 )
Sleep(10);
-- Write image pixels to image->pixels --
SDL_UnlockSurface(image);
}
* This happens under DirectX 5.0 when the system switches away from your
* fullscreen application. The lock will also fail until you have access
* to the video memory again.
*/
/* You should call SDL_BlitSurface() unless you know exactly how SDL
blitting works internally and how to use the other blit functions.
*/
#define SDL_BlitSurface SDL_UpperBlit
/* This is the public blit function, SDL_BlitSurface(), and it performs
rectangle validation and clipping before passing it to SDL_LowerBlit()
*/
extern DECLSPEC int SDLCALL SDL_UpperBlit
(SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect);
/* This is a semi-private blit function and it performs low-level surface
blitting only.
*/
extern DECLSPEC int SDLCALL SDL_LowerBlit
(SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect);
/*
* This function performs a fast fill of the given rectangle with 'color'
* The given rectangle is clipped to the destination surface clip area
* and the final fill rectangle is saved in the passed in pointer.
* If 'dstrect' is NULL, the whole surface will be filled with 'color'
* The color should be a pixel of the format used by the surface, and
* can be generated by the SDL_MapRGB() function.
* This function returns 0 on success, or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_FillRect
(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
/*
* This function takes a surface and copies it to a new surface of the
* pixel format and colors of the video framebuffer, suitable for fast
* blitting onto the display surface. It calls SDL_ConvertSurface()
*
* If you want to take advantage of hardware colorkey or alpha blit
* acceleration, you should set the colorkey and alpha value before
* calling this function.
*
* If the conversion fails or runs out of memory, it returns NULL
*/
extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface);
/*
* This function takes a surface and copies it to a new surface of the
* pixel format and colors of the video framebuffer (if possible),
* suitable for fast alpha blitting onto the display surface.
* The new surface will always have an alpha channel.
*
* If you want to take advantage of hardware colorkey or alpha blit
* acceleration, you should set the colorkey and alpha value before
* calling this function.
*
* If the conversion fails or runs out of memory, it returns NULL
*/
extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* YUV video surface overlay functions */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This function creates a video output overlay
Calling the returned surface an overlay is something of a misnomer because
the contents of the display surface underneath the area where the overlay
is shown is undefined - it may be overwritten with the converted YUV data.
*/
extern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height,
Uint32 format, SDL_Surface *display);
/* Lock an overlay for direct access, and unlock it when you are done */
extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay);
extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay);
/* Blit a video overlay to the display surface.
The contents of the video surface underneath the blit destination are
not defined.
The width and height of the destination rectangle may be different from
that of the overlay, but currently only 2x scaling is supported.
*/
extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect);
/* Free a video overlay */
extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* OpenGL support functions. */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Dynamically load a GL driver, if SDL is built with dynamic GL.
*
* SDL links normally with the OpenGL library on your system by default,
* but you can compile it to dynamically load the GL driver at runtime.
* If you do this, you need to retrieve all of the GL functions used in
* your program from the dynamic library using SDL_GL_GetProcAddress().
*
* This is disabled in default builds of SDL.
*/
extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
/*
* Get the address of a GL function (for extension functions)
*/
extern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc);
/*
* Set an attribute of the OpenGL subsystem before intialization.
*/
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
/*
* Get an attribute of the OpenGL subsystem from the windowing
* interface, such as glX. This is of course different from getting
* the values from SDL's internal OpenGL subsystem, which only
* stores the values you request before initialization.
*
* Developers should track the values they pass into SDL_GL_SetAttribute
* themselves if they want to retrieve these values.
*/
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value);
/*
* Swap the OpenGL buffers, if double-buffering is supported.
*/
extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
/*
* Internal functions that should not be called unless you have read
* and understood the source code for these functions.
*/
extern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects);
extern DECLSPEC void SDLCALL SDL_GL_Lock(void);
extern DECLSPEC void SDLCALL SDL_GL_Unlock(void);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* These functions allow interaction with the window manager, if any. */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Sets/Gets the title and icon text of the display window
*/
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon);
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon);
/*
* Sets the icon for the display window.
* This function must be called before the first call to SDL_SetVideoMode().
* It takes an icon surface, and a mask in MSB format.
* If 'mask' is NULL, the entire icon surface will be used as the icon.
*/
extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);
/*
* This function iconifies the window, and returns 1 if it succeeded.
* If the function succeeds, it generates an SDL_APPACTIVE loss event.
* This function is a noop and returns 0 in non-windowed environments.
*/
extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
/*
* Toggle fullscreen mode without changing the contents of the screen.
* If the display surface does not require locking before accessing
* the pixel information, then the memory pointers will not change.
*
* If this function was able to toggle fullscreen mode (change from
* running in a window to fullscreen, or vice-versa), it will return 1.
* If it is not implemented, or fails, it returns 0.
*
* The next call to SDL_SetVideoMode() will set the mode fullscreen
* attribute based on the flags parameter - if SDL_FULLSCREEN is not
* set, then the display will be windowed by default where supported.
*
* This is currently only implemented in the X11 video driver.
*/
extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface);
/*
* This function allows you to set and query the input grab state of
* the application. It returns the new input grab state.
*/
typedef enum {
SDL_GRAB_QUERY = -1,
SDL_GRAB_OFF = 0,
SDL_GRAB_ON = 1,
SDL_GRAB_FULLSCREEN /* Used internally */
} SDL_GrabMode;
/*
* Grabbing means that the mouse is confined to the application window,
* and nearly all keyboard input is passed directly to the application,
* and not interpreted by a window manager, if any.
*/
extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
/* Not in public API at the moment - do not use! */
extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_video_h */

View File

@ -0,0 +1,136 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
/* This file sets things up for C dynamic library function definitions,
static inlined functions, and structures aligned at 4-byte alignment.
If you don't like ugly C preprocessor code, don't look at this file. :)
*/
/* This shouldn't be nested -- included it around code only. */
#ifdef _begin_code_h
#error Nested inclusion of begin_code.h
#endif
#define _begin_code_h
/* Make sure the correct platform symbols are defined */
#if !defined(WIN32) && defined(_WIN32)
#define WIN32
#endif /* Windows */
/* Some compilers use a special export keyword */
#ifndef DECLSPEC
# ifdef __BEOS__
# if defined(__GNUC__)
# define DECLSPEC __declspec(dllexport)
# else
# define DECLSPEC __declspec(export)
# endif
# else
# ifdef WIN32
# ifdef __BORLANDC__
# ifdef BUILD_SDL
# define DECLSPEC
# else
# define DECLSPEC __declspec(dllimport)
# endif
# else
# define DECLSPEC __declspec(dllexport)
# endif
# else
# define DECLSPEC
# endif
# endif
#endif
/* By default SDL uses the C calling convention */
#ifndef SDLCALL
#ifdef WIN32
#define SDLCALL __cdecl
#else
#define SDLCALL
#endif
#endif /* SDLCALL */
/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
#ifdef __SYMBIAN32__
#undef DECLSPEC
#define DECLSPEC
#endif /* __SYMBIAN32__ */
/* Force structure packing at 4 byte alignment.
This is necessary if the header is included in code which has structure
packing set to an alternate value, say for loading structures from disk.
The packing is reset to the previous value in close_code.h
*/
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
#ifdef _MSC_VER
#pragma warning(disable: 4103)
#endif
#ifdef __BORLANDC__
#pragma nopackwarning
#endif
#pragma pack(push,4)
#elif (defined(__MWERKS__) && defined(macintosh))
#pragma options align=mac68k4byte
#pragma enumsalwaysint on
#endif /* Compiler needs structure packing set */
/* Set up compiler-specific options for inlining functions */
#ifndef SDL_INLINE_OKAY
#ifdef __GNUC__
#define SDL_INLINE_OKAY
#else
/* Add any special compiler-specific cases here */
#if defined(_MSC_VER) || defined(__BORLANDC__) || \
defined(__DMC__) || defined(__SC__) || \
defined(__WATCOMC__) || defined(__LCC__)
#ifndef __inline__
#define __inline__ __inline
#endif
#define SDL_INLINE_OKAY
#else
#if !defined(__MRC__) && !defined(_SGI_SOURCE)
#define __inline__ inline
#define SDL_INLINE_OKAY
#endif /* Not a funky compiler */
#endif /* Visual C++ */
#endif /* GNU C */
#endif /* SDL_INLINE_OKAY */
/* If inlining isn't supported, remove "__inline__", turning static
inlined functions into static functions (resulting in code bloat
in all files which include the offending header files)
*/
#ifndef SDL_INLINE_OKAY
#define __inline__
#endif
/* Apparently this is needed by several Windows compilers */
#if !defined(__MACH__)
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif /* NULL */
#endif /* ! MacOS X - breaks precompiled headers */

View File

@ -0,0 +1,41 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
/* This file reverses the effects of begin_code.h and should be included
after you finish any function and structure declarations in your headers
*/
#undef _begin_code_h
/* Reset structure packing at previous byte alignment */
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
#ifdef __BORLANDC__
#pragma nopackwarning
#endif
#if (defined(__MWERKS__) && defined(macintosh))
#pragma options align=reset
#pragma enumsalwaysint reset
#else
#pragma pack(pop)
#endif
#endif /* Compiler needs structure packing set */

View File

@ -0,0 +1,17 @@
#ifndef _ALGORITHM_INCLUDED
#define _ALGORITHM_INCLUDED
#include <vector>
#include <stdlib.h>
namespace std
{
static bool (*__cmpfn)(const void* elem1, const void* elem2);
static int __compare(const void* elem1, const void* elem2)
{return __cmpfn(elem1,elem2)?-1:1;}
template<class T, class Pred>
void sort(T* first, T* last, Pred pr)
{
__cmpfn=(bool(*)(const void*,const void*))pr;
qsort(first,last-first,sizeof(*first),&__compare);
}
}
#endif

View File

@ -0,0 +1,251 @@
/* ANSI and traditional C compatability macros
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000
Free Software Foundation, Inc.
This file is part of the GNU C Library.
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. */
/* ANSI and traditional C compatibility macros
ANSI C is assumed if __STDC__ is #defined.
Macro ANSI C definition Traditional C definition
----- ---- - ---------- ----------- - ----------
PTR `void *' `char *'
LONG_DOUBLE `long double' `double'
VOLATILE `volatile' `'
SIGNED `signed' `'
PTRCONST `void *const' `char *'
ANSI_PROTOTYPES 1 not defined
CONST is also defined, but is obsolete. Just use const.
obsolete -- DEFUN (name, arglist, args)
Defines function NAME.
ARGLIST lists the arguments, separated by commas and enclosed in
parentheses. ARGLIST becomes the argument list in traditional C.
ARGS list the arguments with their types. It becomes a prototype in
ANSI C, and the type declarations in traditional C. Arguments should
be separated with `AND'. For functions with a variable number of
arguments, the last thing listed should be `DOTS'.
obsolete -- DEFUN_VOID (name)
Defines a function NAME, which takes no arguments.
obsolete -- EXFUN (name, (prototype)) -- obsolete.
Replaced by PARAMS. Do not use; will disappear someday soon.
Was used in external function declarations.
In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in
parentheses). In traditional C it is `NAME()'.
For a function that takes no arguments, PROTOTYPE should be `(void)'.
obsolete -- PROTO (type, name, (prototype) -- obsolete.
This one has also been replaced by PARAMS. Do not use.
PARAMS ((args))
We could use the EXFUN macro to handle prototype declarations, but
the name is misleading and the result is ugly. So we just define a
simple macro to handle the parameter lists, as in:
static int foo PARAMS ((int, char));
This produces: `static int foo();' or `static int foo (int, char);'
EXFUN would have done it like this:
static int EXFUN (foo, (int, char));
but the function is not external...and it's hard to visually parse
the function name out of the mess. EXFUN should be considered
obsolete; new code should be written to use PARAMS.
DOTS is also obsolete.
Examples:
extern int printf PARAMS ((const char *format, ...));
*/
#ifndef _ANSIDECL_H
#define _ANSIDECL_H 1
/* Every source file includes this file,
so they will all get the switch for lint. */
/* LINTLIBRARY */
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32)
/* All known AIX compilers implement these things (but don't always
define __STDC__). The RISC/OS MIPS compiler defines these things
in SVR4 mode, but does not define __STDC__. */
#define PTR void *
#define PTRCONST void *CONST
#define LONG_DOUBLE long double
#ifndef IN_GCC
#define AND ,
#define NOARGS void
#define VOLATILE volatile
#define SIGNED signed
#endif /* ! IN_GCC */
#define PARAMS(paramlist) paramlist
#define ANSI_PROTOTYPES 1
#define VPARAMS(ARGS) ARGS
#define VA_START(va_list,var) va_start(va_list,var)
/* These are obsolete. Do not use. */
#ifndef IN_GCC
#define CONST const
#define DOTS , ...
#define PROTO(type, name, arglist) type name arglist
#define EXFUN(name, proto) name proto
#define DEFUN(name, arglist, args) name(args)
#define DEFUN_VOID(name) name(void)
#endif /* ! IN_GCC */
#else /* Not ANSI C. */
#define PTR char *
#define PTRCONST PTR
#define LONG_DOUBLE double
#ifndef IN_GCC
#define AND ;
#define NOARGS
#define VOLATILE
#define SIGNED
#endif /* !IN_GCC */
#ifndef const /* some systems define it in header files for non-ansi mode */
#define const
#endif
#define PARAMS(paramlist) ()
#define VPARAMS(ARGS) (va_alist) va_dcl
#define VA_START(va_list,var) va_start(va_list)
/* These are obsolete. Do not use. */
#ifndef IN_GCC
#define CONST
#define DOTS
#define PROTO(type, name, arglist) type name ()
#define EXFUN(name, proto) name()
#define DEFUN(name, arglist, args) name arglist args;
#define DEFUN_VOID(name) name()
#endif /* ! IN_GCC */
#endif /* ANSI C. */
/* Using MACRO(x,y) in cpp #if conditionals does not work with some
older preprocessors. Thus we can't define something like this:
#define HAVE_GCC_VERSION(MAJOR, MINOR) \
(__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
and then test "#if HAVE_GCC_VERSION(2,7)".
So instead we use the macro below and test it against specific values. */
/* This macro simplifies testing whether we are using gcc, and if it
is of a particular minimum version. (Both major & minor numbers are
significant.) This macro will evaluate to 0 if we are not using
gcc at all. */
#ifndef GCC_VERSION
#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
#endif /* GCC_VERSION */
/* Define macros for some gcc attributes. This permits us to use the
macros freely, and know that they will come into play for the
version of gcc in which they are supported. */
#if (GCC_VERSION < 2007)
# define __attribute__(x)
#endif
/* Attribute __malloc__ on functions was valid as of gcc 2.96. */
#ifndef ATTRIBUTE_MALLOC
# if (GCC_VERSION >= 2096)
# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
# else
# define ATTRIBUTE_MALLOC
# endif /* GNUC >= 2.96 */
#endif /* ATTRIBUTE_MALLOC */
/* Attributes on labels were valid as of gcc 2.93. */
#ifndef ATTRIBUTE_UNUSED_LABEL
# if (GCC_VERSION >= 2093)
# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
# else
# define ATTRIBUTE_UNUSED_LABEL
# endif /* GNUC >= 2.93 */
#endif /* ATTRIBUTE_UNUSED_LABEL */
#ifndef ATTRIBUTE_UNUSED
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif /* ATTRIBUTE_UNUSED */
#ifndef ATTRIBUTE_NORETURN
#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
#endif /* ATTRIBUTE_NORETURN */
#ifndef ATTRIBUTE_PRINTF
#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
#define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5)
#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
#endif /* ATTRIBUTE_PRINTF */
/* We use __extension__ in some places to suppress -pedantic warnings
about GCC extensions. This feature didn't work properly before
gcc 2.8. */
#if GCC_VERSION < 2008
#define __extension__
#endif
/* Bootstrap support: Autoconf will possibly define the `inline' or
`const' keywords as macros, however this is only valid for the
stage1 compiler. If we detect a modern version of gcc,
unconditionally reset the values. This makes sure the right thing
happens in stage2 and later. We need to do this very early;
i.e. before any header files that might use these keywords.
Otherwise conflicts might occur. */
#if (GCC_VERSION >= 2007)
# ifdef __STDC__
# undef const
# endif
# undef inline
# define inline __inline__ /* __inline__ prevents -pedantic warnings */
# ifndef HAVE_LONG_DOUBLE
# define HAVE_LONG_DOUBLE 1
# endif
#endif /* GCC >= 2.7 */
#endif /* ansidecl.h */

View File

@ -0,0 +1,20 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef _AR_H_
#define _AR_H_
#define ARMAG "!<arch>\n"
#define SARMAG 8
#define ARFMAG "`\n"
struct ar_hdr {
char ar_name[16];
char ar_date[12];
char ar_uid[6];
char ar_gid[6];
char ar_mode[8];
char ar_size[10];
char ar_fmag[2];
};
#endif

View File

@ -0,0 +1,109 @@
/*
* Copyright (c) 1983, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ftp.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _ARPA_FTP_H
#define _ARPA_FTP_H
/* Definitions for FTP; see RFC-765. */
/*
* Reply codes.
*/
#define PRELIM 1 /* positive preliminary */
#define COMPLETE 2 /* positive completion */
#define CONTINUE 3 /* positive intermediate */
#define TRANSIENT 4 /* transient negative completion */
#define ERROR 5 /* permanent negative completion */
/*
* Type codes
*/
#define TYPE_A 1 /* ASCII */
#define TYPE_E 2 /* EBCDIC */
#define TYPE_I 3 /* image */
#define TYPE_L 4 /* local byte size */
#ifdef FTP_NAMES
char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" };
#endif
/*
* Form codes
*/
#define FORM_N 1 /* non-print */
#define FORM_T 2 /* telnet format effectors */
#define FORM_C 3 /* carriage control (ASA) */
#ifdef FTP_NAMES
char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" };
#endif
/*
* Structure codes
*/
#define STRU_F 1 /* file (no record structure) */
#define STRU_R 2 /* record structure */
#define STRU_P 3 /* page structure */
#ifdef FTP_NAMES
char *strunames[] = {"0", "File", "Record", "Page" };
#endif
/*
* Mode types
*/
#define MODE_S 1 /* stream */
#define MODE_B 2 /* block */
#define MODE_C 3 /* compressed */
#ifdef FTP_NAMES
char *modenames[] = {"0", "Stream", "Block", "Compressed" };
#endif
/*
* Record Tokens
*/
#define REC_ESC '\377' /* Record-mode Escape */
#define REC_EOR '\001' /* Record-mode End-of-Record */
#define REC_EOF '\002' /* Record-mode End-of-File */
/*
* Block Header
*/
#define BLK_EOR 0x80 /* Block is End-of-Record */
#define BLK_EOF 0x40 /* Block is End-of-File */
#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */
#define BLK_RESTART 0x10 /* Block is Restart Marker */
#define BLK_BYTECOUNT 2 /* Bytes in this block */
#endif /* !_ARPA_FTP_H */

View File

@ -0,0 +1,24 @@
#ifndef _ARPA_INET_H
#define _ARPA_INET_H
#include <sys/cdefs.h>
#include <sys/types.h>
#include <netinet/in.h>
__BEGIN_DECLS
int inet_aton(const char* cp, struct in_addr* inp) ;
unsigned long int inet_addr(const char* cp) ;
unsigned long int inet_network(const char* cp) ;
char* inet_ntoa(struct in_addr in) ;
char* inet_ntoa_r(struct in_addr in,char* buf) ;
struct in_addr inet_makeaddr(int net, int host) ;
unsigned long int inet_lnaof(struct in_addr in) ;
unsigned long int inet_netof(struct in_addr in) ;
int inet_pton (int AF, const char* CP, void* BUF) ;
const char* inet_ntop (int AF, const void* CP, char* BUF, size_t LEN) ;
__END_DECLS
#endif

View File

@ -0,0 +1,258 @@
#ifndef _ARPA_NAMESER_H
#define _ARPA_NAMESER_H
#include <sys/cdefs.h>
#include <endian.h>
__BEGIN_DECLS
#define NS_PACKETSZ 512 /* maximum packet size */
#define NS_MAXDNAME 1025 /* maximum domain name */
#define NS_MAXCDNAME 255 /* maximum compressed domain name */
#define NS_MAXLABEL 63 /* maximum length of domain label */
#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */
#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */
#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
#define NS_INT32SZ 4 /* #/bytes of data in a u_int32_t */
#define NS_INT16SZ 2 /* #/bytes of data in a u_int16_t */
#define NS_INT8SZ 1 /* #/bytes of data in a u_int8_t */
#define NS_INADDRSZ 4 /* IPv4 T_A */
#define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */
#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */
#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */
/*
* Currently defined type values for resources and queries.
*/
typedef enum __ns_type {
ns_t_invalid = 0, /* Cookie. */
ns_t_a = 1, /* Host address. */
ns_t_ns = 2, /* Authoritative server. */
ns_t_md = 3, /* Mail destination. */
ns_t_mf = 4, /* Mail forwarder. */
ns_t_cname = 5, /* Canonical name. */
ns_t_soa = 6, /* Start of authority zone. */
ns_t_mb = 7, /* Mailbox domain name. */
ns_t_mg = 8, /* Mail group member. */
ns_t_mr = 9, /* Mail rename name. */
ns_t_null = 10, /* Null resource record. */
ns_t_wks = 11, /* Well known service. */
ns_t_ptr = 12, /* Domain name pointer. */
ns_t_hinfo = 13, /* Host information. */
ns_t_minfo = 14, /* Mailbox information. */
ns_t_mx = 15, /* Mail routing information. */
ns_t_txt = 16, /* Text strings. */
ns_t_rp = 17, /* Responsible person. */
ns_t_afsdb = 18, /* AFS cell database. */
ns_t_x25 = 19, /* X_25 calling address. */
ns_t_isdn = 20, /* ISDN calling address. */
ns_t_rt = 21, /* Router. */
ns_t_nsap = 22, /* NSAP address. */
ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */
ns_t_sig = 24, /* Security signature. */
ns_t_key = 25, /* Security key. */
ns_t_px = 26, /* X.400 mail mapping. */
ns_t_gpos = 27, /* Geographical position (withdrawn). */
ns_t_aaaa = 28, /* Ip6 Address. */
ns_t_loc = 29, /* Location Information. */
ns_t_nxt = 30, /* Next domain (security). */
ns_t_eid = 31, /* Endpoint identifier. */
ns_t_nimloc = 32, /* Nimrod Locator. */
ns_t_srv = 33, /* Server Selection. */
ns_t_atma = 34, /* ATM Address */
ns_t_naptr = 35, /* Naming Authority PoinTeR */
ns_t_kx = 36, /* Key Exchange */
ns_t_cert = 37, /* Certification record */
ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */
ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */
ns_t_sink = 40, /* Kitchen sink (experimentatl) */
ns_t_opt = 41, /* EDNS0 option (meta-RR) */
ns_t_tsig = 250, /* Transaction signature. */
ns_t_ixfr = 251, /* Incremental zone transfer. */
ns_t_axfr = 252, /* Transfer zone of authority. */
ns_t_mailb = 253, /* Transfer mailbox records. */
ns_t_maila = 254, /* Transfer mail agent records. */
ns_t_any = 255, /* Wildcard match. */
ns_t_zxfr = 256, /* BIND-specific, nonstandard. */
ns_t_max = 65536
} ns_type;
/*
* Values for class field
*/
typedef enum __ns_class {
ns_c_invalid = 0, /* Cookie. */
ns_c_in = 1, /* Internet. */
ns_c_2 = 2, /* unallocated/unsupported. */
ns_c_chaos = 3, /* MIT Chaos-net. */
ns_c_hs = 4, /* MIT Hesiod. */
/* Query class values which do not appear in resource records */
ns_c_none = 254, /* for prereq. sections in update requests */
ns_c_any = 255, /* Wildcard match. */
ns_c_max = 65536
} ns_class;
/*
* Currently defined opcodes.
*/
typedef enum __ns_opcode {
ns_o_query = 0, /* Standard query. */
ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */
ns_o_status = 2, /* Name server status query (unsupported). */
/* Opcode 3 is undefined/reserved. */
ns_o_notify = 4, /* Zone change notification. */
ns_o_update = 5, /* Zone update message. */
ns_o_max = 6
} ns_opcode;
/*
* Currently defined response codes.
*/
typedef enum __ns_rcode {
ns_r_noerror = 0, /* No error occurred. */
ns_r_formerr = 1, /* Format error. */
ns_r_servfail = 2, /* Server failure. */
ns_r_nxdomain = 3, /* Name error. */
ns_r_notimpl = 4, /* Unimplemented. */
ns_r_refused = 5, /* Operation refused. */
/* these are for BIND_UPDATE */
ns_r_yxdomain = 6, /* Name exists */
ns_r_yxrrset = 7, /* RRset exists */
ns_r_nxrrset = 8, /* RRset does not exist */
ns_r_notauth = 9, /* Not authoritative for zone */
ns_r_notzone = 10, /* Zone of record different from zone section */
ns_r_max = 11,
/* The following are TSIG extended errors */
ns_r_badsig = 16,
ns_r_badkey = 17,
ns_r_badtime = 18
} ns_rcode;
typedef struct {
unsigned id :16; /* query identification number */
#if BYTE_ORDER == BIG_ENDIAN
/* fields in third byte */
unsigned qr: 1; /* response flag */
unsigned opcode: 4; /* purpose of message */
unsigned aa: 1; /* authoritive answer */
unsigned tc: 1; /* truncated message */
unsigned rd: 1; /* recursion desired */
/* fields in fourth byte */
unsigned ra: 1; /* recursion available */
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
unsigned ad: 1; /* authentic data from named */
unsigned cd: 1; /* checking disabled by resolver */
unsigned rcode :4; /* response code */
#endif
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
/* fields in third byte */
unsigned rd :1; /* recursion desired */
unsigned tc :1; /* truncated message */
unsigned aa :1; /* authoritive answer */
unsigned opcode :4; /* purpose of message */
unsigned qr :1; /* response flag */
/* fields in fourth byte */
unsigned rcode :4; /* response code */
unsigned cd: 1; /* checking disabled by resolver */
unsigned ad: 1; /* authentic data from named */
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
unsigned ra :1; /* recursion available */
#endif
/* remaining bytes */
unsigned qdcount :16; /* number of question entries */
unsigned ancount :16; /* number of answer entries */
unsigned nscount :16; /* number of authority entries */
unsigned arcount :16; /* number of resource entries */
} HEADER;
#define PACKETSZ NS_PACKETSZ
#define MAXDNAME NS_MAXDNAME
#define MAXCDNAME NS_MAXCDNAME
#define MAXLABEL NS_MAXLABEL
#define HFIXEDSZ NS_HFIXEDSZ
#define QFIXEDSZ NS_QFIXEDSZ
#define RRFIXEDSZ NS_RRFIXEDSZ
#define INT32SZ NS_INT32SZ
#define INT16SZ NS_INT16SZ
#define INADDRSZ NS_INADDRSZ
#define IN6ADDRSZ NS_IN6ADDRSZ
#define INDIR_MASK NS_CMPRSFLGS
#define NAMESERVER_PORT NS_DEFAULTPORT
#define S_ZONE ns_s_zn
#define S_PREREQ ns_s_pr
#define S_UPDATE ns_s_ud
#define S_ADDT ns_s_ar
#define QUERY ns_o_query
#define IQUERY ns_o_iquery
#define STATUS ns_o_status
#define NS_NOTIFY_OP ns_o_notify
#define NS_UPDATE_OP ns_o_update
#define NOERROR ns_r_noerror
#define FORMERR ns_r_formerr
#define SERVFAIL ns_r_servfail
#define NXDOMAIN ns_r_nxdomain
#define NOTIMP ns_r_notimpl
#define REFUSED ns_r_refused
#define YXDOMAIN ns_r_yxdomain
#define YXRRSET ns_r_yxrrset
#define NXRRSET ns_r_nxrrset
#define NOTAUTH ns_r_notauth
#define NOTZONE ns_r_notzone
#define DELETE ns_uop_delete
#define ADD ns_uop_add
#define T_A ns_t_a
#define T_NS ns_t_ns
#define T_MD ns_t_md
#define T_MF ns_t_mf
#define T_CNAME ns_t_cname
#define T_SOA ns_t_soa
#define T_MB ns_t_mb
#define T_MG ns_t_mg
#define T_MR ns_t_mr
#define T_NULL ns_t_null
#define T_WKS ns_t_wks
#define T_PTR ns_t_ptr
#define T_HINFO ns_t_hinfo
#define T_MINFO ns_t_minfo
#define T_MX ns_t_mx
#define T_TXT ns_t_txt
#define T_RP ns_t_rp
#define T_AFSDB ns_t_afsdb
#define T_X25 ns_t_x25
#define T_ISDN ns_t_isdn
#define T_RT ns_t_rt
#define T_NSAP ns_t_nsap
#define T_NSAP_PTR ns_t_nsap_ptr
#define T_SIG ns_t_sig
#define T_KEY ns_t_key
#define T_PX ns_t_px
#define T_GPOS ns_t_gpos
#define T_AAAA ns_t_aaaa
#define T_LOC ns_t_loc
#define T_NXT ns_t_nxt
#define T_EID ns_t_eid
#define T_NIMLOC ns_t_nimloc
#define T_SRV ns_t_srv
#define T_ATMA ns_t_atma
#define T_NAPTR ns_t_naptr
#define T_TSIG ns_t_tsig
#define T_IXFR ns_t_ixfr
#define T_AXFR ns_t_axfr
#define T_MAILB ns_t_mailb
#define T_MAILA ns_t_maila
#define T_ANY ns_t_any
#define C_IN ns_c_in
#define C_CHAOS ns_c_chaos
#define C_HS ns_c_hs
#define C_NONE ns_c_none
#define C_ANY ns_c_any
__END_DECLS
#endif

View File

@ -0,0 +1,319 @@
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)telnet.h 8.2 (Berkeley) 12/15/93
*/
#ifndef _ARPA_TELNET_H
#define _ARPA_TELNET_H
/*
* Definitions for the TELNET protocol.
*/
#define IAC 255 /* interpret as command: */
#define DONT 254 /* you are not to use option */
#define DO 253 /* please, you use option */
#define WONT 252 /* I won't use option */
#define WILL 251 /* I will use option */
#define SB 250 /* interpret as subnegotiation */
#define GA 249 /* you may reverse the line */
#define EL 248 /* erase the current line */
#define EC 247 /* erase the current character */
#define AYT 246 /* are you there */
#define AO 245 /* abort output--but let prog finish */
#define IP 244 /* interrupt process--permanently */
#define BREAK 243 /* break */
#define DM 242 /* data mark--for connect. cleaning */
#define NOP 241 /* nop */
#define SE 240 /* end sub negotiation */
#define EOR 239 /* end of record (transparent mode) */
#define ABORT 238 /* Abort process */
#define SUSP 237 /* Suspend process */
#define xEOF 236 /* End of file: EOF is already used... */
#define SYNCH 242 /* for telfunc calls */
#ifdef TELCMDS
char *telcmds[] = {
"EOF", "SUSP", "ABORT", "EOR",
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0,
};
#else
extern char *telcmds[];
#endif
#define TELCMD_FIRST xEOF
#define TELCMD_LAST IAC
#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
(unsigned int)(x) >= TELCMD_FIRST)
#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
/* telnet options */
#define TELOPT_BINARY 0 /* 8-bit data path */
#define TELOPT_ECHO 1 /* echo */
#define TELOPT_RCP 2 /* prepare to reconnect */
#define TELOPT_SGA 3 /* suppress go ahead */
#define TELOPT_NAMS 4 /* approximate message size */
#define TELOPT_STATUS 5 /* give status */
#define TELOPT_TM 6 /* timing mark */
#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
#define TELOPT_NAOL 8 /* negotiate about output line width */
#define TELOPT_NAOP 9 /* negotiate about output page size */
#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
#define TELOPT_XASCII 17 /* extended ascic character set */
#define TELOPT_LOGOUT 18 /* force logout */
#define TELOPT_BM 19 /* byte macro */
#define TELOPT_DET 20 /* data entry terminal */
#define TELOPT_SUPDUP 21 /* supdup protocol */
#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
#define TELOPT_SNDLOC 23 /* send location */
#define TELOPT_TTYPE 24 /* terminal type */
#define TELOPT_EOR 25 /* end or record */
#define TELOPT_TUID 26 /* TACACS user identification */
#define TELOPT_OUTMRK 27 /* output marking */
#define TELOPT_TTYLOC 28 /* terminal location number */
#define TELOPT_3270REGIME 29 /* 3270 regime */
#define TELOPT_X3PAD 30 /* X.3 PAD */
#define TELOPT_NAWS 31 /* window size */
#define TELOPT_TSPEED 32 /* terminal speed */
#define TELOPT_LFLOW 33 /* remote flow control */
#define TELOPT_LINEMODE 34 /* Linemode option */
#define TELOPT_XDISPLOC 35 /* X Display Location */
#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
#define TELOPT_AUTHENTICATION 37/* Authenticate */
#define TELOPT_ENCRYPT 38 /* Encryption option */
#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
#define TELOPT_EXOPL 255 /* extended-options-list */
#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
#ifdef TELOPTS
char *telopts[NTELOPTS+1] = {
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
"TACACS UID", "OUTPUT MARKING", "TTYLOC",
"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
"LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
"ENCRYPT", "NEW-ENVIRON",
0,
};
#define TELOPT_FIRST TELOPT_BINARY
#define TELOPT_LAST TELOPT_NEW_ENVIRON
#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
#endif
/* sub-option qualifiers */
#define TELQUAL_IS 0 /* option is... */
#define TELQUAL_SEND 1 /* send option */
#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
#define LFLOW_OFF 0 /* Disable remote flow control */
#define LFLOW_ON 1 /* Enable remote flow control */
#define LFLOW_RESTART_ANY 2 /* Restart output on any char */
#define LFLOW_RESTART_XON 3 /* Restart output only on XON */
/*
* LINEMODE suboptions
*/
#define LM_MODE 1
#define LM_FORWARDMASK 2
#define LM_SLC 3
#define MODE_EDIT 0x01
#define MODE_TRAPSIG 0x02
#define MODE_ACK 0x04
#define MODE_SOFT_TAB 0x08
#define MODE_LIT_ECHO 0x10
#define MODE_MASK 0x1f
/* Not part of protocol, but needed to simplify things... */
#define MODE_FLOW 0x0100
#define MODE_ECHO 0x0200
#define MODE_INBIN 0x0400
#define MODE_OUTBIN 0x0800
#define MODE_FORCE 0x1000
#define SLC_SYNCH 1
#define SLC_BRK 2
#define SLC_IP 3
#define SLC_AO 4
#define SLC_AYT 5
#define SLC_EOR 6
#define SLC_ABORT 7
#define SLC_EOF 8
#define SLC_SUSP 9
#define SLC_EC 10
#define SLC_EL 11
#define SLC_EW 12
#define SLC_RP 13
#define SLC_LNEXT 14
#define SLC_XON 15
#define SLC_XOFF 16
#define SLC_FORW1 17
#define SLC_FORW2 18
#define NSLC 18
/*
* For backwards compatability, we define SLC_NAMES to be the
* list of names if SLC_NAMES is not defined.
*/
#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
"LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
#ifdef SLC_NAMES
char *slc_names[] = {
SLC_NAMELIST
};
#else
extern char *slc_names[];
#define SLC_NAMES SLC_NAMELIST
#endif
#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
#define SLC_NAME(x) slc_names[x]
#define SLC_NOSUPPORT 0
#define SLC_CANTCHANGE 1
#define SLC_VARIABLE 2
#define SLC_DEFAULT 3
#define SLC_LEVELBITS 0x03
#define SLC_FUNC 0
#define SLC_FLAGS 1
#define SLC_VALUE 2
#define SLC_ACK 0x80
#define SLC_FLUSHIN 0x40
#define SLC_FLUSHOUT 0x20
#define OLD_ENV_VAR 1
#define OLD_ENV_VALUE 0
#define NEW_ENV_VAR 0
#define NEW_ENV_VALUE 1
#define ENV_ESC 2
#define ENV_USERVAR 3
/*
* AUTHENTICATION suboptions
*/
/*
* Who is authenticating who ...
*/
#define AUTH_WHO_CLIENT 0 /* Client authenticating server */
#define AUTH_WHO_SERVER 1 /* Server authenticating client */
#define AUTH_WHO_MASK 1
/*
* amount of authentication done
*/
#define AUTH_HOW_ONE_WAY 0
#define AUTH_HOW_MUTUAL 2
#define AUTH_HOW_MASK 2
#define AUTHTYPE_NULL 0
#define AUTHTYPE_KERBEROS_V4 1
#define AUTHTYPE_KERBEROS_V5 2
#define AUTHTYPE_SPX 3
#define AUTHTYPE_MINK 4
#define AUTHTYPE_CNT 5
#define AUTHTYPE_TEST 99
#ifdef AUTH_NAMES
char *authtype_names[] = {
"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
};
#else
extern char *authtype_names[];
#endif
#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
#define AUTHTYPE_NAME(x) authtype_names[x]
/*
* ENCRYPTion suboptions
*/
#define ENCRYPT_IS 0 /* I pick encryption type ... */
#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
#define ENCRYPT_REPLY 2 /* Initial setup response */
#define ENCRYPT_START 3 /* Am starting to send encrypted */
#define ENCRYPT_END 4 /* Am ending encrypted */
#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
#define ENCRYPT_REQEND 6 /* Request you send encrypting */
#define ENCRYPT_ENC_KEYID 7
#define ENCRYPT_DEC_KEYID 8
#define ENCRYPT_CNT 9
#define ENCTYPE_ANY 0
#define ENCTYPE_DES_CFB64 1
#define ENCTYPE_DES_OFB64 2
#define ENCTYPE_CNT 3
#ifdef ENCRYPT_NAMES
char *encrypt_names[] = {
"IS", "SUPPORT", "REPLY", "START", "END",
"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
0,
};
char *enctype_names[] = {
"ANY", "DES_CFB64", "DES_OFB64", 0,
};
#else
extern char *encrypt_names[];
extern char *enctype_names[];
#endif
#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
#define ENCRYPT_NAME(x) encrypt_names[x]
#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
#define ENCTYPE_NAME(x) enctype_names[x]
#endif /* _ARPA_TELNET_H */

View File

@ -0,0 +1,80 @@
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)tftp.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _ARPA_TFTP_H
#define _ARPA_TFTP_H
/*
* Trivial File Transfer Protocol (IEN-133)
*/
#define SEGSIZE 512 /* data segment size */
/*
* Packet types.
*/
#define RRQ 01 /* read request */
#define WRQ 02 /* write request */
#define DATA 03 /* data packet */
#define ACK 04 /* acknowledgement */
#define ERROR 05 /* error code */
struct tftphdr {
short th_opcode; /* packet type */
union {
short tu_block; /* block # */
short tu_code; /* error code */
char tu_stuff[1]; /* request packet stuff */
} th_u;
char th_data[1]; /* data or error string */
};
#define th_block th_u.tu_block
#define th_code th_u.tu_code
#define th_stuff th_u.tu_stuff
#define th_msg th_data
/*
* Error codes.
*/
#define EUNDEF 0 /* not defined */
#define ENOTFOUND 1 /* file not found */
#define EACCESS 2 /* access violation */
#define ENOSPACE 3 /* disk full or allocation exceeded */
#define EBADOP 4 /* illegal TFTP operation */
#define EBADID 5 /* unknown transfer ID */
#define EEXISTS 6 /* file already exists */
#define ENOUSER 7 /* no such user */
#endif /* _ARPA_TFTP_H */

View File

@ -0,0 +1,43 @@
#ifndef _I386_BYTEORDER_H
#define _I386_BYTEORDER_H
#include <asm/types.h>
#include __DEV_CONFIG_H
#ifdef __GNUC__
static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
{
#ifdef CONFIG_X86_BSWAP
__asm__("bswap %0" : "=r" (x) : "0" (x));
#else
__asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
"rorl $16,%0\n\t" /* swap words */
"xchgb %b0,%h0" /* swap higher bytes */
:"=q" (x)
: "0" (x));
#endif
return x;
}
static __inline__ __const__ __u16 ___arch__swab16(__u16 x)
{
__asm__("xchgb %b0,%h0" /* swap bytes */ \
: "=q" (x) \
: "0" (x)); \
return x;
}
#define __arch__swab32(x) ___arch__swab32(x)
#define __arch__swab16(x) ___arch__swab16(x)
#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
# define __BYTEORDER_HAS_U64__
# define __SWAB_64_THRU_32__
#endif
#endif /* __GNUC__ */
#include <linux/byteorder/little_endian.h>
#endif /* _I386_BYTEORDER_H */

View File

@ -0,0 +1,4 @@
#ifndef _I386_TYPES_H
#define _I386_TYPES_H
#endif

View File

@ -0,0 +1,31 @@
/* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#undef assert
#undef unimpl
#define assert(test) ((void)((test)||(__dj_assert(#test,__FILE__,__LINE__),0)))
#define unimpl() __dj_unimp("Called unimplemented function in file \"" __FILE__ "\"\n")
#ifndef __dj_include_assert_h_
#define __dj_include_assert_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _MSC_VER
void __declspec(noreturn) __dj_assert(const char *,const char *,int);
void __declspec(noreturn) __dj_unimp(const char *fn);
#else
void __dj_assert(const char *,const char *,int) __attribute__((__noreturn__));
void __dj_unimp(const char *fn) __attribute__((__noreturn__));
#endif
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_assert_h_ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,115 @@
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_bios_h_
#define __dj_include_bios_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
int bioscom(int _cmd, char _data, int _port);
int biosdisk(int _cmd, int _drive, int _head, int _track, int _sector,
int _nsects, void *_buffer);
int biosequip(void);
int bioskey(int cmd);
int biosmemory(void);
int biosprint(int _cmd, int _byte, int _port);
long biostime(int _cmd, long _newtime);
/*
* For compatibility with other DOS C compilers.
*/
/* Disk parameters for _bios_disk() function. */
struct _diskinfo_t {
unsigned drive; /* Drive number. */
unsigned head; /* Head number. */
unsigned track; /* Track number. */
unsigned sector; /* Sector number. */
unsigned nsectors; /* Number of sectors to read/write/verify. */
void *buffer; /* Buffer for reading/writing/verifying. */
};
#define diskinfo_t _diskinfo_t
/* Constants for _bios_disk() function. */
#define _DISK_RESET 0 /* Reset disk controller. */
#define _DISK_STATUS 1 /* Get disk status. */
#define _DISK_READ 2 /* Read disk sectors. */
#define _DISK_WRITE 3 /* Write disk sectors. */
#define _DISK_VERIFY 4 /* Verify disk sectors. */
#define _DISK_FORMAT 5 /* Format disk track. */
/* Constants fot _bios_serialcom() function. */
#define _COM_INIT 0 /* Init serial port. */
#define _COM_SEND 1 /* Send character. */
#define _COM_RECEIVE 2 /* Receive character. */
#define _COM_STATUS 3 /* Get serial port status. */
#define _COM_CHR7 2 /* 7 bits characters. */
#define _COM_CHR8 3 /* 8 bits characters. */
#define _COM_STOP1 0 /* 1 stop bit. */
#define _COM_STOP2 4 /* 2 stop bits. */
#define _COM_NOPARITY 0 /* No parity. */
#define _COM_ODDPARITY 8 /* Odd parity. */
#define _COM_SPACEPARITY 16 /* Space parity. */
#define _COM_EVENPARITY 24 /* Even parity. */
#define _COM_110 0 /* 110 baud. */
#define _COM_150 32 /* 150 baud. */
#define _COM_300 64 /* 300 baud. */
#define _COM_600 96 /* 600 baud. */
#define _COM_1200 128 /* 1200 baud. */
#define _COM_2400 160 /* 2400 baud. */
#define _COM_4800 192 /* 4800 baud. */
#define _COM_9600 224 /* 9600 baud. */
/* Constants for _bios_keybrd() function. */
#define _KEYBRD_READ 0 /* Read character. */
#define _KEYBRD_READY 1 /* Check character. */
#define _KEYBRD_SHIFTSTATUS 2 /* Get shift status. */
#define _NKEYBRD_READ 0x10 /* Read extended character. */
#define _NKEYBRD_READY 0x11 /* Check extended character. */
#define _NKEYBRD_SHIFTSTATUS 0x12 /* Get exteded shift status. */
/* Constans for _bios_printer() function. */
#define _PRINTER_WRITE 0 /* Write character. */
#define _PRINTER_INIT 1 /* Initialize printer. */
#define _PRINTER_STATUS 2 /* Get printer status. */
/* Constants for _bios_timeofday() function. */
#define _TIME_GETCLOCK 0 /* Get current clock count. */
#define _TIME_SETCLOCK 1 /* Set current clock count. */
#define _bios_equiplist() ((unsigned)biosequip())
#define _bios_memsize() ((unsigned)biosmemory())
#define _bios_printer(_c, _p, _d) ((unsigned)biosprint(_c, _d, _p))
#define _bios_serialcom(_c, _p, _d) ((unsigned)bioscom(_c, _d, _p))
#define _bios_keybrd(_c) ((unsigned)bioskey(_c))
unsigned _bios_disk(unsigned _cmd, struct _diskinfo_t *_di);
unsigned _bios_timeofday(unsigned _cmd, unsigned long *_timeval);
/* For int86(), int86x() and union REGS. */
#include <dos.h>
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_bios_h_ */

View File

@ -0,0 +1,7 @@
/* i386 is little-endian. */
#ifndef _ENDIAN_H
# error "Never use <bits/endian.h> directly; include <endian.h> instead."
#endif
#define __BYTE_ORDER __LITTLE_ENDIAN

View File

@ -0,0 +1,16 @@
#ifndef __BITS_STDIO_H
#define __BITS_STDIO_H
struct file_stream_ops {
int (* s_putc)(struct __FILE *,int);
int (* s_getc)(struct __FILE *,int *);
int (* s_read)(struct __FILE *,void *,int);
int (* s_write)(struct __FILE *,void *,int);
int (* s_seek)(struct __FILE *,int,int);
int (* s_flush)(struct __FILE *);
};
#define STM_OP(x,n) \
(x)->std_ops->s_##n
#endif

View File

@ -0,0 +1,26 @@
/* wchar_t type related definitions.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _BITS_WCHAR_H
#define _BITS_WCHAR_H 1
#define __WCHAR_MIN (-2147483647l - 1l)
#define __WCHAR_MAX (2147483647l)
#endif /* bits/wchar.h */

View File

@ -0,0 +1,19 @@
/* Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#define __WORDSIZE 32

View File

@ -0,0 +1,339 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_coff_h_
#define __dj_include_coff_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
/*** coff information for Intel 386/486. */
/********************** FILE HEADER **********************/
struct external_filehdr {
unsigned short f_magic; /* magic number */
unsigned short f_nscns; /* number of sections */
unsigned long f_timdat; /* time & date stamp */
unsigned long f_symptr; /* file pointer to symtab */
unsigned long f_nsyms; /* number of symtab entries */
unsigned short f_opthdr; /* sizeof(optional hdr) */
unsigned short f_flags; /* flags */
};
/* Bits for f_flags:
* F_RELFLG relocation info stripped from file
* F_EXEC file is executable (no unresolved external references)
* F_LNNO line numbers stripped from file
* F_LSYMS local symbols stripped from file
* F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)
*/
#define F_RELFLG (0x0001)
#define F_EXEC (0x0002)
#define F_LNNO (0x0004)
#define F_LSYMS (0x0008)
#define I386MAGIC 0x14c
#define I386AIXMAGIC 0x175
#define I386BADMAG(x) (((x).f_magic!=I386MAGIC) && (x).f_magic!=I386AIXMAGIC)
#define FILHDR struct external_filehdr
#define FILHSZ sizeof(FILHDR)
/********************** AOUT "OPTIONAL HEADER" **********************/
typedef struct
{
unsigned short magic; /* type of file */
unsigned short vstamp; /* version stamp */
unsigned long tsize; /* text size in bytes, padded to FW bdry*/
unsigned long dsize; /* initialized data " " */
unsigned long bsize; /* uninitialized data " " */
unsigned long entry; /* entry pt. */
unsigned long text_start; /* base of text used for this file */
unsigned long data_start; /* base of data used for this file */
}
AOUTHDR;
typedef struct gnu_aout {
unsigned long info;
unsigned long tsize;
unsigned long dsize;
unsigned long bsize;
unsigned long symsize;
unsigned long entry;
unsigned long txrel;
unsigned long dtrel;
} GNU_AOUT;
#define AOUTSZ (sizeof(AOUTHDR))
#define OMAGIC 0404 /* object files, eg as output */
#define ZMAGIC 0413 /* demand load format, eg normal ld output */
#define STMAGIC 0401 /* target shlib */
#define SHMAGIC 0443 /* host shlib */
/********************** SECTION HEADER **********************/
struct external_scnhdr {
char s_name[8]; /* section name */
unsigned long s_paddr; /* physical address, aliased s_nlib */
unsigned long s_vaddr; /* virtual address */
unsigned long s_size; /* section size */
unsigned long s_scnptr; /* file ptr to raw data for section */
unsigned long s_relptr; /* file ptr to relocation */
unsigned long s_lnnoptr; /* file ptr to line numbers */
unsigned short s_nreloc; /* number of relocation entries */
unsigned short s_nlnno; /* number of line number entries*/
unsigned long s_flags; /* flags */
};
#define SCNHDR struct external_scnhdr
#define SCNHSZ sizeof(SCNHDR)
/*
* names of "special" sections
*/
#define _TEXT ".text"
#define _DATA ".data"
#define _BSS ".bss"
#define _COMMENT ".comment"
#define _LIB ".lib"
/*
* s_flags "type"
*/
#define STYP_TEXT (0x0020) /* section contains text only */
#define STYP_DATA (0x0040) /* section contains data only */
#define STYP_BSS (0x0080) /* section contains bss only */
/********************** LINE NUMBERS **********************/
/* 1 line number entry for every "breakpointable" source line in a section.
* Line numbers are grouped on a per function basis; first entry in a function
* grouping will have l_lnno = 0 and in place of physical address will be the
* symbol table index of the function name.
*/
struct external_lineno {
union {
unsigned long l_symndx __attribute__((packed)); /* function name symbol index, iff l_lnno == 0 */
unsigned long l_paddr __attribute__((packed)); /* (physical) address of line number */
} l_addr;
unsigned short l_lnno; /* line number */
};
#define LINENO struct external_lineno
#define LINESZ sizeof(LINENO)
/********************** SYMBOLS **********************/
#define E_SYMNMLEN 8 /* # characters in a symbol name */
#define E_FILNMLEN 14 /* # characters in a file name */
#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
struct external_syment
{
union {
char e_name[E_SYMNMLEN];
struct {
unsigned long e_zeroes __attribute__((packed));
unsigned long e_offset __attribute__((packed));
} e;
} e;
unsigned long e_value __attribute__((packed));
short e_scnum;
unsigned short e_type;
unsigned char e_sclass;
unsigned char e_numaux;
};
#define N_BTMASK (0xf)
#define N_TMASK (0x30)
#define N_BTSHFT (4)
#define N_TSHIFT (2)
union external_auxent {
struct {
unsigned long x_tagndx __attribute__((packed)); /* str, un, or enum tag indx */
union {
struct {
unsigned short x_lnno; /* declaration line number */
unsigned short x_size; /* str/union/array size */
} x_lnsz;
unsigned long x_fsize __attribute__((packed)); /* size of function */
} x_misc;
union {
struct { /* if ISFCN, tag, or .bb */
unsigned long x_lnnoptr __attribute__((packed)); /* ptr to fcn line # */
unsigned long x_endndx __attribute__((packed)); /* entry ndx past block end */
} x_fcn;
struct { /* if ISARY, up to 4 dimen. */
unsigned short x_dimen[E_DIMNUM];
} x_ary;
} x_fcnary;
unsigned short x_tvndx; /* tv index */
} x_sym;
union {
char x_fname[E_FILNMLEN];
struct {
unsigned long x_zeroes __attribute__((packed));
unsigned long x_offset __attribute__((packed));
} x_n;
} x_file;
struct {
unsigned long x_scnlen __attribute__((packed)); /* section length */
unsigned short x_nreloc; /* # relocation entries */
unsigned short x_nlinno; /* # line numbers */
} x_scn;
struct {
unsigned long x_tvfill __attribute__((packed)); /* tv fill value */
unsigned short x_tvlen; /* length of .tv */
unsigned short x_tvran[2]; /* tv range */
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
};
#define SYMENT struct external_syment
#define SYMESZ sizeof(SYMENT)
#define AUXENT union external_auxent
#define AUXESZ sizeof(AUXENT)
# define _ETEXT "etext"
/* Relocatable symbols have number of the section in which they are defined,
or one of the following: */
#define N_UNDEF ((short)0) /* undefined symbol */
#define N_ABS ((short)-1) /* value of symbol is absolute */
#define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */
#define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */
#define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/
/*
* Type of a symbol, in low N bits of the word
*/
#define T_NULL 0
#define T_VOID 1 /* function argument (only used by compiler) */
#define T_CHAR 2 /* character */
#define T_SHORT 3 /* short integer */
#define T_INT 4 /* integer */
#define T_LONG 5 /* long integer */
#define T_FLOAT 6 /* floating point */
#define T_DOUBLE 7 /* double word */
#define T_STRUCT 8 /* structure */
#define T_UNION 9 /* union */
#define T_ENUM 10 /* enumeration */
#define T_MOE 11 /* member of enumeration*/
#define T_UCHAR 12 /* unsigned character */
#define T_USHORT 13 /* unsigned short */
#define T_UINT 14 /* unsigned integer */
#define T_ULONG 15 /* unsigned long */
#define T_LNGDBL 16 /* long double */
/*
* derived types, in n_type
*/
#define DT_NON (0) /* no derived type */
#define DT_PTR (1) /* pointer */
#define DT_FCN (2) /* function */
#define DT_ARY (3) /* array */
#define BTYPE(x) ((x) & N_BTMASK)
#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
#define ISTAG(x) ((x)==C_STRTAG||(x)==C_UNTAG||(x)==C_ENTAG)
#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
/********************** STORAGE CLASSES **********************/
/* This used to be defined as -1, but now n_sclass is unsigned. */
#define C_EFCN 0xff /* physical end of function */
#define C_NULL 0
#define C_AUTO 1 /* automatic variable */
#define C_EXT 2 /* external symbol */
#define C_STAT 3 /* static */
#define C_REG 4 /* register variable */
#define C_EXTDEF 5 /* external definition */
#define C_LABEL 6 /* label */
#define C_ULABEL 7 /* undefined label */
#define C_MOS 8 /* member of structure */
#define C_ARG 9 /* function argument */
#define C_STRTAG 10 /* structure tag */
#define C_MOU 11 /* member of union */
#define C_UNTAG 12 /* union tag */
#define C_TPDEF 13 /* type definition */
#define C_USTATIC 14 /* undefined static */
#define C_ENTAG 15 /* enumeration tag */
#define C_MOE 16 /* member of enumeration */
#define C_REGPARM 17 /* register parameter */
#define C_FIELD 18 /* bit field */
#define C_AUTOARG 19 /* auto argument */
#define C_LASTENT 20 /* dummy entry (end of block) */
#define C_BLOCK 100 /* ".bb" or ".eb" */
#define C_FCN 101 /* ".bf" or ".ef" */
#define C_EOS 102 /* end of structure */
#define C_FILE 103 /* file name */
#define C_LINE 104 /* line # reformatted as symbol table entry */
#define C_ALIAS 105 /* duplicate tag */
#define C_HIDDEN 106 /* ext symbol in dmert public lib */
/********************** RELOCATION DIRECTIVES **********************/
struct external_reloc {
unsigned long r_vaddr __attribute__((packed));
unsigned long r_symndx __attribute__((packed));
unsigned short r_type;
};
#define RELOC struct external_reloc
#define RELSZ sizeof(RELOC)
#define RELOC_REL32 20 /* 32-bit PC-relative address */
#define RELOC_ADDR32 6 /* 32-bit absolute address */
#define DEFAULT_DATA_SECTION_ALIGNMENT 4
#define DEFAULT_BSS_SECTION_ALIGNMENT 4
#define DEFAULT_TEXT_SECTION_ALIGNMENT 4
/* For new sections we havn't heard of before */
#define DEFAULT_SECTION_ALIGNMENT 4
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_coff_h_ */

View File

@ -0,0 +1,112 @@
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_conio_h_
#define __dj_include_conio_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
extern int directvideo; /* ignored by gppconio */
extern int _wscroll;
#define _NOCURSOR 0
#define _SOLIDCURSOR 1
#define _NORMALCURSOR 2
struct text_info {
unsigned char winleft;
unsigned char wintop;
unsigned char winright;
unsigned char winbottom;
unsigned char attribute;
unsigned char normattr;
unsigned char currmode;
unsigned char screenheight;
unsigned char screenwidth;
unsigned char curx;
unsigned char cury;
};
enum text_modes { LASTMODE=-1, BW40=0, C40, BW80, C80, MONO=7, C4350=64 };
enum COLORS {
/* dark colors */
BLACK,
BLUE,
GREEN,
CYAN,
RED,
MAGENTA,
BROWN,
LIGHTGRAY,
/* light colors */
DARKGRAY, /* "light black" */
LIGHTBLUE,
LIGHTGREEN,
LIGHTCYAN,
LIGHTRED,
LIGHTMAGENTA,
YELLOW,
WHITE
};
#define BLINK 0x80 /* blink bit */
void blinkvideo(void);
char * cgets(char *_str);
void clreol(void);
void clrscr(void);
int _conio_kbhit(void); /* checks for ungetch char */
int cprintf(const char *_format, ...) __attribute__((format(printf,1,2)));
int cputs(const char *_str);
int cscanf(const char *_format, ...) __attribute__((format(scanf,1,2)));
void delline(void);
int getch(void);
int getche(void);
int gettext(int _left, int _top, int _right, int _bottom, void *_destin);
void gettextinfo(struct text_info *_r);
void gotoxy(int _x, int _y);
void gppconio_init(void);
void highvideo(void);
void insline(void);
void intensevideo(void);
void lowvideo(void);
int movetext(int _left, int _top, int _right, int _bottom, int _destleft, int _desttop);
void normvideo(void);
int putch(int _c);
int puttext(int _left, int _top, int _right, int _bottom, void *_source);
void _setcursortype(int _type);
void _set_screen_lines(int _nlines);
void textattr(int _attr);
void textbackground(int _color);
void textcolor(int _color);
void textmode(int _mode);
int ungetch(int);
int wherex(void);
int wherey(void);
void window(int _left, int _top, int _right, int _bottom);
#define kbhit _conio_kbhit /* Who ever includes gppconio.h probably
also wants _conio_kbhit and not kbhit
from libc */
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_conio_h_ */

View File

@ -0,0 +1,191 @@
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_crt0_h_
#define __dj_include_crt0_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
/*****************************************************************************\
* crt0.h - specific to go32 v2.0 applications, controls command line
* argument creation.
\*****************************************************************************/
/*****************************************************************************\
* If the application wishes to provide a wildcard expansion function,
* it should define a __crt0_glob_function function. It should return
* a list of the expanded values, or 0 if no expansion will occur.
* The startup code will free the returned pointer if it is nonzero.
*
* If no expander function is provided, wildcards will be expanded in
* the POSIX.1 style. To disable expansion, provide a __crt0_glob_function
* that always returns 0.
*
* Applications that do not rely on environment variables can provide an
* alternate version of __crt0_load_environment_file that does nothing.
*
* Applications that do not rely on arguments passed to main() can
* provide an alternate version of __crt0_setup_arguments() that does
* nothing.
\*****************************************************************************/
extern char *__dos_argv0;
extern int __crt0_argc;
extern char **__crt0_argv;
void __crt0_load_environment_file(char *_app_name);
void __crt0_setup_arguments(void);
char **__crt0_glob_function(char *_arg);
/*****************************************************************************\
*
* To set any of these startup flags, add the following declaration to
* *your* source code:
*
* int _crt0_startup_flags = _CRT0_FLAG_* | _CRT0_FLAG_*;
*
* The default is all flags off.
*
\*****************************************************************************/
extern int _crt0_startup_flags;
/* If set, argv[0] is left in whatever case it was. If not set, all
** characters are mapped to lower case. Note that if the argv0 field in
** the stubinfo structure is present, the case of that part of argv0 is not
** affected.
*/
#define _CRT0_FLAG_PRESERVE_UPPER_CASE 0x0001
/* If set, reverse slashes (dos-style) are preserved in argv[0]. If not
** set, all reverse slashes are replaced with unix-style slashes.
*/
#define _CRT0_FLAG_USE_DOS_SLASHES 0x0002
/* If set, the .EXE suffix is removed from the file name component of
** argv[0]. If not set, the suffix remains.
*/
#define _CRT0_FLAG_DROP_EXE_SUFFIX 0x0004
/* If set, the drive specifier (ex: `C:') is removed from the beginning of
** argv[0] (if present). If not set, the drive specifier remains.
*/
#define _CRT0_FLAG_DROP_DRIVE_SPECIFIER 0x0008
/* If set, response files (ex: @gcc.rf) are not expanded. If not set, the
** contents of the response files are used to create arguments. Note that
** if the file does not exist, that argument remains unexpanded.
*/
#define _CRT0_FLAG_DISALLOW_RESPONSE_FILES 0x0010
/* If set, fill sbrk()'d memory with a constant value. If not, memory
** gets whatever happens to have been in there, which breaks some
** applications.
*/
#define _CRT0_FLAG_FILL_SBRK_MEMORY 0x0020
/* If set, fill memory (above) with 0xdeadbeef, else fill with zero.
** This is especially useful for debugging uninitialized memory problems.
*/
#define _CRT0_FLAG_FILL_DEADBEEF 0x0040
/* If set, set DS limit to 4GB which allows use of near pointers to DOS
** (and other) memory. WARNING, disables memory protection and bad pointers
** may crash the machine or wipe out your data.
*/
#define _CRT0_FLAG_NEARPTR 0x0080
/* If set, disable NULL pointer protection (if it can be controlled at all).
*/
#define _CRT0_FLAG_NULLOK 0x0100
/* If set, enabled capture of NMI in exception code. This may cause problems
** with laptops and "green" boxes which use it to wake up. Default is to
** leave NMIs alone and pass through to real mode code. You decide.
*/
#define _CRT0_FLAG_NMI_SIGNAL 0x0200
/* If set, disable usage of long file name functions even on systems
** (such as Win95) which support them. This might be needed to work
** around program assumptions on file name format on programs written
** specifically for DOS.
*/
#define _CRT0_FLAG_NO_LFN 0x0400
/* If set, chooses an sbrk() algorithm. If your code requires one type
** or the other, set the value (since the default may change). The non-move
** sbrk makes sure the base of CS/DS/SS does not change. Each new sbrk()
** allocation is put in a different DPMI memory block. This works best with
** DOS programs which would like to use near pointers or hardware interrupts.
** The unix sbrk resizes a single memory block, so programs making assumptions
** about unix-like sbrk behavior may run better with this choice.
*/
#define _CRT0_FLAG_NONMOVE_SBRK 0x0000 /* Default */
#define _CRT0_FLAG_UNIX_SBRK 0x0800
/* If set, locks all memory as it is allocated. This effectively disables
** virtual memory, and may be useful if using extensive hardware interrupt
** codes in a relatively small image size. The memory is locked after it
** is sbrk()ed, so the locking may fail. This bit may be set or cleared
** during execution. When sbrk() uses multiple memory zones, it can be
** difficult to lock all memory since the memory block size and location is
** impossible to determine.
*/
#define _CRT0_FLAG_LOCK_MEMORY 0x1000
/* If set, disables all filename letter-case conversion in functions that
** traverse directories (except findfirst/findnext which always return the
** filenames exactly as found in the directory entry). When reset, all
** filenames on 8+3 MSDOS filesystems and DOS-style 8+3 filenames on LFN
** systems are converted to lower-case by functions such as `readdir',
** `getcwd', `_fixpath' and `srchpath'. Note that when this flag is set,
** ALL filenames on MSDOS systems will appear in upper-case, which is
** both ugly and will break many Unix-born programs. Use only if you know
** exactly what you are doing!
*/
#define _CRT0_FLAG_PRESERVE_FILENAME_CASE 0x2000
/* If set, the quote characters ', ", and \ will be retained in argv[]
** elements when processing command lines passed via `system'. This is
** used by `redir', and should only be needed if you want to get the
** original command line exactly as it was passed by the caller.
*/
#define _CRT0_FLAG_KEEP_QUOTES 0x4000
/*****************************************************************************\
* Access to the memory handles used by the non-move sbrk algorithm.
* The handle is the SI:DI DPMI handle; the address is the offset relative
* to the application's address space. Address will be zero unused slots > 1.
\*****************************************************************************/
typedef struct {
long handle;
unsigned address;
} __djgpp_sbrk_handle;
extern __djgpp_sbrk_handle __djgpp_memory_handle_list[256];
__djgpp_sbrk_handle *__djgpp_memory_handle(unsigned address);
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_crt0_h_ */

View File

@ -0,0 +1,18 @@
#ifndef _CSTDIO_INCLUDED
#define _CSTDIO_INCLUDED
#include <stdio.h>
class ios
{
public:
enum open_mode { in = 0x01,
out = 0x02,
ate = 0x04,
app = 0x08,
trunc = 0x10,
nocreate = 0x20,
noreplace = 0x40,
binary = 0x80 };
enum seek_dir { beg=0, cur=1, end=2 };
};
#endif

View File

@ -0,0 +1,48 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_ctype_h_
#define __dj_include_ctype_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
int isalnum(int c);
int isalpha(int c);
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);
int tolower(int c);
int toupper(int c);
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#include <inlines/ctype.ha>
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
int isascii(int c);
int toascii(int c);
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#include <inlines/ctype.hd>
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_ctype_h_ */

View File

@ -0,0 +1,946 @@
/*
***************************************************************************
* This file comprises part of PDCurses. PDCurses is Public Domain software.
* You may use this code for whatever purposes you desire. This software
* is provided AS IS with NO WARRANTY whatsoever.
* Should this software be used in another application, an acknowledgement
* that PDCurses code is used would be appreciated, but is not mandatory.
*
* Any changes which you make to this software which may improve or enhance
* it, should be forwarded to the current maintainer for the benefit of
* other users.
*
* The only restriction placed on this code is that no distribution of
* modified PDCurses code be made under the PDCurses name, by anyone
* other than the current maintainer.
*
* See the file maintain.er for details of the current maintainer.
***************************************************************************
*/
/*
$Id$
*/
/*
*----------------------------------------------------------------------
* PDCurses
*----------------------------------------------------------------------
* MH
* 950126 2.2 Added more System V R4 functions
*
* Added beta Xwindows port
*
* Changed chtype to long
*
* Incorporated panels library
*
* Support for more and newer versions of compilers
*
* MH
* 930531 2.1 Added support for djgpp
*
* Added beta Unix version
*
* Added OS/2 DLL support.
*
* Changed behaviour of overlay(), overwrite() and typeahead()
*
* 921120 2.0 Changed #if to #ifdef/#if defined to make it
* easier to add new platforms/compilers.
*
* Added System V colour support.
*
* Added OS/2 port.
*-------
* Frotz
* 911221 2.0 pre-beta Changed back from short to int. (int is the
* correct size for the default platform. Short
* might be too short on some platforms. This
* is more portable. I, also, made this mistake.)
*
* Many functions are now macros. If you want
* the real thing, #undef the macro. (X/Open
* requirement.)
*
* Merged many sources into current release.
*
* Added many X/Open routines (not quite all yet).
*
* Added internal documentation to all routines.
*
* Added a HISTORY file to the environment.
*
* Added a CONTRIB file to the environment.
*-------
* bl 900114 1.4 Window origin mod in overlay() and overwrite(), on
* public (and very reasonable) request. Swapped
* #define'd values of OK and ERR; OK now 1, and
* ERR is 0/NULL. Conforms better to UNIX
* versions. borderchars[] removed from WINDOW
* struct since the border() functions were
* redefined. Use of short wherever possible.
* Portability improvements, mispelled name of
* [w]setscrreg().
*
* 881005 1.3 All modules lint-checked with MSC '-W3' and
* turbo'C' '-w -w-pro' switches. Support for
* border(), wborder() functions.
*
* 881002 1.2 Rcsid[] string in all modules, for maintenance.
*
* 880306 1.1 'Raw' output routines, revision info in curses.h.
*
* 870515 1.0 Initial Release.
*
*----------------------------------------------------------------------
*/
#ifndef __PDCURSES__
#define __PDCURSES__ 1
/*man-start*********************************************************************
All defines are "defined" here. All compiler and environment
specific definitions are defined into generic class defines.
These defines are to be given values so that the code can
rely on #if, rather than a complicated set of #if defined() or
#ifdefs...
PDCurses definitions list: (Only define those needed)
REGISTERWINDOWS True for auto window update registery.
FAST_VIDEO True if display is memory mapped, or
we can utilize the fast video update routines.
DOS True if compiling for DOS.
OS2 True if compiling for OS/2.
FLEXOS True if compiling for Flexos.
HC True if using a Metaware compiler.
TC True if using a Borland compiler.
MSC True if using a Microsoft compiler.
ANSI True if the compiler supports ANSI C and
(full or mixed) prototypes.
CPLUSPLUS True if the compiler supports C++.
PDCurses portable platform definitions list:
PDCurses Enables access to PDCurses-only routines.
XOPEN Always true.
SYSV True if you are compiling for SYSV portability.
BSD True if you are compiling for BSD portability.
INTERNAL Enables access to internal PDCurses routines.
PDCURSES_WCLR Makes behaviour of wclrtoeol() and wclrtoeof()
unique to PDCurses. By default Unix behavior is set.
See notes in wclrtoeol() and wclrtoeof().
**man-end**********************************************************************/
#define PDCURSES 1 /* PDCurses-only routines */
#define XOPEN 1 /* X/Open Curses routines */
#define SYSV 1 /* System V Curses routines */
#define BSD 1 /* BSD Curses routines */
#define INTERNAL 1 /* PDCurses Internal routines */
#ifdef __MENUET_CURSES__
#undef DOS
#undef LINUX
#undef UNIX
#define MENUETOS 1
#define ANSI 1
#define CURSES__32BIT__
#ifdef _cplusplus
#define CPLUSPLUS 1
#endif
#define NO_VSSCANF 1
#endif
/*---------------------------------------------------------------------*/
#include <stdio.h> /* Required by X/Open usage below */
/*----------------------------------------------------------------------
*
* PDCurses Manifest Constants
*
*/
#ifndef FALSE /* booleans */
# define FALSE 0
#endif
#ifndef TRUE /* booleans */
# define TRUE !FALSE
#endif
#ifndef NULL
# define NULL ((void*)0) /* Null pointer */
#endif
#ifndef ERR
# define ERR 0 /* general error flag */
#endif
#ifndef OK
# define OK 1 /* general OK flag */
#endif
/*----------------------------------------------------------------------
*
* PDCurses Type Declarations
*
*/
typedef unsigned char bool; /* PDCurses Boolean type */
typedef unsigned short chtype; /* 8-bit attr + 8-bit char */
/*----------------------------------------------------------------------
*
* PDCurses Structure Definitions:
*
*/
typedef struct _win /* definition of a window. */
{
int _cury; /* current pseudo-cursor */
int _curx;
int _maxy; /* max window coordinates */
int _maxx;
int _pmaxy; /* max physical size */
int _pmaxx;
int _begy; /* origin on screen */
int _begx;
int _lastpy; /* last y coordinate of upper left pad display area */
int _lastpx; /* last x coordinate of upper left pad display area */
int _lastsy1; /* last upper y coordinate of screen window for pad */
int _lastsx1; /* last upper x coordinate of screen window for pad */
int _lastsy2; /* last lower y coordinate of screen window for pad */
int _lastsx2; /* last lower x coordinate of screen window for pad */
int _flags; /* window properties */
chtype _attrs; /* standard A_STANDOUT attributes and colors */
chtype _bkgd; /* wrs(4/6/93) background, normally blank */
int _tabsize; /* tab character size */
bool _clear; /* causes clear at next refresh */
bool _leave; /* leaves cursor as it happens */
bool _scroll; /* allows window scrolling */
bool _nodelay; /* input character wait flag */
bool _immed; /* immediate update flag */
bool _use_keypad; /* flags keypad key mode active */
bool _use_idl; /* True if Ins/Del line can be used*/
bool _use_idc; /* True if Ins/Del character can be used*/
chtype**_y; /* pointer to line pointer array */
int* _firstch; /* first changed character in line */
int* _lastch; /* last changed character in line */
int _tmarg; /* top of scrolling region */
int _bmarg; /* bottom of scrolling region */
char* _title; /* window title */
char _title_ofs; /* window title offset from left */
chtype _title_attr; /* window title attributes */
chtype _blank; /* window's blank character */
int _parx, _pary; /* coords relative to parent (0,0) */
struct _win* _parent; /* subwin's pointer to parent win */
} WINDOW;
/*----------------------------------------------------------------------
*
* Private structures that are necessary for correct
* macro construction.
*
*/
#ifdef REGISTERWINDOWS
typedef struct _ref /* Refresh Window Structure */
{
WINDOW* win;
struct _ref* next;
struct _ref* tail;
} ACTIVE;
typedef struct _wins
{
WINDOW* w; /* pointer to a visible window */
struct _wins* next; /* Next visible window pointer */
struct _wins* prev; /* Next visible window pointer */
struct _wins* tail; /* Last visible window pointer */
/* Only head window (stdscr) has */
/* a valid tail pointer. */
} WINDS;
#endif
typedef struct
{
bool alive; /* TRUE if already opened. */
bool autocr; /* if lf -> crlf */
bool cbreak; /* if terminal unbuffered */
bool echo; /* if terminal echo */
bool raw_inp; /* raw input mode (v. cooked input) */
bool raw_out; /* raw output mode (7 v. 8 bits) */
bool refrbrk; /* if premature refresh brk allowed */
bool orgcbr; /* original MSDOS ^-BREAK setting */
bool visible_cursor; /* TRUE if cursor is visible */
bool audible; /* FALSE if the bell is visual */
bool full_redraw; /* TRUE for bad performance */
bool direct_video; /* Allow Direct Screen Memory writes*/
bool mono; /* TRUE if current screen is mono. */
bool sizeable; /* TRUE if adapter is resizeable. */
bool bogus_adapter; /* TRUE if adapter has insane values*/
bool shell; /* TRUE if reset_prog_mode() needs */
/* to be called. */
chtype blank; /* Background character */
chtype orig_attr; /* Original screen attributes */
int cursrow; /* position of physical cursor */
int curscol; /* position of physical cursor */
int cursor; /* Current Cursor definition */
int visibility; /* Visibility of cursor */
int video_page; /* Current PC video page */
int orig_emulation; /* Original cursor emulation value */
int orig_cursor; /* Original cursor size */
int font; /* default font size */
int orig_font; /* Original font size */
int lines; /* New value for LINES */
int cols; /* New value for COLS */
int emalloc; /* 0x0C0C if initscr() is to reset */
/* this value to TRUE; */
/* TRUE only if emalloc()/ecalloc() */
/* are is to be used; */
/* FALSE if malloc()/calloc() are */
/* to be used. */
int tahead; /* Type-ahead value */
int adapter; /* Screen type */
#ifdef UNIX
int adapter; /* Screen type */
int number_keys; /* number of function keys */
char *key_seq[200]; /* key sequence ptr for function keys */
int key_num[200]; /* key numbers for function keys */
#endif
} SCREEN;
/* external variables */
extern int LINES; /* terminal height */
extern int COLS; /* terminal width */
extern WINDOW* stdscr; /* the default screen window */
extern SCREEN _cursvar; /* curses variables */
#if defined (INTERNAL) | defined (CURSES_LIBRARY)
extern WINDOW* curscr; /* the current screen image */
extern int _default_lines; /* For presetting maximum lines */
#endif
#ifdef REGISTERWINDOWS
extern ACTIVE* CurWins; /* Currently Visible Windows */
#endif
/*man-start*********************************************************************
PDCurses Text Attributes:
To include colour in PDCurses, a number of things had to be sacrificed
from the strict Unix and System V support.
The main problem is fitting all character attributes and colour into
an unsigned char (all 8 bits!). On System V, chtype is a long on
PDCurses it is a short int.
The following is the structure of a win->_attrs chtype:
-------------------------------------------------
|15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
-------------------------------------------------
colour number | attrs | character eg 'a'
the high order char is an index into an array of physical colours
(defined in INITPAIR.c). 32 (5 bits) foreground/background colour
combinations combined with 8 (3 bits) attribute modifiers are
available.
The available attribute enhancers are bold, reverse and blink.
All other Unix attributes have no effect as attributes. This
limitation may be overcome in future releases by expanding chtype
to a long.
**man-end**********************************************************************/
/* Video attribute definitions. */
#define A_NORMAL (chtype)0x0000 /* SysV */
#define A_ALTCHARSET (chtype)0x0000 /* X/Open */
#define A_BLINK (chtype)0x0400 /* X/Open */
#define A_BLANK (chtype)0x0000 /* X/Open */
#define A_BOLD (chtype)0x0100 /* X/Open */
#define A_DIM (chtype)0x0000 /* X/Open */
#define A_PROTECT (chtype)0x0000 /* X/Open */
#define A_REVERSE (chtype)0x0200 /* X/Open */
#define A_STANDOUT ((chtype)(A_REVERSE | A_BOLD)) /* X/Open */
#define A_UNDERLINE (chtype)0x0000 /* X/Open */
#define A_COLOR (chtype)0xF800 /*System V */
#define A_CHARTEXT (chtype)(0xFF) /* X/Open */
#define A_ATTRIBUTES (chtype)(~A_CHARTEXT) /* X/Open */
#define CHR_MSK A_CHARTEXT /* Obsolete */
#define ATR_MSK A_ATTRIBUTES /* Obsolete */
#define ATR_NRM A_NORMAL /* Obsolete */
#define ACS_ULCORNER (chtype)0xda /* SysV */
#define ACS_LLCORNER (chtype)0xc0 /* SysV */
#define ACS_URCORNER (chtype)0xbf /* SysV */
#define ACS_LRCORNER (chtype)0xd9 /* SysV */
#define ACS_RTEE (chtype)0xb4 /* SysV */
#define ACS_LTEE (chtype)0xc3 /* SysV */
#define ACS_BTEE (chtype)0xc1 /* SysV */
#define ACS_TTEE (chtype)0xc2 /* SysV */
#define ACS_HLINE (chtype)0xc4 /* SysV */
#define ACS_VLINE (chtype)0xb3 /* SysV */
#define ACS_PLUS (chtype)0xc5 /* SysV */
#define ACS_S1 (chtype)0x2d /* SysV */
#define ACS_S9 (chtype)0x5f /* SysV */
#define ACS_DIAMOND (chtype)0xc5 /* SysV */
#define ACS_CKBOARD (chtype)0xb2 /* SysV */
#define ACS_DEGREE (chtype)0xf8 /* SysV */
#define ACS_PLMINUS (chtype)0xf1 /* SysV */
#define ACS_BULLET (chtype)0xf9 /* SysV */
#define ACS_LARROW (chtype)0x3c /* SysV */
#define ACS_RARROW (chtype)0x3e /* SysV */
#define ACS_DARROW (chtype)0x76 /* SysV */
#define ACS_UARROW (chtype)0x5e /* SysV */
#define ACS_BOARD (chtype)0x23 /* SysV */
#define ACS_LANTERN (chtype)0x23 /* SysV */
#define ACS_BLOCK (chtype)0x23 /* SysV */
# define COLOR_BLACK 0
# define COLOR_BLUE 1
# define COLOR_GREEN 2
# define COLOR_CYAN 3
# define COLOR_RED 4
# define COLOR_MAGENTA 5
# define COLOR_YELLOW 6
# define COLOR_WHITE 7
#define COLOR_PAIR(n) (((n) << 11) & A_ATTRIBUTES)
#define PAIR_NUMBER(n) (((n) & A_COLOR) >> 11)
extern int COLORS,COLOR_PAIRS;
/*----------------------------------------------------------------------
*
* Function and Keypad Key Definitions.
* Many are just for compatibility.
*
*/
#define KEY_MIN 0x101 /* Minimum curses key value */
#define KEY_BREAK 0x101 /* Not on PC KBD */
#define KEY_DOWN 0x102 /* Down arrow key */
#define KEY_UP 0x103 /* Up arrow key */
#define KEY_LEFT 0x104 /* Left arrow key */
#define KEY_RIGHT 0x105 /* Right arrow key */
#define KEY_HOME 0x106 /* home key */
#define KEY_BACKSPACE 0x107 /* not on pc */
#define KEY_F0 0x108 /* function keys. space for */
#define KEY_F(n) (KEY_F0+(n))/* 64 keys are reserved. */
#define KEY_DL 0x148 /* not on pc */
#define KEY_IL 0x149 /* insert line */
#define KEY_DC 0x14a /* delete character */
#define KEY_IC 0x14b /* insert char or enter ins mode */
#define KEY_EIC 0x14c /* exit insert char mode */
#define KEY_CLEAR 0x14d /* clear screen */
#define KEY_EOS 0x14e /* clear to end of screen */
#define KEY_EOL 0x14f /* clear to end of line */
#define KEY_SF 0x150 /* scroll 1 line forward */
#define KEY_SR 0x151 /* scroll 1 line back (reverse) */
#define KEY_NPAGE 0x152 /* next page */
#define KEY_PPAGE 0x153 /* previous page */
#define KEY_STAB 0x154 /* set tab */
#define KEY_CTAB 0x155 /* clear tab */
#define KEY_CATAB 0x156 /* clear all tabs */
#define KEY_ENTER 0x157 /* enter or send (unreliable) */
#define KEY_SRESET 0x158 /* soft/reset (partial/unreliable)*/
#define KEY_RESET 0x159 /* reset/hard reset (unreliable) */
#define KEY_PRINT 0x15a /* print/copy */
#define KEY_LL 0x15b /* home down/bottom (lower left) */
#define KEY_ABORT 0x15c /* abort/terminate key (any) */
#define KEY_SHELP 0x15d /* short help */
#define KEY_LHELP 0x15e /* long help */
#define KEY_BTAB 0x15f /* Back tab key */
#define KEY_BEG 0x160 /* beg(inning) key */
#define KEY_CANCEL 0x161 /* cancel key */
#define KEY_CLOSE 0x162 /* close key */
#define KEY_COMMAND 0x163 /* cmd (command) key */
#define KEY_COPY 0x164 /* copy key */
#define KEY_CREATE 0x165 /* create key */
#define KEY_END 0x166 /* end key */
#define KEY_EXIT 0x167 /* exit key */
#define KEY_FIND 0x168 /* find key */
#define KEY_HELP 0x169 /* help key */
#define KEY_MARK 0x16a /* mark key */
#define KEY_MESSAGE 0x16b /* message key */
#define KEY_MOVE 0x16c /* move key */
#define KEY_NEXT 0x16d /* next object key */
#define KEY_OPEN 0x16e /* open key */
#define KEY_OPTIONS 0x16f /* options key */
#define KEY_PREVIOUS 0x170 /* previous object key */
#define KEY_REDO 0x171 /* redo key */
#define KEY_REFERENCE 0x172 /* ref(erence) key */
#define KEY_REFRESH 0x173 /* refresh key */
#define KEY_REPLACE 0x174 /* replace key */
#define KEY_RESTART 0x175 /* restart key */
#define KEY_RESUME 0x176 /* resume key */
#define KEY_SAVE 0x177 /* save key */
#define KEY_SBEG 0x178 /* shifted beginning key */
#define KEY_SCANCEL 0x179 /* shifted cancel key */
#define KEY_SCOMMAND 0x17a /* shifted command key */
#define KEY_SCOPY 0x17b /* shifted copy key */
#define KEY_SCREATE 0x17c /* shifted create key */
#define KEY_SDC 0x17d /* shifted delete char key */
#define KEY_SDL 0x17e /* shifted delete line key */
#define KEY_SELECT 0x17f /* select key */
#define KEY_SEND 0x180 /* shifted end key */
#define KEY_SEOL 0x181 /* shifted clear line key */
#define KEY_SEXIT 0x182 /* shifted exit key */
#define KEY_SFIND 0x183 /* shifted find key */
#define KEY_SHOME 0x184 /* shifted home key */
#define KEY_SIC 0x185 /* shifted input key */
#define KEY_SLEFT 0x187 /* shifted left arrow key */
#define KEY_SMESSAGE 0x188 /* shifted message key */
#define KEY_SMOVE 0x189 /* shifted move key */
#define KEY_SNEXT 0x18a /* shifted next key */
#define KEY_SOPTIONS 0x18b /* shifted options key */
#define KEY_SPREVIOUS 0x18c /* shifted prev key */
#define KEY_SPRINT 0x18d /* shifted print key */
#define KEY_SREDO 0x18e /* shifted redo key */
#define KEY_SREPLACE 0x18f /* shifted replace key */
#define KEY_SRIGHT 0x190 /* shifted right arrow */
#define KEY_SRSUME 0x191 /* shifted resume key */
#define KEY_SSAVE 0x192 /* shifted save key */
#define KEY_SSUSPEND 0x193 /* shifted suspend key */
#define KEY_SUNDO 0x194 /* shifted undo key */
#define KEY_SUSPEND 0x195 /* suspend key */
#define KEY_UNDO 0x196 /* undo key */
/* PDCurses specific key definitions */
#define ALT_0 0x197 /* Alt-0 PC only */
#define ALT_1 0x198 /* Alt-1 PC only */
#define ALT_2 0x199 /* Alt-2 PC only */
#define ALT_3 0x19a /* Alt-3 PC only */
#define ALT_4 0x19b /* Alt-4 PC only */
#define ALT_5 0x19c /* Alt-5 PC only */
#define ALT_6 0x19d /* Alt-6 PC only */
#define ALT_7 0x19e /* Alt-7 PC only */
#define ALT_8 0x19f /* Alt-8 PC only */
#define ALT_9 0x1a0 /* Alt-9 PC only */
#define ALT_A 0x1a1 /* Alt-A PC only */
#define ALT_B 0x1a2 /* Alt-B PC only */
#define ALT_C 0x1a3 /* Alt-C PC only */
#define ALT_D 0x1a4 /* Alt-D PC only */
#define ALT_E 0x1a5 /* Alt-E PC only */
#define ALT_F 0x1a6 /* Alt-F PC only */
#define ALT_G 0x1a7 /* Alt-G PC only */
#define ALT_H 0x1a8 /* Alt-H PC only */
#define ALT_I 0x1a9 /* Alt-I PC only */
#define ALT_J 0x1aa /* Alt-J PC only */
#define ALT_K 0x1ab /* Alt-K PC only */
#define ALT_L 0x1ac /* Alt-L PC only */
#define ALT_M 0x1ad /* Alt-M PC only */
#define ALT_N 0x1ae /* Alt-N PC only */
#define ALT_O 0x1af /* Alt-O PC only */
#define ALT_P 0x1b0 /* Alt-P PC only */
#define ALT_Q 0x1b1 /* Alt-Q PC only */
#define ALT_R 0x1b2 /* Alt-R PC only */
#define ALT_S 0x1b3 /* Alt-S PC only */
#define ALT_T 0x1b4 /* Alt-T PC only */
#define ALT_U 0x1b5 /* Alt-U PC only */
#define ALT_V 0x1b6 /* Alt-V PC only */
#define ALT_W 0x1b7 /* Alt-W PC only */
#define ALT_X 0x1b8 /* Alt-X PC only */
#define ALT_Y 0x1b9 /* Alt-Y PC only */
#define ALT_Z 0x1ba /* Alt-Z PC only */
#define CTL_LEFT 0x1bb /* Control-Left-Arrow PC only */
#define CTL_RIGHT 0x1bc /* Control-Right-Arrow PC only */
#define CTL_PGUP 0x1bd /* Control-PgUp PC only */
#define CTL_PGDN 0x1be /* Control-PgDn PC only */
#define CTL_HOME 0x1bf /* Control-Home PC only */
#define CTL_END 0x1c0 /* Control-End PC only */
#define KEY_BACKTAB 0x1c1 /* Back-tab PC only */
#define KEY_A1 0x1c2 /* upper left on Virtual keypad */
#define KEY_A2 0x1c3 /* upper middle on Virt. keypad */
#define KEY_A3 0x1c4 /* upper right on Vir. keypad */
#define KEY_B1 0x1c5 /* middle left on Virt. keypad */
#define KEY_B2 0x1c6 /* center on Virt. keypad */
#define KEY_B3 0x1c7 /* middle right on Vir. keypad */
#define KEY_C1 0x1c8 /* lower left on Virt. keypad */
#define KEY_C2 0x1c9 /* lower middle on Virt. keypad */
#define KEY_C3 0x1ca /* lower right on Vir. keypad */
#define PADSLASH 0x1cb /* slash on keypad */
#define PADENTER 0x1cc /* enter on keypad */
#define CTL_PADENTER 0x1cd /* ctl-enter on keypad */
#define ALT_PADENTER 0x1ce /* alt-enter on keypad */
#define SHF_PADSTOP 0x1cf /* shift-stop on keypad */
#define PADSTAR 0x1d0 /* star on keypad */
#define PADMINUS 0x1d1 /* minus on keypad */
#define PADPLUS 0x1d2 /* plus on keypad */
#define CTL_PADSTOP 0x1d3 /* ctl-stop on keypad */
#define CTL_PADCENTER 0x1d4 /* ctl-enter on keypad */
#define CTL_PADPLUS 0x1d5 /* ctl-plus on keypad */
#define CTL_PADMINUS 0x1d6 /* ctl-minus on keypad */
#define CTL_PADSLASH 0x1d7 /* ctl-slash on keypad */
#define CTL_PADSTAR 0x1d8 /* ctl-star on keypad */
#define ALT_PADPLUS 0x1d9 /* alt-plus on keypad */
#define ALT_PADMINUS 0x1da /* alt-minus on keypad */
#define ALT_PADSLASH 0x1db /* alt-slash on keypad */
#define ALT_PADSTAR 0x1dc /* alt-star on keypad */
#define CTL_INS 0x1dd /* ctl-insert */
#define ALT_DEL 0x1de /* alt-delete */
#define ALT_INS 0x1df /* alt-insert */
#define CTL_UP 0x1e0 /* ctl-up arrow */
#define CTL_DOWN 0x1e1 /* ctl-down arrow */
#define CTL_TAB 0x1e2 /* ctl-tab */
#define ALT_TAB 0x1e3 /* alt-tab */
#define ALT_MINUS 0x1e4 /* alt-minus */
#define ALT_EQUAL 0x1e5 /* alt-equal */
#define ALT_HOME 0x1e6 /* alt-home */
#define ALT_PGUP 0x1e7 /* alt-pgup */
#define ALT_PGDN 0x1e8 /* alt-pgdn */
#define ALT_END 0x1e9 /* alt-end */
#define ALT_UP 0x1ea /* alt-up arrow */
#define ALT_DOWN 0x1eb /* alt-down arrow */
#define ALT_RIGHT 0x1ec /* alt-right arrow */
#define ALT_LEFT 0x1ed /* alt-left arrow */
#define ALT_ENTER 0x1ee /* alt-enter */
#define ALT_ESC 0x1ef /* alt-escape */
#define ALT_BQUOTE 0x1f0 /* alt-back quote */
#define ALT_LBRACKET 0x1f1 /* alt-left bracket */
#define ALT_RBRACKET 0x1f2 /* alt-right bracket */
#define ALT_SEMICOLON 0x1f3 /* alt-semi-colon */
#define ALT_FQUOTE 0x1f4 /* alt-forward quote */
#define ALT_COMMA 0x1f5 /* alt-comma */
#define ALT_STOP 0x1f6 /* alt-stop */
#define ALT_FSLASH 0x1f7 /* alt-forward slash */
#define ALT_BKSP 0x1f8 /* alt-backspace */
#define CTL_BKSP 0x1f9 /* ctl-backspace */
#define CTL_PAD0 0x1fa /* ctl-keypad 0 */
#define CTL_PAD1 0x1fb /* ctl-keypad 1 */
#define CTL_PAD2 0x1fc /* ctl-keypad 2 */
#define CTL_PAD3 0x1fd /* ctl-keypad 3 */
#define CTL_PAD4 0x1fe /* ctl-keypad 4 */
#define CTL_PAD5 0x1ff /* ctl-keypad 5 */
#define CTL_PAD6 0x200 /* ctl-keypad 6 */
#define CTL_PAD7 0x201 /* ctl-keypad 7 */
#define CTL_PAD8 0x202 /* ctl-keypad 8 */
#define CTL_PAD9 0x203 /* ctl-keypad 9 */
#define CTL_DEL 0x204 /* clt-delete */
#define ALT_BSLASH 0x205 /* alt-back slash */
#define CTL_ENTER 0x206 /* ctl-enter */
#define KEY_MOUSE 0x207 /* "mouse" key */
#define KEY_MAX KEY_MOUSE /* Maximum curses key */
/*----------------------------------------------------------------------
* PDCurses function declarations
*/
#ifdef ANSI
# ifdef CPLUSPLUS
extern "C" {
# endif
int addchnstr( chtype *, int );
int baudrate( void );
int beep( void );
int border( chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype );
char breakchar( void );
int can_change_color ( void );
int clearok( WINDOW*, bool );
int color_content( int, short*, short*, short* );
int copywin( WINDOW*, WINDOW*, int, int, int, int, int, int, int );
int curs_set( int );
int cursoff( void );
int curson( void );
int def_prog_mode( void );
int def_shell_mode( void );
int delay_output( int );
int delwin( WINDOW* );
WINDOW* derwin( WINDOW*, int, int, int, int );
int doupdate( void );
WINDOW* dupwin( WINDOW* );
int endwin( void );
char erasechar( void );
int fixterm( void );
int flash( void );
int flushinp( void );
int gettmode( void );
bool has_colors( void );
int hline( chtype, int );
int inchnstr( chtype *, int );
int init_color( short, short, short, short );
int init_pair( short, short, short );
WINDOW* initscr( void );
int intrflush( WINDOW*, bool );
int is_linetouched(WINDOW *,int);
int is_wintouched(WINDOW *);
char* keyname( int );
char killchar( void );
char* longname( void );
int meta( WINDOW*, bool );
int mvaddrawch( int, int, chtype );
int mvaddrawstr( int, int, char* );
int mvcur( int, int, int, int );
int mvderwin( WINDOW*, int, int );
int mvinsrawch( int, int, chtype );
int mvprintw( int, int, char*,... );
int mvscanw( int, int, char*,... );
int mvwin( WINDOW*, int, int );
int mvwinsrawch( WINDOW*, int, int, chtype );
int mvwprintw( WINDOW*, int, int, char*,... );
int mvwscanw( WINDOW*, int, int, char*,... );
WINDOW* newpad( int, int );
SCREEN* newterm( char*, FILE*, FILE* );
WINDOW* newwin( int, int, int, int );
int noraw( void );
int overlay( WINDOW*, WINDOW* );
int overwrite( WINDOW*, WINDOW* );
int pair_content( int, short*, short* );
int pnoutrefresh( WINDOW*, int, int, int, int, int, int );
int prefresh( WINDOW*, int, int, int, int, int, int );
int printw( char*,... );
int raw( void );
int refresh( void );
int reset_prog_mode( void );
int reset_shell_mode( void );
int resetterm( void );
int resetty( void );
int saveoldterm( void );
int saveterm( void );
int savetty( void );
int scanw( char*,... );
int scroll( WINDOW* );
SCREEN* set_term( SCREEN* );
int start_color( void );
WINDOW* subpad( WINDOW*, int, int, int, int );
WINDOW* subwin( WINDOW*, int, int, int, int );
int tabsize( int );
chtype termattrs( void );
char* termname( void );
int touchline( WINDOW*, int ,int );
int touchwin( WINDOW* );
int typeahead( int );
char* unctrl( chtype );
int vline( chtype, int );
int waddchnstr( WINDOW*, chtype*, int );
int waddnstr( WINDOW*, char*, int );
int waddrawstr( WINDOW*, char* );
int waddstr( WINDOW*, char* );
int wattroff( WINDOW*, chtype );
int wattron( WINDOW*, chtype );
int wattrset( WINDOW*, chtype );
int wbkgd(WINDOW*, chtype);
void wbkgdset(WINDOW*, chtype);
int wborder( WINDOW*, chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype );
int wclear( WINDOW* );
int wclrtobot( WINDOW* );
int wclrtoeol( WINDOW* );
int wdelch( WINDOW* );
int wdeleteln( WINDOW* );
int werase( WINDOW* );
int wgetch( WINDOW* );
int wgetnstr( WINDOW*, char*, int );
int wgetstr( WINDOW*, char* );
int whline( WINDOW*, chtype, int );
int winchnstr( WINDOW*, chtype*, int );
int winnstr( WINDOW*, char*, int );
int winsch( WINDOW*, chtype );
int winsdelln( WINDOW*, int );
int winsertln( WINDOW* );
int winsnstr( WINDOW*, char*, int );
int wmove( WINDOW*, int, int );
int wnoutrefresh( WINDOW* );
char wordchar( void );
int wprintw( WINDOW*, char*,... );
int wredrawln( WINDOW*, int ,int );
int wrefresh( WINDOW* );
int wscanw( WINDOW*, char*,... );
int wscrl( WINDOW*, int );
int wsetscrreg( WINDOW*, int, int );
int wtabsize( WINDOW*, int );
int wtouchln(WINDOW *, int, int, int);
int ungetch( int );
int wvline( WINDOW*, chtype, int );
#ifdef PDCURSES
int raw_output( bool );
int resize_screen( int );
WINDOW* resize_window( WINDOW*, int, int );
int win_print( WINDOW*, int );
#endif
/*
* Keep the compiler happy with our macros below...
*/
int PDC_chadd( WINDOW*, chtype, bool, bool );
int PDC_chins( WINDOW*, chtype, bool );
# ifdef CPLUSPLUS
}
# endif
#endif
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
/*
* Functions defined as macros
*/
#define addch( c ) waddch( stdscr, c )
#define addchstr( c ) addchnstr( c, -1 )
#define addstr(str) waddstr( stdscr, str )
#define addnstr(str, n) waddnstr( stdscr, str, n )
#define attroff(attr) wattroff( stdscr, attr )
#define attron(attr) wattron( stdscr, attr )
#define attrset(attr) wattrset( stdscr, attr )
#define bkgd(c) wbkgd(stdscr,c)
#define bkgdset(c) wbkgdset(stdscr,c)
#define border(ls,rs,ts,bs,tl,tr,bl,br) wborder(stdscr,ls,rs,ts,bs,tl,tr,bl,br)
#define box( w, v, h ) wborder( w, v, v, h, h, 0, 0, 0, 0 )
#define clear() (clearok( stdscr, TRUE )==ERR?ERR:wclear( stdscr ))
#define clrtobot() wclrtobot( stdscr )
#define clrtoeol() wclrtoeol( stdscr )
#define delch() wdelch( stdscr )
#define deleteln() wdeleteln( stdscr )
#define derwin(w,nl,nc,by,bx) subwin((w),(nl),(nc),(by+(w)->_begy),(bx+(w)->_begx))
#define echochar(c) (addch((chtype)c)==ERR?ERR:refresh())
#define erase() werase( stdscr )
#define getbegx(w) (w)->_begx
#define getbegy(w) (w)->_begy
#define getbegyx(w,y,x) ( y = (w)->_begy, x = (w)->_begx )
#define getch() wgetch(stdscr)
#define getmaxx(w) (w)->_maxx
#define getmaxy(w) (w)->_maxy
#define getmaxyx(w,y,x) ( y = (w)->_maxy, x = (w)->_maxx )
#define getparx(w) (w)->_parx
#define getpary(w) (w)->_pary
#define getparyx(w,y,x) ( y = (w)->_pary, x = (w)->_parx )
#define getstr(str) wgetstr( stdscr, str )
#define getyx(w,y,x) ( y = (w)->_cury, x = (w)->_curx )
#define has_colors() ((_cursvar.mono) ? FALSE : TRUE)
#define idcok(w,flag) OK
#define idlok(w,flag) OK
#define inch() (stdscr->_y[stdscr->_cury][stdscr->_curx])
#define inchstr( c ) inchnstr( c, stdscr->_maxx-stdscr->_curx )
#define innstr(str,n) winnstr(stdscr,(str),(n))
#define insch( c ) winsch( stdscr, c )
#define insdelln(n) winsdelln(stdscr,n)
#define insertln() winsertln( stdscr )
#define insnstr(s,n) winsnstr(stdscr,s,n)
#define insstr(s) winsnstr(stdscr,s,(-1))
#define instr(str) winnstr(stdscr,(str),stdscr->_maxx)
#define isendwin() ((_cursvar.alive) ? FALSE : TRUE)
#define keypad(w,flag) (w->_use_keypad = flag)
#define leaveok(w,flag) (w->_leave = flag)
#define move(y,x) wmove( stdscr, y, x )
#define mvaddch(y,x,c) (move( y, x )==ERR?ERR:addch( c ))
#define mvaddchstr(y,x,c) (move( y, x )==ERR?ERR:addchnstr( c, -1 ))
#define mvaddchnstr(y,x,c,n) (move( y, x )==ERR?ERR:addchnstr( c, n ))
#define mvaddstr(y,x,str) (move( y, x )==ERR?ERR:addstr( str ))
#define mvdelch(y,x) (move( y, x )==ERR?ERR:wdelch( stdscr ))
#define mvgetch(y,x) (move( y, x )==ERR?ERR:wgetch(stdscr))
#define mvgetstr(y,x,str) (move( y, x )==ERR?ERR:wgetstr( stdscr, str ))
#define mvinch(y,x) (move( y, x )==ERR?ERR:(stdscr->_y[y][x]))
#define mvinchstr(y,x,c) (move( y, x )==ERR?ERR:inchnstr( c, stdscr->_maxx-stdscr->_curx ))
#define mvinchnstr(y,x,c,n) (move( y, x )==ERR?ERR:inchnstr( c, n ))
#define mvinsch(y,x,c) (move( y, x )==ERR?ERR:winsch( stdscr, c ))
#define mvinsnstr(y,x,s,n) (move( y, x )==ERR?ERR:winsnstr(stdscr,s,n))
#define mvinsstr(y,x,s) (move( y, x )==ERR?ERR:winsnstr(stdscr,s,(-1)))
#define mvinstr(y,x,str) (move( y, x )==ERR?ERR:winnstr(stdscr,(str),stdscr->_maxx))
#define mvinnstr(y,x,str,n) (move( y, x )==ERR?ERR:winnstr(stdscr,(str),(n)))
#define mvwaddch(w,y,x,c) (wmove( w, y, x )==ERR?ERR:waddch( w, c ))
#define mvwaddchstr(w,y,x,c) (wmove( w, y, x )==ERR?ERR:waddchnstr( w, c, -1 ))
#define mvwaddchnstr(w,y,x,c,n) (wmove( w, y, x )==ERR?ERR:waddchnstr( w, c, n ))
#define mvwaddrawch(w,y,x,c) (wmove( w, y, x )==ERR?ERR:waddrawch( w, c ))
#define mvwaddrawstr(w,y,x,str) (wmove( w, y, x )==ERR?ERR:waddrawstr( w, str ))
#define mvwaddstr(w,y,x,str) (wmove( w, y, x )==ERR?ERR:waddstr( w, str ))
#define mvwdelch(w,y,x) (wmove( w, y, x )==ERR?ERR:wdelch( w ))
#define mvwgetch(w,y,x) (wmove( w, y, x )==ERR?ERR:wgetch( w ))
#define mvwgetstr(w,y,x,str) (wmove( w, y, x )==ERR?ERR:wgetstr( w, str ))
#define mvwinch(w,y,x) (wmove( w, y, x )==ERR?ERR:((w)->_y[y][x]))
#define mvwinchstr(w,y,x,c) (wmove( w, y, x )==ERR?ERR:winchnstr( w, c, (w)->_maxx-(w)->_curx ))
#define mvwinchnstr(w,y,x,c,n) (wmove( w, y, x )==ERR?ERR:winchnstr( w, c, n ))
#define mvwinsch(w,y,x,c) (wmove( w, y, x )==ERR?ERR:winsch( w, c ))
#define mvwinstr(w,y,x,str) (wmove( w, y, x )==ERR?ERR:winnstr(w,str,(w)->_maxx))
#define mvwinnstr(w,y,x,str,n) (wmove( w, y, x )==ERR?ERR:winnstr(w,str,n))
#define mvwinsnstr(w,y,x,s,n) (wmove( w, y, x )==ERR?ERR:winsnstr(w,s,n))
#define mvwinsstr(w,y,x,s) (wmove( w, y, x )==ERR?ERR:winsnstr(w,s,(-1)))
#define napms(ms) delay_output(ms)
#define nl() (_cursvar.autocr = TRUE)
#define nonl() (_cursvar.autocr = FALSE)
#define notimeout(w,flag) (OK)
#define pechochar(w,c) (waddch(w,(chtype)c)==ERR?ERR:prefresh(w))
#define redrawwin(w) wredrawln((w),0,(win)->_maxy)
#define refrbrk(flag) (_cursvar.refrbrk = flag)
#define refresh() wrefresh( stdscr )
#define scrl(n) wscrl(stdscr,n)
#define scroll(w) wscrl((w),1)
#define scrollok(w,flag) ((w)->_scroll = flag)
#define setscrreg(top, bot) wsetscrreg( stdscr, top, bot )
#define standend() wattrset(stdscr, A_NORMAL)
#define standout() wattrset(stdscr, A_STANDOUT)
#define touchline(w,y,n) wtouchln((w),(y),(n),TRUE)
#define touchwin(w) wtouchln((w),0,(w)->_maxy,TRUE)
#define traceoff() {trace_on = FALSE;}
#define traceon() {trace_on = TRUE;}
#define untouchwin(w) wtouchln((w),0,((w)->_maxy),FALSE)
#define waddch(w, c) PDC_chadd( w, (chtype)c, (bool)!(_cursvar.raw_out), TRUE )
#define waddchstr(w, c) (waddchnstr( w, c, -1 ) )
#define wclear(w) ( werase( w )==ERR?ERR:((w)->_clear = TRUE))
#define wechochar(w,c) (waddch(w,(chtype)c)==ERR?ERR:wrefresh(w))
#define winch(w) ((w)->_y[(w)->_cury][(w)->_curx])
#define winchstr(w, c) (winchnstr( w, c, (w)->_maxx-(w)->_curx ) )
#define winsstr(w,str) winsnstr((w),(str),(-1))
#define winstr(w,str) winnstr((w),str,(w)->_maxx)
#define wstandend(w) wattrset(w, A_NORMAL)
#define wstandout(w) wattrset(w, A_STANDOUT)
#ifndef UNIX
#define cbreak() (_cursvar.cbreak = TRUE)
#define nocbreak() (_cursvar.cbreak = FALSE)
#define crmode() (_cursvar.cbreak = TRUE)
#define nocrmode() (_cursvar.cbreak = FALSE)
#define echo() (_cursvar.echo = TRUE)
#define noecho() (_cursvar.echo = FALSE)
#define nodelay(w,flag) (w->_nodelay = flag)
#endif
#ifdef PDCURSES
#define addrawch( c ) waddrawch( stdscr, c )
#define addrawstr(str) waddrawstr( stdscr, str )
#define insrawch( c ) winsrawch( stdscr, c )
#define waddrawch(w, c) PDC_chadd( w, (chtype)c, FALSE, TRUE )
#define winsrawch(w, c) PDC_chins( w, (chtype)c, FALSE )
/*
* FYI: Need to document these functions...
*/
#define title(s,a) wtitle( stdscr, s, (chtype)a )
#define titleofs(ofs) wtitleofs( stdscr, ofs )
#define wtitle(w,s,a) (w->_title = s, w->_title_attr = (chtype)a)
#define wtitleofs(w,ofs) (w->_title_ofs = ofs)
#endif
/*
* Load up curspriv.h. This should be in the same place as
* stdlib.h. We allow anyone who defines CURSES_LIBRARY to have
* access to our internal routines. This provides quick
* PC applications at the expense of portability.
*/
#if defined (CURSES_LIBRARY) | defined( INTERNAL)
# include <curspriv.h>
# include <stdlib.h>
#endif
#endif /* __PDCURSES__ */

View File

@ -0,0 +1,324 @@
/*
***************************************************************************
* This file comprises part of PDCurses. PDCurses is Public Domain software.
* You may use this code for whatever purposes you desire. This software
* is provided AS IS with NO WARRANTY whatsoever.
* Should this software be used in another application, an acknowledgement
* that PDCurses code is used would be appreciated, but is not mandatory.
*
* Any changes which you make to this software which may improve or enhance
* it, should be forwarded to the current maintainer for the benefit of
* other users.
*
* The only restriction placed on this code is that no distribution of
* modified PDCurses code be made under the PDCurses name, by anyone
* other than the current maintainer.
*
* See the file maintain.er for details of the current maintainer.
***************************************************************************
*/
/*
$Id$
*/
#ifndef CURSOS2_INCL
#define CURSOS2_INCL 1
#ifdef CURSES__32BIT__
#if (NOVIO)
#define KbdSetStatus Kbd32SetStatus
#define KbdGetStatus Kbd32GetStatus
#define KbdCharIn Kbd32CharIn
#define KbdPeek Kbd32Peek
#define KbdFlushBuffer Kbd32FlushBuffer
#define VioGetMode Vio32GetMode
#define VioSetMode Vio32SetMode
#define VioGetCurPos Vio32GetCurPos
#define VioSetCurPos Vio32SetCurPos
#define VioGetCurType Vio32GetCurType
#define VioSetCurType Vio32SetCurType
#define VioScrollDn Vio32ScrollDn
#define VioScrollUp Vio32ScrollUp
#define VioGetConfig Vio32GetConfig
#define VioWrtTTY Vio32WrtTTY
#define VioReadCellStr Vio32ReadCellStr
#define VioWrtCellStr Vio32WrtCellStr
#define VioWrtNAttr Vio32WrtNAttr
#endif /* NOVIO */
#define FARKeyword
#define CURS_INCL_VIO_KBD
#ifdef __EMX__
# ifndef USE_OS2_H
# ifdef EMXVIDEO /* Define to use emx dos compatible video */
# include <stdlib.h>
# include <sys/video.h>
# ifdef USE_OS2_H
# undef USE_OS2_H /* And we can use the extra compile speed... */
# endif
# else
# define USE_OS2_H
# endif
# endif
# define APIENTRY
#else
# define APIRET ULONG
#endif
#else
# define FARKeyword far
# define APIRET USHORT
#ifdef USE_OS2_H
# define INCL_VIO
# define INCL_KBD
#else
# define CURS_INCL_VIO_KBD
#endif
#endif /* __32BIT__ */
#ifndef EMXVIDEO
/* if USE_OS2_H is defined then use the os2.h that comes with your compiler ...*/
#ifdef USE_OS2_H
# include <os2.h>
#else
/* ... otherwise use these definitions */
# include <os2def.h>
#endif
#ifdef CURS_INCL_VIO_KBD
typedef SHANDLE HKBD;
typedef HKBD FARKeyword * PHKBD;
typedef SHANDLE HVIO;
typedef HVIO FARKeyword * PHVIO;
typedef struct _KBDINFO {
USHORT cb;
USHORT fsMask;
USHORT chTurnAround;
USHORT fsInterim;
USHORT fsState;
}KBDINFO;
typedef KBDINFO FARKeyword *PKBDINFO;
USHORT APIENTRY KbdSetStatus(
PKBDINFO pkbdinfo,
HKBD hkbd );
USHORT APIENTRY KbdGetStatus(
PKBDINFO pkbdinfo,
HKBD hdbd );
typedef struct _KBDKEYINFO {
UCHAR chChar; /* ASCII character code */
UCHAR chScan; /* Scan Code */
UCHAR fbStatus;
UCHAR bNlsShift;
USHORT fsState;
ULONG time;
}KBDKEYINFO;
typedef KBDKEYINFO FARKeyword *PKBDKEYINFO;
#define IO_WAIT 0
#define IO_NOWAIT 1
USHORT APIENTRY KbdCharIn(
PKBDKEYINFO pkbci,
USHORT fWait, /* IO_WAIT, IO_NOWAIT */
HKBD hkbd);
USHORT APIENTRY KbdPeek(
PKBDKEYINFO pkbci,
HKBD hkbd );
USHORT APIENTRY KbdFlushBuffer(
HKBD hkbd);
typedef struct _VIOMODEINFO {
USHORT cb;
UCHAR fbType;
UCHAR color;
USHORT col; /* number of text columns */
USHORT row; /* number of text rows */
USHORT hres; /* horizontal resolution */
USHORT vres; /* vertical resolution */
UCHAR fmt_ID;
UCHAR attrib; /* number of attributes */
ULONG buf_addr;
ULONG buf_length;
ULONG full_length;
ULONG partial_length;
PCH ext_data_addr;
} VIOMODEINFO;
typedef VIOMODEINFO FARKeyword *PVIOMODEINFO;
USHORT APIENTRY VioGetMode(
PVIOMODEINFO pvioModeInfo,
HVIO hvio);
USHORT APIENTRY VioSetMode(
PVIOMODEINFO pvioModeInfo,
HVIO hvio);
USHORT APIENTRY VioGetCurPos(
PUSHORT pusRow,
PUSHORT pusColumn,
HVIO hvio );
USHORT APIENTRY VioSetCurPos(
USHORT usRow,
USHORT usColumn,
HVIO hvio);
typedef struct _VIOCURSORINFO {
USHORT yStart;
USHORT cEnd;
USHORT cx;
USHORT attr; /* -1=hidden cursor, any other=normal cursor */
} VIOCURSORINFO;
typedef VIOCURSORINFO FARKeyword *PVIOCURSORINFO;
USHORT APIENTRY VioGetCurType(
PVIOCURSORINFO pvioCursorInfo,
HVIO hvio );
USHORT APIENTRY VioSetCurType(
PVIOCURSORINFO pvioCursorInfo,
HVIO hvio );
USHORT APIENTRY VioScrollDn(
USHORT usTopRow,
USHORT usLeftCol,
USHORT usBotRow,
USHORT usRightCol,
USHORT cbLines,
PBYTE pCell,
HVIO hvio );
USHORT APIENTRY VioScrollUp(
USHORT usTopRow,
USHORT usLeftCol,
USHORT usBotRow,
USHORT usRightCol,
USHORT cbLines,
PBYTE pCell,
HVIO hvio );
/* VIOCONFIGINFO.adapter constants */
#define DISPLAY_MONOCHROME 0x0000
#define DISPLAY_CGA 0x0001
#define DISPLAY_EGA 0x0002
#define DISPLAY_VGA 0x0003
#define DISPLAY_8514A 0x0007
/* VIOCONFIGINFO.display constants */
#define MONITOR_MONOCHROME 0x0000
#define MONITOR_COLOR 0x0001
#define MONITOR_ENHANCED 0x0002
#define MONITOR_8503 0x0003
#define MONITOR_851X_COLOR 0x0004
#define MONITOR_8514 0x0009
typedef struct _VIOCONFIGINFO {
USHORT cb;
USHORT adapter;
USHORT display;
ULONG cbMemory;
USHORT Configuration;
USHORT VDHVersion;
USHORT Flags;
ULONG HWBufferSize;
ULONG FullSaveSize;
ULONG PartSaveSize;
USHORT EMAdaptersOFF;
USHORT EMDisplaysOFF;
} VIOCONFIGINFO;
typedef VIOCONFIGINFO FARKeyword *PVIOCONFIGINFO;
USHORT APIENTRY VioGetConfig(
USHORT usConfigId, /* Reserved (must be 0) */
PVIOCONFIGINFO pvioin,
HVIO hvio );
USHORT APIENTRY VioWrtTTY(
PCH pch,
USHORT cb,
HVIO hvio );
USHORT APIENTRY VioReadCellStr(
PCH pchCellStr,
PUSHORT pcb,
USHORT usRow,
USHORT usColumn,
HVIO hvio );
USHORT APIENTRY VioWrtCellStr(
PCH pchCellStr,
USHORT cb,
USHORT usRow,
USHORT usColumn,
HVIO hvio );
USHORT APIENTRY VioWrtNAttr(
PBYTE pAttr,
USHORT cb,
USHORT usRow,
USHORT usColumn,
HVIO hvio );
USHORT APIENTRY VioWrtNCell(
PBYTE pCell,
USHORT cb,
USHORT usRow,
USHORT usColumn,
HVIO hvio );
#endif
#endif
#ifndef KEYBOARD_ASCII_MODE
#define KEYBOARD_ASCII_MODE 0x0008
#endif
#ifndef KEYBOARD_BINARY_MODE
#define KEYBOARD_BINARY_MODE 0x0004
#endif
#endif /* !EMXVIDEO */

View File

@ -0,0 +1,320 @@
/*
***************************************************************************
* This file comprises part of PDCurses. PDCurses is Public Domain software.
* You may use this code for whatever purposes you desire. This software
* is provided AS IS with NO WARRANTY whatsoever.
* Should this software be used in another application, an acknowledgement
* that PDCurses code is used would be appreciated, but is not mandatory.
*
* Any changes which you make to this software which may improve or enhance
* it, should be forwarded to the current maintainer for the benefit of
* other users.
*
* The only restriction placed on this code is that no distribution of
* modified PDCurses code be made under the PDCurses name, by anyone
* other than the current maintainer.
*
* See the file maintain.er for details of the current maintainer.
***************************************************************************
*/
/*
$Id$
*/
/*
*
* CURSPRIV.H
*
* Header file for definitions and declarations for the
* PDCurses package. These definitions should not be generally
* accessible to programmers, but are provided if the applications
* programmer decides to make the decision in favor of speed on a
* PC over portability.
*
* Revision History:
* Frotz 1.5Beta 900714 Added many levels of compiler support.
* Added mixed prototypes for all "internal" routines.
* Removed all assembly language. Added EGA/VGA
* support. Converted all #ifdef to #if in all
* modules except CURSES.H and CURSPRIV.H.
* Always include ASSERT.H. Added support for an
* external malloc(), calloc() and free().
* Added support for FAST_VIDEO (direct-memory writes).
* Added various memory model support (for FAST_VIDEO).
* Added much of the December 1988 X/Open Curses
* specification.
* bl 1.3 881005 All modules lint-checked with MSC '-W3' and turbo'C'
* '-w -w-pro' switches.
* bl 1.2 881002 Support (by #ifdef UCMASM) for uppercase-only
* assembly routine names. If UCMASM if defined,
* all assembler names are #defined as upper case.
* Not needed if you do "MASM /MX. Also missing
* declaration of cursesscroll(). Fixes thanks to
* N.D. Pentcheff
* bl 1.1 880306 Add _chadd() for raw output routines.
* bl 1.0 870515 Release.
*
*/
#ifndef __CURSES_INTERNALS__
#define __CURSES_INTERNALS__
/* Always include... */
#include <assert.h>
/*----------------------------------------------------------------------
* MEMORY MODEL SUPPORT:
*
* MODELS
* TINY cs,ds,ss all in 1 segment (not enough memory!)
* SMALL cs:1 segment, ds:1 segment
* MEDIUM cs:many segments ds:1 segment
* COMPACT cs:1 segment, ds:many segments
* LARGE cs:many segments ds:many segments
* HUGE cs:many segments ds:segments > 64K
*/
#ifdef __TINY__
# define SMALL 1
#endif
#ifdef __SMALL__
# define SMALL 1
#endif
#ifdef __MEDIUM__
# define MEDIUM 1
#endif
#ifdef __COMPACT__
# define COMPACT 1
#endif
#ifdef __LARGE__
# define LARGE 1
#endif
#ifdef __HUGE__
# define HUGE 1
#endif
/*----------------------------------------------------------------------
* OPERATING SYSTEM SUPPORT:
*
* DOS The one we all know and love:-}
* OS/2 The new kid on the block.
* FLEXOS A Real-time, protected-mode OS from
* Digital Research, Inc.
* (AKA, the 4680 from IBM...)
*/
/*----------------------------------------*/
/*----------------------------------------------------------------------
* MALLOC DEBUGGING SUPPORT:
*
* Set EMALLOC and EMALLOC_MAGIC in order to use your private
* versions of malloc(), calloc(), and free(). This can help,
* but not solve, your malloc problems when debugging...
*
*/
#ifndef INTERNAL
# define EMALLOC 0 /* Disable External Malloc */
#else
# define EMALLOC 0 /* Enable/Disable External Malloc */
# define EMALLOC_MAGIC 0x0C0C /* Our magic indicator that we should */
/* use our external malloc rather than */
/* the runtime's malloc. */
#endif
/*----------------------------------------------------------------------*/
/* window properties */
#define _SUBWIN 0x01 /* window is a subwindow */
#define _ENDLINE 0x02 /* last winline is last screen line */
#define _FULLWIN 0x04 /* window fills screen */
#define _SCROLLWIN 0x08 /* window lwr rgt is screen lwr rgt */
#define _PAD 0x10 /* X/Open Pad. */
#define _SUBPAD 0x20 /* X/Open subpad. */
/*----------------------------------------------------------------------*/
/* Miscellaneous */
#define _INBUFSIZ 512 /* size of terminal input buffer */
#define _NO_CHANGE -1 /* flags line edge unchanged */
/* @@@ THESE SHOULD BE INDIVIDUAL FUNCTIONS, NOT MACROS! */
#define _BCHAR 0x03 /* Break char (^C) */
#define _ECHAR 0x08 /* Erase char (^H) */
#define _DWCHAR 0x17 /* Delete Word char (^W) */
#define _DLCHAR 0x15 /* Delete Line char (^U) */
#define _GOCHAR 0x11 /* ^Q character */
#define _PRINTCHAR 0x10 /* ^P character */
#define _STOPCHAR 0x13 /* ^S character */
#define NUNGETCH 20 /* max # chars to ungetch() */
/* Setmode stuff */
struct cttyset
{
bool been_set;
SCREEN saved;
};
extern struct cttyset c_sh_tty; /* tty modes for shell_mode */
extern struct cttyset c_pr_tty; /* tty modes for prog_mode */
extern struct cttyset c_save_tty;
extern struct cttyset c_save_trm;
/* Printscan stuff */
extern char c_printscanbuf[]; /* buffer used during I/O */
/* tracing flag */
extern bool trace_on;
/* Strget stuff */
extern char* c_strbeg;
/* doupdate stuff */
extern WINDOW* twin; /* used by many routines */
/* Monitor (terminal) type information */
#define _NONE 0x00
#define _MDA 0x01
#define _CGA 0x02
#define _EGACOLOR 0x04
#define _EGAMONO 0x05
#define _VGACOLOR 0x07
#define _VGAMONO 0x08
#define _MCGACOLOR 0x0a
#define _MCGAMONO 0x0b
#define _FLEXOS 0x20 /* A Flexos console */
#define _MDS_GENIUS 0x30
#define _UNIX_COLOR 0x40
#define _UNIX_MONO 0x41
/* Text-mode font size information */
#define _FONT8 8
#define _FONT14 14
#define _FONT15 15 /* GENIUS */
#define _FONT16 16
/*----------------------------------------------------------------------
* ANSI C prototypes. Be sure that your compiler conditional
* compilation definitions above define ANSI to be non-zero
* if you compiler supports prototypes.
*/
#ifdef ANSI
# ifdef CPLUSPLUS
extern "C" {
# endif
int PDC_backchar( WINDOW*, char*, int* );
bool PDC_breakout( void );
int PDC_chadd( WINDOW*, chtype, bool, bool );
bool PDC_check_bios_key( void );
int PDC_chg_attr( WINDOW*, chtype, int, int, int, int );
int PDC_chins( WINDOW*, chtype, bool );
int PDC_clr_scrn( WINDOW* );
int PDC_clr_update( WINDOW* );
int PDC_copy_win( WINDOW *,WINDOW *,int,int,int,int,int,int,int,int,bool );
int PDC_cursor_off( void );
int PDC_cursor_on( void );
int PDC_fix_cursor( int );
int PDC_gattr( void );
int PDC_get_bios_key( void );
int PDC_get_columns( void );
bool PDC_get_ctrl_break( void );
int PDC_get_cur_col( void );
int PDC_get_cur_row( void );
int PDC_get_cursor_pos( int*, int* );
int PDC_get_cursor_mode( void );
int PDC_get_font( void );
int PDC_get_rows( void );
int PDC_gotoxy( int, int );
int PDC_init_atrtab(void);
WINDOW* PDC_makenew( int, int, int, int );
int PDC_newline( WINDOW*, int );
int PDC_print( int, int, int );
int PDC_putc( chtype, chtype );
int PDC_putchar( chtype );
int PDC_putctty( chtype, chtype );
int PDC_rawgetch( void );
int PDC_sanity_check( int );
int PDC_scr_close( void );
int PDC_scr_open( SCREEN*, bool );
int PDC_scroll( int, int, int, int, int, chtype );
int PDC_set_80x25( void );
int PDC_set_ctrl_break( bool );
int PDC_set_cursor_mode( int, int );
int PDC_set_font( int );
int PDC_set_rows( int );
int PDC_split_plane( WINDOW*, char*, char*, int, int, int, int );
int PDC_sysgetch( void );
bool PDC_transform_line( int );
void PDC_usleep( long );
int PDC_validchar( int );
#if defined( OS2 ) && !defined( EMXVIDEO )
VIOCONFIGINFO PDC_query_adapter_type( void );
VIOMODEINFO PDC_get_scrn_mode( void );
int PDC_set_scrn_mode( VIOMODEINFO );
bool PDC_scrn_modes_equal (VIOMODEINFO, VIOMODEINFO);
#else
int PDC_query_adapter_type( void );
int PDC_get_scrn_mode( void );
int PDC_set_scrn_mode( int );
bool PDC_scrn_modes_equal (int, int);
#endif
#ifdef FLEXOS
int PDC_flexos_8bitmode( void );
int PDC_flexos_16bitmode( void );
char* PDC_flexos_gname( void );
#endif
#ifdef UNIX
int PDC_kbhit(void);
int PDC_setup_keys(void);
#endif
#if defined (XCURSES)
int XCurses_redraw_curscr(void);
int XCurses_display_cursor(int,int ,chtype ,int ,int ,chtype );
int XCurses_rawgetch(void);
bool XCurses_kbhit(void);
int XCurses_instruct(int);
int XCurses_transform_line(long *, int , int , int );
int Xinitscr(void);
int Xendwin(void);
#endif
#ifdef PDCDEBUG
void PDC_debug( char*,... );
#endif
#ifdef REGISTERWINDOWS
bool PDC_inswin( WINDOW*, WINDOW* );
int PDC_addtail( WINDOW* );
int PDC_addwin( WINDOW*, WINDOW* );
int PDC_rmwin( WINDOW* );
WINDS* PDC_findwin( WINDOW* );
#endif
# ifdef CPLUSPLUS
}
# endif
#endif
#define PDC_COLOR_PAIRS 64
#define PDC_OFFSET 8
#define MAX_ATRTAB 272
#define chtype_attr(ch) ((atrtab[((ch >> 8) & 0xFF)] << 8) & A_ATTRIBUTES)
#include<menuet/os.h>
#include<menuet/textcon.h>
#endif /* __CURSES_INTERNALS__*/

View File

@ -0,0 +1,83 @@
/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_debug_dbgcom_h_
#define __dj_include_debug_dbgcom_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
#include <setjmp.h>
#include <debug/tss.h>
typedef struct {
unsigned long app_base; /* linear base address of application */
unsigned long dr[8]; /* debug registers, set when a_tss runs */
} ExternalDebuggerInfo;
extern ExternalDebuggerInfo edi;
/* structure of FPU state */
/* 14 bytes for FPU env */
/* plus 8*10 bytes from the FPU stack */
/* r[8] is the array as defined in intel docs */
/* st0 is r[top] */
#define NPX_TOP_MASK 0x3800
#define NPX_TOP_SHIFT 11
typedef struct {
unsigned short sig0;
unsigned short sig1;
unsigned short sig2;
unsigned short sig3;
unsigned short exponent:15;
unsigned short sign:1;
} NPXREG;
typedef struct {
unsigned long control;
unsigned long status;
unsigned long tag;
unsigned long eip;
unsigned long cs;
unsigned long dataptr;
unsigned long datasel;
NPXREG reg[8];
long double st[8];
char st_valid[8];
long double mmx[8];
char in_mmx_mode;
char top;
} NPX;
extern NPX npx;
void save_npx (void); /* Save the FPU of the debugged program */
void load_npx (void); /* Restore the FPU of the debugged program */
void run_child(void);
int read_child(unsigned child_addr, void *buf, unsigned len);
int write_child(unsigned child_addr, void *buf, unsigned len);
void edi_init(jmp_buf start_state);
void cleanup_client(void);
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_debug_dbgcom_h_ */

View File

@ -0,0 +1,55 @@
/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_debug_redir_h_
#define __dj_include_debug_redir_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
/* How many handles do we track.
WARNING: if you change this, you need to recompile dbgredir.c !!! */
#define DBG_HANDLES 3
/* Describe a single redirected handle.
Actually only inf_handle and our_handle are currently used (and
even they could share the same slot), but I'm keeping the rest,
mostly because they might be useful for applications. */
struct dbg_redirect {
int inf_handle;
int our_handle;
char *file_name;
int mode;
off_t filepos;
};
/* cmdline_parse_args processes command lines into the following structure: */
typedef struct _cmdline {
char *command; /* command line with redirection removed */
int redirected; /* 1 if handles redirected for child */
struct dbg_redirect **redirection;/* info about redirected handles */
} cmdline_t;
extern void redir_cmdline_delete (cmdline_t *);
extern int redir_cmdline_parse (const char *, cmdline_t *);
extern int redir_to_child (cmdline_t *);
extern int redir_to_debugger (cmdline_t *);
extern int redir_debug_init (cmdline_t *);
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_debug_dbgcom_h_ */

View File

@ -0,0 +1,76 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_debug_stab_h_
#define __dj_include_debug_stab_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
/* This is file STAB.H */
/*
** Copyright (C) 1993 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
**
** This file is distributed under the terms listed in the document
** "copying.dj", available from DJ Delorie at the address above.
** A copy of "copying.dj" should accompany this file; if not, a copy
** should be available from where this file was obtained. This file
** may not be distributed without a verbatim copy of "copying.dj".
**
** This file is distributed WITHOUT ANY WARRANTY; without even the implied
** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#if !defined (N_UNDF)
#define N_UNDF 0
#endif
#if !defined (N_ABS)
#define N_ABS 2
#endif
#if !defined (N_TEXT)
#define N_TEXT 4
#endif
#if !defined (N_DATA)
#define N_DATA 6
#endif
#if !defined (N_BSS)
#define N_BSS 8
#endif
#if !defined (N_FN)
#define N_FN 15
#endif
#if !defined (N_EXT)
#define N_EXT 1
#endif
#if !defined (N_TYPE)
#define N_TYPE 0x1e
#endif
#if !defined (N_STAB)
#define N_STAB 0xe0
#endif
#if !defined (N_SO)
#define N_SO 0x64
#endif
#if !defined (N_SLINE)
#define N_SLINE 0x44
#endif
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_debug_stab_h_ */

View File

@ -0,0 +1,65 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_debug_syms_h_
#define __dj_include_debug_syms_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
/* This is file SYMS.H */
/*
** Copyright (C) 1993 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
**
** This file is distributed under the terms listed in the document
** "copying.dj", available from DJ Delorie at the address above.
** A copy of "copying.dj" should accompany this file; if not, a copy
** should be available from where this file was obtained. This file
** may not be distributed without a verbatim copy of "copying.dj".
**
** This file is distributed WITHOUT ANY WARRANTY; without even the implied
** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef _SYMS_H_
#define _SYMS_H_
void syms_init(char *fname);
void syms_list(int byval);
unsigned long syms_name2val(const char *name);
char *syms_val2name(unsigned long val, unsigned long *delta);
char *syms_val2line(unsigned long val, int *lineret, int exact);
char *syms_module(int no);
unsigned long syms_line2val(char *filename, int lnum);
void syms_listwild(char *pattern,
void (*handler)(unsigned long addr, char type_c, char *name, char *name2, int lnum));
extern int undefined_symbol;
extern int syms_printwhy;
#define N_INDR 0x0a
#define N_SETA 0x14 /* Absolute set element symbol */
#define N_SETT 0x16 /* Text set element symbol */
#define N_SETD 0x18 /* Data set element symbol */
#define N_SETB 0x1A /* Bss set element symbol */
#define N_SETV 0x1C /* Pointer to set vector in data area. */
#endif
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_debug_syms_h_ */

View File

@ -0,0 +1,72 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_debug_tss_h_
#define __dj_include_debug_tss_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
typedef struct TSS {
unsigned short tss_back_link;
unsigned short res0;
unsigned long tss_esp0;
unsigned short tss_ss0;
unsigned short res1;
unsigned long tss_esp1;
unsigned short tss_ss1;
unsigned short res2;
unsigned long tss_esp2;
unsigned short tss_ss2;
unsigned short res3;
unsigned long tss_cr3;
unsigned long tss_eip;
unsigned long tss_eflags;
unsigned long tss_eax;
unsigned long tss_ecx;
unsigned long tss_edx;
unsigned long tss_ebx;
unsigned long tss_esp;
unsigned long tss_ebp;
unsigned long tss_esi;
unsigned long tss_edi;
unsigned short tss_es;
unsigned short res4;
unsigned short tss_cs;
unsigned short res5;
unsigned short tss_ss;
unsigned short res6;
unsigned short tss_ds;
unsigned short res7;
unsigned short tss_fs;
unsigned short res8;
unsigned short tss_gs;
unsigned short res9;
unsigned short tss_ldt;
unsigned short res10;
unsigned short tss_trap;
unsigned char tss_iomap;
unsigned char tss_irqn;
unsigned long tss_error;
} TSS;
extern TSS a_tss;
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_debug_tss_h_ */

View File

@ -0,0 +1,48 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_debug_v2load_h_
#define __dj_include_debug_v2load_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
#include <setjmp.h>
typedef struct {
unsigned first_addr;
unsigned last_addr;
} AREAS;
typedef enum {
A_text,
A_data,
A_bss,
A_arena,
A_stack
} AREA_TYPES;
#define areas _v2load_areas
#define MAX_AREA 5
extern AREAS areas[MAX_AREA];
int v2loadimage(const char *program, const char *cmdline, jmp_buf load_state);
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_debug_v2load_h_ */

View File

@ -0,0 +1,28 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_debug_wild_h_
#define __dj_include_debug_wild_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
int wild(char *pattern, char *string);
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_debug_wild_h_ */

View File

@ -0,0 +1,92 @@
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_dir_h_
#define __dj_include_dir_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
/* ffblk is also enhanced for LFNs; the dos 21 byte reserved area is used to
hold the extra information. Fields marked LFN are only valid if the magic
is set to LFN32 */
/* This is for g++ 2.7.2 and below */
#pragma pack(push,1)
struct ffblk {
char lfn_magic[6]; /* LFN */
short lfn_handle; /* LFN */
unsigned short lfn_ctime; /* LFN */
unsigned short lfn_cdate; /* LFN */
unsigned short lfn_atime; /* LFN */
unsigned short lfn_adate; /* LFN */
char _ff_reserved[5];
unsigned char ff_attrib;
unsigned short ff_ftime;
unsigned short ff_fdate;
unsigned long ff_fsize;
char ff_name[260];
};
struct ffblklfn {
unsigned long fd_attrib;
unsigned long long fd_ctime;
unsigned long long fd_atime;
unsigned long long fd_mtime;
unsigned long fd_sizehi;
unsigned long fd_size;
unsigned long long fd_reserved;
char fd_longname[260];
char fd_name[14];
};
#pragma pack(pop)
#define FA_RDONLY 1
#define FA_HIDDEN 2
#define FA_SYSTEM 4
#define FA_LABEL 8
#define FA_DIREC 16
#define FA_ARCH 32
/* for fnmerge/fnsplit */
#define MAXPATH 260
#define MAXDRIVE 3
#define MAXDIR 256
#define MAXFILE 256
#define MAXEXT 255
#define WILDCARDS 0x01
#define EXTENSION 0x02
#define FILENAME 0x04
#define DIRECTORY 0x08
#define DRIVE 0x10
int __file_tree_walk(const char *_dir, int (*_fn)(const char *_path, const struct ffblk *_ff));
int findfirst(const char *_pathname, struct ffblk *_ffblk, int _attrib);
int findnext(struct ffblk *_ffblk);
void fnmerge (char *_path, const char *_drive, const char *_dir, const char *_name, const char *_ext);
int fnsplit (const char *_path, char *_drive, char *_dir, char *_name, char *_ext);
int getdisk(void);
char * searchpath(const char *_program);
int setdisk(int _drive);
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_dir.h_ */

View File

@ -0,0 +1,28 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_direct_h_
#define __dj_include_direct_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
#include <dirent.h>
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_direct_h_ */

View File

@ -0,0 +1,62 @@
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_dirent_h_
#define __dj_include_dirent_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
/* Definition of DIR requires many other headers; not included here to
avoid namespace pollution. */
//typedef struct __dj_DIR DIR;
#include <menuet/os.h>
struct dirent {
char d_namlen;
char d_name[256];
};
typedef struct
{
struct systree_info2 fileinfo;
struct dirent entry;
__u8 bdfeheader[0x20];
struct bdfe_item bdfebase;
__u8 bdfename[264];
} DIR;
int closedir(DIR *dirp);
DIR * opendir(const char *_dirname);
struct dirent * readdir(DIR *_dirp);
//void rewinddir(DIR *_dirp);
#ifndef _POSIX_SOURCE
extern int __opendir_flags; /* default is zero, used only by opendir */
#define __OPENDIR_PRESERVE_CASE 0001
#define __OPENDIR_FIND_HIDDEN 0002 /* ignored; on by default */
#define __OPENDIR_FIND_LABEL 0004
#define __OPENDIR_NO_HIDDEN 0x08 /* NOT 0002 for back-compatibility */
void seekdir(DIR *_dir, long _loc);
long telldir(DIR *_dir);
void __set_need_fake_dot_dotdot(DIR *_dir);
void _lfn_find_close(int _handle);
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_dirent_h_ */

View File

@ -0,0 +1,275 @@
/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_dos_h_
#define __dj_include_dos_h_
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
#include <pc.h>
int _detect_80387(void);
struct DWORDREGS {
unsigned long edi;
unsigned long esi;
unsigned long ebp;
unsigned long cflag;
unsigned long ebx;
unsigned long edx;
unsigned long ecx;
unsigned long eax;
unsigned short eflags;
};
struct DWORDREGS_W {
unsigned long di;
unsigned long si;
unsigned long bp;
unsigned long cflag;
unsigned long bx;
unsigned long dx;
unsigned long cx;
unsigned long ax;
unsigned short flags;
};
struct WORDREGS {
unsigned short di, _upper_di;
unsigned short si, _upper_si;
unsigned short bp, _upper_bp;
unsigned short cflag, _upper_cflag;
unsigned short bx, _upper_bx;
unsigned short dx, _upper_dx;
unsigned short cx, _upper_cx;
unsigned short ax, _upper_ax;
unsigned short flags;
};
struct BYTEREGS {
unsigned short di, _upper_di;
unsigned short si, _upper_si;
unsigned short bp, _upper_bp;
unsigned long cflag;
unsigned char bl;
unsigned char bh;
unsigned short _upper_bx;
unsigned char dl;
unsigned char dh;
unsigned short _upper_dx;
unsigned char cl;
unsigned char ch;
unsigned short _upper_cx;
unsigned char al;
unsigned char ah;
unsigned short _upper_ax;
unsigned short flags;
};
union REGS { /* Compatible with DPMI structure, except cflag */
struct DWORDREGS d;
#ifdef _NAIVE_DOS_REGS
struct WORDREGS x;
#else
#ifdef _BORLAND_DOS_REGS
struct DWORDREGS x;
#else
struct DWORDREGS_W x;
#endif
#endif
struct WORDREGS w;
struct BYTEREGS h;
};
struct SREGS {
unsigned short es;
unsigned short ds;
unsigned short fs;
unsigned short gs;
unsigned short cs;
unsigned short ss;
};
struct ftime {
unsigned ft_tsec:5; /* 0-29, double to get real seconds */
unsigned ft_min:6; /* 0-59 */
unsigned ft_hour:5; /* 0-23 */
unsigned ft_day:5; /* 1-31 */
unsigned ft_month:4; /* 1-12 */
unsigned ft_year:7; /* since 1980 */
};
struct date {
short da_year;
char da_day;
char da_mon;
};
struct time {
unsigned char ti_min;
unsigned char ti_hour;
unsigned char ti_hund;
unsigned char ti_sec;
};
struct dfree {
unsigned df_avail;
unsigned df_total;
unsigned df_bsec;
unsigned df_sclus;
};
#ifdef __cplusplus
extern "C" {
#endif
extern unsigned short _osmajor, _osminor;
extern const char * _os_flavor;
extern int _doserrno;
unsigned short _get_dos_version(int);
int int86(int ivec, union REGS *in, union REGS *out);
int int86x(int ivec, union REGS *in, union REGS *out, struct SREGS *seg);
int intdos(union REGS *in, union REGS *out);
int intdosx(union REGS *in, union REGS *out, struct SREGS *seg);
int bdos(int func, unsigned dx, unsigned al);
int bdosptr(int func, void *dx, unsigned al);
#define bdosptr(a, b, c) bdos(a, (unsigned)(b), c)
#define intdos(a, b) int86(0x21, a, b)
#define intdosx(a, b, c) int86x(0x21, a, b, c)
int getftime(int handle, struct ftime *ftimep);
int setftime(int handle, struct ftime *ftimep);
int getcbrk(void);
int setcbrk(int new_value);
void getdate(struct date *);
/* void gettime(struct time *); */
void setdate(struct date *);
void settime(struct time *);
void getdfree(unsigned char drive, struct dfree *ptr);
void delay(unsigned msec);
/* int _get_default_drive(void);
void _fixpath(const char *, char *); */
/*
* For compatibility with other DOS C compilers.
*/
#define _A_NORMAL 0x00 /* Normal file - No read/write restrictions */
#define _A_RDONLY 0x01 /* Read only file */
#define _A_HIDDEN 0x02 /* Hidden file */
#define _A_SYSTEM 0x04 /* System file */
#define _A_VOLID 0x08 /* Volume ID file */
#define _A_SUBDIR 0x10 /* Subdirectory */
#define _A_ARCH 0x20 /* Archive file */
#define _enable enable
#define _disable disable
struct _dosdate_t {
unsigned char day; /* 1-31 */
unsigned char month; /* 1-12 */
unsigned short year; /* 1980-2099 */
unsigned char dayofweek; /* 0-6, 0=Sunday */
};
#define dosdate_t _dosdate_t
struct _dostime_t {
unsigned char hour; /* 0-23 */
unsigned char minute; /* 0-59 */
unsigned char second; /* 0-59 */
unsigned char hsecond; /* 0-99 */
};
#define dostime_t _dostime_t
#pragma pack(push,1)
struct _find_t {
char reserved[21];
unsigned char attrib;
unsigned short wr_time;
unsigned short wr_date;
unsigned long size;
char name[256];
};
#pragma pack(pop)
#define find_t _find_t
struct _diskfree_t {
unsigned short total_clusters;
unsigned short avail_clusters;
unsigned short sectors_per_cluster;
unsigned short bytes_per_sector;
};
#define diskfree_t _diskfree_t
struct _DOSERROR {
int exterror;
#ifdef __cplusplus
char errclass;
#else
char class;
#endif
char action;
char locus;
};
#define DOSERROR _DOSERROR
unsigned int _dos_creat(const char *_filename, unsigned int _attr, int *_handle);
unsigned int _dos_creatnew(const char *_filename, unsigned int _attr, int *_handle);
unsigned int _dos_open(const char *_filename, unsigned int _mode, int *_handle);
unsigned int _dos_write(int _handle, const void *_buffer, unsigned int _count, unsigned int *_result);
unsigned int _dos_read(int _handle, void *_buffer, unsigned int _count, unsigned int *_result);
unsigned int _dos_close(int _handle);
unsigned int _dos_commit(int _handle);
unsigned int _dos_findfirst(char *_name, unsigned int _attr, struct _find_t *_result);
unsigned int _dos_findnext(struct _find_t *_result);
void _dos_getdate(struct _dosdate_t *_date);
unsigned int _dos_setdate(struct _dosdate_t *_date);
void _dos_gettime(struct _dostime_t *_time);
unsigned int _dos_settime(struct _dostime_t *_time);
unsigned int _dos_getftime(int _handle, unsigned int *_p_date, unsigned int *_p_time);
unsigned int _dos_setftime(int _handle, unsigned int _date, unsigned int _time);
unsigned int _dos_getfileattr(const char *_filename, unsigned int *_p_attr);
unsigned int _dos_setfileattr(const char *_filename, unsigned int _attr);
void _dos_getdrive(unsigned int *_p_drive);
void _dos_setdrive(unsigned int _drive, unsigned int *_p_drives);
unsigned int _dos_getdiskfree(unsigned int _drive, struct _diskfree_t *_diskspace);
int _dosexterr(struct _DOSERROR *_p_error);
#define dosexterr(_ep) _dosexterr(_ep)
#define int386(_i, _ir, _or) int86(_i, _ir, _or)
#define int386x(_i, _ir, _or, _sr) int86x(_i, _ir, _or, _sr)
#ifdef __cplusplus
}
#endif
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifndef _USE_LFN
#define _USE_LFN (1)
#endif
#endif /* !__dj_include_dos_h_ */

View File

@ -0,0 +1,85 @@
#ifndef __EFMT_H
#define __EFMT_H
#ifndef __PACKED__
#define __PACKED__ __attribute__((packed))
#endif
typedef struct
{
unsigned long magic __PACKED__;
unsigned char bitness __PACKED__;
unsigned char endian __PACKED__;
unsigned char elf_ver_1 __PACKED__;
unsigned char res[9] __PACKED__;
unsigned short file_type __PACKED__;
unsigned short machine __PACKED__;
unsigned long elf_ver_2 __PACKED__;
unsigned long entry_pt __PACKED__;
unsigned long phtab_offset __PACKED__;
unsigned long shtab_offset __PACKED__;
unsigned long flags __PACKED__;
unsigned short file_hdr_size __PACKED__;
unsigned short phtab_ent_size __PACKED__;
unsigned short num_phtab_ents __PACKED__;
unsigned short shtab_ent_size __PACKED__;
unsigned short num_sects __PACKED__;
unsigned short shstrtab_index __PACKED__;
} elf_file_t;
typedef struct
{
unsigned long sect_name __PACKED__;
unsigned long type __PACKED__;
unsigned long flags __PACKED__;
unsigned long virt_adr __PACKED__;
unsigned long offset __PACKED__;
unsigned long size __PACKED__;
unsigned long link __PACKED__;
unsigned long info __PACKED__;
unsigned long align __PACKED__;
unsigned long ent_size __PACKED__;
} elf_sect_t;
typedef struct
{
unsigned long adr __PACKED__;
unsigned char type __PACKED__;
unsigned long symtab_index:24 __PACKED__;
unsigned long addend __PACKED__;
} elf_reloc_t;
typedef struct
{
unsigned long name __PACKED__;
unsigned long value __PACKED__;
unsigned long size __PACKED__;
unsigned type:4 __PACKED__;
unsigned binding:4 __PACKED__;
unsigned char zero __PACKED__;
unsigned short section __PACKED__;
} elf_sym_t;
typedef struct
{
unsigned char * file, * sects,*bss,*symtab;
char * strtab;
unsigned long bss_sect_num,entry;
} exe_file_t;
int get_elf_section_name(exe_file_t * f,unsigned short sect_num,char * namebuf);
int get_elf_section_addr(exe_file_t * f,unsigned short sect_num,unsigned long * adr);
int get_elf_symbol_addr(exe_file_t * f,unsigned long i,
unsigned long * sym_val,unsigned short sect_num,
int (* lookup_fn)(char * symname,unsigned long * val));
int do_elf_relocation(exe_file_t * f,elf_reloc_t * reloc,
unsigned short sect_num,unsigned long symtab_sect_num,
int (* sym_lookup_fn)(char * symname,unsigned long * val),int ignore_ext);
int get_elf_section_index(exe_file_t * f,char * sect_name,unsigned long * i);
int elf_load_from_mem(exe_file_t * f);
int relocate_elf_file(exe_file_t * f,
int (* sym_lookup_fn)(char * symname,unsigned long * val),int ignore_ext);
int get_elf_symbol_value(exe_file_t * f,char * symname,unsigned long * symval);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
#ifndef __EMULAYER_FS_H
#define __EMULAYER_FS_H
#include<sys/stat.h>
#include<fcntl.h>
#define MAX_EMUFS_HANDLES 64
typedef struct __emu_FILE emu_FILE;
typedef struct {
int (* read)(emu_FILE * filp,unsigned long size,char * buf);
int (* write)(emu_FILE * filp,unsigned long size,char * buf);
int (* seek)(emu_FILE * filp,int offset,int whence);
int (* open)(emu_FILE * filp);
int (* close)(emu_FILE * filp);
int (* stat)(emu_FILE * filp,struct stat * statp);
int (* sync)(emu_FILE * filp);
} emu_FILE_operations_t;
struct __emu_FILE
{
int f_handle;
char * f_path;
unsigned long f_pos;
unsigned long f_size;
int f_flags;
int f_mode;
emu_FILE_operations_t * f_op;
void * f_priv;
};
struct __emu_VMOUNT
{
char * mpnt;
int (* preopen_file)(emu_FILE * filp);
struct __emu_VMOUNT * m_next;
};
void init_emufs(void);
struct __emu_VMOUNT * EMU_find_best_mount(char * fpath);
extern emu_FILE * EMU_file_table[MAX_EMUFS_HANDLES];
emu_FILE * EMU_get_empty_filp(char * forpath);
void EMU_put_filp(int h);
int EMU_open(const char * fname,int mode);
int EMU_close(int handle);
int EMU_read(int handle,char * buf,int count);
int EMU_write(int handle,char * buf,int count);
int EMU_lseek(int handle,int off,int whence);
int EMU_fstat(int handle, struct stat *statbuf);
int EMU_filelength(int fp);
int EMU_flush(int fp);
#endif

View File

@ -0,0 +1 @@
void init_emu_layer(void);

View File

@ -0,0 +1,29 @@
#ifndef _ENDIAN_H
#define _ENDIAN_H 1
#include <features.h>
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321
#define __PDP_ENDIAN 3412
#include <bits/endian.h>
#ifndef __FLOAT_WORD_ORDER
#define __FLOAT_WORD_ORDER __BYTE_ORDER
#endif
#ifdef __USE_BSD
#define LITTLE_ENDIAN __LITTLE_ENDIAN
#define BIG_ENDIAN __BIG_ENDIAN
#define PDP_ENDIAN __PDP_ENDIAN
#define BYTE_ORDER __BYTE_ORDER
#endif
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define __LONG_LONG_PAIR(HI, LO) LO, HI
#elif __BYTE_ORDER == __BIG_ENDIAN
#define __LONG_LONG_PAIR(HI, LO) HI, LO
#endif
#endif

View File

@ -0,0 +1,78 @@
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_errno_h_
#define __dj_include_errno_h_
#ifdef __cplusplus
extern "C" {
#endif
#include<dos.h>
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#define EDOM 1
#define ERANGE 2
extern int errno;
#ifndef __STRICT_ANSI__
#define E2BIG 3
#define EACCES 4
#define EAGAIN 5
#define EBADF 6
#define EBUSY 7
#define ECHILD 8
#define EDEADLK 9
#define EEXIST 10
#define EFAULT 11
#define EFBIG 12
#define EINTR 13
#define EINVAL 14
#define EIO 15
#define EISDIR 16
#define EMFILE 17
#define EMLINK 18
#define ENAMETOOLONG 19
#define ENFILE 20
#define ENODEV 21
#define ENOENT 22
#define ENOEXEC 23
#define ENOLCK 24
#define ENOMEM 25
#define ENOSPC 26
#define ENOSYS 27
#define ENOTDIR 28
#define ENOTEMPTY 29
#define ENOTTY 30
#define ENXIO 31
#define EPERM 32
#define EPIPE 33
#define EROFS 34
#define ESPIPE 35
#define ESRCH 36
#define EXDEV 37
#ifndef _POSIX_SOURCE
#define ENMFILE 38
extern char * sys_errlist[];
extern int sys_nerr;
extern const char * __sys_errlist[];
extern int __sys_nerr;
extern int _doserrno;
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_errno_h_ */

View File

@ -0,0 +1,120 @@
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_fcntl_h_
#define __dj_include_fcntl_h_
#ifdef __cplusplus
extern "C" {
#endif
#define FD_CLOEXEC 0x0001
#define F_DUPFD 1
#define F_GETFD 2
#define F_GETFL 3
#define F_GETLK 4
#define F_SETFD 5
#define F_SETFL 6
#define F_SETLK 7
#define F_SETLKW 8
#define F_UNLCK 0
#define F_RDLCK 1
#define F_WRLCK 2
#define O_RDONLY 0x0000
#define O_WRONLY 0x0001
#define O_RDWR 0x0002
#define O_ACCMODE 0x0003
#define O_BINARY 0x0004 /* must fit in char, reserved by dos */
#define O_TEXT 0x0008 /* must fit in char, reserved by dos */
#define O_NOINHERIT 0x0080 /* DOS-specific */
#define O_CREAT 0x0100 /* second byte, away from DOS bits */
#define O_EXCL 0x0200
#define O_NOCTTY 0x0400
#define O_TRUNC 0x0800
#define O_APPEND 0x1000
#define O_NONBLOCK 0x2000
#include <sys/types.h>
struct flock {
off_t l_len;
pid_t l_pid;
off_t l_start;
short l_type;
short l_whence;
};
extern int _fmode; /* O_TEXT or O_BINARY */
int open(const char *_path, int _oflag, ...);
int creat(const char *_path, mode_t _mode);
int fcntl(int _fildes, int _cmd, ...);
#define SH_COMPAT 0x0000
#define SH_DENYRW 0x0010
#define SH_DENYWR 0x0020
#define SH_DENYRD 0x0030
#define SH_DENYNO 0x0040
#define _SH_COMPAT SH_COMPAT
#define _SH_DENYRW SH_DENYRW
#define _SH_DENYWR SH_DENYWR
#define _SH_DENYRD SH_DENYRD
#define _SH_DENYNO SH_DENYNO
extern int __djgpp_share_flags;
#define S_IREAD S_IRUSR
#define S_IWRITE S_IWUSR
#define S_IEXEC S_IXUSR
/*
* For compatibility with other DOS C compilers.
*/
#define _O_RDONLY O_RDONLY
#define _O_WRONLY O_WRONLY
#define _O_RDWR O_RDWR
#define _O_APPEND O_APPEND
#define _O_CREAT O_CREAT
#define _O_TRUNC O_TRUNC
#define _O_EXCL O_EXCL
#define _O_TEXT O_TEXT
#define _O_BINARY O_BINARY
#define _O_NOINHERIT O_NOINHERIT
/*
* Support for advanced filesystems (Windows 9x VFAT, NTFS, LFN etc.)
*/
#define _FILESYS_UNKNOWN 0x80000000U
#define _FILESYS_CASE_SENSITIVE 0x0001
#define _FILESYS_CASE_PRESERVED 0x0002
#define _FILESYS_UNICODE 0x0004
#define _FILESYS_LFN_SUPPORTED 0x4000
#define _FILESYS_VOL_COMPRESSED 0x8000
unsigned _get_volume_info (const char *_path, int *_max_file_len, int *_max_path_len, char *_filesystype);
char _use_lfn (const char *_path);
char *_lfn_gen_short_fname (const char *_long_fname, char *_short_fname);
#define _LFN_CTIME 1
#define _LFN_ATIME 2
unsigned _lfn_get_ftime (int _handle, int _which);
char _preserve_fncase (void);
#ifndef _USE_LFN
#define _USE_LFN _use_lfn(0) /* assume it's the same on ALL drives */
#endif
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_fcntl_h_ */

View File

@ -0,0 +1,191 @@
#ifndef _FEATURES_H
#define _FEATURES_H 1
#undef __USE_ISOC99
#undef __USE_POSIX
#undef __USE_POSIX2
#undef __USE_POSIX199309
#undef __USE_POSIX199506
#undef __USE_XOPEN
#undef __USE_XOPEN_EXTENDED
#undef __USE_UNIX98
#undef __USE_XOPEN2K
#undef __USE_LARGEFILE
#undef __USE_LARGEFILE64
#undef __USE_FILE_OFFSET64
#undef __USE_BSD
#undef __USE_SVID
#undef __USE_MISC
#undef __USE_GNU
#undef __USE_REENTRANT
#undef __FAVOR_BSD
#undef __KERNEL_STRICT_NAMES
#ifndef _LOOSE_KERNEL_NAMES
#define __KERNEL_STRICT_NAMES
#endif
#define __USE_ANSI 1
#if defined _BSD_SOURCE && \
!(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \
defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED || \
defined _GNU_SOURCE || defined _SVID_SOURCE)
# define __FAVOR_BSD 1
#endif
#ifdef _GNU_SOURCE
# undef _ISOC99_SOURCE
# define _ISOC99_SOURCE 1
# undef _POSIX_SOURCE
# define _POSIX_SOURCE 1
# undef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 199506L
# undef _XOPEN_SOURCE
# define _XOPEN_SOURCE 600
# undef _XOPEN_SOURCE_EXTENDED
# define _XOPEN_SOURCE_EXTENDED 1
# undef _LARGEFILE64_SOURCE
# define _LARGEFILE64_SOURCE 1
# undef _BSD_SOURCE
# define _BSD_SOURCE 1
# undef _SVID_SOURCE
# define _SVID_SOURCE 1
#endif
#if (!defined __STRICT_ANSI__ && !defined _ISOC99_SOURCE && \
!defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \
!defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \
!defined _BSD_SOURCE && !defined _SVID_SOURCE)
# define _BSD_SOURCE 1
# define _SVID_SOURCE 1
#endif
#if (defined _ISOC99_SOURCE || defined _ISOC9X_SOURCE \
|| (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
# define __USE_ISOC99 1
#endif
#if (!defined __STRICT_ANSI__ && !defined _POSIX_SOURCE && \
!defined _POSIX_C_SOURCE)
# define _POSIX_SOURCE 1
# if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500
# define _POSIX_C_SOURCE 2
# else
# define _POSIX_C_SOURCE 199506L
# endif
#endif
#if defined _POSIX_SOURCE || _POSIX_C_SOURCE >= 1 || defined _XOPEN_SOURCE
# define __USE_POSIX 1
#endif
#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE
# define __USE_POSIX2 1
#endif
#if (_POSIX_C_SOURCE - 0) >= 199309L
# define __USE_POSIX199309 1
#endif
#if (_POSIX_C_SOURCE - 0) >= 199506L
# define __USE_POSIX199506 1
#endif
#ifdef _XOPEN_SOURCE
# define __USE_XOPEN 1
# if (_XOPEN_SOURCE - 0) >= 500
# define __USE_XOPEN_EXTENDED 1
# define __USE_UNIX98 1
# undef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE 1
# if (_XOPEN_SOURCE - 0) >= 600
# define __USE_XOPEN2K 1
# undef __USE_ISOC99
# define __USE_ISOC99 1
# endif
# else
# ifdef _XOPEN_SOURCE_EXTENDED
# define __USE_XOPEN_EXTENDED 1
# endif
# endif
#endif
#ifdef _LARGEFILE_SOURCE
# define __USE_LARGEFILE 1
#endif
#ifdef _LARGEFILE64_SOURCE
# define __USE_LARGEFILE64 1
#endif
#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
# define __USE_FILE_OFFSET64 1
#endif
#if defined _BSD_SOURCE || defined _SVID_SOURCE
# define __USE_MISC 1
#endif
#ifdef _BSD_SOURCE
# define __USE_BSD 1
#endif
#ifdef _SVID_SOURCE
# define __USE_SVID 1
#endif
#ifdef _GNU_SOURCE
# define __USE_GNU 1
#endif
#if defined _REENTRANT || defined _THREAD_SAFE
# define __USE_REENTRANT 1
#endif
#define __STDC_IEC_559__ 1
#define __STDC_IEC_559_COMPLEX__ 1
#define __STDC_ISO_10646__ 200009L
#undef __GNU_LIBRARY__
#define __GNU_LIBRARY__ 6
#define __GLIBC__ 2
#define __GLIBC_MINOR__ 2
#if defined __GNUC__ && defined __GNUC_MINOR__
# define __GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
#else
# define __GNUC_PREREQ(maj, min) 0
#endif
#define __GLIBC_PREREQ(maj, min) \
((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
# if defined __USE_FILE_OFFSET64 && !defined __REDIRECT
# define __USE_LARGEFILE 1
# define __USE_LARGEFILE64 1
# endif
#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
# define __USE_EXTERN_INLINES 1
#endif
/* This is here only because every header file already includes this one. */
#ifndef _LIBC
/* Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
<gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
which will always return failure (and set errno to ENOSYS).
We avoid including <gnu/stubs.h> when compiling the C library itself to
avoid a dependency loop. stubs.h depends on every object file. If
this #include were done for the library source code, then every object
file would depend on stubs.h. */
# include <gnu/stubs.h>
#endif
#endif /* features.h */

View File

@ -0,0 +1,28 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_file_h_
#define __dj_include_file_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
#include <sys/file.h>
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_file_h_ */

View File

@ -0,0 +1,116 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_float_h_
#define __dj_include_float_h_
#ifdef __cplusplus
extern "C" {
#endif
extern float __dj_float_epsilon;
extern float __dj_float_max;
extern float __dj_float_min;
#define FLT_DIG 6
#define FLT_EPSILON __dj_float_epsilon
#define FLT_MANT_DIG 24
#define FLT_MAX __dj_float_max
#define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 128
#define FLT_MIN __dj_float_min
#define FLT_MIN_10_EXP (-37)
#define FLT_MIN_EXP (-125)
#define FLT_RADIX 2
#define FLT_ROUNDS 1
extern double __dj_double_epsilon;
extern double __dj_double_max;
extern double __dj_double_min;
#define DBL_DIG 15
#define DBL_EPSILON __dj_double_epsilon
#define DBL_MANT_DIG 53
#define DBL_MAX __dj_double_max
#define DBL_MAX_10_EXP 308
#define DBL_MAX_EXP 1024
#define DBL_MIN __dj_double_min
#define DBL_MIN_10_EXP (-307)
#define DBL_MIN_EXP (-1021)
extern long double __dj_long_double_epsilon;
extern long double __dj_long_double_max;
extern long double __dj_long_double_min;
#define LDBL_DIG 18
#define LDBL_EPSILON __dj_long_double_epsilon
#define LDBL_MANT_DIG 64
#define LDBL_MAX __dj_long_double_max
#define LDBL_MAX_10_EXP 4932
#define LDBL_MAX_EXP 16384
#define LDBL_MIN __dj_long_double_min
#define LDBL_MIN_10_EXP (-4931)
#define LDBL_MIN_EXP (-16381)
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
/* These indicate the results of the last operation */
#define SW_INVALID 0x0001 /* Invalid operation */
#define SW_DENORMAL 0x0002 /* Denormalized operand */
#define SW_ZERODIVIDE 0x0004 /* Division by zero */
#define SW_OVERFLOW 0x0008 /* Overflow */
#define SW_UNDERFLOW 0x0010 /* Underflow (computational) */
#define SW_INEXACT 0x0020 /* Precision (computational) */
#define SW_STACKFAULT 0x0040 /* Stack Fault (over/under flow) */
#define SW_ERRORSUMMARY 0x0080 /* Error summary */
#define SW_COND 0x4700 /* Condition Code */
#define SW_C0 0x0100 /* Condition 0 bit */
#define SW_C1 0x0200 /* Condition 1 bit (also 0=stack underflow, 1=stack overflow) */
#define SW_C2 0x0400 /* Condition 2 bit */
#define SW_C3 0x4000 /* Condition 3 bit */
#define SW_TOP 0x3800 /* Top of stack */
#define SW_TOP_SHIFT 11 /* Shift to move TOS to LSB */
#define SW_BUSY 0x8000 /* FPU busy */
#define MCW_EM 0x003f /* Exception masks (0=fault, 1=handle) */
#define EM_INVALID 0x0001 /* Invalid operation */
#define EM_DENORMAL 0x0002 /* Denormalized operand */
#define EM_ZERODIVIDE 0x0004 /* Division by zero */
#define EM_OVERFLOW 0x0008 /* Overflow */
#define EM_UNDERFLOW 0x0010 /* Underflow */
#define EM_INEXACT 0x0020 /* Precision */
#define MCW_PC 0x0300 /* precision control */
#define PC_24 0x0000 /* 24 bits (single precision) */
#define PC_53 0x0200 /* 53 bits (double precision) */
#define PC_64 0x0300 /* 64 bits (extended precision) */
#define MCW_RC 0x0c00 /* Rounding control */
#define RC_NEAR 0x0000 /* Round to nearest or even */
#define RC_DOWN 0x0400 /* Round towards -Inf */
#define RC_UP 0x0800 /* Round towards +Inf */
#define RC_CHOP 0x0c00 /* Truncate towards zero */
#define MCW_IC 0x1000 /* obsolete; i486 is always affine */
#define IC_AFFINE 0x1000 /* -Inf < +Inf */
#define IC_PROJECTIVE 0x0000 /* -Inf == +Inf */
unsigned int _clear87(void);
unsigned int _control87(unsigned int newcw, unsigned int mask);
void _fpreset(void);
unsigned int _status87(void);
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_float_h_ */

View File

@ -0,0 +1,40 @@
/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_fnmatch_h_
#define __dj_include_fnmatch_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#define FNM_NOESCAPE 0x01
#define FNM_PATHNAME 0x02
#define FNM_PERIOD 0x04
#define FNM_NOMATCH 1
#define FNM_ERROR 2
int fnmatch(const char *_pattern, const char *_string, int _flags);
#ifndef _POSIX_SOURCE
#define FNM_NOCASE 0x08
#define FNM_CASEFOLD FNM_NOCASE /* compatibility with GNU fnmatch */
#define FNM_IGNORECASE FNM_NOCASE /* compatibility with Solaris */
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_fnmatch_h_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,130 @@
/* This file is part of the FreeType project */
/* ft_conf.h for MSDOS */
/* we need the following because there are some typedefs in this file */
#ifndef FT_CONF_H
#define FT_CONF_H
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H
/* Define if you have the getpagesize function. */
#define HAVE_GETPAGESIZE
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE
/* Define if you have the valloc function. */
#undef HAVE_VALLOC
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H
/* Define if you have the <unistd.h> header file. */
#if defined( __EMX__ ) || defined( __DJGPP__ ) || defined( __GO32__ )
/* some compilers are known to have <unistd.h>; */
/* add yours if needed, and report to us the update. */
#define HAVE_UNISTD_H
#else
/* most MS-DOS compilers lack <unistd.h> */
#undef HAVE_UNISTD_H
#endif
/* Define if you need <conio.h> for console I/O functions. */
#ifdef __EMX__
#define HAVE_CONIO_H
#endif
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H
/* Define if you have the libintl library. */
#undef HAVE_LIBINTL
#define HAVE_PRINT_FUNCTION 1
#define Print( format, ap )
#include <limits.h>
#if UINT_MAX == 0xFFFF
#define SIZEOF_INT 2
#elif UINT_MAX == 0xFFFFFFFF
#define SIZEOF_INT 4
#else
#error "Unsupported number of bytes in `int' type!"
#endif
#define SIZEOF_LONG 4
#define TT_CONFIG_OPTION_EXTEND_ENGINE
#define TT_CONFIG_OPTION_GRAY_SCALING
#undef TT_CONFIG_OPTION_NO_INTERPRETER
#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
#undef TT_CONFIG_OPTION_STATIC_INTERPRETER
#undef TT_CONFIG_OPTION_STATIC_RASTER
#undef TT_CONFIG_OPTION_THREAD_SAFE
#undef DEBUG_LEVEL_TRACE
#undef DEBUG_LEVEL_ERROR
#if SIZEOF_INT == 4
typedef signed int TT_Int32;
typedef unsigned int TT_Word32;
#elif SIZEOF_LONG == 4
typedef signed long TT_Int32;
typedef unsigned long TT_Word32;
#else
#error "no 32bit type found"
#endif
#if SIZEOF_LONG == 8
/* LONG64 must be defined when a 64-bit type is available */
/* INT64 must then be defined to this type.. */
#define LONG64
#define INT64 long
#else
/* GCC provides the non-ANSI 'long long' 64-bit type. You can activate */
/* by defining the TT_USE_LONG_LONG macro in 'ft_conf.h'. Note that this */
/* will produce many -ansi warnings during library compilation. */
#ifdef TT_USE_LONG_LONG
#define LONG64
#define INT64 long long
#endif /* TT_USE_LONG_LONG */
#endif
#endif /* FT_CONF_H */
/* END */

View File

@ -0,0 +1,161 @@
/*******************************************************************
*
* fterrid.h
*
* TrueType Error ID definitions
*
* Copyright 1996-1999 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
******************************************************************/
#ifndef FREETYPE_H
#error "Don't include this file! Use freetype.h instead."
#endif
#ifndef FTERRID_H
#define FTERRID_H
/************************ error codes declaration **************/
/* The error codes are grouped in 'classes' used to indicate the */
/* 'level' at which the error happened. */
/* The class is given by an error code's high byte. */
/* ------------- Success is always 0 -------- */
#define TT_Err_Ok 0
/* -------- High-level API error codes ------ */
#define TT_Err_Invalid_Face_Handle 0x001
#define TT_Err_Invalid_Instance_Handle 0x002
#define TT_Err_Invalid_Glyph_Handle 0x003
#define TT_Err_Invalid_CharMap_Handle 0x004
#define TT_Err_Invalid_Result_Address 0x005
#define TT_Err_Invalid_Glyph_Index 0x006
#define TT_Err_Invalid_Argument 0x007
#define TT_Err_Could_Not_Open_File 0x008
#define TT_Err_File_Is_Not_Collection 0x009
#define TT_Err_Table_Missing 0x00A
#define TT_Err_Invalid_Horiz_Metrics 0x00B
#define TT_Err_Invalid_CharMap_Format 0x00C
#define TT_Err_Invalid_PPem 0x00D
#define TT_Err_Invalid_Vert_Metrics 0x00E
#define TT_Err_Invalid_File_Format 0x010
#define TT_Err_Invalid_Engine 0x020
#define TT_Err_Too_Many_Extensions 0x021
#define TT_Err_Extensions_Unsupported 0x022
#define TT_Err_Invalid_Extension_Id 0x023
#define TT_Err_No_Vertical_Data 0x030
#define TT_Err_Max_Profile_Missing 0x080
#define TT_Err_Header_Table_Missing 0x081
#define TT_Err_Horiz_Header_Missing 0x082
#define TT_Err_Locations_Missing 0x083
#define TT_Err_Name_Table_Missing 0x084
#define TT_Err_CMap_Table_Missing 0x085
#define TT_Err_Hmtx_Table_Missing 0x086
#define TT_Err_OS2_Table_Missing 0x087
#define TT_Err_Post_Table_Missing 0x088
#define TT_Err_Glyf_Table_Missing 0x089
/* -------- Memory component error codes ---- */
/* this error indicates that an operation cannot */
/* be performed due to memory exhaustion. */
#define TT_Err_Out_Of_Memory 0x100
/* -------- File component error codes ------ */
/* these error codes indicate that the file could */
/* not be accessed properly. Usually, this means */
/* a broken font file! */
#define TT_Err_Invalid_File_Offset 0x200
#define TT_Err_Invalid_File_Read 0x201
#define TT_Err_Invalid_Frame_Access 0x202
/* -------- Glyph loader error codes -------- */
/* Produced only by the glyph loader, these error */
/* codes indicate a broken glyph in a font file. */
#define TT_Err_Too_Many_Points 0x300
#define TT_Err_Too_Many_Contours 0x301
#define TT_Err_Invalid_Composite 0x302
#define TT_Err_Too_Many_Ins 0x303
/* --- bytecode interpreter error codes ----- */
/* These error codes are produced by the TrueType */
/* bytecode interpreter. They usually indicate a */
/* broken font file, a broken glyph within a font */
/* file, or a bug in the interpreter! */
#define TT_Err_Invalid_Opcode 0x400
#define TT_Err_Too_Few_Arguments 0x401
#define TT_Err_Stack_Overflow 0x402
#define TT_Err_Code_Overflow 0x403
#define TT_Err_Bad_Argument 0x404
#define TT_Err_Divide_By_Zero 0x405
#define TT_Err_Storage_Overflow 0x406
#define TT_Err_Cvt_Overflow 0x407
#define TT_Err_Invalid_Reference 0x408
#define TT_Err_Invalid_Distance 0x409
#define TT_Err_Interpolate_Twilight 0x40A
#define TT_Err_Debug_OpCode 0x40B
#define TT_Err_ENDF_In_Exec_Stream 0x40C
#define TT_Err_Out_Of_CodeRanges 0x40D
#define TT_Err_Nested_DEFS 0x40E
#define TT_Err_Invalid_CodeRange 0x40F
#define TT_Err_Invalid_Displacement 0x410
#define TT_Err_Execution_Too_Long 0x411
/* ------ internal failure error codes ----- */
/* These error codes are produced when an incoherent */
/* library state has been detected. These reflect a */
/* severe bug in the engine! (Or a major overwrite */
/* of your application into the library's data.) */
#define TT_Err_Nested_Frame_Access 0x500
#define TT_Err_Invalid_Cache_List 0x501
#define TT_Err_Could_Not_Find_Context 0x502
#define TT_Err_Unlisted_Object 0x503
/* ---- scan-line converter error codes ----- */
/* These error codes are produced by the raster component. */
/* They indicate that an outline structure was incoherently */
/* setup, or that you're trying to render an horribly */
/* complex glyph! */
#define TT_Err_Raster_Pool_Overflow 0x600
#define TT_Err_Raster_Negative_Height 0x601
#define TT_Err_Raster_Invalid_Value 0x602
#define TT_Err_Raster_Not_Initialized 0x603
#endif /* FTERRID_H */
/* END */

View File

@ -0,0 +1,628 @@
/*******************************************************************
*
* ftnameid.h
*
* TrueType Name ID definitions
*
* Copyright 1996-1999 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
******************************************************************/
#ifndef FREETYPE_H
#error "Don't include this file! Use freetype.h instead."
#endif
#ifndef FTNAMEID_H
#define FTNAMEID_H
/*
* possible values for the 'Platform' identifier code in the name
* records of the TTF "name" table
*/
#define TT_PLATFORM_APPLE_UNICODE 0
#define TT_PLATFORM_MACINTOSH 1
#define TT_PLATFORM_ISO 2
#define TT_PLATFORM_MICROSOFT 3
/*
* possible values of the platform specific encoding identifier field in
* the name records of the TTF "name" table when the 'Platform' identifier
* code is TT_PLATFORM_APPLE_UNICODE
*/
#define TT_APPLE_ID_DEFAULT 0
#define TT_APPLE_ID_UNICODE_1_1 1
#define TT_APPLE_ID_ISO_10646 2
#define TT_APPLE_ID_UNICODE_2_0 3
/*
* possible values of the platform specific encoding identifier field in
* the name records of the TTF "name" table when the 'Platform' identifier
* code is TT_PLATFORM_MACINTOSH
*/
#define TT_MAC_ID_ROMAN 0
#define TT_MAC_ID_JAPANESE 1
#define TT_MAC_ID_TRADITIONAL_CHINESE 2
#define TT_MAC_ID_KOREAN 3
#define TT_MAC_ID_ARABIC 4
#define TT_MAC_ID_HEBREW 5
#define TT_MAC_ID_GREEK 6
#define TT_MAC_ID_RUSSIAN 7
#define TT_MAC_ID_RSYMBOL 8
#define TT_MAC_ID_DEVANAGARI 9
#define TT_MAC_ID_GURMUKHI 10
#define TT_MAC_ID_GUJARATI 11
#define TT_MAC_ID_ORIYA 12
#define TT_MAC_ID_BENGALI 13
#define TT_MAC_ID_TAMIL 14
#define TT_MAC_ID_TELUGU 15
#define TT_MAC_ID_KANNADA 16
#define TT_MAC_ID_MALAYALAM 17
#define TT_MAC_ID_SINHALESE 18
#define TT_MAC_ID_BURMESE 19
#define TT_MAC_ID_KHMER 20
#define TT_MAC_ID_THAI 21
#define TT_MAC_ID_LAOTIAN 22
#define TT_MAC_ID_GEORGIAN 23
#define TT_MAC_ID_ARMENIAN 24
#define TT_MAC_ID_MALDIVIAN 25
#define TT_MAC_ID_SIMPLIFIED_CHINESE 25
#define TT_MAC_ID_TIBETAN 26
#define TT_MAC_ID_MONGOLIAN 27
#define TT_MAC_ID_GEEZ 28
#define TT_MAC_ID_SLAVIC 29
#define TT_MAC_ID_VIETNAMESE 30
#define TT_MAC_ID_SINDHI 31
#define TT_MAC_ID_UNINTERP 32
/*
* possible values of the platform specific encoding identifier field in
* the name records of the TTF "name" table when the 'Platform' identifier
* code is TT_PLATFORM_ISO
*/
#define TT_ISO_ID_7BIT_ASCII 0
#define TT_ISO_ID_10646 1
#define TT_ISO_ID_8859_1 2
/*
* possible values of the platform specific encoding identifier field in
* the name records of the TTF "name" table when the 'Platform' identifier
* code is TT_PLATFORM_MICROSOFT
*/
#define TT_MS_ID_SYMBOL_CS 0
#define TT_MS_ID_UNICODE_CS 1
#define TT_MS_ID_SJIS 2
#define TT_MS_ID_GB2312 3
#define TT_MS_ID_BIG_5 4
#define TT_MS_ID_WANSUNG 5
#define TT_MS_ID_JOHAB 6
/*
* possible values of the language identifier field in the name records of
* the TTF "name" table when the 'Platform' identifier code is
* TT_PLATFORM_MACINTOSH
*
* the canonical source for the Apple assigned Language ID's is at
* http://fonts.apple.com/TTRefMan/RM06/Chap6name.html
*/
#define TT_MAC_LANGID_ENGLISH 0
#define TT_MAC_LANGID_FRENCH 1
#define TT_MAC_LANGID_GERMAN 2
#define TT_MAC_LANGID_ITALIAN 3
#define TT_MAC_LANGID_DUTCH 4
#define TT_MAC_LANGID_SWEDISH 5
#define TT_MAC_LANGID_SPANISH 6
#define TT_MAC_LANGID_DANISH 7
#define TT_MAC_LANGID_PORTUGUESE 8
#define TT_MAC_LANGID_NORWEGIAN 9
#define TT_MAC_LANGID_HEBREW 10
#define TT_MAC_LANGID_JAPANESE 11
#define TT_MAC_LANGID_ARABIC 12
#define TT_MAC_LANGID_FINNISH 13
#define TT_MAC_LANGID_GREEK 14
#define TT_MAC_LANGID_ICELANDIC 15
#define TT_MAC_LANGID_MALTESE 16
#define TT_MAC_LANGID_TURKISH 17
#define TT_MAC_LANGID_CROATIAN 18
#define TT_MAC_LANGID_CHINESE_TRADITIONAL 19
#define TT_MAC_LANGID_URDU 20
#define TT_MAC_LANGID_HINDI 21
#define TT_MAC_LANGID_THAI 22
#define TT_MAC_LANGID_KOREAN 23
#define TT_MAC_LANGID_LITHUANIAN 24
#define TT_MAC_LANGID_POLISH 25
#define TT_MAC_LANGID_HUNGARIAN 26
#define TT_MAC_LANGID_ESTONIAN 27
#define TT_MAC_LANGID_LETTISH 28
#define TT_MAC_LANGID_SAAMISK 29
#define TT_MAC_LANGID_FAEROESE 30
#define TT_MAC_LANGID_FARSI 31
#define TT_MAC_LANGID_RUSSIAN 32
#define TT_MAC_LANGID_CHINESE_SIMPLIFIED 33
#define TT_MAC_LANGID_FLEMISH 34
#define TT_MAC_LANGID_IRISH 35
#define TT_MAC_LANGID_ALBANIAN 36
#define TT_MAC_LANGID_ROMANIAN 37
#define TT_MAC_LANGID_CZECH 38
#define TT_MAC_LANGID_SLOVAK 39
#define TT_MAC_LANGID_SLOVENIAN 40
#define TT_MAC_LANGID_YIDDISH 41
#define TT_MAC_LANGID_SERBIAN 42
#define TT_MAC_LANGID_MACEDONIAN 43
#define TT_MAC_LANGID_BULGARIAN 44
#define TT_MAC_LANGID_UKRAINIAN 45
#define TT_MAC_LANGID_BYELORUSSIAN 46
#define TT_MAC_LANGID_UZBEK 47
#define TT_MAC_LANGID_KAZAKH 48
#define TT_MAC_LANGID_AZERBAIJANI 49
#define TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT 50
#define TT_MAC_LANGID_ARMENIAN 51
#define TT_MAC_LANGID_GEORGIAN 52
#define TT_MAC_LANGID_MOLDAVIAN 53
#define TT_MAC_LANGID_KIRGHIZ 54
#define TT_MAC_LANGID_TAJIKI 55
#define TT_MAC_LANGID_TURKMEN 56
#define TT_MAC_LANGID_MONGOLIAN 57
#define TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT 58
#define TT_MAC_LANGID_PASHTO 59
#define TT_MAC_LANGID_KURDISH 60
#define TT_MAC_LANGID_KASHMIRI 61
#define TT_MAC_LANGID_SINDHI 62
#define TT_MAC_LANGID_TIBETAN 63
#define TT_MAC_LANGID_NEPALI 64
#define TT_MAC_LANGID_SANSKRIT 65
#define TT_MAC_LANGID_MARATHI 66
#define TT_MAC_LANGID_BENGALI 67
#define TT_MAC_LANGID_ASSAMESE 68
#define TT_MAC_LANGID_GUJARATI 69
#define TT_MAC_LANGID_PUNJABI 70
#define TT_MAC_LANGID_ORIYA 71
#define TT_MAC_LANGID_MALAYALAM 72
#define TT_MAC_LANGID_KANNADA 73
#define TT_MAC_LANGID_TAMIL 74
#define TT_MAC_LANGID_TELUGU 75
#define TT_MAC_LANGID_SINHALESE 76
#define TT_MAC_LANGID_BURMESE 77
#define TT_MAC_LANGID_KHMER 78
#define TT_MAC_LANGID_LAO 79
#define TT_MAC_LANGID_VIETNAMESE 80
#define TT_MAC_LANGID_INDONESIAN 81
#define TT_MAC_LANGID_TAGALOG 82
#define TT_MAC_LANGID_MALAY_ROMAN_SCRIPT 83
#define TT_MAC_LANGID_MALAY_ARABIC_SCRIPT 84
#define TT_MAC_LANGID_AMHARIC 85
#define TT_MAC_LANGID_TIGRINYA 86
#define TT_MAC_LANGID_GALLA 87
#define TT_MAC_LANGID_SOMALI 88
#define TT_MAC_LANGID_SWAHILI 89
#define TT_MAC_LANGID_RUANDA 90
#define TT_MAC_LANGID_RUNDI 91
#define TT_MAC_LANGID_CHEWA 92
#define TT_MAC_LANGID_MALAGASY 93
#define TT_MAC_LANGID_ESPERANTO 94
#define TT_MAC_LANGID_WELSH 128
#define TT_MAC_LANGID_BASQUE 129
#define TT_MAC_LANGID_CATALAN 130
#define TT_MAC_LANGID_LATIN 131
#define TT_MAC_LANGID_QUECHUA 132
#define TT_MAC_LANGID_GUARANI 133
#define TT_MAC_LANGID_AYMARA 134
#define TT_MAC_LANGID_TATAR 135
#define TT_MAC_LANGID_UIGHUR 136
#define TT_MAC_LANGID_DZONGKHA 137
#define TT_MAC_LANGID_JAVANESE 138
#define TT_MAC_LANGID_SUNDANESE 139
#define TT_MAC_LANGID_SCOTTISH_GAELIC 140
#define TT_MAC_LANGID_IRISH_GAELIC 141
#define TT_MAC_LANGID_BRETON 142
#define TT_MAC_LANGID_INUKTITUT 143
/*
* possible values of the language identifier field in the name records of
* the TTF "name" table when the 'Platform' identifier code is
* TT_PLATFORM_MICROSOFT
*
* the canonical source for the MS assigned LCID's is at
* http://www.microsoft.com/typography/OTSPEC/lcid-cp.txt
*/
#define TT_MS_LANGID_ARABIC_SAUDI_ARABIA 0x0401
#define TT_MS_LANGID_ARABIC_IRAQ 0x0801
#define TT_MS_LANGID_ARABIC_EGYPT 0x0c01
#define TT_MS_LANGID_ARABIC_LIBYA 0x1001
#define TT_MS_LANGID_ARABIC_ALGERIA 0x1401
#define TT_MS_LANGID_ARABIC_MOROCCO 0x1801
#define TT_MS_LANGID_ARABIC_TUNISIA 0x1c01
#define TT_MS_LANGID_ARABIC_OMAN 0x2001
#define TT_MS_LANGID_ARABIC_YEMEN 0x2401
#define TT_MS_LANGID_ARABIC_SYRIA 0x2801
#define TT_MS_LANGID_ARABIC_JORDAN 0x2c01
#define TT_MS_LANGID_ARABIC_LEBANON 0x3001
#define TT_MS_LANGID_ARABIC_KUWAIT 0x3401
#define TT_MS_LANGID_ARABIC_UAE 0x3801
#define TT_MS_LANGID_ARABIC_BAHRAIN 0x3c01
#define TT_MS_LANGID_ARABIC_QATAR 0x4001
#define TT_MS_LANGID_BULGARIAN_BULGARIA 0x0402
#define TT_MS_LANGID_CATALAN_SPAIN 0x0403
#define TT_MS_LANGID_CHINESE_TAIWAN 0x0404
#define TT_MS_LANGID_CHINESE_PRC 0x0804
#define TT_MS_LANGID_CHINESE_HONG_KONG 0x0c04
#define TT_MS_LANGID_CHINESE_SINGAPORE 0x1004
#define TT_MS_LANGID_CHINESE_MACAU 0x1404
#define TT_MS_LANGID_CZECH_CZECH_REPUBLIC 0x0405
#define TT_MS_LANGID_DANISH_DENMARK 0x0406
#define TT_MS_LANGID_GERMAN_GERMANY 0x0407
#define TT_MS_LANGID_GERMAN_SWITZERLAND 0x0807
#define TT_MS_LANGID_GERMAN_AUSTRIA 0x0c07
#define TT_MS_LANGID_GERMAN_LUXEMBOURG 0x1007
#define TT_MS_LANGID_GERMAN_LIECHTENSTEI 0x1407
#define TT_MS_LANGID_GREEK_GREECE 0x0408
#define TT_MS_LANGID_ENGLISH_UNITED_STATES 0x0409
#define TT_MS_LANGID_ENGLISH_UNITED_KINGDOM 0x0809
#define TT_MS_LANGID_ENGLISH_AUSTRALIA 0x0c09
#define TT_MS_LANGID_ENGLISH_CANADA 0x1009
#define TT_MS_LANGID_ENGLISH_NEW_ZEALAND 0x1409
#define TT_MS_LANGID_ENGLISH_IRELAND 0x1809
#define TT_MS_LANGID_ENGLISH_SOUTH_AFRICA 0x1c09
#define TT_MS_LANGID_ENGLISH_JAMAICA 0x2009
#define TT_MS_LANGID_ENGLISH_CARIBBEAN 0x2409
#define TT_MS_LANGID_ENGLISH_BELIZE 0x2809
#define TT_MS_LANGID_ENGLISH_TRINIDAD 0x2c09
#define TT_MS_LANGID_ENGLISH_ZIMBABWE 0x3009
#define TT_MS_LANGID_ENGLISH_PHILIPPINES 0x3409
#define TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT 0x040a
#define TT_MS_LANGID_SPANISH_MEXICO 0x080a
#define TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT 0x0c0a
#define TT_MS_LANGID_SPANISH_GUATEMALA 0x100a
#define TT_MS_LANGID_SPANISH_COSTA_RICA 0x140a
#define TT_MS_LANGID_SPANISH_PANAMA 0x180a
#define TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC 0x1c0a
#define TT_MS_LANGID_SPANISH_VENEZUELA 0x200a
#define TT_MS_LANGID_SPANISH_COLOMBIA 0x240a
#define TT_MS_LANGID_SPANISH_PERU 0x280a
#define TT_MS_LANGID_SPANISH_ARGENTINA 0x2c0a
#define TT_MS_LANGID_SPANISH_ECUADOR 0x300a
#define TT_MS_LANGID_SPANISH_CHILE 0x340a
#define TT_MS_LANGID_SPANISH_URUGUAY 0x380a
#define TT_MS_LANGID_SPANISH_PARAGUAY 0x3c0a
#define TT_MS_LANGID_SPANISH_BOLIVIA 0x400a
#define TT_MS_LANGID_SPANISH_EL_SALVADOR 0x440a
#define TT_MS_LANGID_SPANISH_HONDURAS 0x480a
#define TT_MS_LANGID_SPANISH_NICARAGUA 0x4c0a
#define TT_MS_LANGID_SPANISH_PUERTO_RICO 0x500a
#define TT_MS_LANGID_FINNISH_FINLAND 0x040b
#define TT_MS_LANGID_FRENCH_FRANCE 0x040c
#define TT_MS_LANGID_FRENCH_BELGIUM 0x080c
#define TT_MS_LANGID_FRENCH_CANADA 0x0c0c
#define TT_MS_LANGID_FRENCH_SWITZERLAND 0x100c
#define TT_MS_LANGID_FRENCH_LUXEMBOURG 0x140c
#define TT_MS_LANGID_FRENCH_MONACO 0x180c
#define TT_MS_LANGID_HEBREW_ISRAEL 0x040d
#define TT_MS_LANGID_HUNGARIAN_HUNGARY 0x040e
#define TT_MS_LANGID_ICELANDIC_ICELAND 0x040f
#define TT_MS_LANGID_ITALIAN_ITALY 0x0410
#define TT_MS_LANGID_ITALIAN_SWITZERLAND 0x0810
#define TT_MS_LANGID_JAPANESE_JAPAN 0x0411
#define TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA 0x0412
#define TT_MS_LANGID_KOREAN_JOHAB_KOREA 0x0812
#define TT_MS_LANGID_DUTCH_NETHERLANDS 0x0413
#define TT_MS_LANGID_DUTCH_BELGIUM 0x0813
#define TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL 0x0414
#define TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK 0x0814
#define TT_MS_LANGID_POLISH_POLAND 0x0415
#define TT_MS_LANGID_PORTUGUESE_BRAZIL 0x0416
#define TT_MS_LANGID_PORTUGUESE_PORTUGAL 0x0816
#define TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND 0x0417
#define TT_MS_LANGID_ROMANIAN_ROMANIA 0x0418
#define TT_MS_LANGID_MOLDAVIAN_MOLDAVIA 0x0818
#define TT_MS_LANGID_RUSSIAN_RUSSIA 0x0419
#define TT_MS_LANGID_RUSSIAN_MOLDAVIA 0x0819
#define TT_MS_LANGID_CROATIAN_CROATIA 0x041a
#define TT_MS_LANGID_SERBIAN_SERBIA_LATIN 0x081a
#define TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC 0x0c1a
#define TT_MS_LANGID_SLOVAK_SLOVAKIA 0x041b
#define TT_MS_LANGID_ALBANIAN_ALBANIA 0x041c
#define TT_MS_LANGID_SWEDISH_SWEDEN 0x041d
#define TT_MS_LANGID_SWEDISH_FINLAND 0x081d
#define TT_MS_LANGID_THAI_THAILAND 0x041e
#define TT_MS_LANGID_TURKISH_TURKEY 0x041f
#define TT_MS_LANGID_URDU_PAKISTAN 0x0420
#define TT_MS_LANGID_INDONESIAN_INDONESIA 0x0421
#define TT_MS_LANGID_UKRAINIAN_UKRAINE 0x0422
#define TT_MS_LANGID_BELARUSIAN_BELARUS 0x0423
#define TT_MS_LANGID_SLOVENE_SLOVENIA 0x0424
#define TT_MS_LANGID_ESTONIAN_ESTONIA 0x0425
#define TT_MS_LANGID_LATVIAN_LATVIA 0x0426
#define TT_MS_LANGID_LITHUANIAN_LITHUANIA 0x0427
#define TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA 0x0827
#define TT_MS_LANGID_MAORI_NEW_ZEALAND 0x0428
#define TT_MS_LANGID_FARSI_IRAN 0x0429
#define TT_MS_LANGID_VIETNAMESE_VIET_NAM 0x042a
#define TT_MS_LANGID_ARMENIAN_ARMENIA 0x042b
#define TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN 0x042c
#define TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC 0x082c
#define TT_MS_LANGID_BASQUE_SPAIN 0x042d
#define TT_MS_LANGID_SORBIAN_GERMANY 0x042e
#define TT_MS_LANGID_MACEDONIAN_MACEDONIA 0x042f
#define TT_MS_LANGID_SUTU_SOUTH_AFRICA 0x0430
#define TT_MS_LANGID_TSONGA_SOUTH_AFRICA 0x0431
#define TT_MS_LANGID_TSWANA_SOUTH_AFRICA 0x0432
#define TT_MS_LANGID_VENDA_SOUTH_AFRICA 0x0433
#define TT_MS_LANGID_XHOSA_SOUTH_AFRICA 0x0434
#define TT_MS_LANGID_ZULU_SOUTH_AFRICA 0x0435
#define TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA 0x0436
#define TT_MS_LANGID_GEORGIAN_GEORGIA 0x0437
#define TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS 0x0438
#define TT_MS_LANGID_HINDI_INDIA 0x0439
#define TT_MS_LANGID_MALTESE_MALTA 0x043a
#define TT_MS_LANGID_SAAMI_LAPONIA 0x043b
#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043c
#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083c
#define TT_MS_LANGID_MALAY_MALAYSIA 0x043e
#define TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM 0x083e
#define TT_MS_LANGID_KAZAK_KAZAKSTAN 0x043f
#define TT_MS_LANGID_SWAHILI_KENYA 0x0441
#define TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN 0x0443
#define TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC 0x0843
#define TT_MS_LANGID_TATAR_TATARSTAN 0x0444
#define TT_MS_LANGID_BENGALI_INDIA 0x0445
#define TT_MS_LANGID_PUNJABI_INDIA 0x0446
#define TT_MS_LANGID_GUJARATI_INDIA 0x0447
#define TT_MS_LANGID_ORIYA_INDIA 0x0448
#define TT_MS_LANGID_TAMIL_INDIA 0x0449
#define TT_MS_LANGID_TELUGU_INDIA 0x044a
#define TT_MS_LANGID_KANNADA_INDIA 0x044b
#define TT_MS_LANGID_MALAYALAM_INDIA 0x044c
#define TT_MS_LANGID_ASSAMESE_INDIA 0x044d
#define TT_MS_LANGID_MARATHI_INDIA 0x044e
#define TT_MS_LANGID_SANSKRIT_INDIA 0x044f
#define TT_MS_LANGID_KONKANI_INDIA 0x0457
/*
* possible values of the 'Name' identifier field in the name records of
* the TTF "name" table. These values are platform independent.
*/
#define TT_NAME_ID_COPYRIGHT 0
#define TT_NAME_ID_FONT_FAMILY 1
#define TT_NAME_ID_FONT_SUBFAMILY 2
#define TT_NAME_ID_UNIQUE_ID 3
#define TT_NAME_ID_FULL_NAME 4
#define TT_NAME_ID_VERSION_STRING 5
#define TT_NAME_ID_PS_NAME 6
#define TT_NAME_ID_TRADEMARK 7
/* the following values are from the OpenType spec */
#define TT_NAME_ID_MANUFACTURER 8
#define TT_NAME_ID_DESIGNER 9
#define TT_NAME_ID_DESCRIPTION 10
#define TT_NAME_ID_VENDOR_URL 11
#define TT_NAME_ID_DESIGNER_URL 12
#define TT_NAME_ID_LICENSE 13
#define TT_NAME_ID_LICENSE_URL 14
/* number 15 is reserved */
#define TT_NAME_ID_PREFERRED_FAMILY 16
#define TT_NAME_ID_PREFERRED_SUBFAMILY 17
#define TT_NAME_ID_MAC_FULL_NAME 18
/*
* Bit Mask values for the Unicode Ranges from the TTF "OS2 " table.
*/
/* General Scripts Area */
/* Bit 0 C0 Controls and Basic Latin */
#define TT_UCR_BASIC_LATIN (1L << 0) /* U+0000-U+007F */
/* Bit 1 C1 Controls and Latin-1 Supplement */
#define TT_UCR_LATIN1_SUPPLEMENT (1L << 1) /* U+0080-U+00FF */
/* Bit 2 Latin Extended-A */
#define TT_UCR_LATIN_EXTENDED_A (1L << 2) /* U+0100-U+017F */
/* Bit 3 Latin Extended-B */
#define TT_UCR_LATIN_EXTENDED_B (1L << 3) /* U+0180-U+024F */
/* Bit 4 IPA Extensions */
#define TT_UCR_IPA_EXTENSIONS (1L << 4) /* U+0250-U+02AF */
/* Bit 5 Spacing Modifier Letters */
#define TT_UCR_SPACING_MODIFIER (1L << 5) /* U+02B0-U+02FF */
/* Bit 6 Combining Diacritical Marks */
#define TT_UCR_COMBINING_DIACRITICS (1L << 6) /* U+0300-U+036F */
/* Bit 7 Greek */
#define TT_UCR_GREEK (1L << 7) /* U+0370-U+03FF */
/* Bit 8 is reserved (was: Greek Symbols and Coptic) */
/* Bit 9 Cyrillic */
#define TT_UCR_CYRILLIC (1L << 9) /* U+0400-U+04FF */
/* Bit 10 Armenian */
#define TT_UCR_ARMENIAN (1L << 10) /* U+0530-U+058F */
/* Bit 11 Hebrew */
#define TT_UCR_HEBREW (1L << 11) /* U+0590-U+05FF */
/* Bit 12 is reserved (was: Hebrew Extended) */
/* Bit 13 Arabic */
#define TT_UCR_ARABIC (1L << 13) /* U+0600-U+06FF */
/* Bit 14 is reserved (was: Arabic Extended) */
/* Bit 15 Devanagari */
#define TT_UCR_DEVANAGARI (1L << 15) /* U+0900-U+097F */
/* Bit 16 Bengali */
#define TT_UCR_BENGALI (1L << 16) /* U+0980-U+09FF */
/* Bit 17 Gurmukhi */
#define TT_UCR_GURMUKHI (1L << 17) /* U+0A00-U+0A7F */
/* Bit 18 Gujarati */
#define TT_UCR_GUJARATI (1L << 18) /* U+0A80-U+0AFF */
/* Bit 19 Oriya */
#define TT_UCR_ORIYA (1L << 19) /* U+0B00-U+0B7F */
/* Bit 20 Tamil */
#define TT_UCR_TAMIL (1L << 20) /* U+0B80-U+0BFF */
/* Bit 21 Telugu */
#define TT_UCR_TELUGU (1L << 21) /* U+0C00-U+0C7F */
/* Bit 22 Kannada */
#define TT_UCR_KANNADA (1L << 22) /* U+0C80-U+0CFF */
/* Bit 23 Malayalam */
#define TT_UCR_MALAYALAM (1L << 23) /* U+0D00-U+0D7F */
/* Bit 24 Thai */
#define TT_UCR_THAI (1L << 24) /* U+0E00-U+0E7F */
/* Bit 25 Lao */
#define TT_UCR_LAO (1L << 25) /* U+0E80-U+0EFF */
/* Bit 26 Georgian */
#define TT_UCR_GEORGIAN (1L << 26) /* U+10A0-U+10FF */
/* Bit 27 is reserved (was Georgian Extended) */
/* Bit 28 Hangul Jamo */
#define TT_UCR_HANGUL_JAMO (1L << 28) /* U+1100-U+11FF */
/* Bit 29 Latin Extended Additional */
#define TT_UCR_LATIN_EXTENDED_ADDITIONAL (1L << 29) /* U+1E00-U+1EFF */
/* Bit 30 Greek Extended */
#define TT_UCR_GREEK_EXTENDED (1L << 30) /* U+1F00-U+1FFF */
/* Symbols Area */
/* Bit 31 General Punctuation */
#define TT_UCR_GENERAL_PUNCTUATION (1L << 31) /* U+2000-U+206F */
/* Bit 32 Superscripts And Subscripts */
#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS (1L << 0) /* U+2070-U+209F */
/* Bit 33 Currency Symbols */
#define TT_UCR_CURRENCY_SYMBOLS (1L << 1) /* U+20A0-U+20CF */
/* Bit 34 Combining Diacritical Marks For Symbols */
#define TT_UCR_COMBINING_DIACRITICS_SYMB (1L << 2) /* U+20D0-U+20FF */
/* Bit 35 Letterlike Symbols */
#define TT_UCR_LETTERLIKE_SYMBOLS (1L << 3) /* U+2100-U+214F */
/* Bit 36 Number Forms */
#define TT_UCR_NUMBER_FORMS (1L << 4) /* U+2150-U+218F */
/* Bit 37 Arrows */
#define TT_UCR_ARROWS (1L << 5) /* U+2190-U+21FF */
/* Bit 38 Mathematical Operators */
#define TT_UCR_MATHEMATICAL_OPERATORS (1L << 6) /* U+2200-U+22FF */
/* Bit 39 Miscellaneous Technical */
#define TT_UCR_MISCELLANEOUS_TECHNICAL (1L << 7) /* U+2300-U+23FF */
/* Bit 40 Control Pictures */
#define TT_UCR_CONTROL_PICTURES (1L << 8) /* U+2400-U+243F */
/* Bit 41 Optical Character Recognition */
#define TT_UCR_OCR (1L << 9) /* U+2440-U+245F */
/* Bit 42 Enclosed Alphanumerics */
#define TT_UCR_ENCLOSED_ALPHANUMERICS (1L << 10) /* U+2460-U+24FF */
/* Bit 43 Box Drawing */
#define TT_UCR_BOX_DRAWING (1L << 11) /* U+2500-U+257F */
/* Bit 44 Block Elements */
#define TT_UCR_BLOCK_ELEMENTS (1L << 12) /* U+2580-U+259F */
/* Bit 45 Geometric Shapes */
#define TT_UCR_GEOMETRIC_SHAPES (1L << 13) /* U+25A0-U+25FF */
/* Bit 46 Miscellaneous Symbols */
#define TT_UCR_MISCELLANEOUS_SYMBOLS (1L << 14) /* U+2600-U+26FF */
/* Bit 47 Dingbats */
#define TT_UCR_DINGBATS (1L << 15) /* U+2700-U+27BF */
/* CJK Phonetics and Symbols Area */
/* Bit 48 CJK Symbols And Punctuation */
#define TT_UCR_CJK_SYMBOLS (1L << 16) /* U+3000-U+303F */
/* Bit 49 Hiragana */
#define TT_UCR_HIRAGANA (1L << 17) /* U+3040-U+309F */
/* Bit 50 Katakana */
#define TT_UCR_KATAKANA (1L << 18) /* U+30A0-U+30FF */
/* Bit 51 Bopomofo */
#define TT_UCR_BOPOMOFO (1L << 19) /* U+3100-U+312F */
/* Bit 52 Hangul Compatibility Jamo */
#define TT_UCR_HANGUL_COMPATIBILITY_JAMO (1L << 20) /* U+3130-U+318F */
/* Bit 53 CJK Miscellaneous */
#define TT_UCR_CJK_MISC (1L << 21) /* U+3190-U+319F */
/* Bit 54 Enclosed CJK Letters And Months */
#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS (1L << 22) /* U+3200-U+32FF */
/* Bit 55 CJK Compatibility */
#define TT_UCR_CJK_COMPATIBILITY (1L << 23) /* U+3300-U+33FF */
/* Hangul Syllables Area */
/* Bit 56 Hangul */
#define TT_UCR_HANGUL (1L << 24) /* U+AC00-U+D7A3 */
/* Surrogates Area */
/* Bit 57 Surrogates */
#define TT_UCR_SURROGATES (1L << 25) /* U+D800-U+DFFF */
/* Bit 58 is reserved for Unicode SubRanges */
/* CJK Ideographs Area */
/* Bit 59 CJK Unified Ideographs */
#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS (1L << 27) /* U+4E00-U+9FFF */
/* Private Use Area */
/* Bit 60 Private Use */
#define TT_UCR_PRIVATE_USE (1L << 28) /* U+E000-U+F8FF */
/* Compatibility Area and Specials */
/* Bit 61 CJK Compatibility Ideographs */
#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1L << 29) /* U+F900-U+FAFF */
/* Bit 62 Alphabetic Presentation Forms */
#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS (1L << 30) /* U+FB00-U+FB4F */
/* Bit 63 Arabic Presentation Forms-A */
#define TT_UCR_ARABIC_PRESENTATIONS_A (1L << 31) /* U+FB50-U+FSFF */
/* Bit 64 Combining Half Marks */
#define TT_UCR_COMBINING_HALF_MARKS (1L << 0) /* U+FE20-U+FE2F */
/* Bit 65 CJK Compatibility Forms */
#define TT_UCR_CJK_COMPATIBILITY_FORMS (1L << 1) /* U+FE30-U+FE4F */
/* Bit 66 Small Form Variants */
#define TT_UCR_SMALL_FORM_VARIANTS (1L << 2) /* U+FE50-U+FE6F */
/* Bit 67 Arabic Presentation Forms-B */
#define TT_UCR_ARABIC_PRESENTATIONS_B (1L << 3) /* U+FE70-U+FEFF */
/* Bit 68 Halfwidth And Fullwidth Forms */
#define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS (1L << 4) /* U+FF00-U+FFEF */
/* Bit 69 Specials */
#define TT_UCR_SPECIALS (1L << 5) /* U+FEFF,
U+FFF0-U+FFFF */
/* Bit 70 Tibetan */
#define TT_UCR_TIBETAN (1L << 6) /* U+0F00-U+0FBF */
/* Some compilers have a very limited length of identifiers. */
#if defined( __TURBOC__ ) && __TURBOC__ < 0x0410 || defined( __PACIFIC__ )
#define HAVE_LIMIT_ON_IDENTS
#endif
#ifndef HAVE_LIMIT_ON_IDENTS
/*
* Here some alias #defines in order to be clearer.
*
* These are not always #defined to stay within the 31 character limit
* which some compilers have.
*
* Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern
* Borland compilers (read: from BC++ 3.1 on) can increase this limit.
* If you get a warning with such a compiler, use the -i40 switch.
*/
#define TT_UCR_ARABIC_PRESENTATION_FORMS_A \
TT_UCR_ARABIC_PRESENTATIONS_A
#define TT_UCR_ARABIC_PRESENTATION_FORMS_B \
TT_UCR_ARABIC_PRESENTATIONS_B
#define TT_UCR_COMBINING_DIACRITICAL_MARKS \
TT_UCR_COMBINING_DIACRITICS
#define TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB \
TT_UCR_COMBINING_DIACRITICS_SYMB
#endif /* ndef HAVE_LIMIT_ON_IDENTS */
#endif /* FTNAMEID_H */
/* END */

View File

@ -0,0 +1,49 @@
/*******************************************************************
*
* Function :
*
* Description :
*
* Input :
*
* Output :
*
* Notes :
*
******************************************************************/
/*******************************************************************
*
* Function :
*
* Description :
*
* Input : None
*
* Output : Error code.
*
******************************************************************/
/*******************************************************************
*
* Function :
*
* Description :
*
******************************************************************/
/*******************************************************************
*
* Component Name (e.g. TTRaster.C) + eventually a version number.
*
* Component Short Description (e.g. Rasterizer).
*
* Copyright 1996 David Turner, Robert Wilhelm and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
******************************************************************/

View File

@ -0,0 +1,216 @@
/*******************************************************************
*
* ttcache.h 1.1
*
* Generic object cache
*
* Copyright 1996-1999 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*
* This component defines and implements object caches.
*
* An object class is a structure layout that encapsulate one
* given type of data used by the FreeType engine. Each object
* class is completely described by:
*
* - a 'root' or 'leading' structure containing the first
* important fields of the class. The root structure is
* always of fixed size.
*
* It is implemented as a simple C structure, and may
* contain several pointers to sub-tables that can be
* sized and allocated dynamically.
*
* Examples: TFace, TInstance, TGlyph & TExecution_Context
* (defined in 'ttobjs.h')
*
* - we make a difference between 'child' pointers and 'peer'
* pointers. A 'child' pointer points to a sub-table that is
* owned by the object, while a 'peer' pointer points to any
* other kind of data the object isn't responsible for.
*
* An object class is thus usually a 'tree' of 'child' tables.
*
* - each object class needs a constructor and a destructor.
*
* A constructor is a function which receives the address of
* freshly allocated and zeroed object root structure and
* 'builds' all the valid child data that must be associated
* to the object before it becomes 'valid'.
*
* A destructor does the inverse job: given the address of
* a valid object, it must discard all its child data and
* zero its main fields (essentially the pointers and array
* sizes found in the root fields).
*
*
* Important notes:
*
* When the constructor fails to allocate an object, it must
* return immediately with an error code, and not try to release
* what it has previously allocated before the error. The cache
* manager detects the error and calls the destructor on the
* partial object, before returning the error to the caller (along
* with a NULL pointer for the "new" object).
*
* The destructor must thus be able to deal with "partial objects",
* i.e., objects where only part of the child tables are allocated,
* and only release these ones. As the TT_Free() function accepts
* a NULL parameter (and returns successfuly in this case), no check
* is really necessary when using the macro 'FREE()'.
*
* Currently, there is no check in the cache manager to see if a
* destructor fails (double error state!).
*
* This scheme is more compact and more maintanable than the one
* where de-allocation code is duplicated in the constructor
* _and_ the destructor.
*
*
*
* Changes between 1.1 and 1.0:
*
* - introduced the refreshed and finalizer class definition/implementation
* - inserted an engine instance pointer in the cache structure
*
******************************************************************/
#ifndef TTCACHE_H
#define TTCACHE_H
#include "tttypes.h"
#include "ttconfig.h"
#include "ttmutex.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef TT_Error TConstructor( void* object,
void* parent );
typedef TT_Error TDestructor ( void* object );
typedef TConstructor TRefresher;
typedef TDestructor TFinalizer;
typedef TConstructor* PConstructor;
typedef TDestructor* PDestructor;
typedef TRefresher* PRefresher;
typedef TFinalizer* PFinalizer;
/* A Cache class record holds the data necessary to define */
/* a cache kind. */
struct TCache_Class_
{
ULong object_size;
Long idle_limit;
PConstructor init;
PDestructor done;
PRefresher reset;
PFinalizer finalize;
};
typedef struct TCache_Class_ TCache_Class;
typedef TCache_Class* PCache_Class;
/* Simple list node record. A list element is said to be 'unlinked' */
/* when it doesn't belong to any list. */
struct TList_Element_;
typedef struct TList_Element_ TList_Element;
typedef TList_Element* PList_Element;
struct TList_Element_
{
PList_Element next;
void* data;
};
/* Simple singly-linked list record - LIFO style, no tail field */
typedef PList_Element TSingle_List;
struct TCache_
{
PEngine_Instance engine;
PCache_Class clazz; /* 'class' is a reserved word in C++ */
TMutex* lock;
TSingle_List active;
TSingle_List idle;
Long idle_count;
};
typedef struct TCache_ TCache;
typedef TCache* PCache;
/* Returns a new list element, either fresh or recycled. */
/* Note: the returned element is unlinked. */
/* An object cache holds two lists tracking the active and */
/* idle objects that are currently created and used by the */
/* engine. It can also be 'protected' by a mutex. */
/* Initializes a new cache, of class 'clazz', pointed by 'cache', */
/* protected by the 'lock' mutex. Set 'lock' to NULL if the cache */
/* doesn't need protection */
LOCAL_DEF
TT_Error Cache_Create( PEngine_Instance engine,
PCache_Class clazz,
TCache* cache,
TMutex* lock );
/* Destroys a cache and all its listed objects */
LOCAL_DEF
TT_Error Cache_Destroy( TCache* cache );
/* Extracts a new object from the cache */
LOCAL_DEF
TT_Error Cache_New( TCache* cache,
void** new_object,
void* parent_object );
/* Returns an object to the cache, or discards it depending */
/* on the cache class' 'idle_limit' field */
LOCAL_DEF
TT_Error Cache_Done( TCache* cache, void* data );
#define CACHE_New( _cache, _newobj, _parent ) \
Cache_New( (TCache*)_cache, (void**)&_newobj, (void*)_parent )
#define CACHE_Done( _cache, _obj ) \
Cache_Done( (TCache*)_cache, (void*)_obj )
LOCAL_DEF
TT_Error TTCache_Init( PEngine_Instance engine );
LOCAL_DEF
TT_Error TTCache_Done( PEngine_Instance engine );
#ifdef __cplusplus
}
#endif
#endif /* TTCACHE_H */
/* END */

View File

@ -0,0 +1,97 @@
/*******************************************************************
*
* ttcalc.h
*
* Arithmetic Computations (specification).
*
* Copyright 1996-1999 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
******************************************************************/
#ifndef TTCALC_H
#define TTCALC_H
#include "ttconfig.h"
#include "freetype.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef LONG64
typedef INT64 TT_Int64;
#define ADD_64( x, y, z ) z = x + y
#define SUB_64( x, y, z ) z = x - y
#define MUL_64( x, y, z ) z = (TT_Int64)(x) * (y)
#define DIV_64( x, y ) ( (x) / (y) )
#define SQRT_64( x ) Sqrt64( x )
#define SQRT_32( x ) Sqrt32( x )
LOCAL_DEF TT_Int32 Sqrt64( TT_Int64 l );
#else /* LONG64 */
struct TT_Int64_
{
TT_Word32 lo;
TT_Word32 hi;
};
typedef struct TT_Int64_ TT_Int64;
#define ADD_64( x, y, z ) Add64( &x, &y, &z )
#define SUB_64( x, y, z ) Sub64( &x, &y, &z )
#define MUL_64( x, y, z ) MulTo64( x, y, &z )
#define DIV_64( x, y ) Div64by32( &x, y )
#define SQRT_64( x ) Sqrt64( &x )
#define SQRT_32( x ) Sqrt32( x )
LOCAL_DEF void Add64( TT_Int64* x, TT_Int64* y, TT_Int64* z );
LOCAL_DEF void Sub64( TT_Int64* x, TT_Int64* y, TT_Int64* z );
LOCAL_DEF void MulTo64( TT_Int32 x, TT_Int32 y, TT_Int64* z );
LOCAL_DEF TT_Int32 Div64by32( TT_Int64* x, TT_Int32 y );
LOCAL_DEF int Order64( TT_Int64* z );
LOCAL_DEF TT_Int32 Sqrt64( TT_Int64* l );
#endif /* LONG64 */
/* The two following functions are now part of the API! */
/* TT_Long TT_MulDiv( TT_Long a, TT_Long b, TT_Long c ); */
/* TT_Long TT_MulFix( TT_Long a, TT_Long b ); */
#define INT_TO_F26DOT6( x ) ( (Long)(x) << 6 )
#define INT_TO_F2DOT14( x ) ( (Long)(x) << 14 )
#define INT_TO_FIXED( x ) ( (Long)(x) << 16 )
#define F2DOT14_TO_FIXED( x ) ( (Long)(x) << 2 )
#define FLOAT_TO_FIXED( x ) ( (Long)(x * 65536.0) )
#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ((x) + 32) & -64) \
: ( -((32 - (x)) & -64) ) )
#ifdef __cplusplus
}
#endif
#endif /* TTCALC_H */
/* END */

View File

@ -0,0 +1,169 @@
/*******************************************************************
*
* ttcmap.h 1.0
*
* TrueType Character Mappings
*
* Copyright 1996-1999 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*
******************************************************************/
#ifndef TTCMAP_H
#define TTCMAP_H
#include "ttconfig.h"
#include "tttypes.h"
#ifdef __cplusplus
extern "C" {
#endif
/* format 0 */
struct TCMap0_
{
PByte glyphIdArray;
};
typedef struct TCMap0_ TCMap0;
typedef TCMap0* PCMap0;
/* format 2 */
struct TCMap2SubHeader_
{
UShort firstCode; /* first valid low byte */
UShort entryCount; /* number of valid low bytes */
Short idDelta; /* delta value to glyphIndex */
UShort idRangeOffset; /* offset from here to 1st code */
};
typedef struct TCMap2SubHeader_ TCMap2SubHeader;
typedef TCMap2SubHeader* PCMap2SubHeader;
struct TCMap2_
{
PUShort subHeaderKeys;
/* high byte mapping table */
/* value = subHeader index * 8 */
PCMap2SubHeader subHeaders;
PUShort glyphIdArray;
UShort numGlyphId; /* control value */
};
typedef struct TCMap2_ TCMap2;
typedef TCMap2* PCMap2;
/* format 4 */
struct TCMap4Segment_
{
UShort endCount;
UShort startCount;
Short idDelta; /* in the specs defined as UShort but the
example there gives negative values... */
UShort idRangeOffset;
};
typedef struct TCMap4Segment_ TCMap4Segment;
typedef TCMap4Segment* PCMap4Segment;
struct TCMap4_
{
UShort segCountX2; /* number of segments * 2 */
UShort searchRange; /* these parameters can be used */
UShort entrySelector; /* for a binary search */
UShort rangeShift;
PCMap4Segment segments;
PUShort glyphIdArray;
UShort numGlyphId; /* control value */
};
typedef struct TCMap4_ TCMap4;
typedef TCMap4* PCMap4;
/* format 6 */
struct TCMap6_
{
UShort firstCode; /* first character code of subrange */
UShort entryCount; /* number of character codes in subrange */
PUShort glyphIdArray;
};
typedef struct TCMap6_ TCMap6;
typedef TCMap6* PCMap6;
/* charmap table */
struct TCMapTable_
{
UShort platformID;
UShort platformEncodingID;
UShort format;
UShort length;
UShort version;
Bool loaded;
ULong offset;
union
{
TCMap0 cmap0;
TCMap2 cmap2;
TCMap4 cmap4;
TCMap6 cmap6;
} c;
};
typedef struct TCMapTable_ TCMapTable;
typedef TCMapTable* PCMapTable;
/* Load character mappings directory when face is loaded. */
/* The mappings themselves are only loaded on demand. */
LOCAL_DEF
TT_Error CharMap_Load( PCMapTable table,
TT_Stream input );
/* Destroy one character mapping table */
LOCAL_DEF
TT_Error CharMap_Free( PCMapTable table );
/* Use character mapping table to perform mapping */
LOCAL_DEF
UShort CharMap_Index( PCMapTable cmap,
UShort charCode );
/* NOTE: The PFace type isn't defined at this point */
#ifdef __cplusplus
}
#endif
#endif /* TTCMAP_H */
/* END */

View File

@ -0,0 +1,279 @@
/*******************************************************************
*
* ttconfig.h 1.0
*
* Configuration settings header file (spec only).
*
* Copyright 1996-1999 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
* Notes:
*
* All the configuration #define statements have been gathered in
* this file to allow easy check and modification.
*
******************************************************************/
#ifndef TTCONFIG_H
#define TTCONFIG_H
/* ------------ auto configuration ------------------------------------- */
/*************************************************************************/
/* Here we include the file ft_conf.h for system dependent stuff. */
/* The specific makefile is responsible for providing the right path to */
/* this file. */
#include "ft_conf.h"
/**************************************************************************/
/* Define TT_CONFIG_THREAD_SAFE if you want to build a thread-safe */
/* version of the library. */
/* #define TT_CONFIG_OPTION_THREAD_SAFE */
/* ------------ general debugging -------------------------------------- */
/*************************************************************************
*
* There are now three debugging modes:
*
* - trace mode:
*
* Error and trace messages are sent to the log file
* (which can be the standard error output). Define
* DEBUG_LEVEL_TRACE to enable this mode.
*
* - error mode:
*
* Only error messages are generated. Define
* DEBUG_LEVEL_ERROR to enable this mode.
*
* - release mode:
*
* Error messages are neither sent nor generated. The code is
* free from any debugging parts.
*
*
* Note that you should link the engine with the 'ttdebug' component.
* in case either DEBUG_LEVEL_TRACE or DEBUG_LEVEL_ERROR is defined.
*
* Please consult ttdebug.h for more details. */
/* #define DEBUG_LEVEL_TRACE */
/* #define DEBUG_LEVEL_ERROR */
/* ------------ special debugging -------------------------------------- */
/*************************************************************************/
/* Define this if you want to generate a special debug version of the */
/* rasterizer. This will progressively draw the glyphs while the */
/* computations are done directly on the graphics screen... (with */
/* inverted glyphs). */
/* */
/* Use it at your own risk! It is not maintained currently. */
/* */
/* IMPORTANT: This is reserved to developers willing to debug the */
/* rasterizer, which seems working very well in its */
/* current state... */
/* #define DEBUG_RASTER */
/*************************************************************************/
/* Define this to have a simple debugger version of RunIns(). */
/* */
/* Use it at your own risk! It is not maintained currently. */
/* #define DEBUG_INTERPRETER */
/*************************************************************************/
/* Define this to have some housekeeping of allocation and deallocation. */
/* */
/* Please note that probably not all OS-specific versions of ttmemory.c */
/* provide this functionality. */
/* #define DEBUG_MEMORY */
/*************************************************************************/
/* Define this to have bounds checking for file buffer frames. */
/* */
/* Please note that probably not all OS-specific versions of ttfile.c */
/* provide this functionality. */
/* #define DEBUG_FILE */
/* ------------ arithmetic and processor support ----------------------- */
/*************************************************************************/
/* Define TT_USE_LONG_LONG if you want to enable the use of the */
/* 'long long' 64-bit type provided by gcc and other compilers. Note */
/* that : */
/* */
/* 1. The type isn't ANSI, and thus will produce many warnings */
/* during library compilation. */
/* */
/* 2. Though the generated object files are slightly smaller, the */
/* resulting executables are bigger of about 4Kb! gcc must be */
/* linking some extra code in there! */
/* */
/* 3. There is really no speed gain in doing so (but it may help */
/* debug the ttcalc component). */
/* */
/* IMPORTANT NOTE: You don't need to define it on 64-bits machines! */
/* */
/* NOTE 2 : This flag used to be _GNUC_LONG64_ */
/* #define TT_USE_LONG_LONG */
/*************************************************************************/
/* define ALIGNMENT to your processor/environment preferred alignment */
/* size. A value of 8 should work on all current processors, even */
/* 64-bits ones. */
#define ALIGNMENT 8
/* --------------- miscellaneous ----------------------------------- */
/*********************************************************************/
/* The number of extensions available. Don't change this value */
/* except if you add new extensions to the engine. */
#define TT_MAX_EXTENSIONS 8
/* --------------- automatic setup -- don't touch ------------------ */
/*********************************************************************/
/* If HAVE_TT_TEXT is defined we don't provide a default typedef for */
/* defining TT_Text. */
#ifndef HAVE_TT_TEXT
#define HAVE_TT_TEXT
typedef char TT_Text;
#endif
/*********************************************************************/
/* We define NULL in case it's not defined yet. The default */
/* location is stdlib.h. */
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
/*********************************************************************/
/* Some systems can't use vfprintf for error messages on stderr; if */
/* HAVE_PRINT_FUNCTION is defined, the Print macro must be supplied */
/* externally (having the same parameters). */
/* */
/* This is only used by the "ttdebug" component, which should be */
/* linked to the engine only in debug mode. */
#if defined( DEBUG_LEVEL_TRACE ) || defined( DEBUG_LEVEL_ERROR )
#ifndef HAVE_PRINT_FUNCTION
#define Print( format, ap ) vfprintf( stderr, (format), (ap) )
#endif
#endif
/********************************************************************/
/* */
/* I have added the ability to compile the library into a single */
/* object file. This gets rids of all the external symbols defined */
/* in each component interface, and de-pollutes the name-space. */
/* */
/* I use two macros, namely LOCAL_FUNC and LOCAL_DEF, which only */
/* apply to functions that are internal to the engine, and */
/* should never be seen or linked by a client application. */
/* */
/* LOCAL_DEF used in header (.h) files, to define a function */
/* that will be seen by other components. This */
/* translates to "extern" in normal mode, and to */
/* "static" in single-object mode. */
/* */
/* LOCAL_FUNC used in implementation (.c) files, just before */
/* the function body. This translates to nothing */
/* in normal mode, and to "static" in single-object */
/* mode. */
/* */
/* Getting rid of un-necessary symbols makes the "ttcommon" */
/* renaming macros hack unnecessary. Moreover, the stripped */
/* single object file (freetype.o) is 52 Kb, instead of the */
/* previous 57 Kb (size of all combined .o files), and gives */
/* a better idea of the engine's real code size. */
/* */
/* It is called a "MAKE_OPTION" because the macro must be */
/* defined in the Makefile, rather than this one. It allows */
/* any developer to quickly switch from one mode to the other */
/* without messing with "ttconfig.h" each time. */
/* */
#ifndef TT_MAKE_OPTION_SINGLE_OBJECT
#define LOCAL_FUNC /* void */
#define LOCAL_DEF extern
#else
#define LOCAL_FUNC static
#define LOCAL_DEF static
#endif
/*************************************************************************/
/* Define EXPORT_DEF and EXPORT_FUNC as needed to build e.g. a DLL. All */
/* variables and functions visible from outside have these prefixes. */
#ifndef EXPORT_DEF
#define EXPORT_DEF extern
#endif
#ifndef EXPORT_FUNC
#define EXPORT_FUNC /* void */
#endif
/* -------------- internal (developer) configuration toggles ------------ */
#undef TT_STATIC_INTERPRETER
/* Do not undefine this configuration macro. It is now a default that */
/* must be kept in all release builds. */
#undef TT_STATIC_RASTER
/* Define this if you want to generate a static raster. This makes */
/* a non re-entrant version of the scan-line converter, which is */
/* about 10% faster and 50% bigger than an indirect one! */
#endif /* TTCONFIG_H */
/* END */

View File

@ -0,0 +1,170 @@
/*******************************************************************
*
* ttdebug.h
*
* Debugging and Logging component (specification)
*
* Copyright 1996-1999 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*
* This component contains various macros and functions used to
* ease the debugging of the FreeType engine. Its main purpose
* is in assertion checking, tracing, and error detection.
*
* There are now three debugging modes:
*
* - trace mode:
*
* Error and trace messages are sent to the log file
* (which can be the standard error output). Define
* DEBUG_LEVEL_TRACE to enable this mode.
*
* - error mode:
*
* Only error messages are generated. Define
* DEBUG_LEVEL_ERROR to enable this mode.
*
* - release mode:
*
* Error messages are neither sent nor generated. The code is
* free from any debugging parts.
*
******************************************************************/
#ifndef TTDEBUG_H
#define TTDEBUG_H
#include "ttconfig.h"
#include "tttypes.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined( DEBUG_LEVEL_TRACE )
typedef enum Trace_Component_
{
trace_any = 0,
trace_api,
trace_interp,
trace_load,
trace_gload,
trace_memory,
trace_file,
trace_mutex,
trace_cache,
trace_calc,
trace_cmap,
trace_extend,
trace_objs,
trace_raster,
trace_bitmap,
trace_max
} Trace_Component;
/* Here we define an array to hold the trace levels per component. */
/* Since it is globally defined, all array members are set to 0. */
/* You should set the values in this array either in your program */
/* or with your debugger. */
/* */
/* Currently, up to eight levels (PTRACE0-PTRACE7, see below) are */
/* used in some parts of the engine. */
/* */
/* For example, to have all tracing messages in the raster */
/* component, say */
/* */
/* #define DEBUG_LEVEL_TRACE */
/* #include "ttdebug.h" */
/* */
/* ... */
/* set_tt_trace_levels( trace_raster, 7 ) */
/* */
/* in your code before initializing the FreeType engine. */
/* */
/* Maybe it is better to define DEBUG_LEVEL_TRACE in ttconfig.h... */
extern char tt_trace_levels[trace_max];
/* IMPORTANT: */
/* */
/* Each component must define the macro TT_COMPONENT */
/* to a valid Trace_Component value before using any */
/* PTRACEx macro. */
/* */
#define PTRACE( level, varformat ) \
if ( tt_trace_levels[TT_COMPONENT] >= level ) TT_Message##varformat
#elif defined( DEBUG_LEVEL_ERROR )
#define PTRACE( level, varformat ) /* nothing */
#else /* RELEASE MODE */
#define TT_Assert( condition, action ) /* nothing */
#define PTRACE( level, varformat ) /* nothing */
#define PERROR( varformat ) /* nothing */
#define PANIC( varformat ) /* nothing */
#endif
/************************************************************************/
/* */
/* Define macros and fuctions that are common to the debug and trace */
/* modes. */
/* */
#if defined( DEBUG_LEVEL_TRACE ) || defined( DEBUG_LEVEL_ERROR )
#define TT_Assert( condition, action ) if ( !(condition) ) ( action )
void TT_Message( const String* fmt, ... );
void TT_Panic ( const String* fmt, ... );
/* print a message and exit */
const String* Cur_U_Line( void* exec );
#define PERROR( varformat ) TT_Message##varformat
#define PANIC( varformat ) TT_Panic##varformat
#endif
#if defined( DEBUG_LEVEL_TRACE )
void set_tt_trace_levels( int index, char value );
#endif
#define PTRACE0( varformat ) PTRACE( 0, varformat )
#define PTRACE1( varformat ) PTRACE( 1, varformat )
#define PTRACE2( varformat ) PTRACE( 2, varformat )
#define PTRACE3( varformat ) PTRACE( 3, varformat )
#define PTRACE4( varformat ) PTRACE( 4, varformat )
#define PTRACE5( varformat ) PTRACE( 5, varformat )
#define PTRACE6( varformat ) PTRACE( 6, varformat )
#define PTRACE7( varformat ) PTRACE( 7, varformat )
#ifdef __cplusplus
}
#endif
#endif /* TTDEBUG_H */

View File

@ -0,0 +1,115 @@
/*******************************************************************
*
* ttengine.h 1.1
*
* Engine instance structure definition.
*
* Copyright 1996-1999 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
* New in 1.1 :
*
* - added the 'raster_lock' mutex field to synchronize
* scan-line conversion in thread-safe and re-entrant builds.
*
******************************************************************/
#ifndef TTENGINE_H
#define TTENGINE_H
#include "tttypes.h"
#include "ttconfig.h"
#include "freetype.h"
#include "ttmutex.h"
#ifdef __cplusplus
extern "C" {
#endif
/********************************************************************/
/* */
/* The freetype engine instance structure. */
/* */
/* This structure holds all the data that is necessary to run */
/* one instance of the freetype engine. It is needed to get a */
/* completely re-entrant version of the library. */
/* */
/* The goal is to move _all_ component-specific variables, either */
/* static or global in the structure; the component initializers */
/* and finalizers will all be called with the address of a valid */
/* TEngine_Instance. */
/* */
/********************************************************************/
struct TEngine_Instance_
{
TMutex lock; /* engine lock */
void* list_free_elements;
void* objs_face_class; /* the face cache class */
void* objs_instance_class; /* the instance cache class */
void* objs_execution_class; /* the context cache class */
void* objs_glyph_class; /* the glyph cache class */
void* objs_face_cache; /* these caches are used to track */
void* objs_exec_cache; /* the current face and execution */
/* context objects */
void* file_component; /* ttfile implementation dependent */
TMutex raster_lock; /* mutex for this engine's render pool */
void* raster_component; /* ttraster implementation depedent */
Byte raster_palette[5]; /* gray-levels palette for anti-aliasing */
void* extension_component; /* extensions dependent */
#if 0
TT_Glyph_Loader_Callback glCallback; /* glyph loader callback, if any */
#endif
};
/* NOTE : The raster's lock is only acquired by the Render_Glyph and */
/* Render_Gray_Glyph functions, which always release it on exit */
/* They do not lock the engine mutex. This means you shouldn't */
/* be concerned about deadlocks between the two mutexes, as these */
/* should never appear.. */
typedef struct TEngine_Instance_ TEngine_Instance;
typedef TEngine_Instance* PEngine_Instance;
#ifdef TT_CONFIG_OPTION_THREAD_SAFE /* for re-entrant builds */
#define ENGINE_ARG TEngine_Instance* _engine
#define ENGINE_ARGS TEngine_Instance* _engine,
#define ENGINE_VAR _engine
#define ENGINE_VARS _engine,
#define ENGINE _engine
#else /* for thread-safe builds */
#define ENGINE_ARG /* void */
#define ENGINE_ARGS
#define ENGINE_VAR
#define ENGINE_VARS
#endif /* TT_CONFIG_OPTION_THREAD_SAFE */
#ifdef __cplusplus
}
#endif
#endif /* TTENGINE_H */
/* END */

Some files were not shown because too many files have changed in this diff Show More