We don't need these either for now.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32738 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2009-08-27 08:20:46 +00:00
parent 4a76f8198b
commit 04c2fe0b76
57 changed files with 0 additions and 16471 deletions
-12
View File
@@ -1,12 +0,0 @@
/*
* Master include file for the Game Kit.
*
*/
#include <WindowScreen.h>
#include <DirectWindow.h>
#include <FileGameSound.h>
#include <GameSound.h>
#include <GameSoundDefs.h>
#include <PushGameSound.h>
#include <SimpleGameSound.h>
#include <StreamingGameSound.h>
-13
View File
@@ -1,13 +0,0 @@
/*
* Master include file for the Midi Kit.
*
*/
#include <Midi.h>
#include <MidiDefs.h>
#include <MidiPort.h>
#include <MidiStore.h>
#include <MidiSynth.h>
#include <MidiSynthFile.h>
#include <MidiText.h>
#include <Samples.h>
#include <Synth.h>
-8
View File
@@ -1,8 +0,0 @@
/*
* Master include file for the Net Kit.
*
*/
#include <net_settings.h>
#include <netdb.h>
#include <socket.h>
#include <netinet/in.h>
-9
View File
@@ -1,9 +0,0 @@
/*
* Master include file for the Network Kit.
*
*/
#include <socket.h>
#include <NetAddress.h>
#include <NetBuffer.h>
#include <NetEndpoint.h>
#include <NetDebug.h>
-9
View File
@@ -1,9 +0,0 @@
/*
* Master include file for the OpenGL Kit.
*
*/
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <GLView.h>
-12
View File
@@ -1,12 +0,0 @@
/*
* Master include file for the Translation Kit.
*
* <TranslatorAddOn.h> not included, as it's only required when building an add-on
*/
#include <BitmapStream.h>
#include <TranslationDefs.h>
#include <TranslationErrors.h>
#include <TranslationUtils.h>
#include <TranslatorFormats.h>
#include <TranslatorRoster.h>
#include <Translator.h>
-168
View File
@@ -1,168 +0,0 @@
/*******************************************************************************
//
// File: DirectWindow.h
//
// Description: Client window class for direct screen access.
//
// Copyright 1998, Be Incorporated, All Rights Reserved.
//
*******************************************************************************/
#ifndef _DIRECT_WINDOW_H
#define _DIRECT_WINDOW_H
#include <Region.h>
#include <Window.h>
class BDirectDriver;
/* State of the direct access when called back through DirectConnected */
enum direct_buffer_state {
B_DIRECT_MODE_MASK = 15,
B_DIRECT_START = 0,
B_DIRECT_STOP = 1,
B_DIRECT_MODIFY = 2,
B_CLIPPING_MODIFIED = 16,
B_BUFFER_RESIZED = 32,
B_BUFFER_MOVED = 64,
B_BUFFER_RESET = 128
};
/* State of the direct driver and its hooks functions */
enum direct_driver_state {
B_DRIVER_CHANGED = 0x0001,
B_MODE_CHANGED = 0x0002
};
/* Integer rect used to define a cliping rectangle. All bounds are included */
/* Moved to Region.h */
/* Frame buffer access descriptor */
typedef struct {
direct_buffer_state buffer_state;
direct_driver_state driver_state;
void *bits;
void *pci_bits;
int32 bytes_per_row;
uint32 bits_per_pixel;
color_space pixel_format;
buffer_layout layout;
buffer_orientation orientation;
uint32 _reserved[9];
uint32 _dd_type_;
uint32 _dd_token_;
uint32 clip_list_count;
clipping_rect window_bounds;
clipping_rect clip_bounds;
clipping_rect clip_list[1];
} direct_buffer_info;
/* BDirectWindow class */
class BDirectWindow : public BWindow {
public:
BDirectWindow( BRect frame,
const char *title,
window_type type,
uint32 flags,
uint32 workspace = B_CURRENT_WORKSPACE);
BDirectWindow( BRect frame,
const char *title,
window_look look,
window_feel feel,
uint32 flags,
uint32 workspace = B_CURRENT_WORKSPACE);
virtual ~BDirectWindow();
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
/* defined for future extension (fragile base class). Identical to BWindow */
virtual void Quit(void);
virtual void DispatchMessage(BMessage *message, BHandler *handler);
virtual void MessageReceived(BMessage *message);
virtual void FrameMoved(BPoint new_position);
virtual void WorkspacesChanged(uint32 old_ws, uint32 new_ws);
virtual void WorkspaceActivated(int32 ws, bool state);
virtual void FrameResized(float new_width, float new_height);
virtual void Minimize(bool minimize);
virtual void Zoom( BPoint rec_position,
float rec_width,
float rec_height);
virtual void ScreenChanged(BRect screen_size, color_space depth);
virtual void MenusBeginning();
virtual void MenusEnded();
virtual void WindowActivated(bool state);
virtual void Show();
virtual void Hide();
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
virtual status_t Perform(perform_code d, void *arg);
private:
virtual void task_looper();
virtual BMessage *ConvertToMessage(void *raw, int32 code);
/* new APIs */
public:
virtual void DirectConnected(direct_buffer_info *info);
status_t GetClippingRegion(BRegion *region, BPoint *origin = NULL) const;
status_t SetFullScreen(bool enable);
bool IsFullScreen() const;
static bool SupportsWindowMode(screen_id = B_MAIN_SCREEN_ID);
/* private */
private:
typedef BWindow inherited;
virtual void _ReservedDirectWindow1();
virtual void _ReservedDirectWindow2();
virtual void _ReservedDirectWindow3();
virtual void _ReservedDirectWindow4();
BDirectWindow();
BDirectWindow(BDirectWindow &);
BDirectWindow &operator=(BDirectWindow &);
bool daemon_killer;
bool connection_enable;
bool full_screen_enable;
bool direct_driver_ready;
bool in_direct_connect;
int32 direct_lock;
sem_id direct_sem;
uint32 direct_lock_count;
thread_id direct_lock_owner;
char *direct_lock_stack;
sem_id disable_sem;
sem_id disable_sem_ack;
uint32 dw_init_status;
uint32 info_area_size;
uint32 direct_driver_type;
uint32 direct_driver_token;
area_id cloned_clipping_area;
area_id source_clipping_area;
thread_id direct_daemon_id;
direct_buffer_info *buffer_desc;
BDirectDriver *direct_driver;
struct priv_ext *extension;
uint32 _reserved_[15];
static int32 DirectDaemonFunc(void *arg);
bool LockDirect() const;
void UnlockDirect() const;
void InitData();
void DisposeData();
status_t DriverSetup() const;
};
#endif
-138
View File
@@ -1,138 +0,0 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: FileGameSound.h
// Author: Christopher ML Zumwalt May ([email protected])
// Description: BFileGameSound is a class that streams data out of a file.
//------------------------------------------------------------------------------
#ifndef _FILEGAMESOUND_H
#define _FILEGAMESOUND_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <StreamingGameSound.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
struct _gs_media_tracker;
struct _gs_ramp;
// FileGameSound -------------------------------------------------------------
class BFileGameSound : public BStreamingGameSound
{
public:
BFileGameSound(const entry_ref * file,
bool looping = true,
BGameSoundDevice * device = NULL);
BFileGameSound(const char * file,
bool looping = true,
BGameSoundDevice * device = NULL);
virtual ~BFileGameSound();
virtual BGameSound * Clone() const;
virtual status_t StartPlaying();
virtual status_t StopPlaying();
status_t Preload(); // if you have stopped and want to start quickly again
virtual void FillBuffer(void * inBuffer,
size_t inByteCount);
virtual status_t Perform(int32 selector, void * data);
virtual status_t SetPaused(bool isPaused,
bigtime_t rampTime);
enum {
B_NOT_PAUSED,
B_PAUSE_IN_PROGRESS,
B_PAUSED
};
int32 IsPaused();
private:
_gs_media_tracker * fAudioStream;
bool fStopping;
bool fLooping;
char fReserved;
char * fBuffer;
size_t fFrameSize;
size_t fBufferSize;
size_t fPlayPosition;
thread_id fReadThread;
port_id fPort;
_gs_ramp * fPausing;
bool fPaused;
float fPauseGain;
status_t Init(const entry_ref* file);
static int32 ReadThread(void* arg);
bool Load();
bool Read(void * buffer, size_t bytes);
/* leave these declarations private unless you plan on actually implementing and using them. */
BFileGameSound();
BFileGameSound(const BFileGameSound&);
BFileGameSound& operator=(const BFileGameSound&);
/* fbc data and virtuals */
uint32 _reserved_BFileGameSound_[9];
status_t _Reserved_BFileGameSound_0(int32 arg, ...); /* SetPaused(bool paused, bigtime_t ramp); */
virtual status_t _Reserved_BFileGameSound_1(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_2(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_3(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_4(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_5(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_6(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_7(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_8(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_9(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_10(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_11(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_12(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_13(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_14(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_15(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_16(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_17(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_18(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_19(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_20(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_21(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_22(int32 arg, ...);
virtual status_t _Reserved_BFileGameSound_23(int32 arg, ...);
};
#endif
-167
View File
@@ -1,167 +0,0 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: GameSound.h
// Author: Christopher ML Zumwalt May ([email protected])
// Description: Base class for play sounds using the game kit
//------------------------------------------------------------------------------
#ifndef _GAMESOUND_H
#define _GAMESOUND_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <GameSoundDefs.h>
#include <new>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
class BGameSoundDevice;
// BGameSound class -------------------------------------------------------------
class BGameSound
{
public:
BGameSound(BGameSoundDevice * device = NULL);
virtual ~BGameSound();
virtual BGameSound * Clone() const = 0;
status_t InitCheck() const;
// BGameSound attributes
BGameSoundDevice * Device() const;
gs_id ID() const;
const gs_audio_format & Format() const; // only valid after Init()
// Playing sounds
virtual status_t StartPlaying();
virtual bool IsPlaying();
virtual status_t StopPlaying();
// Modifing the playback
status_t SetGain(float gain,
bigtime_t duration = 0); // ramp duration in seconds
status_t SetPan(float pan,
bigtime_t duration = 0); // ramp duration in seconds
float Gain();
float Pan();
virtual status_t SetAttributes(gs_attribute * inAttributes,
size_t inAttributeCount);
virtual status_t GetAttributes(gs_attribute * outAttributes,
size_t inAttributeCount);
void * operator new(size_t size);
void * operator new(size_t size, const nothrow_t &) throw();
void operator delete(void * ptr);
#if !__MWERKS__
// there's a bug in MWCC under R4.1 and earlier
void operator delete(void * ptr,
const nothrow_t &) throw();
#endif
static status_t SetMemoryPoolSize(size_t in_poolSize);
static status_t LockMemoryPool(bool in_lockInCore);
static int32 SetMaxSoundCount(int32 in_maxCount);
virtual status_t Perform(int32 selector, void * data);
protected:
status_t SetInitError(status_t in_initError);
status_t Init(gs_id handle);
BGameSound(const BGameSound & other);
BGameSound & operator=(const BGameSound & other);
private:
BGameSoundDevice* fDevice;
status_t fInitError;
gs_audio_format fFormat;
gs_id fSound;
/* leave these declarations private unless you plan on actually implementing and using them. */
BGameSound();
/* fbc data and virtuals */
uint32 _reserved_BGameSound_[16];
virtual status_t _Reserved_BGameSound_0(int32 arg, ...);
virtual status_t _Reserved_BGameSound_1(int32 arg, ...);
virtual status_t _Reserved_BGameSound_2(int32 arg, ...);
virtual status_t _Reserved_BGameSound_3(int32 arg, ...);
virtual status_t _Reserved_BGameSound_4(int32 arg, ...);
virtual status_t _Reserved_BGameSound_5(int32 arg, ...);
virtual status_t _Reserved_BGameSound_6(int32 arg, ...);
virtual status_t _Reserved_BGameSound_7(int32 arg, ...);
virtual status_t _Reserved_BGameSound_8(int32 arg, ...);
virtual status_t _Reserved_BGameSound_9(int32 arg, ...);
virtual status_t _Reserved_BGameSound_10(int32 arg, ...);
virtual status_t _Reserved_BGameSound_11(int32 arg, ...);
virtual status_t _Reserved_BGameSound_12(int32 arg, ...);
virtual status_t _Reserved_BGameSound_13(int32 arg, ...);
virtual status_t _Reserved_BGameSound_14(int32 arg, ...);
virtual status_t _Reserved_BGameSound_15(int32 arg, ...);
virtual status_t _Reserved_BGameSound_16(int32 arg, ...);
virtual status_t _Reserved_BGameSound_17(int32 arg, ...);
virtual status_t _Reserved_BGameSound_18(int32 arg, ...);
virtual status_t _Reserved_BGameSound_19(int32 arg, ...);
virtual status_t _Reserved_BGameSound_20(int32 arg, ...);
virtual status_t _Reserved_BGameSound_21(int32 arg, ...);
virtual status_t _Reserved_BGameSound_22(int32 arg, ...);
virtual status_t _Reserved_BGameSound_23(int32 arg, ...);
virtual status_t _Reserved_BGameSound_24(int32 arg, ...);
virtual status_t _Reserved_BGameSound_25(int32 arg, ...);
virtual status_t _Reserved_BGameSound_26(int32 arg, ...);
virtual status_t _Reserved_BGameSound_27(int32 arg, ...);
virtual status_t _Reserved_BGameSound_28(int32 arg, ...);
virtual status_t _Reserved_BGameSound_29(int32 arg, ...);
virtual status_t _Reserved_BGameSound_30(int32 arg, ...);
virtual status_t _Reserved_BGameSound_31(int32 arg, ...);
virtual status_t _Reserved_BGameSound_32(int32 arg, ...);
virtual status_t _Reserved_BGameSound_33(int32 arg, ...);
virtual status_t _Reserved_BGameSound_34(int32 arg, ...);
virtual status_t _Reserved_BGameSound_35(int32 arg, ...);
virtual status_t _Reserved_BGameSound_36(int32 arg, ...);
virtual status_t _Reserved_BGameSound_37(int32 arg, ...);
virtual status_t _Reserved_BGameSound_38(int32 arg, ...);
virtual status_t _Reserved_BGameSound_39(int32 arg, ...);
virtual status_t _Reserved_BGameSound_40(int32 arg, ...);
virtual status_t _Reserved_BGameSound_41(int32 arg, ...);
virtual status_t _Reserved_BGameSound_42(int32 arg, ...);
virtual status_t _Reserved_BGameSound_43(int32 arg, ...);
virtual status_t _Reserved_BGameSound_44(int32 arg, ...);
virtual status_t _Reserved_BGameSound_45(int32 arg, ...);
virtual status_t _Reserved_BGameSound_46(int32 arg, ...);
virtual status_t _Reserved_BGameSound_47(int32 arg, ...);
};
#endif // _GAME_SOUND_H
-100
View File
@@ -1,100 +0,0 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: GameSound.cpp
// Author: Christopher ML Zumwalt May ([email protected])
// Description: Declerations for game sounds
//------------------------------------------------------------------------------
#if !defined(_GAME_SOUND_DEFS_H)
#define _GAME_SOUND_DEFS_H
#include <SupportDefs.h>
typedef int32 gs_id;
#define B_GS_CUR_API_VERSION B_BEOS_VERSION
#define B_GS_MIN_API_VERSION 0x100
// invalid sound handle
#define B_GS_INVALID_SOUND ((gs_id)-1)
// gs_id for the main mix buffer
#define B_GS_MAIN_SOUND ((gs_id)-2)
enum //fixme renumber to real error messages
{
B_GS_BAD_HANDLE = -99999,
B_GS_NO_SOUNDS,
B_GS_NO_HARDWARE,
B_GS_ALREADY_COMMITTED,
B_GS_READ_ONLY_VALUE
};
struct gs_audio_format
{ /* same as media_raw_audio_format */
enum format { /* for "format" */
B_GS_U8 = 0x11, /* 128 == mid, 1 == bottom, 255 == top */
B_GS_S16 = 0x2, /* 0 == mid, -32767 == bottom, +32767 == top */
B_GS_F = 0x24, /* 0 == mid, -1.0 == bottom, 1.0 == top */
B_GS_S32 = 0x4 /* 0 == mid, 0x80000001 == bottom, 0x7fffffff == top */
};
float frame_rate;
uint32 channel_count; /* 1 or 2, mostly */
uint32 format; /* for compressed formats, go to media_encoded_audio_format */
uint32 byte_order; /* 2 for little endian, 1 for big endian */
size_t buffer_size; /* size of each buffer -- NOT GUARANTEED */
};
//
enum gs_attributes
{
B_GS_NO_ATTRIBUTE = 0, // when there is no attribute
B_GS_MAIN_GAIN = 1, // 0 == 0 dB, -6.0 == -6 dB (gs_id ignored)
B_GS_CD_THROUGH_GAIN, // 0 == 0 dB, -12.0 == -12 dB (gs_id ignored)
// but which CD?
B_GS_GAIN = 128, // 0 == 0 dB, -1.0 == -1 dB, +10.0 == +10 dB
B_GS_PAN, // 0 == middle, -1.0 == left, +1.0 == right
B_GS_SAMPLING_RATE, // 44100.0 == 44.1 kHz
B_GS_LOOPING, // 0 == no
B_GS_FIRST_PRIVATE_ATTRIBUTE = 90000,
B_GS_FIRST_USER_ATTRIBUTE = 100000
};
struct gs_attribute
{
int32 attribute; // which attribute
bigtime_t duration; // how long of time to ramp over for the change
float value; // where the value stops changing
uint32 flags; // whatever flags are for the attribute
};
struct gs_attribute_info
{
int32 attribute;
float granularity;
float minimum;
float maximum;
};
#endif // _GAME_SOUND_DEFS_H
-138
View File
@@ -1,138 +0,0 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: FileGameSound.h
// Author: Christopher ML Zumwalt May ([email protected])
// Description: BFileGameSound is a class that streams data out of a file.
//------------------------------------------------------------------------------
#ifndef _PUSHGAMESOUND_H
#define _PUSHGAMESOUND_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <StreamingGameSound.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
// FileGameSound -------------------------------------------------------------
class BPushGameSound : public BStreamingGameSound
{
public:
BPushGameSound(size_t inBufferFrameCount,
const gs_audio_format * format,
size_t inBufferCount = 2,
BGameSoundDevice * device = NULL);
virtual ~BPushGameSound();
enum lock_status {
lock_failed = -1, // not yet time to do more
lock_ok = 0, // do more
lock_ok_frames_dropped // you may have missed some buffers
};
virtual lock_status LockNextPage(void ** out_pagePtr,
size_t * out_pageSize);
virtual status_t UnlockPage(void * in_pagePtr);
virtual lock_status LockForCyclic(void ** out_basePtr,
size_t * out_size);
virtual status_t UnlockCyclic();
virtual size_t CurrentPosition();
virtual BGameSound * Clone() const;
virtual status_t Perform(int32 selector, void * data);
protected:
BPushGameSound(BGameSoundDevice * device);
virtual status_t SetParameters(size_t inBufferFrameCount,
const gs_audio_format * format,
size_t inBufferCount);
virtual status_t SetStreamHook(void (*hook)(void * inCookie, void * inBuffer, size_t inByteCount, BStreamingGameSound * me),
void * cookie);
virtual void FillBuffer(void * inBuffer,
size_t inByteCount);
private:
/* leave these declarations private unless you plan on actually implementing and using them. */
BPushGameSound();
BPushGameSound(const BPushGameSound&);
BPushGameSound& operator=(const BPushGameSound&);
bool BytesReady(size_t * bytes);
sem_id fLock;
BList * fPageLocked;
size_t fLockPos;
size_t fPlayPos;
char * fBuffer;
size_t fPageSize;
int32 fPageCount;
size_t fBufferSize;
/* fbc data and virtuals */
uint32 _reserved_BPushGameSound_[12];
virtual status_t _Reserved_BPushGameSound_0(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_1(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_2(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_3(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_4(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_5(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_6(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_7(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_8(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_9(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_10(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_11(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_12(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_13(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_14(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_15(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_16(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_17(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_18(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_19(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_20(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_21(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_22(int32 arg, ...);
virtual status_t _Reserved_BPushGameSound_23(int32 arg, ...);
};
#endif // _PUSH_GAME_SOUND_H
-111
View File
@@ -1,111 +0,0 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: SimpleGameSound.h
// Author: Christopher ML Zumwalt May ([email protected])
// Description: BSimpleGameSound is a class for sound effects that are
// short, and consists of non-changing samples in memory.
//------------------------------------------------------------------------------
#ifndef _SIMPLEGAMESOUND_H
#define _SIMPLEGAMESOUND_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <GameSoundDefs.h>
#include <GameSound.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
// BGameSound class -------------------------------------------------------------
class BSimpleGameSound : public BGameSound
{
public:
BSimpleGameSound(const entry_ref * inFile,
BGameSoundDevice * device = NULL);
BSimpleGameSound(const char * inFile,
BGameSoundDevice * device = NULL);
BSimpleGameSound(const void * inData,
size_t inFrameCount,
const gs_audio_format * format,
BGameSoundDevice * device = NULL);
BSimpleGameSound(const BSimpleGameSound & other);
virtual ~BSimpleGameSound();
virtual BGameSound * Clone() const;
virtual status_t Perform(int32 selector, void * data);
status_t SetIsLooping(bool looping);
bool IsLooping() const;
private:
status_t Init(const entry_ref * inFile);
status_t Init(const void* inData,
int64 inFrameCount,
const gs_audio_format* format);
/* leave these declarations private unless you plan on actually implementing and using them. */
BSimpleGameSound();
BSimpleGameSound& operator=(const BSimpleGameSound&);
/* fbc data and virtuals */
uint32 _reserved_BSimpleGameSound_[12];
virtual status_t _Reserved_BSimpleGameSound_0(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_1(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_2(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_3(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_4(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_5(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_6(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_7(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_8(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_9(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_10(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_11(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_12(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_13(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_14(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_15(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_16(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_17(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_18(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_19(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_20(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_21(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_22(int32 arg, ...);
virtual status_t _Reserved_BSimpleGameSound_23(int32 arg, ...);
};
#endif // _SIMPLE_GAME_SOUND_H
-122
View File
@@ -1,122 +0,0 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: StreamingGameSound.h
// Author: Christopher ML Zumwalt May ([email protected])
// Description: BStreamingGameSound is a class for all kinds of streaming
// (data not known beforehand) game sounds.
//------------------------------------------------------------------------------
#ifndef _STREAMINGGAMESOUND_H
#define _STREAMINGGAMESOUND_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <SupportDefs.h>
#include <GameSound.h>
#include <Locker.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
class BStreamingGameSound : public BGameSound
{
public:
BStreamingGameSound(size_t inBufferFrameCount,
const gs_audio_format * format,
size_t inBufferCount = 2,
BGameSoundDevice * device = NULL);
virtual ~BStreamingGameSound();
virtual BGameSound * Clone() const;
virtual status_t SetStreamHook(void (*hook)(void * inCookie, void * inBuffer, size_t inByteCount, BStreamingGameSound * me),
void * cookie);
virtual void FillBuffer(void * inBuffer,
size_t inByteCount);
virtual status_t SetAttributes(gs_attribute * inAttributes,
size_t inAttributeCount);
virtual status_t Perform(int32 selector, void * data);
protected:
BStreamingGameSound(BGameSoundDevice * device);
virtual status_t SetParameters(size_t inBufferFrameCount,
const gs_audio_format * format,
size_t inBufferCount);
bool Lock();
void Unlock();
private:
void (*fStreamHook)(void * cookie, void * buffer, size_t bytes, BStreamingGameSound * sound);
void * fStreamCookie;
BLocker fLock;
/* leave these declarations private unless you plan on actually implementing and using them. */
BStreamingGameSound();
BStreamingGameSound(const BStreamingGameSound&);
BStreamingGameSound& operator=(const BStreamingGameSound&);
/* fbc data and virtuals */
uint32 _reserved_BStreamingGameSound_[12];
virtual status_t _Reserved_BStreamingGameSound_0(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_1(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_2(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_3(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_4(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_5(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_6(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_7(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_8(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_9(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_10(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_11(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_12(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_13(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_14(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_15(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_16(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_17(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_18(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_19(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_20(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_21(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_22(int32 arg, ...);
virtual status_t _Reserved_BStreamingGameSound_23(int32 arg, ...);
};
#endif // _STREAMING_GAME_SOUND_H
-225
View File
@@ -1,225 +0,0 @@
/*******************************************************************************
/
/ File: WindowScreen.h
/
/ Description: Client window class for direct screen access.
/
/ Copyright 1993-98, Be Incorporated, All Rights Reserved.
/
*******************************************************************************/
#ifndef _WINDOW_SCREEN_H
#define _WINDOW_SCREEN_H
#include <BeBuild.h>
#include <Window.h>
#include <SupportDefs.h>
#include <OS.h>
#include <kernel/image.h>
#include <GraphicsCard.h>
#include <Accelerant.h>
/* private struct */
typedef struct {
area_id memory_area;
area_id io_area;
char addon_path[64+B_FILE_NAME_LENGTH];
} _direct_screen_info_;
/* private typedef */
typedef int32 (*_add_on_control_)(uint32,void *);
/* Global function, allowing to move the position of the mouse when the GameKit is in
control of the screen. */
_IMPEXP_GAME
void set_mouse_position(int32 x, int32 y);
/********************** WARNING - WARNING - WARNING ***********************************
This is the current version of WindowScreen. The main purpose of this object is to
establish a direct connexion between application and graphic driver, to increase
efficiency and abilities. The graphic driver architecture will overcome serious
changes in the next release, consequently this could only be a preview version of
the real WindowScreen API.
Nevertheless, compatibility will be insure in future releases FOR MOST OF THE API,
through the use of a compatibility library (the new game library having a name
different from "libgame.so"), or a compatibility class (the new WindowScreen class
using a different name). Part of the API for which compatibility will not be insure
after the Preview Release are specifically pointed out in the following declarations.
****************************************************************************************/
enum {
B_ENABLE_VIEW_DRAWING = 0x0001,
B_ENABLE_DEBUGGER = 0x0002
};
class BWindowScreen : public BWindow {
public:
BWindowScreen(const char *title,
uint32 space,
status_t *error,
bool debug_enable = false);
BWindowScreen(const char *title,
uint32 space,
uint32 attributes,
status_t *error);
virtual ~BWindowScreen();
virtual void Quit(void);
virtual void ScreenConnected(bool active);
void Disconnect();
virtual void WindowActivated(bool active);
virtual void WorkspaceActivated(int32 ws, bool state);
virtual void ScreenChanged(BRect screen_size, color_space depth);
virtual void Hide();
virtual void Show();
void SetColorList(rgb_color *list,int32 first_index = 0,int32 last_index = 255);
status_t SetSpace(uint32 space);
bool CanControlFrameBuffer();
status_t SetFrameBuffer(int32 width, int32 height);
status_t MoveDisplayArea(int32 x, int32 y);
void *IOBase(); // Not supported anymore. It always returns NULL
rgb_color *ColorList();
frame_buffer_info *FrameBufferInfo();
graphics_card_hook CardHookAt(int32 index);
graphics_card_info *CardInfo();
/******************************* Debugger API Notice ********************************
Those three calls, and the debug_enable flag in the constructor, have been added to
help debugging a WindowScreen application without a cross-developement platform or
the use of serial debug output.
To use them, you need to :
- enable the debug mode by setting the debug_enable flag of the constructor to "true".
- register all threads that could be accessing the screen directly at any time. To do
that, call RegisterThread after spawning the new thread and before resuming
it (you should never draw from the Window thread itself, neither register it).
- launch your application from Terminal. The GameKit will first swicth to another
workspace before opening the WindowScreen. If you launch from workspace 0 [Alt-F1],
it will choose the workspace 1 [Alt-F2]. For any other workspace, it will choose
the previous one (for example, for workspace 3 (Alt-F4), it will choose workspace 2
[Alt-F3]).
Then :
- You can use printf(...) anywhere to display informations that will be logged in the
Terminal window. You can go back to the Terminal Window at any time (using the
correct Alt-F?? key). Switching workspace will automatically suspend all the thread
you registered and save the graphic context. Switching back to the WindowScreen
workspace will restore everything and resume your application.
- If you need to save and restore more states when your application is suspended and
resumed, you can overwrite the ForceSwitchForDebug() method. This function is called
with active == true just after suspending your app, and active == false just before
resuming it.
- You can suspend your application by calling the Debugger() method. This will also
switch to the Terminal workspace. Then you can resume by just switchng back to the
WindowScreen workspace (using the good Alt-F?? key). It's better not to call Debugger()
with the WindowScreen locked.
In case of crash :
- Use the safety short-cut : All the left modifiers (Ctrl, Shift, Option, Command, Alt
or equivalents) of your keyboard and F12. That should send you back to 640x480, and
the debugger terminal should be visible (and usable) if any.
- Then, you can also switch to your Terminal workspace to check the last printf infos.
- After you got (we hope) more information about your (or our :-) bug, quit the debugger
window. Then you should be able to change your code and run your application again.
In any case, check the Error() function immediately after the WindowScreen constructor.
A bad error code will mean that the GameKit is in a inconsistent state, and then you
have better to reboot your machine. If you don't wnat to reboot, you can also try to
run your application in a different workspace.
It's far to be perfect, but we hope it will still help.
The Debug API will not be support after the Preview Release (replaced by the debug
API in the new WindowScreen class).
***************************************************************************************/
void RegisterThread(thread_id id);
virtual void SuspensionHook(bool active);
void Suspend(char *label);
virtual status_t Perform(perform_code d, void *arg);
private:
typedef BWindow inherited;
virtual void _ReservedWindowScreen1();
virtual void _ReservedWindowScreen2();
virtual void _ReservedWindowScreen3();
virtual void _ReservedWindowScreen4();
BWindowScreen();
BWindowScreen(BWindowScreen &);
BWindowScreen &operator=(BWindowScreen &);
char addon_state;
char space_mode;
void *io_buffer;
bool direct_enable;
bool work_state;
bool window_state;
bool activate_state;
int32 lock_state;
int32 screen_index;
int32 memory_area, io_area;
display_mode *old_space;
display_mode *new_space;
uint32 space0;
sem_id activate_sem;
sem_id debug_sem;
image_id addon_image;
rgb_color colorList[256];
GetAccelerantHook m_gah;
graphics_card_info card_info;
graphics_card_hook hooks[B_HOOK_COUNT];
_direct_screen_info_ info;
frame_buffer_info format_info;
char *debug_buffer;
bool debug_state;
bool debug_first;
int32 debug_list_count;
int32 debug_workspace;
thread_id *debug_list;
uint32 _attributes;
uint32 mode_count;
display_mode *mode_list;
engine_token *et;
wait_engine_idle m_wei;
acquire_engine m_ae;
release_engine m_re;
fill_rectangle fill_rect;
screen_to_screen_blit blit_rect;
screen_to_screen_transparent_blit trans_blit_rect;
screen_to_screen_scaled_filtered_blit scaled_filtered_blit_rect;
uint32 _reserved_[21];
static BRect CalcFrame(int32 index, int32 space, display_mode *dmode);
int32 SetFullscreen(int32 enable);
status_t InitData(uint32 space, uint32 attributes);
status_t SetActiveState(int32 state);
status_t SetLockState(int32 state);
void GetCardInfo();
void Suspend();
void Resume();
status_t GetModeFromSpace(uint32 space, display_mode *dmode);
status_t InitClone();
status_t AssertDisplayMode(display_mode *dmode);
};
#endif
-160
View File
@@ -1,160 +0,0 @@
/*******************************************************************************
/
/ File: E-mail.h
/
/ Description: Mail attributes and BMailMessage class.
/
/ Copyright 1993-98, Be Incorporated, All Rights Reserved.
/
*******************************************************************************/
#ifndef _E_MAIL_H
#define _E_MAIL_H
#include <UTF8.h>
class BList;
/* -----------------------------------------------------------------------*/
/* 'E-Mail' attributes...*/
#define B_MAIL_ATTR_NAME "MAIL:name" /* indexed string*/
#define B_MAIL_ATTR_STATUS "MAIL:status" /* indexed string*/
#define B_MAIL_ATTR_PRIORITY "MAIL:priority" /* indexed string*/
#define B_MAIL_ATTR_TO "MAIL:to" /* indexed string*/
#define B_MAIL_ATTR_CC "MAIL:cc" /* indexed string*/
#define B_MAIL_ATTR_FROM "MAIL:from" /* indexed string*/
#define B_MAIL_ATTR_SUBJECT "MAIL:subject" /* indexed string*/
#define B_MAIL_ATTR_REPLY "MAIL:reply" /* indexed string*/
#define B_MAIL_ATTR_WHEN "MAIL:when" /* indexed time*/
#define B_MAIL_ATTR_FLAGS "MAIL:flags" /* indexed int32*/
#define B_MAIL_ATTR_RECIPIENTS "MAIL:recipients" /* string*/
#define B_MAIL_ATTR_MIME "MAIL:mime" /* string*/
#define B_MAIL_ATTR_HEADER "MAIL:header_length" /* int32*/
#define B_MAIL_ATTR_CONTENT "MAIL:content_length" /* int32*/
/* mail flags */
enum mail_flags {B_MAIL_PENDING = 1, /* waiting to be sent*/
B_MAIL_SENT = 2, /* has been sent*/
B_MAIL_SAVE = 4}; /* save mail after sending*/
#define B_MAIL_TYPE "text/x-email" /* mime type*/
/* Everything past this point is deprecated. See MailMessage.h, mail_encoding.h
and MailDaemon.h for alternatives. */
/* DEPRECATED -- DEPRECATED -- DEPRECATED -- DEPRECATED -- DEPRECATED */
/* DEPRECATED -- DEPRECATED -- DEPRECATED -- DEPRECATED -- DEPRECATED */
/* defines...*/
/* schedule days */
#define B_CHECK_NEVER 0
#define B_CHECK_WEEKDAYS 1
#define B_CHECK_DAILY 2
#define B_CHECK_CONTINUOUSLY 3
#define B_CHECK_CONTINUOSLY 3
/* max. lengths */
#define B_MAX_USER_NAME_LENGTH 32
#define B_MAX_HOST_NAME_LENGTH 64
/* rfc822 header field types */
#define B_MAIL_TO "To: "
#define B_MAIL_CC "Cc: "
#define B_MAIL_BCC "Bcc: "
#define B_MAIL_FROM "From: "
#define B_MAIL_DATE "Date: "
#define B_MAIL_REPLY "Reply-To: "
#define B_MAIL_SUBJECT "Subject: "
#define B_MAIL_PRIORITY "Priority: "
/* -----------------------------------------------------------------------*/
/* structs...*/
typedef struct {
char pop_name[B_MAX_USER_NAME_LENGTH];
char pop_password[B_MAX_USER_NAME_LENGTH];
char pop_host[B_MAX_HOST_NAME_LENGTH];
char real_name[128];
char reply_to[128];
int32 days; /* see flags above*/
int32 interval; /* in seconds*/
int32 begin_time; /* in seconds*/
int32 end_time; /* in seconds*/
} mail_pop_account;
typedef struct {
bool alert;
bool beep;
} mail_notification;
/* -----------------------------------------------------------------------*/
/* global functions...*/
_IMPEXP_MAIL int32 count_pop_accounts(void);
_IMPEXP_MAIL status_t get_pop_account(mail_pop_account*, int32 index = 0);
_IMPEXP_MAIL status_t set_pop_account(mail_pop_account*, int32 index = 0,
bool save = true);
_IMPEXP_MAIL status_t get_smtp_host(char*);
_IMPEXP_MAIL status_t set_smtp_host(char*, bool save = true);
_IMPEXP_MAIL status_t get_mail_notification(mail_notification*);
_IMPEXP_MAIL status_t set_mail_notification(mail_notification*, bool save = true);
_IMPEXP_MAIL status_t check_for_mail(int32 *incoming_count = NULL);
_IMPEXP_MAIL status_t send_queued_mail(void);
_IMPEXP_MAIL status_t forward_mail(entry_ref*, const char* recipients, bool now = true);
_IMPEXP_MAIL ssize_t decode_base64(char *out, char *in, off_t length,
bool replace_cr = false);
_IMPEXP_MAIL ssize_t encode_base64(char *out, char *in, off_t length);
/* -----------------------------------------------------------------------*/
/* class...*/
class BMailMessage {
public:
BMailMessage(void);
~BMailMessage(void);
status_t AddContent(const char *text, int32 length,
uint32 encoding = B_ISO1_CONVERSION,
bool clobber = false);
status_t AddContent(const char *text, int32 length,
const char *encoding, bool clobber = false);
status_t AddEnclosure(entry_ref *ref, bool clobber = false);
status_t AddEnclosure(const char *path, bool clobber = false);
status_t AddEnclosure(const char *MIME_type, void *data, int32 len,
bool clobber = false);
status_t AddHeaderField(uint32 encoding, const char *field_name, const char *str,
bool clobber = false);
status_t AddHeaderField(const char *field_name, const char *str,
bool clobber = false);
status_t Send(bool send_now = false,
bool remove_when_I_have_completed_sending_this_message_to_your_preferred_SMTP_server = false);
/* -----------------------------------------------------------------------*/
private:
BList* fFields;
bool fMultiPart;
int32 concatinate(char**, int32, char*);
int32 count_fields(char *name = NULL);
status_t find_field(char*, type_code*, char**, void**, int32*,
uint32*, char**, bool*, int32);
BList* find_field(const char*);
status_t get_field_name(char**, int32);
status_t set_field(const char*, type_code, const char*, const void*,
int32, uint32, const char*, bool);
};
#endif /* _MAIL_H */
-127
View File
@@ -1,127 +0,0 @@
#ifndef ZOIDBERG_MAIL_ATTACHMENT_H
#define ZOIDBERG_MAIL_ATTACHMENT_H
/* Attachment - classes which handle mail attachments
**
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
*/
#include <Node.h>
#include <MailContainer.h>
#include <MailComponent.h>
class BMailAttachment : public BMailComponent {
public:
virtual void SetFileName(const char *name) = 0;
virtual status_t FileName(char *name) = 0;
virtual status_t SetTo(BFile *file, bool deleteFileWhenDone = false) = 0;
virtual status_t SetTo(entry_ref *ref) = 0;
virtual status_t InitCheck() = 0;
private:
virtual void _ReservedAttachment1();
virtual void _ReservedAttachment2();
virtual void _ReservedAttachment3();
virtual void _ReservedAttachment4();
};
class BSimpleMailAttachment : public BMailAttachment {
public:
BSimpleMailAttachment(BPositionIO *dataToAttach, mail_encoding encoding = base64);
BSimpleMailAttachment(const void *dataToAttach, size_t lengthOfData, mail_encoding encoding = base64);
BSimpleMailAttachment(BFile *file, bool delete_when_done);
BSimpleMailAttachment(entry_ref *ref);
BSimpleMailAttachment();
virtual ~BSimpleMailAttachment();
virtual status_t SetTo(BFile *file, bool delete_file_when_done = false);
virtual status_t SetTo(entry_ref *ref);
virtual status_t InitCheck();
virtual void SetFileName(const char *name);
virtual status_t FileName(char *name);
virtual status_t GetDecodedData(BPositionIO *data);
virtual status_t SetDecodedData(BPositionIO *data);
virtual BPositionIO *GetDecodedData();
virtual status_t SetDecodedData(const void *data, size_t length /* data to attach */);
virtual status_t SetDecodedDataAndDeleteWhenDone(BPositionIO *data);
void SetEncoding(mail_encoding encoding = base64 /* note: we only support base64. This is a no-op */);
mail_encoding Encoding();
virtual status_t SetToRFC822(BPositionIO *data, size_t length, bool parse_now = false);
virtual status_t RenderToRFC822(BPositionIO *render_to);
private:
void Initialize(mail_encoding encoding);
void ParseNow();
virtual void _ReservedSimple1();
virtual void _ReservedSimple2();
virtual void _ReservedSimple3();
status_t fStatus;
BPositionIO *_data, *_raw_data;
size_t _raw_length;
off_t _raw_offset;
bool _we_own_data;
mail_encoding _encoding;
uint32 _reserved[5];
};
class BAttributedMailAttachment : public BMailAttachment {
public:
BAttributedMailAttachment(BFile *file, bool delete_when_done);
BAttributedMailAttachment(entry_ref *ref);
BAttributedMailAttachment();
virtual ~BAttributedMailAttachment();
virtual status_t SetTo(BFile *file, bool delete_file_when_done = false);
virtual status_t SetTo(entry_ref *ref);
virtual status_t InitCheck();
void SaveToDisk(BEntry *entry);
//-----we pay no attention to entry, but set it to the location of our file in /tmp
void SetEncoding(mail_encoding encoding /* anything but uuencode */);
mail_encoding Encoding();
virtual status_t FileName(char *name);
virtual void SetFileName(const char *name);
virtual status_t GetDecodedData(BPositionIO *data);
virtual status_t SetDecodedData(BPositionIO *data);
virtual status_t SetToRFC822(BPositionIO *data, size_t length, bool parse_now = false);
virtual status_t RenderToRFC822(BPositionIO *render_to);
virtual status_t MIMEType(BMimeType *mime);
private:
status_t Initialize();
virtual void _ReservedAttributed1();
virtual void _ReservedAttributed2();
virtual void _ReservedAttributed3();
BMIMEMultipartMailContainer *fContainer;
status_t fStatus;
BSimpleMailAttachment *_data, *_attributes_attach;
BMessage _attributes;
uint32 _reserved[5];
};
#endif /* ZOIDBERG_MAIL_ATTACHMENT_H */
-140
View File
@@ -1,140 +0,0 @@
#ifndef ZOIDBERG_MAIL_COMPONENT_H
#define ZOIDBERG_MAIL_COMPONENT_H
/* (Text)Component - message component base class and plain text
**
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
*/
#include <UTF8.h>
#include <Message.h>
#include <String.h>
#include <mail_encoding.h>
class BMimeType;
extern const char *kHeaderCharsetString;
extern const char *kHeaderEncodingString;
// Special field names in the headers which specify the character set (int32)
// and encoding (int8) to use when converting the headers from UTF-8 to the
// output e-mail format (rfc2047). For use with SetHeaderField when you pass
// it a structured header in a BMessage.
enum component_type {
B_MAIL_PLAIN_TEXT_BODY = 0,
B_MAIL_SIMPLE_ATTACHMENT,
B_MAIL_ATTRIBUTED_ATTACHMENT,
B_MAIL_MULTIPART_CONTAINER
};
class BMailComponent {
public:
BMailComponent(uint32 defaultCharSet = B_MAIL_NULL_CONVERSION);
virtual ~BMailComponent();
//------Info on this component
uint32 ComponentType();
BMailComponent *WhatIsThis();
// Takes any generic MailComponent, and returns an instance
// of a MailComponent subclass that applies to this case,
// ready for instantiation. Note that you still have to
// Instantiate() it yourself.
bool IsAttachment();
// Returns true if this component is an attachment, false
// otherwise
void SetHeaderField(
const char *key, const char *value,
uint32 charset = B_MAIL_NULL_CONVERSION,
mail_encoding encoding = null_encoding,
bool replace_existing = true);
// If you want to delete a header, pass in a zero length or NULL
// string for the value field, or use RemoveHeader.
void SetHeaderField(
const char *key, BMessage *structured_header,
bool replace_existing = true);
const char *HeaderAt(int32 index);
const char *HeaderField(const char *key, int32 index = 0);
status_t HeaderField(const char *key, BMessage *structured_header, int32 index = 0);
status_t RemoveHeader(const char *key);
virtual status_t GetDecodedData(BPositionIO *data);
virtual status_t SetDecodedData(BPositionIO *data);
virtual status_t SetToRFC822(BPositionIO *data, size_t length, bool parse_now = false);
virtual status_t RenderToRFC822(BPositionIO *render_to);
virtual status_t MIMEType(BMimeType *mime);
protected:
uint32 _charSetForTextDecoding;
// This is the character set to be used for decoding text
// components, or if it is B_MAIL_NULL_CONVERSION then the character
// set will be determined automatically. Since we can't use a
// global variable (different messages might have different values
// of this), and since sub-components can't find their parents,
// this is passed down during construction to some (just Component,
// Container, Message, MIME, Text) child components and ends up
// being used in the text components.
private:
virtual void _ReservedComponent1();
virtual void _ReservedComponent2();
virtual void _ReservedComponent3();
virtual void _ReservedComponent4();
virtual void _ReservedComponent5();
BMessage headers;
uint32 _reserved[5];
};
class BTextMailComponent : public BMailComponent {
public:
BTextMailComponent(const char *text = NULL, uint32 defaultCharSet = B_MAIL_NULL_CONVERSION);
virtual ~BTextMailComponent();
void SetEncoding(mail_encoding encoding, int32 charset);
// encoding: you should always use quoted_printable, base64 is strongly not
// recommended, see rfc 2047 for the reasons why
// charset: use Conversion flavor constants from UTF8.h
void SetText(const char *text);
void AppendText(const char *text);
const char *Text();
BString *BStringText();
void Quote(const char *message = NULL,
const char *quote_style = "> ");
virtual status_t GetDecodedData(BPositionIO *data);
virtual status_t SetDecodedData(BPositionIO *data);
virtual status_t SetToRFC822(BPositionIO *data, size_t length, bool parse_now = false);
virtual status_t RenderToRFC822(BPositionIO *render_to);
private:
virtual void _ReservedText1();
virtual void _ReservedText2();
BString text;
BString decoded;
mail_encoding encoding;
uint32 charset; // This character set is used for encoding, not decoding.
status_t ParseRaw();
BPositionIO *raw_data;
size_t raw_length;
off_t raw_offset;
uint32 _reserved[5];
};
#endif /* ZOIDBERG_MAIL_COMPONENT_H */
-78
View File
@@ -1,78 +0,0 @@
#ifndef ZOIDBERG_MAIL_CONTAINER_H
#define ZOIDBERG_MAIL_CONTAINER_H
/* Container - message part container class
**
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
*/
#include <List.h>
#include <MailComponent.h>
class BPositionIO;
class BMailContainer : public BMailComponent {
public:
BMailContainer (uint32 defaultCharSet = B_MAIL_NULL_CONVERSION) :
BMailComponent (defaultCharSet) {};
virtual status_t AddComponent(BMailComponent *component) = 0;
virtual status_t RemoveComponent(BMailComponent *component) = 0;
virtual status_t RemoveComponent(int32 index) = 0;
virtual BMailComponent *GetComponent(int32 index, bool parse_now = false) = 0;
virtual int32 CountComponents() const = 0;
private:
virtual void _ReservedContainer1();
virtual void _ReservedContainer2();
virtual void _ReservedContainer3();
virtual void _ReservedContainer4();
};
class BMIMEMultipartMailContainer : public BMailContainer {
public:
BMIMEMultipartMailContainer(
const char *boundary = NULL,
const char *this_is_an_MIME_message_text = NULL,
uint32 defaultCharSet = B_MAIL_NULL_CONVERSION);
BMIMEMultipartMailContainer(BMIMEMultipartMailContainer &copy);
virtual ~BMIMEMultipartMailContainer();
void SetBoundary(const char *boundary);
void SetThisIsAnMIMEMessageText(const char *text);
// MailContainer
virtual status_t AddComponent(BMailComponent *component);
virtual status_t RemoveComponent(BMailComponent *component);
virtual status_t RemoveComponent(int32 index);
virtual BMailComponent *GetComponent(int32 index, bool parse_now = false);
virtual int32 CountComponents() const;
// MailComponent
virtual status_t GetDecodedData(BPositionIO *data);
virtual status_t SetDecodedData(BPositionIO *data);
virtual status_t SetToRFC822(BPositionIO *data, size_t length, bool parse_now = false);
virtual status_t RenderToRFC822(BPositionIO *render_to);
private:
virtual void _ReservedMultipart1();
virtual void _ReservedMultipart2();
virtual void _ReservedMultipart3();
const char *_boundary;
const char *_MIME_message_warning;
BPositionIO *_io_data;
BList _components_in_raw;
BList _components_in_code;
uint32 _reserved[5];
};
#endif /* ZOIDBERG_MAIL_CONTAINER_H */
-18
View File
@@ -1,18 +0,0 @@
#ifndef ZOIDBERG_MAIL_DAEMON_H
#define ZOIDBERG_MAIL_DAEMON_H
/* Daemon - talking to the mail daemon
**
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
*/
class BMailDaemon {
public:
static status_t CheckMail(bool send_queued_mail = true,const char *account = NULL);
static status_t SendQueuedMail();
static int32 CountNewMessages(bool wait_for_fetch_completion = false);
static status_t Quit();
};
#endif /* ZOIDBERG_MAIL_DAEMON_H */
-112
View File
@@ -1,112 +0,0 @@
#ifndef ZOIDBERG_MAIL_MESSAGE_H
#define ZOIDBERG_MAIL_MESSAGE_H
/* Message - the main general purpose mail message class
**
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
*/
#include <MailContainer.h>
// add our additional attributes
#define B_MAIL_ATTR_ACCOUNT "MAIL:account"
#define B_MAIL_ATTR_THREAD "MAIL:thread"
class BDirectory;
enum mail_reply_to_mode {
B_MAIL_REPLY_TO = 0,
B_MAIL_REPLY_TO_ALL,
B_MAIL_REPLY_TO_SENDER
};
class BEmailMessage : public BMailContainer {
public:
BEmailMessage(BPositionIO *mail_file = NULL, bool own = false, uint32 defaultCharSet = B_MAIL_NULL_CONVERSION);
BEmailMessage(entry_ref *ref, uint32 defaultCharSet = B_MAIL_NULL_CONVERSION);
virtual ~BEmailMessage();
status_t InitCheck() const;
BPositionIO *Data() const { return fData; }
// is only set if the message owns the data
BEmailMessage *ReplyMessage(mail_reply_to_mode replyTo, bool accountFromMail, const char *quote_style = "> ");
BEmailMessage *ForwardMessage(bool accountFromMail, bool includeAttachments = false);
// These return messages with the body quoted and
// ready to send via the appropriate channel. ReplyMessage()
// addresses the message appropriately, but ForwardMessage()
// leaves it unaddressed.
const char *To();
const char *From();
const char *ReplyTo();
const char *CC();
const char *Subject();
const char *Date();
int Priority();
void SetSubject(const char *to, uint32 charset = B_MAIL_NULL_CONVERSION, mail_encoding encoding = null_encoding);
void SetReplyTo(const char *to, uint32 charset = B_MAIL_NULL_CONVERSION, mail_encoding encoding = null_encoding);
void SetFrom(const char *to, uint32 charset = B_MAIL_NULL_CONVERSION, mail_encoding encoding = null_encoding);
void SetTo(const char *to, uint32 charset = B_MAIL_NULL_CONVERSION, mail_encoding encoding = null_encoding);
void SetCC(const char *to, uint32 charset = B_MAIL_NULL_CONVERSION, mail_encoding encoding = null_encoding);
void SetBCC(const char *to);
void SetPriority(int to);
status_t GetName(char *name,int32 maxLength) const;
status_t GetName(BString *name) const;
void SendViaAccountFrom(BEmailMessage *message);
void SendViaAccount(const char *account_name);
void SendViaAccount(int32 chain_id);
int32 Account() const;
status_t GetAccountName(char *account,int32 maxLength) const;
status_t GetAccountName(BString *account) const;
virtual status_t AddComponent(BMailComponent *component);
virtual status_t RemoveComponent(BMailComponent *component);
virtual status_t RemoveComponent(int32 index);
virtual BMailComponent *GetComponent(int32 index, bool parse_now = false);
virtual int32 CountComponents() const;
void Attach(entry_ref *ref, bool include_attributes = true);
bool IsComponentAttachment(int32 index);
void SetBodyTextTo(const char *text);
const char *BodyText();
status_t SetBody(BTextMailComponent *body);
BTextMailComponent *Body();
virtual status_t SetToRFC822(BPositionIO *data, size_t length, bool parse_now = false);
virtual status_t RenderToRFC822(BPositionIO *render_to);
status_t RenderTo(BDirectory *dir, BEntry *message = NULL);
//---message will be set to the message file if not equal to NULL
status_t Send(bool send_now);
private:
BTextMailComponent *RetrieveTextBody(BMailComponent *);
virtual void _ReservedMessage1();
virtual void _ReservedMessage2();
virtual void _ReservedMessage3();
BPositionIO *fData;
status_t _status;
int32 _chain_id;
char *_bcc;
int32 _num_components;
BMailComponent *_body;
BTextMailComponent *_text_body;
uint32 _reserved[5];
};
#endif /* ZOIDBERG_MAIL_MESSAGE_H */
-153
View File
@@ -1,153 +0,0 @@
#ifndef ZOIDBERG_MAIL_SETTINGS_H
#define ZOIDBERG_MAIL_SETTINGS_H
/* Settings - the mail daemon's settings
**
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
*/
#include <Archivable.h>
#include <List.h>
#include <Message.h>
class BPath;
typedef enum
{
B_MAIL_SHOW_STATUS_WINDOW_NEVER = 0,
B_MAIL_SHOW_STATUS_WINDOW_WHEN_SENDING = 1,
B_MAIL_SHOW_STATUS_WINDOW_WHEN_ACTIVE = 2,
B_MAIL_SHOW_STATUS_WINDOW_ALWAYS = 3
} b_mail_status_window_option;
typedef enum
{
B_MAIL_STATUS_LOOK_TITLED = 0,
B_MAIL_STATUS_LOOK_NORMAL_BORDER = 1,
B_MAIL_STATUS_LOOK_FLOATING = 2,
B_MAIL_STATUS_LOOK_THIN_BORDER = 3,
B_MAIL_STATUS_LOOK_NO_BORDER = 4
} b_mail_status_window_look;
typedef enum {
inbound,
outbound
} b_mail_chain_direction;
class BMailStatusWindow;
class BMailChain;
BMailChain* NewMailChain();
BMailChain* GetMailChain(uint32 id);
status_t GetOutboundMailChains(BList *list);
status_t GetInboundMailChains(BList *list);
class BMailChain : public BArchivable
{
public:
BMailChain(uint32 id);
BMailChain(BMessage*);
virtual ~BMailChain();
virtual status_t Archive(BMessage*,bool) const;
static BArchivable* Instantiate(BMessage*);
status_t Save(bigtime_t timeout = B_INFINITE_TIMEOUT);
status_t Delete() const;
status_t Reload();
status_t InitCheck() const;
uint32 ID() const;
b_mail_chain_direction ChainDirection() const;
void SetChainDirection(b_mail_chain_direction);
const char *Name() const;
status_t SetName(const char*);
BMessage *MetaData() const;
// "Filter" below refers to the settings message for a MailFilter
int32 CountFilters() const;
status_t GetFilter(int32 index, BMessage* out_settings, entry_ref *addon = NULL) const;
status_t SetFilter(int32 index, const BMessage&, const entry_ref&);
status_t AddFilter(const BMessage&, const entry_ref&); // at end
status_t AddFilter(int32 index, const BMessage&, const entry_ref&);
status_t RemoveFilter(int32 index);
void RunChain(BMailStatusWindow *window,
bool async = true,
bool save_when_done = true,
bool delete_when_done = false);
private:
status_t Path(BPath *path) const;
status_t Load(BMessage*);
int32 id;
char name[B_FILE_NAME_LENGTH];
BMessage *meta_data;
status_t _err;
b_mail_chain_direction direction;
int32 settings_ct, addons_ct;
BList filter_settings;
BList filter_addons;
uint32 _reserved[5];
};
class BMailSettings
{
public:
BMailSettings();
~BMailSettings();
status_t Save(bigtime_t timeout = B_INFINITE_TIMEOUT);
status_t Reload();
status_t InitCheck() const;
// Global settings
int32 WindowFollowsCorner();
void SetWindowFollowsCorner(int32 which_corner);
uint32 ShowStatusWindow();
void SetShowStatusWindow(uint32 mode);
bool DaemonAutoStarts();
void SetDaemonAutoStarts(bool does_it);
void SetConfigWindowFrame(BRect frame);
BRect ConfigWindowFrame();
void SetStatusWindowFrame(BRect frame);
BRect StatusWindowFrame();
int32 StatusWindowWorkspaces();
void SetStatusWindowWorkspaces(int32 workspaces);
int32 StatusWindowLook();
void SetStatusWindowLook(int32 look);
bigtime_t AutoCheckInterval();
void SetAutoCheckInterval(bigtime_t);
bool CheckOnlyIfPPPUp();
void SetCheckOnlyIfPPPUp(bool yes);
bool SendOnlyIfPPPUp();
void SetSendOnlyIfPPPUp(bool yes);
uint32 DefaultOutboundChainID();
void SetDefaultOutboundChainID(uint32 to);
private:
BMessage data;
uint32 _reserved[4];
};
#endif /* ZOIDBERG_MAIL_SETTINGS_H */
-59
View File
@@ -1,59 +0,0 @@
#ifndef ZOIDBERG_MAIL_ENCODING_H
#define ZOIDBERG_MAIL_ENCODING_H
/* mail encoding - mail de-/encoding functions (base64 and friends)
**
** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
*/
#include <size_t.h>
#include <sys/types.h>
#define B_MAIL_NULL_CONVERSION ((uint32) -1)
#define B_MAIL_UTF8_CONVERSION ((uint32) -2)
// For specifying the UTF-8 character set when converting to/from UTF-8.
#define B_MAIL_US_ASCII_CONVERSION ((uint32) -3)
// Plain 7 bit ASCII character set. A subset of UTF-8, but some mail software
// specifies it so we need to recognize it.
#define BASE64_LINELENGTH 76
typedef enum {
base64 = 'b',
quoted_printable = 'q',
seven_bit = '7',
eight_bit = '8',
uuencode = 'u', // Invalid to encode something using uuencode.
null_encoding = 0, // For not changing existing settings.
no_encoding = -1
} mail_encoding;
#ifdef __cplusplus
extern "C" {
#endif
ssize_t encode(mail_encoding encoding, char *out, const char *in,
off_t length, int headerMode);
// boolean headerMode only matters for quoted_printable and base64.
ssize_t decode(mail_encoding encoding, char *out, const char *in, off_t length,
int underscore_is_space);
// the value of underscore_is_space only matters for quoted_printable.
ssize_t max_encoded_length(mail_encoding encoding, off_t cur_length);
mail_encoding encoding_for_cte(const char *content_transfer_encoding);
ssize_t encode_base64(char *out, const char *in, off_t length, int headerMode);
ssize_t decode_base64(char *out, const char *in, off_t length);
ssize_t encode_qp(char *out, const char *in, off_t length, int headerMode);
ssize_t decode_qp(char *out, const char *in, off_t length, int underscore_is_space);
//---underscore_is_space should be 1 if and only if you are decoding a header field
ssize_t uu_decode(char *out, const char *in, off_t length);
#ifdef __cplusplus
}
#endif
#endif /* ZOIDBERG_MAIL_ENCODING_H */
-123
View File
@@ -1,123 +0,0 @@
#ifndef _MIDI_H
#define _MIDI_H
#include <BeBuild.h>
#include <MidiDefs.h>
#include <OS.h>
class BList;
class BMidiLocalProducer;
class BMidiLocalConsumer;
class BMidi
{
public:
BMidi();
virtual ~BMidi();
virtual void NoteOff(
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
virtual void NoteOn(
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
virtual void KeyPressure(
uchar channel, uchar note, uchar pressure, uint32 time = B_NOW);
virtual void ControlChange(
uchar channel, uchar controlNumber, uchar controlValue,
uint32 time = B_NOW);
virtual void ProgramChange(
uchar channel, uchar programNumber, uint32 time = B_NOW);
virtual void ChannelPressure(
uchar channel, uchar pressure, uint32 time = B_NOW);
virtual void PitchBend(
uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW);
virtual void SystemExclusive(
void* data, size_t length, uint32 time = B_NOW);
virtual void SystemCommon(
uchar status, uchar data1, uchar data2, uint32 time = B_NOW);
virtual void SystemRealTime(uchar status, uint32 time = B_NOW);
virtual void TempoChange(int32 beatsPerMinute, uint32 time = B_NOW);
virtual void AllNotesOff(bool justChannel = true, uint32 time = B_NOW);
virtual status_t Start();
virtual void Stop();
bool IsRunning() const;
void Connect(BMidi* toObject);
void Disconnect(BMidi* fromObject);
bool IsConnected(BMidi* toObject) const;
BList* Connections() const;
void SnoozeUntil(uint32 time) const;
protected:
void SprayNoteOff(
uchar channel, uchar note, uchar velocity, uint32 time) const;
void SprayNoteOn(
uchar channel, uchar note, uchar velocity, uint32 time) const;
void SprayKeyPressure(
uchar channel, uchar note, uchar pressure, uint32 time) const;
void SprayControlChange(
uchar channel, uchar controlNumber, uchar controlValue,
uint32 time) const;
void SprayProgramChange(
uchar channel, uchar programNumber, uint32 time) const;
void SprayChannelPressure(
uchar channel, uchar pressure, uint32 time) const;
void SprayPitchBend(
uchar channel, uchar lsb, uchar msb, uint32 time) const;
void SpraySystemExclusive(
void* data, size_t length, uint32 time = B_NOW) const;
void SpraySystemCommon(
uchar status, uchar data1, uchar data2, uint32 time) const;
void SpraySystemRealTime(uchar status, uint32 time) const;
void SprayTempoChange(int32 beatsPerMinute, uint32 time) const;
bool KeepRunning();
private:
friend status_t _run_thread(void* data);
virtual void _ReservedMidi1();
virtual void _ReservedMidi2();
virtual void _ReservedMidi3();
virtual void Run();
BMidiLocalProducer* producer;
BMidiLocalConsumer* consumer;
BList* connections;
volatile thread_id threadId;
volatile bool isRunning;
uint8 _reserved1[3];
uint32 _reserved2[5];
};
#endif // _MIDI_H
-302
View File
@@ -1,302 +0,0 @@
#ifndef _MIDI_DEFS_H
#define _MIDI_DEFS_H
#include <OS.h>
#include <Errors.h>
//------------------------------------------------------------------------------
/* System time converted to int milliseconds */
#define B_NOW ((uint32)(system_time()/1000))
//------------------------------------------------------------------------------
/* Synthesizer things */
#define B_SYNTH_DIRECTORY B_BEOS_DATA_DIRECTORY
#define B_BIG_SYNTH_FILE "synth/big_synth.sy"
#define B_LITTLE_SYNTH_FILE "synth/little_synth.sy"
typedef enum synth_mode
{
B_NO_SYNTH,
B_BIG_SYNTH,
B_LITTLE_SYNTH,
B_DEFAULT_SYNTH,
B_SAMPLES_ONLY
}
synth_mode;
//------------------------------------------------------------------------------
/* Need to move these into Errors.h */
enum
{
B_BAD_INSTRUMENT = B_MIDI_ERROR_BASE + 0x100,
B_BAD_MIDI_DATA,
B_ALREADY_PAUSED,
B_ALREADY_RESUMED,
B_NO_SONG_PLAYING,
B_TOO_MANY_SONGS_PLAYING
};
//------------------------------------------------------------------------------
#ifndef uchar
typedef unsigned char uchar;
#endif
#ifndef _MIDI_CONSTANTS_
#define _MIDI_CONSTANTS_
/* Channel Message Masks*/
const uchar B_NOTE_OFF = 0x80;
const uchar B_NOTE_ON = 0x90;
const uchar B_KEY_PRESSURE = 0xa0;
const uchar B_CONTROL_CHANGE = 0xb0;
const uchar B_PROGRAM_CHANGE = 0xc0;
const uchar B_CHANNEL_PRESSURE = 0xd0;
const uchar B_PITCH_BEND = 0xe0;
/* System Messages*/
const uchar B_SYS_EX_START = 0xf0;
const uchar B_MIDI_TIME_CODE = 0xf1;
const uchar B_SONG_POSITION = 0xf2;
const uchar B_SONG_SELECT = 0xf3;
const uchar B_CABLE_MESSAGE = 0xf5;
const uchar B_TUNE_REQUEST = 0xf6;
const uchar B_SYS_EX_END = 0xf7;
const uchar B_TIMING_CLOCK = 0xf8;
const uchar B_START = 0xfa;
const uchar B_CONTINUE = 0xfb;
const uchar B_STOP = 0xfc;
const uchar B_ACTIVE_SENSING = 0xfe;
const uchar B_SYSTEM_RESET = 0xff;
/* Controller Numbers*/
const uchar B_MODULATION = 0x01;
const uchar B_BREATH_CONTROLLER = 0x02;
const uchar B_FOOT_CONTROLLER = 0x04;
const uchar B_PORTAMENTO_TIME = 0x05;
const uchar B_DATA_ENTRY = 0x06;
const uchar B_MAIN_VOLUME = 0x07;
const uchar B_MIDI_BALANCE = 0x08; /* used to be B_BALANCE */
const uchar B_PAN = 0x0a;
const uchar B_EXPRESSION_CTRL = 0x0b;
const uchar B_GENERAL_CTRL_1 = 0x10;
const uchar B_GENERAL_CTRL_2 = 0x11;
const uchar B_GENERAL_CTRL_3 = 0x12;
const uchar B_GENERAL_CTRL_4 = 0x13;
const uchar B_SUSTAIN_PEDAL = 0x40;
const uchar B_PORTAMENTO = 0x41;
const uchar B_SOSTENUTO = 0x42;
const uchar B_SOFT_PEDAL = 0x43;
const uchar B_HOLD_2 = 0x45;
const uchar B_GENERAL_CTRL_5 = 0x50;
const uchar B_GENERAL_CTRL_6 = 0x51;
const uchar B_GENERAL_CTRL_7 = 0x52;
const uchar B_GENERAL_CTRL_8 = 0x53;
const uchar B_EFFECTS_DEPTH = 0x5b;
const uchar B_TREMOLO_DEPTH = 0x5c;
const uchar B_CHORUS_DEPTH = 0x5d;
const uchar B_CELESTE_DEPTH = 0x5e;
const uchar B_PHASER_DEPTH = 0x5f;
const uchar B_DATA_INCREMENT = 0x60;
const uchar B_DATA_DECREMENT = 0x61;
const uchar B_RESET_ALL_CONTROLLERS = 0x79;
const uchar B_LOCAL_CONTROL = 0x7a;
const uchar B_ALL_NOTES_OFF = 0x7b;
const uchar B_OMNI_MODE_OFF = 0x7c;
const uchar B_OMNI_MODE_ON = 0x7d;
const uchar B_MONO_MODE_ON = 0x7e;
const uchar B_POLY_MODE_ON = 0x7f;
const uchar B_TEMPO_CHANGE = 0x51;
#endif // _MIDI_CONSTANTS_
//------------------------------------------------------------------------------
typedef enum midi_axe
{
/* Pianos */
B_ACOUSTIC_GRAND=0,
B_BRIGHT_GRAND,
B_ELECTRIC_GRAND,
B_HONKY_TONK,
B_ELECTRIC_PIANO_1,
B_ELECTRIC_PIANO_2,
B_HARPSICHORD,
B_CLAVICHORD,
/* Tuned Idiophones */
B_CELESTA,
B_GLOCKENSPIEL,
B_MUSIC_BOX,
B_VIBRAPHONE,
B_MARIMBA,
B_XYLOPHONE,
B_TUBULAR_BELLS,
B_DULCIMER,
/* Organs */
B_DRAWBAR_ORGAN,
B_PERCUSSIVE_ORGAN,
B_ROCK_ORGAN,
B_CHURCH_ORGAN,
B_REED_ORGAN,
B_ACCORDION,
B_HARMONICA,
B_TANGO_ACCORDION,
/* Guitars */
B_ACOUSTIC_GUITAR_NYLON,
B_ACOUSTIC_GUITAR_STEEL,
B_ELECTRIC_GUITAR_JAZZ,
B_ELECTRIC_GUITAR_CLEAN,
B_ELECTRIC_GUITAR_MUTED,
B_OVERDRIVEN_GUITAR,
B_DISTORTION_GUITAR,
B_GUITAR_HARMONICS,
/* Basses */
B_ACOUSTIC_BASS,
B_ELECTRIC_BASS_FINGER,
B_ELECTRIC_BASS_PICK,
B_FRETLESS_BASS,
B_SLAP_BASS_1,
B_SLAP_BASS_2,
B_SYNTH_BASS_1,
B_SYNTH_BASS_2,
/* Strings */
B_VIOLIN,
B_VIOLA,
B_CELLO,
B_CONTRABASS,
B_TREMOLO_STRINGS,
B_PIZZICATO_STRINGS,
B_ORCHESTRAL_STRINGS,
B_TIMPANI,
/* Ensemble strings and voices */
B_STRING_ENSEMBLE_1,
B_STRING_ENSEMBLE_2,
B_SYNTH_STRINGS_1,
B_SYNTH_STRINGS_2,
B_VOICE_AAH,
B_VOICE_OOH,
B_SYNTH_VOICE,
B_ORCHESTRA_HIT,
/* Brass */
B_TRUMPET,
B_TROMBONE,
B_TUBA,
B_MUTED_TRUMPET,
B_FRENCH_HORN,
B_BRASS_SECTION,
B_SYNTH_BRASS_1,
B_SYNTH_BRASS_2,
/* Reeds */
B_SOPRANO_SAX,
B_ALTO_SAX,
B_TENOR_SAX,
B_BARITONE_SAX,
B_OBOE,
B_ENGLISH_HORN,
B_BASSOON,
B_CLARINET,
/* Pipes */
B_PICCOLO,
B_FLUTE,
B_RECORDER,
B_PAN_FLUTE,
B_BLOWN_BOTTLE,
B_SHAKUHACHI,
B_WHISTLE,
B_OCARINA,
/* Synth Leads*/
B_LEAD_1,
B_SQUARE_WAVE = B_LEAD_1,
B_LEAD_2,
B_SAWTOOTH_WAVE = B_LEAD_2,
B_LEAD_3,
B_CALLIOPE = B_LEAD_3,
B_LEAD_4,
B_CHIFF = B_LEAD_4,
B_LEAD_5,
B_CHARANG = B_LEAD_5,
B_LEAD_6,
B_VOICE = B_LEAD_6,
B_LEAD_7,
B_FIFTHS = B_LEAD_7,
B_LEAD_8,
B_BASS_LEAD = B_LEAD_8,
/* Synth Pads */
B_PAD_1,
B_NEW_AGE = B_PAD_1,
B_PAD_2,
B_WARM = B_PAD_2,
B_PAD_3,
B_POLYSYNTH = B_PAD_3,
B_PAD_4,
B_CHOIR = B_PAD_4,
B_PAD_5,
B_BOWED = B_PAD_5,
B_PAD_6,
B_METALLIC = B_PAD_6,
B_PAD_7,
B_HALO = B_PAD_7,
B_PAD_8,
B_SWEEP = B_PAD_8,
/* Effects */
B_FX_1,
B_FX_2,
B_FX_3,
B_FX_4,
B_FX_5,
B_FX_6,
B_FX_7,
B_FX_8,
/* Ethnic */
B_SITAR,
B_BANJO,
B_SHAMISEN,
B_KOTO,
B_KALIMBA,
B_BAGPIPE,
B_FIDDLE,
B_SHANAI,
/* Percussion */
B_TINKLE_BELL,
B_AGOGO,
B_STEEL_DRUMS,
B_WOODBLOCK,
B_TAIKO_DRUMS,
B_MELODIC_TOM,
B_SYNTH_DRUM,
B_REVERSE_CYMBAL,
/* Sound Effects */
B_FRET_NOISE,
B_BREATH_NOISE,
B_SEASHORE,
B_BIRD_TWEET,
B_TELEPHONE,
B_HELICOPTER,
B_APPLAUSE,
B_GUNSHOT
}
midi_axe;
#endif // _MIDI_DEFS_H
-87
View File
@@ -1,87 +0,0 @@
#ifndef _MIDI_PORT_H
#define _MIDI_PORT_H
#include <Midi.h>
namespace BPrivate { class BMidiPortGlue; }
class BMidiPort : public BMidi
{
public:
BMidiPort(const char* name = NULL);
~BMidiPort();
status_t InitCheck() const;
status_t Open(const char* name);
void Close();
const char* PortName() const;
virtual void NoteOff(
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
virtual void NoteOn(
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
virtual void KeyPressure(
uchar channel, uchar note, uchar pressure, uint32 time = B_NOW);
virtual void ControlChange(
uchar channel, uchar controlNumber, uchar controlValue,
uint32 time = B_NOW);
virtual void ProgramChange(
uchar channel, uchar programNumber, uint32 time = B_NOW);
virtual void ChannelPressure(
uchar channel, uchar pressure, uint32 time = B_NOW);
virtual void PitchBend(
uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW);
virtual void SystemExclusive(
void* data, size_t length, uint32 time = B_NOW);
virtual void SystemCommon(
uchar status, uchar data0, uchar data2, uint32 time = B_NOW);
virtual void SystemRealTime(uchar status, uint32 time = B_NOW);
virtual status_t Start();
virtual void Stop();
int32 CountDevices();
status_t GetDeviceName(
int32 n, char* name, size_t bufSize = B_OS_NAME_LENGTH);
private:
typedef BMidi super;
friend class BPrivate::BMidiPortGlue;
virtual void _ReservedMidiPort1();
virtual void _ReservedMidiPort2();
virtual void _ReservedMidiPort3();
virtual void Run();
void ScanDevices();
void EmptyDeviceList();
BMidiLocalProducer* localSource;
BMidiLocalConsumer* localSink;
BMidiProducer* remoteSource;
BMidiConsumer* remoteSink;
char* portName;
status_t status;
BList* devices;
uint32 _reserved[1];
};
#endif // _MIDI_PORT_H
-134
View File
@@ -1,134 +0,0 @@
#ifndef _MIDI_STORE_H
#define _MIDI_STORE_H
#include <BeBuild.h>
#include <Midi.h>
#include <MidiSynthFile.h>
struct entry_ref;
class BFile;
class BList;
class BMidiEvent;
class BMidiStore : public BMidi
{
public:
BMidiStore();
virtual ~BMidiStore();
virtual void NoteOff(
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
virtual void NoteOn(
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
virtual void KeyPressure(
uchar channel, uchar note, uchar pressure, uint32 time = B_NOW);
virtual void ControlChange(
uchar channel, uchar controlNumber, uchar controlValue,
uint32 time = B_NOW);
virtual void ProgramChange(
uchar channel, uchar programNumber, uint32 time = B_NOW);
virtual void ChannelPressure(
uchar channel, uchar pressure, uint32 time = B_NOW);
virtual void PitchBend(
uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW);
virtual void SystemExclusive(
void* data, size_t length, uint32 time = B_NOW);
virtual void SystemCommon(
uchar status, uchar data1, uchar data2, uint32 time = B_NOW);
virtual void SystemRealTime(uchar status, uint32 time = B_NOW);
virtual void TempoChange(int32 beatsPerMinute, uint32 time = B_NOW);
status_t Import(const entry_ref* ref);
status_t Export(const entry_ref* ref, int32 format);
void SortEvents(bool force = false);
uint32 CountEvents() const;
uint32 CurrentEvent() const;
void SetCurrentEvent(uint32 eventNumber);
uint32 DeltaOfEvent(uint32 eventNumber) const;
uint32 EventAtDelta(uint32 time) const;
uint32 BeginTime() const;
void SetTempo(int32 beatsPerMinute);
int32 Tempo() const;
private:
friend class BMidiSynthFile;
virtual void _ReservedMidiStore1();
virtual void _ReservedMidiStore2();
virtual void _ReservedMidiStore3();
virtual void Run();
void AddEvent(BMidiEvent* event);
void SprayEvent(const BMidiEvent* event, uint32 time);
BMidiEvent* EventAt(int32 index) const;
uint32 GetEventTime(const BMidiEvent* event) const;
uint32 TicksToMilliseconds(uint32 ticks) const;
uint32 MillisecondsToTicks(uint32 ms) const;
BList* events;
int32 currentEvent;
uint32 startTime;
int32 beatsPerMinute;
int16 ticksPerBeat;
bool needsSorting;
void ReadFourCC(char* fourcc);
uint32 Read32Bit();
uint16 Read16Bit();
uint8 PeekByte();
uint8 NextByte();
void SkipBytes(uint32 length);
uint32 ReadVarLength();
void ReadChunk();
void ReadTrack();
void ReadSystemExclusive();
void ReadMetaEvent();
void WriteFourCC(char a, char b, char c, char d);
void Write32Bit(uint32 val);
void Write16Bit(uint16 val);
void WriteByte(uint8 val);
void WriteVarLength(uint32 val);
void WriteTrack();
void WriteMetaEvent(BMidiEvent* event);
BFile* file;
uint32 byteCount;
uint32 totalTicks;
uint16 numTracks;
uint16 currTrack;
uint16 format;
uint16 _reserved1[1];
bool* instruments;
synth_file_hook hookFunc;
int32 hookArg;
bool looping;
bool paused;
bool finished;
uint32 _reserved2[12];
};
#endif // _MIDI_STORE_H
-88
View File
@@ -1,88 +0,0 @@
#ifndef _MIDI_SYNTH_H
#define _MIDI_SYNTH_H
#include <BeBuild.h>
#include <Midi.h>
#include <Synth.h>
#include <MidiDefs.h>
class BMidiSynth : public BMidi
{
public:
BMidiSynth();
virtual ~BMidiSynth();
status_t EnableInput(bool enable, bool loadInstruments);
bool IsInputEnabled(void) const;
void SetVolume(double volume);
double Volume(void) const;
void SetTransposition(int16 offset);
int16 Transposition(void) const;
void MuteChannel(int16 channel, bool do_mute);
void GetMuteMap(char* pChannels) const;
void SoloChannel(int16 channel, bool do_solo);
void GetSoloMap(char* pChannels) const;
status_t LoadInstrument(int16 instrument);
status_t UnloadInstrument(int16 instrument);
status_t RemapInstrument(int16 from, int16 to);
void FlushInstrumentCache(bool startStopCache);
uint32 Tick(void) const;
virtual void NoteOff(
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
virtual void NoteOn(
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
virtual void KeyPressure(
uchar channel, uchar note, uchar pressure, uint32 time = B_NOW);
virtual void ControlChange(
uchar channel, uchar controlNumber, uchar controlValue,
uint32 time = B_NOW);
virtual void ProgramChange(
uchar channel, uchar programNumber, uint32 time = B_NOW);
virtual void ChannelPressure(
uchar channel, uchar pressure, uint32 time = B_NOW);
virtual void PitchBend(
uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW);
virtual void AllNotesOff(bool justChannel, uint32 time = B_NOW);
protected:
void* fSongVariables;
void* fPerformanceVariables;
bool fMidiQueue;
private:
friend class BSynth;
virtual void _ReservedMidiSynth1();
virtual void _ReservedMidiSynth2();
virtual void _ReservedMidiSynth3();
virtual void _ReservedMidiSynth4();
virtual void Run();
bigtime_t creationTime;
int16 transpose;
bool inputEnabled;
uint32 _reserved;
};
#endif // _MIDI_SYNTH_H
-65
View File
@@ -1,65 +0,0 @@
#ifndef _MIDI_SYNTH_FILE_H
#define _MIDI_SYNTH_FILE_H
#include <BeBuild.h>
#include <MidiSynth.h>
#include <Entry.h>
typedef void (*synth_file_hook)(int32 arg);
class BMidiStore;
class BMidiSynthFile : public BMidiSynth
{
public:
BMidiSynthFile();
~BMidiSynthFile();
status_t LoadFile(const entry_ref* midi_entry_ref);
void UnloadFile(void);
virtual status_t Start(void);
virtual void Stop(void);
void Fade(void);
void Pause(void);
void Resume(void);
int32 Duration(void) const;
int32 Position(int32 ticks) const;
int32 Seek();
status_t GetPatches(int16* pArray768, int16* pReturnedCount) const;
void SetFileHook(synth_file_hook pSongHook, int32 arg);
bool IsFinished(void) const;
void ScaleTempoBy(double tempoFactor);
void SetTempo(int32 newTempoBPM);
int32 Tempo(void) const;
void EnableLooping(bool loop);
void MuteTrack(int16 track, bool do_mute);
void GetMuteMap(char* pTracks) const;
void SoloTrack(int16 track, bool do_solo);
void GetSoloMap(char* pTracks) const;
private:
friend class BSynth;
virtual void _ReservedMidiSynthFile1();
virtual void _ReservedMidiSynthFile2();
virtual void _ReservedMidiSynthFile3();
BMidiStore* store;
int32 _reserved[3];
};
#endif // _MIDI_SYNTH_FILE
-63
View File
@@ -1,63 +0,0 @@
#ifndef _MIDI_TEXT_H
#define _MIDI_TEXT_H
#include <BeBuild.h>
#include <Midi.h>
#include <stdio.h>
class BMidiText : public BMidi
{
public:
BMidiText();
virtual ~BMidiText();
virtual void NoteOff(
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
virtual void NoteOn(
uchar channel, uchar note, uchar velocity, uint32 time = B_NOW);
virtual void KeyPressure(
uchar channel, uchar note, uchar pressure, uint32 time = B_NOW);
virtual void ControlChange(
uchar channel, uchar controlNumber, uchar controlValue,
uint32 time = B_NOW);
virtual void ProgramChange(
uchar channel, uchar programNumber, uint32 time = B_NOW);
virtual void ChannelPressure(
uchar channel, uchar pressure, uint32 time = B_NOW);
virtual void PitchBend(
uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW);
virtual void SystemExclusive(
void* data, size_t length, uint32 time = B_NOW);
virtual void SystemCommon(
uchar status, uchar data1, uchar data2, uint32 time = B_NOW);
virtual void SystemRealTime(uchar status, uint32 time = B_NOW);
void ResetTimer(bool start = false);
private:
virtual void _ReservedMidiText1();
virtual void _ReservedMidiText2();
virtual void _ReservedMidiText3();
virtual void Run();
void WaitAndPrint(uint32 time);
uint32 startTime;
uint32 _reserved[4];
};
#endif // _MIDI_TEXT_H
-50
View File
@@ -1,50 +0,0 @@
#ifndef _SAMPLES_H
#define _SAMPLES_H
#include <BeBuild.h>
#include <Entry.h>
typedef void (*sample_exit_hook)(int32 arg);
typedef bool (*sample_loop_hook)(int32 arg);
class BSamples
{
public:
BSamples();
virtual ~BSamples();
void Start(
void* sampleData, int32 frames, int16 bytes_per_sample,
int16 channel_count, double pitch, int32 loopStart, int32 loopEnd,
double sampleVolume, double stereoPosition, int32 hook_arg,
sample_loop_hook pLoopContinueProc, sample_exit_hook pDoneProc);
bool IsPaused(void) const;
void Pause(void);
void Resume(void);
void Stop(void);
bool IsPlaying(void) const;
void SetVolume(double newVolume);
double Volume(void) const;
void SetSamplingRate(double newRate);
double SamplingRate(void) const;
void SetPlacement(double stereoPosition);
double Placement(void) const;
void EnableReverb(bool useReverb);
private:
virtual void _ReservedSamples1();
virtual void _ReservedSamples2();
virtual void _ReservedSamples3();
uint32 _reserved[8];
};
#endif // _SAMPLES_H
-109
View File
@@ -1,109 +0,0 @@
#ifndef _SYNTH_H
#define _SYNTH_H
#include <BeBuild.h>
#include <Entry.h>
#include <MidiDefs.h>
#include <OS.h>
typedef enum interpolation_mode
{
B_DROP_SAMPLE = 0,
B_2_POINT_INTERPOLATION,
B_LINEAR_INTERPOLATION
}
interpolation_mode;
typedef enum reverb_mode
{
B_REVERB_NONE = 1,
B_REVERB_CLOSET,
B_REVERB_GARAGE,
B_REVERB_BALLROOM,
B_REVERB_CAVERN,
B_REVERB_DUNGEON
}
reverb_mode;
typedef void (*synth_controller_hook) (
int16 channel, int16 controller, int16 value);
class BMidiSynth;
class BMidiSynthFile;
namespace BPrivate { class BSoftSynth; }
class BSynth
{
public:
BSynth();
BSynth(synth_mode synth);
virtual ~BSynth();
status_t LoadSynthData(entry_ref* instrumentsFile);
status_t LoadSynthData(synth_mode synth);
synth_mode SynthMode(void);
void Unload(void);
bool IsLoaded(void) const;
status_t SetSamplingRate(int32 sample_rate);
int32 SamplingRate() const;
status_t SetInterpolation(interpolation_mode interp_mode);
interpolation_mode Interpolation() const;
void SetReverb(reverb_mode rev_mode);
reverb_mode Reverb() const;
status_t EnableReverb(bool reverb_enabled);
bool IsReverbEnabled() const;
status_t SetVoiceLimits(
int16 maxSynthVoices, int16 maxSampleVoices,
int16 limiterThreshhold);
int16 MaxSynthVoices(void) const;
int16 MaxSampleVoices(void) const;
int16 LimiterThreshhold(void) const;
void SetSynthVolume(double theVolume);
double SynthVolume(void) const;
void SetSampleVolume(double theVolume);
double SampleVolume(void) const;
status_t GetAudio(
int16* pLeft, int16* pRight, int32 max_samples) const;
void Pause(void);
void Resume(void);
void SetControllerHook(int16 controller, synth_controller_hook cback);
int32 CountClients(void) const;
private:
friend BMidiSynth;
friend BMidiSynthFile;
virtual void _ReservedSynth1();
virtual void _ReservedSynth2();
virtual void _ReservedSynth3();
virtual void _ReservedSynth4();
void Init();
BPrivate::BSoftSynth* synth;
synth_mode synthMode;
int32 clientCount;
uint32 _reserved[10];
};
extern _IMPEXP_MIDI BSynth* be_synth;
#endif // _SYNTH_H
-76
View File
@@ -1,76 +0,0 @@
#ifndef _MIDI2_DEFS_H
#define _MIDI2_DEFS_H
#include <OS.h>
#include <Errors.h>
#ifndef _MIDI_CONSTANTS_
#define _MIDI_CONSTANTS_
/* Channel Message Masks */
const uchar B_NOTE_OFF = 0x80;
const uchar B_NOTE_ON = 0x90;
const uchar B_KEY_PRESSURE = 0xa0;
const uchar B_CONTROL_CHANGE = 0xb0;
const uchar B_PROGRAM_CHANGE = 0xc0;
const uchar B_CHANNEL_PRESSURE = 0xd0;
const uchar B_PITCH_BEND = 0xe0;
/* System Messages */
const uchar B_SYS_EX_START = 0xf0;
const uchar B_MIDI_TIME_CODE = 0xf1;
const uchar B_SONG_POSITION = 0xf2;
const uchar B_SONG_SELECT = 0xf3;
const uchar B_CABLE_MESSAGE = 0xf5;
const uchar B_TUNE_REQUEST = 0xf6;
const uchar B_SYS_EX_END = 0xf7;
const uchar B_TIMING_CLOCK = 0xf8;
const uchar B_START = 0xfa;
const uchar B_CONTINUE = 0xfb;
const uchar B_STOP = 0xfc;
const uchar B_ACTIVE_SENSING = 0xfe;
const uchar B_SYSTEM_RESET = 0xff;
/* Controller Numbers */
const uchar B_MODULATION = 0x01;
const uchar B_BREATH_CONTROLLER = 0x02;
const uchar B_FOOT_CONTROLLER = 0x04;
const uchar B_PORTAMENTO_TIME = 0x05;
const uchar B_DATA_ENTRY = 0x06;
const uchar B_MAIN_VOLUME = 0x07;
const uchar B_MIDI_BALANCE = 0x08;
const uchar B_PAN = 0x0a;
const uchar B_EXPRESSION_CTRL = 0x0b;
const uchar B_GENERAL_CTRL_1 = 0x10;
const uchar B_GENERAL_CTRL_2 = 0x11;
const uchar B_GENERAL_CTRL_3 = 0x12;
const uchar B_GENERAL_CTRL_4 = 0x13;
const uchar B_SUSTAIN_PEDAL = 0x40;
const uchar B_PORTAMENTO = 0x41;
const uchar B_SOSTENUTO = 0x42;
const uchar B_SOFT_PEDAL = 0x43;
const uchar B_HOLD_2 = 0x45;
const uchar B_GENERAL_CTRL_5 = 0x50;
const uchar B_GENERAL_CTRL_6 = 0x51;
const uchar B_TEMPO_CHANGE = 0x51;
const uchar B_GENERAL_CTRL_7 = 0x52;
const uchar B_GENERAL_CTRL_8 = 0x53;
const uchar B_EFFECTS_DEPTH = 0x5b;
const uchar B_TREMOLO_DEPTH = 0x5c;
const uchar B_CHORUS_DEPTH = 0x5d;
const uchar B_CELESTE_DEPTH = 0x5e;
const uchar B_PHASER_DEPTH = 0x5f;
const uchar B_DATA_INCREMENT = 0x60;
const uchar B_DATA_DECREMENT = 0x61;
const uchar B_RESET_ALL_CONTROLLERS = 0x79;
const uchar B_LOCAL_CONTROL = 0x7a;
const uchar B_ALL_NOTES_OFF = 0x7b;
const uchar B_OMNI_MODE_OFF = 0x7c;
const uchar B_OMNI_MODE_ON = 0x7d;
const uchar B_MONO_MODE_ON = 0x7e;
const uchar B_POLY_MODE_ON = 0x7f;
#endif // _MIDI_CONSTANTS_
#endif // _MIDI2_DEFS_H
-117
View File
@@ -1,117 +0,0 @@
#ifndef _MIDI_CONSUMER_H
#define _MIDI_CONSUMER_H
#include <MidiEndpoint.h>
namespace BPrivate { class BMidiRosterLooper; }
class BMidiConsumer : public BMidiEndpoint
{
public:
bigtime_t Latency() const;
private:
friend class BMidiLocalConsumer;
friend class BMidiLocalProducer;
friend class BMidiRoster;
friend class BPrivate::BMidiRosterLooper;
BMidiConsumer(const char* name = NULL);
virtual ~BMidiConsumer();
virtual void _Reserved1();
virtual void _Reserved2();
virtual void _Reserved3();
virtual void _Reserved4();
virtual void _Reserved5();
virtual void _Reserved6();
virtual void _Reserved7();
virtual void _Reserved8();
port_id port;
bigtime_t latency;
uint32 _reserved[2];
};
class BMidiLocalConsumer : public BMidiConsumer
{
public:
BMidiLocalConsumer(const char* name = NULL);
void SetLatency(bigtime_t latency);
int32 GetProducerID(void);
void SetTimeout(bigtime_t when, void* data);
virtual void Timeout(void* data);
virtual void Data(
uchar* data, size_t length, bool atomic, bigtime_t time);
virtual void NoteOff(
uchar channel, uchar note, uchar velocity, bigtime_t time);
virtual void NoteOn(
uchar channel, uchar note, uchar velocity, bigtime_t time);
virtual void KeyPressure(
uchar channel, uchar note, uchar pressure, bigtime_t time);
virtual void ControlChange(
uchar channel, uchar controlNumber, uchar controlValue,
bigtime_t time);
virtual void ProgramChange(
uchar channel, uchar programNumber, bigtime_t time);
virtual void ChannelPressure(
uchar channel, uchar pressure, bigtime_t time);
virtual void PitchBend(
uchar channel, uchar lsb, uchar msb, bigtime_t time);
virtual void SystemExclusive(
void* data, size_t length, bigtime_t time);
virtual void SystemCommon(
uchar status, uchar data1, uchar data2, bigtime_t time);
virtual void SystemRealTime(uchar status, bigtime_t time);
virtual void TempoChange(int32 beatsPerMinute, bigtime_t time);
virtual void AllNotesOff(bool justChannel, bigtime_t time);
protected:
~BMidiLocalConsumer();
private:
friend class BMidiRoster;
friend int32 _midi_event_thread(void*);
virtual void _Reserved1();
virtual void _Reserved2();
virtual void _Reserved3();
virtual void _Reserved4();
virtual void _Reserved5();
virtual void _Reserved6();
virtual void _Reserved7();
virtual void _Reserved8();
int32 EventThread();
bigtime_t timeout;
void* timeoutData;
int32 currentProducer;
thread_id thread;
uint32 _reserved[1];
};
#endif // _MIDI_CONSUMER_H
-80
View File
@@ -1,80 +0,0 @@
#ifndef _MIDI_ENDPOINT_H
#define _MIDI_ENDPOINT_H
#include <BeBuild.h>
#include <Midi2Defs.h>
#include <OS.h>
#include <String.h>
class BMidiProducer;
class BMidiConsumer;
namespace BPrivate { class BMidiRosterLooper; }
class BMidiEndpoint
{
public:
const char* Name() const;
void SetName(const char* name);
int32 ID() const;
bool IsProducer() const;
bool IsConsumer() const;
bool IsRemote() const;
bool IsLocal() const;
bool IsPersistent() const;
bool IsValid() const;
status_t Release();
status_t Acquire();
status_t SetProperties(const BMessage* properties);
status_t GetProperties(BMessage* properties) const;
status_t Register(void);
status_t Unregister(void);
private:
friend class BMidiConsumer;
friend class BMidiLocalConsumer;
friend class BMidiLocalProducer;
friend class BMidiProducer;
friend class BMidiRoster;
friend class BPrivate::BMidiRosterLooper;
BMidiEndpoint(const char* name);
virtual ~BMidiEndpoint();
virtual void _Reserved1();
virtual void _Reserved2();
virtual void _Reserved3();
virtual void _Reserved4();
virtual void _Reserved5();
virtual void _Reserved6();
virtual void _Reserved7();
virtual void _Reserved8();
status_t SendRegisterRequest(bool);
status_t SendChangeRequest(BMessage*);
bool IsRegistered() const;
bool LockLooper() const;
void UnlockLooper() const;
int32 id;
BString name;
int32 refCount;
BMessage* properties;
bool isLocal;
bool isConsumer;
bool isRegistered;
bool isAlive;
uint32 _reserved[4];
};
#endif // _MIDI_ENDPOINT_H
-127
View File
@@ -1,127 +0,0 @@
#ifndef _MIDI_PRODUCER_H
#define _MIDI_PRODUCER_H
#include <Locker.h>
#include <MidiEndpoint.h>
class BList;
namespace BPrivate { class BMidiRosterLooper; }
class BMidiProducer : public BMidiEndpoint
{
public:
status_t Connect(BMidiConsumer* cons);
status_t Disconnect(BMidiConsumer* cons);
bool IsConnected(BMidiConsumer* cons) const;
BList* Connections() const;
private:
friend class BMidiLocalProducer;
friend class BMidiRoster;
friend class BPrivate::BMidiRosterLooper;
BMidiProducer(const char* name = NULL);
virtual ~BMidiProducer();
virtual void _Reserved1();
virtual void _Reserved2();
virtual void _Reserved3();
virtual void _Reserved4();
virtual void _Reserved5();
virtual void _Reserved6();
virtual void _Reserved7();
virtual void _Reserved8();
status_t SendConnectRequest(BMidiConsumer*, bool);
void ConnectionMade(BMidiConsumer*);
bool ConnectionBroken(BMidiConsumer*);
int32 CountConsumers() const;
BMidiConsumer* ConsumerAt(int32) const;
bool LockProducer() const;
void UnlockProducer() const;
BList* connections;
BLocker* locker;
uint32 _reserved[10];
};
class BMidiLocalProducer : public BMidiProducer
{
public:
BMidiLocalProducer(const char* name = NULL);
virtual void Connected(BMidiConsumer* cons);
virtual void Disconnected(BMidiConsumer* cons);
void SprayData(
void* data, size_t length, bool atomic = false,
bigtime_t time = 0) const;
void SprayNoteOff(
uchar channel, uchar note, uchar velocity,
bigtime_t time = 0) const;
void SprayNoteOn(
uchar channel, uchar note, uchar velocity,
bigtime_t time = 0) const;
void SprayKeyPressure(
uchar channel, uchar note, uchar pressure,
bigtime_t time = 0) const;
void SprayControlChange(
uchar channel, uchar controlNumber, uchar controlValue,
bigtime_t time = 0) const;
void SprayProgramChange(
uchar channel, uchar programNumber, bigtime_t time = 0) const;
void SprayChannelPressure(
uchar channel, uchar pressure, bigtime_t time = 0) const;
void SprayPitchBend(
uchar channel, uchar lsb, uchar msb, bigtime_t time = 0) const;
void SpraySystemExclusive(
void* data, size_t length, bigtime_t time = 0) const;
void SpraySystemCommon(
uchar status, uchar data1, uchar data2, bigtime_t time = 0) const;
void SpraySystemRealTime(
uchar status, bigtime_t time = 0) const;
void SprayTempoChange(
int32 beatsPerMinute, bigtime_t time = 0) const;
protected:
~BMidiLocalProducer();
private:
void SprayEvent(
const void* data, size_t length, bool atomic, bigtime_t time,
bool sysex = false) const;
virtual void _Reserved1();
virtual void _Reserved2();
virtual void _Reserved3();
virtual void _Reserved4();
virtual void _Reserved5();
virtual void _Reserved6();
virtual void _Reserved7();
virtual void _Reserved8();
uint32 _reserved[2];
};
#endif // _MIDI_PRODUCER_H
-84
View File
@@ -1,84 +0,0 @@
#ifndef _MIDI_ROSTER_H
#define _MIDI_ROSTER_H
#include <Application.h>
#include <MidiEndpoint.h>
enum BMidiOp
{
B_MIDI_NO_OP,
B_MIDI_REGISTERED,
B_MIDI_UNREGISTERED,
B_MIDI_CONNECTED,
B_MIDI_DISCONNECTED,
B_MIDI_CHANGED_NAME,
B_MIDI_CHANGED_LATENCY,
B_MIDI_CHANGED_PROPERTIES
};
#define B_MIDI_EVENT 'MIDI'
class BMidiProducer;
class BMidiConsumer;
namespace BPrivate
{
class BMidiRosterLooper;
struct BMidiRosterKiller;
}
class BMidiRoster
{
public:
static BMidiEndpoint* NextEndpoint(int32* id);
static BMidiProducer* NextProducer(int32* id);
static BMidiConsumer* NextConsumer(int32* id);
static BMidiEndpoint* FindEndpoint(int32 id, bool localOnly = false);
static BMidiProducer* FindProducer(int32 id, bool localOnly = false);
static BMidiConsumer* FindConsumer(int32 id, bool localOnly = false);
static void StartWatching(const BMessenger* msngr);
static void StopWatching();
static status_t Register(BMidiEndpoint* endp);
static status_t Unregister(BMidiEndpoint* endp);
static BMidiRoster* MidiRoster();
private:
friend class BMidiConsumer;
friend class BMidiEndpoint;
friend class BMidiLocalProducer;
friend class BMidiLocalConsumer;
friend class BMidiProducer;
friend class BPrivate::BMidiRosterLooper;
friend struct BPrivate::BMidiRosterKiller;
BMidiRoster();
virtual ~BMidiRoster();
virtual void _Reserved1();
virtual void _Reserved2();
virtual void _Reserved3();
virtual void _Reserved4();
virtual void _Reserved5();
virtual void _Reserved6();
virtual void _Reserved7();
virtual void _Reserved8();
void CreateLocal(BMidiEndpoint*);
void DeleteLocal(BMidiEndpoint*);
status_t SendRequest(BMessage*, BMessage*);
BPrivate::BMidiRosterLooper* looper;
BMessenger* server;
uint32 _reserved[16];
};
#endif // _MIDI_ROSTER_H
-105
View File
@@ -1,105 +0,0 @@
/*=--------------------------------------------------------------------------=*
* NetAddress.h -- Interface definition for the BNetAddress class.
*
* Written by S.T. Mansfield (thephantom@mac.com)
*=--------------------------------------------------------------------------=*
* Copyright (c) 2002, The OpenBeOS project.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*=--------------------------------------------------------------------------=*
*/
#ifndef _NETADDRESS_H
#define _NETADDRESS_H
#include <BeBuild.h>
#include <SupportDefs.h>
#include <Archivable.h>
#include <socket.h>
/*
* Empty forward declaration to satisfy the GetImpl method.
*/
class NLAddress;
class BNetAddress : public BArchivable
{
public:
BNetAddress( BMessage* archive );
virtual ~BNetAddress();
virtual status_t Archive( BMessage* into, bool deep = true ) const;
static BArchivable* Instantiate( BMessage* archive );
BNetAddress( const char* hostname = 0, unsigned short port = 0 );
BNetAddress( const struct sockaddr_in& sa );
BNetAddress( in_addr addr, int port = 0 );
BNetAddress( uint32 addr, int port = 0 );
BNetAddress( const BNetAddress& refparam );
BNetAddress( const char* hostname, const char* protocol, const char* service );
BNetAddress& operator=( const BNetAddress& );
status_t InitCheck();
status_t SetTo( const char* hostname, const char* protocol, const char* service );
status_t SetTo( const char* hostname = NULL, unsigned short port = 0 );
status_t SetTo( const struct sockaddr_in& sa );
status_t SetTo( in_addr addr, int port = 0 );
status_t SetTo( uint32 addr = INADDR_ANY, int port = 0 );
status_t GetAddr( char* hostname = NULL, unsigned short* port = NULL ) const;
status_t GetAddr( struct sockaddr_in& sa ) const;
status_t GetAddr( in_addr& addr, unsigned short* port = NULL ) const;
inline NLAddress *GetImpl() const;
protected:
status_t m_init;
private:
virtual void _ReservedBNetAddressFBCCruft1();
virtual void _ReservedBNetAddressFBCCruft2();
virtual void _ReservedBNetAddressFBCCruft3();
virtual void _ReservedBNetAddressFBCCruft4();
virtual void _ReservedBNetAddressFBCCruft5();
virtual void _ReservedBNetAddressFBCCruft6();
// Private copy helper.
status_t clone( const BNetAddress& RefParam );
int32 fFamily; // Encapsulation of sockaddr::sin_family
int32 fPort; // Encapsulation of sockaddr::sin_port
int32 fAddress; // Encapsulation of sockaddr::sin_addr.s_addr
// Not used, here to maintain R5 binary compatiblilty.
int32 fPrivateData[6];
};
inline NLAddress* BNetAddress::GetImpl( void ) const
{
return NULL; // No Nettle backward compatibility
}
#endif // <-- #ifndef _NETADDRESS_H
/*=------------------------------------------------------------------- End -=*/
-128
View File
@@ -1,128 +0,0 @@
/*=--------------------------------------------------------------------------=*
* NetBuffer.h -- Interface definition for the BNetBuffer class.
*
* Written by S.T. Mansfield (thephantom@mac.com)
*=--------------------------------------------------------------------------=*
* Copyright (c) 2002, The OpenBeOS project.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*=--------------------------------------------------------------------------=*
*/
#ifndef _NETBUFFER_H
#define _NETBUFFER_H
#include <BeBuild.h>
#include <SupportDefs.h>
#include <Archivable.h>
#include <socket.h>
/*
* Empty forward declaration to satisfy the GetImpl method.
*/
class NLPacket;
class BNetBuffer : public BArchivable
{
public:
BNetBuffer(size_t size = 0);
virtual ~BNetBuffer();
status_t InitCheck();
BNetBuffer(BMessage *archive);
virtual status_t Archive(BMessage *into, bool deep = true) const;
static BArchivable *Instantiate(BMessage *archive);
BNetBuffer(const BNetBuffer &);
BNetBuffer& operator=(const BNetBuffer &);
// Mutators.
status_t AppendInt8(int8);
status_t AppendUint8(uint8);
status_t AppendInt16(int16);
status_t AppendUint16(uint16);
status_t AppendInt32(int32);
status_t AppendUint32(uint32);
status_t AppendFloat(float);
status_t AppendDouble(double);
status_t AppendString(const char *);
status_t AppendData(const void *, size_t);
status_t AppendMessage(const BMessage &);
status_t AppendInt64(int64);
status_t AppendUint64(uint64);
status_t RemoveInt8(int8 &);
status_t RemoveUint8(uint8 &);
status_t RemoveInt16(int16 &);
status_t RemoveUint16(uint16 &);
status_t RemoveInt32(int32 &);
status_t RemoveUint32(uint32 &);
status_t RemoveFloat(float &);
status_t RemoveDouble(double &);
status_t RemoveString(char *, size_t);
status_t RemoveData(void *, size_t);
status_t RemoveMessage(BMessage &);
status_t RemoveInt64(int64 &);
status_t RemoveUint64(uint64 &);
// Accessors.
unsigned char *Data() const;
size_t Size() const;
size_t BytesRemaining() const;
inline NLPacket *GetImpl() const;
protected:
// Attributes.
status_t m_init;
private:
virtual void _ReservedBNetBufferFBCCruft1();
virtual void _ReservedBNetBufferFBCCruft2();
virtual void _ReservedBNetBufferFBCCruft3();
virtual void _ReservedBNetBufferFBCCruft4();
virtual void _ReservedBNetBufferFBCCruft5();
virtual void _ReservedBNetBufferFBCCruft6();
unsigned char* fData;
int32 fDataSize;
int32 fStackSize;
int32 fCapacity;
// Not used, here to maintain R5 binary compatiblilty.
int32 fPrivateData[5];
// Private class helpers.
status_t clone( const BNetBuffer& );
status_t dpop( int32, int32, void* );
status_t dpush( int32, int32, const void* );
status_t resize( int32 NewSize, bool RegenStack = false );
};
inline NLPacket* BNetBuffer::GetImpl( void ) const
{
return NULL; // No Nettle backward compatibility
}
#endif // <-- #ifndef _NETBUFFER_H
/*=------------------------------------------------------------------- End -=*/
-58
View File
@@ -1,58 +0,0 @@
/*=--------------------------------------------------------------------------=*
* NetDebug.h -- Interface definition for the BNetDebug class.
*
* Written by S.T. Mansfield (thephantom@mac.com)
*=--------------------------------------------------------------------------=*
* Copyright (c) 2002, The OpenBeOS project.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*=--------------------------------------------------------------------------=*
*/
#ifndef _NETDEBUG_H
#define _NETDEBUG_H
/*
* Net debugging class
*
* Use this class to print informative messages and dump data
* to stderr and provide control over whether debug messages
* get printed or not.
*/
class BNetDebug
{
public:
// turn debugging message output on or off
static void Enable(bool);
// test debugging message output state
static bool IsEnabled();
// print a debugging message
static void Print(const char *msg);
// dump raw data in a nice hd-like format
static void Dump(const char *data, size_t size, const char *title);
};
#endif // <-- #ifndef _NETDEBUG_H
/*=------------------------------------------------------------------- End -=*/
-283
View File
@@ -1,283 +0,0 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2004, Haiku
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//------------------------------------------------------------------------------
#ifndef _NETENDPOINT_H
#define _NETENDPOINT_H
#include <BeBuild.h>
#include <SupportDefs.h>
#include <Archivable.h>
#include <sys/socket.h>
#include <NetAddress.h>
#include <NetBuffer.h>
/*
* BNetEndpoint
*
* BNetEndpoint is an object that implements a networking endpoint abstraction.
* Think of it as an object-oriented socket. BNetEndpoint provides
* various ways to send and receive data, establish network connections, bind
* to local addresses, and listen for and accept new connections.
*
*/
// Nettle forward declarations
class NLEndpoint;
class BNetEndpoint : public BArchivable
{
public:
BNetEndpoint(int type = SOCK_STREAM);
BNetEndpoint(int family, int type, int protocol);
BNetEndpoint(const BNetEndpoint &);
BNetEndpoint(BMessage *archive);
BNetEndpoint & operator=(const BNetEndpoint &);
virtual ~BNetEndpoint();
/*
* It is important to call InitCheck() after creating an instance of this class.
*/
status_t InitCheck();
/*
* When a BNetEndpoint is archived, it saves various state information
* which will allow reinstantiation later. For example, if a BNetEndpoint
* that is connected to a remote FTP server is archived, when the archive
* is later instantiated the connection to the FTP server will be reopened
* automatically.
*/
virtual status_t Archive(BMessage *into, bool deep = true) const;
static BArchivable * Instantiate(BMessage *archive);
/*
* BNetEndpoint::SetProtocol()
*
* allows the protocol type to be changed from stream
* to datagram and vice-versa. The current connection (if any) is closed and
* the BNetEndpoint's state is reset.
*
* Returns B_OK if successful, B_ERROR otherwise.
*/
status_t SetProtocol(int proto);
/*
* These functions allow various options to be set for data communications.
* The first allows any option to be set; the latter two turn nonblocking
* I/O on or off, and toggle reuseaddr respectively. The default is for
* *blocking* I/O and for reuseaddr to be OFF.
*
* Returns 0 if successful, -1 otherwise.
*/
int SetOption(int32 opt, int32 lev, const void *data, unsigned int datasize);
int SetNonBlocking(bool on = true);
int SetReuseAddr(bool on = true);
/*
* LocalAddr() returns a BNetAddress corresponding to the local address used by this
* BNetEndpoint. RemoteAddr() returns a BNetAddress corresponding to the address of
* the remote peer we are connected to, if using a connected stream protocol.
*/
const BNetAddress & LocalAddr();
const BNetAddress & RemoteAddr();
/*
* BNetEndpoint::Socket() returns the actual socket used for data communications.
*/
int Socket() const;
/*
* BNetEndpoint::Close()
*
* Close the current BNetEndpoint, terminating any existing connection (if any)
* and discarding unread data.
*/
virtual void Close();
/*
* BNetEndpoint::Bind()
*
* Bind this BNetEndpoint to a local address. Calling bind() without specifying
* a BNetAddress or port number binds to a random local port. The actual port
* bound to can be determined by a subsequent call to BNetEndpoint::LocalAddr().
*
* Returns B_OK if successful, B_ERROR otherwise.
*/
virtual status_t Bind(const BNetAddress &addr);
virtual status_t Bind(int port = 0);
/*
* BNetEndpoint::Connect()
*
* Connect this BNetEndpoint to a remote address. The first version takes
* a BNetAddress already set to the remote address as an argument; the other
* one internally constructs a BNetAddress from the passed-in hostname and port
* number.
*
* Returns B_OK if successful, B_ERROR otherwise.
*/
virtual status_t Connect(const BNetAddress &addr);
virtual status_t Connect(const char *addr, int port);
/*
* BNetEndpoint::Listen()
*
* Specify the number of pending incoming connection attemps to queue.
* This is the number of connection requests that will be allowed in between
* calls to BNetEndpoint::accept(). When this number is exceeded, new
* connection attempts are refused until BNetEndpoint::accept() is called.
*
* Returns B_OK if successful, B_ERROR otherwise.
*/
virtual status_t Listen(int backlog = 5);
/*
* BNetEndpoint::Accept()
*
* Accepts new connections to a bound stream protocol BNetEndpoint.
* Blocks for timeout milleseconds (defaults to forever) waiting for
* new connections. Returns a BNetEndpoint with the same characteristics
* as the one calling BNetEndpoint::Accept(), the new one representing the new
* connection. This returned BNetEndpoint is ready for communication and
* must be deleted at a later time using delete.
*/
virtual BNetEndpoint *Accept(int32 timeout = -1);
/*
* BNetEndpoint::Error() will return the integer error code (set by the OS)
* for the last send/recv error. Likewise, BNetEndpoint::ErrorStr() returns
* a string describing the error.
*/
int Error() const;
char *ErrorStr() const;
/*
* BNetEndpoint::Send()
*
* Send data to the remote end of the connection. If not connected, fails.
* If using a datagram protocol, fails unless BNetEndpoint::Connect()
* has been called, which caches the address we are sending to. The first
* version sends an arbitrary buffer of size size; the second sends the
* contents of a BNetBuffer. Both return the number of bytes actually
* sent, or -1 on failure.
*/
virtual int32 Send(const void *buf, size_t size, int flags = 0);
virtual int32 Send(BNetBuffer &pack, int flags = 0);
/*
* BNetEndpoint::SendTo()
*
* Send data to the address specified by the passed-in BNetAddress object.
* Fails if not using a datagram protocol. The first version sends
* an arbitrary buffer of size size; the second sends the contents of a
* BNetBuffer. Both return the number of bytes actually sent,
* and return -1 on failure.
*/
virtual int32 SendTo(const void *buf, size_t size, const BNetAddress &to, int flags = 0);
virtual int32 SendTo(BNetBuffer &pack, const BNetAddress &to, int flags = 0);
/*
* BNetEndpoint::SetTimeout()
*
* Sets an optional timeout (in microseconds) for calls to BNetEndpoint::Receive()
* and BNetEndpoint::ReceiveFrom(). Causes these calls to time out after the specified
* number of microseconds when in blocking mode.
*/
void SetTimeout(bigtime_t usec);
/*
* BNetEndpoint::Receive()
*
* Receive data pending on the BNetEndpoint's connection. If in the default
* blocking mode, blocks until data is available or a timeout (set by
* BNetEndpoint::SetTimeout). The first call receives into a preallocated buffer
* of the specified size; the second call receives (at most) size bytes into
* an BNetBuffer. The data is appended to the end of the BNetBuffer; this allows
* a BNetBuffer to be used in a loop to buffer incoming data read in chunks
* until a certain size is read. Both return the number of bytes actually
* received, and return -1 on error.
*/
virtual int32 Receive(void *buf, size_t size, int flags = 0);
virtual int32 Receive(BNetBuffer &pack, size_t size, int flags = 0);
/*
* BNetEndpoint::ReceiveFrom()
*
* Receive datagrams from an arbitrary source and fill in the passed-in BNetAddress
* with the address from whence the datagram came. As usual, both return the
* actual number of bytes read. In the BNetBuffer version, the data is appended
* to the end of the BNetBuffer; this allows a BNetBuffer to be used in a loop to
* buffer incoming data read in chunks until a certain amount is read.
*/
virtual int32 ReceiveFrom(void *buf, size_t size, BNetAddress &from, int flags = 0);
virtual int32 ReceiveFrom(BNetBuffer &pack, size_t size, BNetAddress &from, int flags = 0);
/*
* BNetEndpoint::IsDataPending()
*
* Returns true if there is data waiting to be received on this BNetEndpoint.
* Will block for usec_timeout microseconds if specified, waiting for data.
*/
virtual bool IsDataPending(bigtime_t usec_timeout = 0);
inline NLEndpoint *GetImpl() const;
protected:
status_t m_init;
private:
virtual void _ReservedBNetEndpointFBCCruft1();
virtual void _ReservedBNetEndpointFBCCruft2();
virtual void _ReservedBNetEndpointFBCCruft3();
virtual void _ReservedBNetEndpointFBCCruft4();
virtual void _ReservedBNetEndpointFBCCruft5();
virtual void _ReservedBNetEndpointFBCCruft6();
int m_socket;
bigtime_t m_timeout;
int m_last_error;
BNetAddress m_addr;
BNetAddress m_peer;
BNetAddress m_conaddr;
int32 __ReservedBNetEndpointFBCCruftData[6];
};
inline NLEndpoint *BNetEndpoint::GetImpl() const
{
return NULL; // No Nettle backward compatibility
}
#endif // _NETENDPOINT_H
-62
View File
@@ -1,62 +0,0 @@
/*******************************************************************************
/
/ File: net_settings.h
/
/ Description: Network preferences settings.
/
/ Copyright 1993-98, Be Incorporated, All Rights Reserved.
/
*******************************************************************************/
#ifndef _NET_SETTINGS_H
#define _NET_SETTINGS_H
#include <BeBuild.h>
#include <SupportDefs.h>
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* Private types
*/
typedef struct _ns_entry {
const char *key;
const char *value;
} _ns_entry_t;
typedef struct _ns_section {
const char *heading;
unsigned nentries;
_ns_entry_t *entries;
} _ns_section_t;
/*
* Public type, but the data members are private
*/
typedef struct _net_settings {
int _dirty;
unsigned _nsections;
_ns_section_t *_sections;
char _fname[64];
} net_settings;
/*
* For finding and setting network preferences
*/
extern _IMPEXP_NET
char *find_net_setting(net_settings *ncw,
const char *heading, const char *name, char *value,
unsigned nbytes);
extern _IMPEXP_NET
status_t set_net_setting(net_settings *ncw,
const char *heading, const char *name,
const char *value);
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* _NET_SETTINGS_H */
-6
View File
@@ -1,6 +0,0 @@
#ifndef _NET_NETDB_H
#define _NET_NETDB_H
#include <netdb.h> /* should include the posix netdb.h */
#endif /* _NET_NETDB_H */
-17
View File
@@ -1,17 +0,0 @@
#ifndef _NET_SOCKET_H
#define _NET_SOCKET_H
#include <BeBuild.h>
#include <netinet/in.h> /* in_addr, sockaddr_in */
#include <sys/socket.h> /* sockaddr */
#include <sys/select.h>
#define OBOS_NET_STACK_VERSION 0x0100 /* 1.0 */
/*
* Be extension
*/
#define B_UDP_MAX_SIZE (65536 - 1024)
#endif /* _NET_SOCKET_H */
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-349
View File
@@ -1,349 +0,0 @@
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice including the dates of first publication and
* either this permission notice or a reference to
* http://oss.sgi.com/projects/FreeB/
* shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Except as contained in this notice, the name of Silicon Graphics, Inc.
* shall not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization from
* Silicon Graphics, Inc.
*/
#ifndef __glu_h__
#define __glu_h__
#if defined(USE_MGL_NAMESPACE)
#include "glu_mangle.h"
#endif
#include <GL/gl.h>
#ifndef GLAPIENTRY
#define GLAPIENTRY
#endif
#ifndef GLAPIENTRYP
#define GLAPIENTRYP GLAPIENTRY *
#endif
#if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GLU32)
# undef GLAPI
# define GLAPI __declspec(dllexport)
#elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL)
/* tag specifying we're building for DLL runtime support */
# undef GLAPI
# define GLAPI __declspec(dllimport)
#elif !defined(GLAPI)
/* for use with static link lib build of Win32 edition only */
# define GLAPI extern
#endif /* _STATIC_MESA support */
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************/
/* Extensions */
#define GLU_EXT_object_space_tess 1
#define GLU_EXT_nurbs_tessellator 1
/* Boolean */
#define GLU_FALSE 0
#define GLU_TRUE 1
/* Version */
#define GLU_VERSION_1_1 1
#define GLU_VERSION_1_2 1
#define GLU_VERSION_1_3 1
/* StringName */
#define GLU_VERSION 100800
#define GLU_EXTENSIONS 100801
/* ErrorCode */
#define GLU_INVALID_ENUM 100900
#define GLU_INVALID_VALUE 100901
#define GLU_OUT_OF_MEMORY 100902
#define GLU_INCOMPATIBLE_GL_VERSION 100903
#define GLU_INVALID_OPERATION 100904
/* NurbsDisplay */
/* GLU_FILL */
#define GLU_OUTLINE_POLYGON 100240
#define GLU_OUTLINE_PATCH 100241
/* NurbsCallback */
#define GLU_NURBS_ERROR 100103
#define GLU_ERROR 100103
#define GLU_NURBS_BEGIN 100164
#define GLU_NURBS_BEGIN_EXT 100164
#define GLU_NURBS_VERTEX 100165
#define GLU_NURBS_VERTEX_EXT 100165
#define GLU_NURBS_NORMAL 100166
#define GLU_NURBS_NORMAL_EXT 100166
#define GLU_NURBS_COLOR 100167
#define GLU_NURBS_COLOR_EXT 100167
#define GLU_NURBS_TEXTURE_COORD 100168
#define GLU_NURBS_TEX_COORD_EXT 100168
#define GLU_NURBS_END 100169
#define GLU_NURBS_END_EXT 100169
#define GLU_NURBS_BEGIN_DATA 100170
#define GLU_NURBS_BEGIN_DATA_EXT 100170
#define GLU_NURBS_VERTEX_DATA 100171
#define GLU_NURBS_VERTEX_DATA_EXT 100171
#define GLU_NURBS_NORMAL_DATA 100172
#define GLU_NURBS_NORMAL_DATA_EXT 100172
#define GLU_NURBS_COLOR_DATA 100173
#define GLU_NURBS_COLOR_DATA_EXT 100173
#define GLU_NURBS_TEXTURE_COORD_DATA 100174
#define GLU_NURBS_TEX_COORD_DATA_EXT 100174
#define GLU_NURBS_END_DATA 100175
#define GLU_NURBS_END_DATA_EXT 100175
/* NurbsError */
#define GLU_NURBS_ERROR1 100251
#define GLU_NURBS_ERROR2 100252
#define GLU_NURBS_ERROR3 100253
#define GLU_NURBS_ERROR4 100254
#define GLU_NURBS_ERROR5 100255
#define GLU_NURBS_ERROR6 100256
#define GLU_NURBS_ERROR7 100257
#define GLU_NURBS_ERROR8 100258
#define GLU_NURBS_ERROR9 100259
#define GLU_NURBS_ERROR10 100260
#define GLU_NURBS_ERROR11 100261
#define GLU_NURBS_ERROR12 100262
#define GLU_NURBS_ERROR13 100263
#define GLU_NURBS_ERROR14 100264
#define GLU_NURBS_ERROR15 100265
#define GLU_NURBS_ERROR16 100266
#define GLU_NURBS_ERROR17 100267
#define GLU_NURBS_ERROR18 100268
#define GLU_NURBS_ERROR19 100269
#define GLU_NURBS_ERROR20 100270
#define GLU_NURBS_ERROR21 100271
#define GLU_NURBS_ERROR22 100272
#define GLU_NURBS_ERROR23 100273
#define GLU_NURBS_ERROR24 100274
#define GLU_NURBS_ERROR25 100275
#define GLU_NURBS_ERROR26 100276
#define GLU_NURBS_ERROR27 100277
#define GLU_NURBS_ERROR28 100278
#define GLU_NURBS_ERROR29 100279
#define GLU_NURBS_ERROR30 100280
#define GLU_NURBS_ERROR31 100281
#define GLU_NURBS_ERROR32 100282
#define GLU_NURBS_ERROR33 100283
#define GLU_NURBS_ERROR34 100284
#define GLU_NURBS_ERROR35 100285
#define GLU_NURBS_ERROR36 100286
#define GLU_NURBS_ERROR37 100287
/* NurbsProperty */
#define GLU_AUTO_LOAD_MATRIX 100200
#define GLU_CULLING 100201
#define GLU_SAMPLING_TOLERANCE 100203
#define GLU_DISPLAY_MODE 100204
#define GLU_PARAMETRIC_TOLERANCE 100202
#define GLU_SAMPLING_METHOD 100205
#define GLU_U_STEP 100206
#define GLU_V_STEP 100207
#define GLU_NURBS_MODE 100160
#define GLU_NURBS_MODE_EXT 100160
#define GLU_NURBS_TESSELLATOR 100161
#define GLU_NURBS_TESSELLATOR_EXT 100161
#define GLU_NURBS_RENDERER 100162
#define GLU_NURBS_RENDERER_EXT 100162
/* NurbsSampling */
#define GLU_OBJECT_PARAMETRIC_ERROR 100208
#define GLU_OBJECT_PARAMETRIC_ERROR_EXT 100208
#define GLU_OBJECT_PATH_LENGTH 100209
#define GLU_OBJECT_PATH_LENGTH_EXT 100209
#define GLU_PATH_LENGTH 100215
#define GLU_PARAMETRIC_ERROR 100216
#define GLU_DOMAIN_DISTANCE 100217
/* NurbsTrim */
#define GLU_MAP1_TRIM_2 100210
#define GLU_MAP1_TRIM_3 100211
/* QuadricDrawStyle */
#define GLU_POINT 100010
#define GLU_LINE 100011
#define GLU_FILL 100012
#define GLU_SILHOUETTE 100013
/* QuadricCallback */
/* GLU_ERROR */
/* QuadricNormal */
#define GLU_SMOOTH 100000
#define GLU_FLAT 100001
#define GLU_NONE 100002
/* QuadricOrientation */
#define GLU_OUTSIDE 100020
#define GLU_INSIDE 100021
/* TessCallback */
#define GLU_TESS_BEGIN 100100
#define GLU_BEGIN 100100
#define GLU_TESS_VERTEX 100101
#define GLU_VERTEX 100101
#define GLU_TESS_END 100102
#define GLU_END 100102
#define GLU_TESS_ERROR 100103
#define GLU_TESS_EDGE_FLAG 100104
#define GLU_EDGE_FLAG 100104
#define GLU_TESS_COMBINE 100105
#define GLU_TESS_BEGIN_DATA 100106
#define GLU_TESS_VERTEX_DATA 100107
#define GLU_TESS_END_DATA 100108
#define GLU_TESS_ERROR_DATA 100109
#define GLU_TESS_EDGE_FLAG_DATA 100110
#define GLU_TESS_COMBINE_DATA 100111
/* TessContour */
#define GLU_CW 100120
#define GLU_CCW 100121
#define GLU_INTERIOR 100122
#define GLU_EXTERIOR 100123
#define GLU_UNKNOWN 100124
/* TessProperty */
#define GLU_TESS_WINDING_RULE 100140
#define GLU_TESS_BOUNDARY_ONLY 100141
#define GLU_TESS_TOLERANCE 100142
/* TessError */
#define GLU_TESS_ERROR1 100151
#define GLU_TESS_ERROR2 100152
#define GLU_TESS_ERROR3 100153
#define GLU_TESS_ERROR4 100154
#define GLU_TESS_ERROR5 100155
#define GLU_TESS_ERROR6 100156
#define GLU_TESS_ERROR7 100157
#define GLU_TESS_ERROR8 100158
#define GLU_TESS_MISSING_BEGIN_POLYGON 100151
#define GLU_TESS_MISSING_BEGIN_CONTOUR 100152
#define GLU_TESS_MISSING_END_POLYGON 100153
#define GLU_TESS_MISSING_END_CONTOUR 100154
#define GLU_TESS_COORD_TOO_LARGE 100155
#define GLU_TESS_NEED_COMBINE_CALLBACK 100156
/* TessWinding */
#define GLU_TESS_WINDING_ODD 100130
#define GLU_TESS_WINDING_NONZERO 100131
#define GLU_TESS_WINDING_POSITIVE 100132
#define GLU_TESS_WINDING_NEGATIVE 100133
#define GLU_TESS_WINDING_ABS_GEQ_TWO 100134
/*************************************************************/
#ifdef __cplusplus
class GLUnurbs;
class GLUquadric;
class GLUtesselator;
#else
typedef struct GLUnurbs GLUnurbs;
typedef struct GLUquadric GLUquadric;
typedef struct GLUtesselator GLUtesselator;
#endif
typedef GLUnurbs GLUnurbsObj;
typedef GLUquadric GLUquadricObj;
typedef GLUtesselator GLUtesselatorObj;
typedef GLUtesselator GLUtriangulatorObj;
#define GLU_TESS_MAX_COORD 1.0e150
/* Internal convenience typedefs */
typedef void (GLAPIENTRYP _GLUfuncptr)();
GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb);
GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluBeginSurface (GLUnurbs* nurb);
GLAPI void GLAPIENTRY gluBeginTrim (GLUnurbs* nurb);
GLAPI GLint GLAPIENTRY gluBuild1DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
GLAPI GLint GLAPIENTRY gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *data);
GLAPI GLint GLAPIENTRY gluBuild2DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
GLAPI GLint GLAPIENTRY gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data);
GLAPI GLint GLAPIENTRY gluBuild3DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
GLAPI GLint GLAPIENTRY gluBuild3DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
GLAPI GLboolean GLAPIENTRY gluCheckExtension (const GLubyte *extName, const GLubyte *extString);
GLAPI void GLAPIENTRY gluCylinder (GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks);
GLAPI void GLAPIENTRY gluDeleteNurbsRenderer (GLUnurbs* nurb);
GLAPI void GLAPIENTRY gluDeleteQuadric (GLUquadric* quad);
GLAPI void GLAPIENTRY gluDeleteTess (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops);
GLAPI void GLAPIENTRY gluEndCurve (GLUnurbs* nurb);
GLAPI void GLAPIENTRY gluEndPolygon (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluEndSurface (GLUnurbs* nurb);
GLAPI void GLAPIENTRY gluEndTrim (GLUnurbs* nurb);
GLAPI const GLubyte * GLAPIENTRY gluErrorString (GLenum error);
GLAPI void GLAPIENTRY gluGetNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat* data);
GLAPI const GLubyte * GLAPIENTRY gluGetString (GLenum name);
GLAPI void GLAPIENTRY gluGetTessProperty (GLUtesselator* tess, GLenum which, GLdouble* data);
GLAPI void GLAPIENTRY gluLoadSamplingMatrices (GLUnurbs* nurb, const GLfloat *model, const GLfloat *perspective, const GLint *view);
GLAPI void GLAPIENTRY gluLookAt (GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ);
GLAPI GLUnurbs* GLAPIENTRY gluNewNurbsRenderer (void);
GLAPI GLUquadric* GLAPIENTRY gluNewQuadric (void);
GLAPI GLUtesselator* GLAPIENTRY gluNewTess (void);
GLAPI void GLAPIENTRY gluNextContour (GLUtesselator* tess, GLenum type);
GLAPI void GLAPIENTRY gluNurbsCallback (GLUnurbs* nurb, GLenum which, _GLUfuncptr CallBackFunc);
GLAPI void GLAPIENTRY gluNurbsCallbackData (GLUnurbs* nurb, GLvoid* userData);
GLAPI void GLAPIENTRY gluNurbsCallbackDataEXT (GLUnurbs* nurb, GLvoid* userData);
GLAPI void GLAPIENTRY gluNurbsCurve (GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type);
GLAPI void GLAPIENTRY gluNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat value);
GLAPI void GLAPIENTRY gluNurbsSurface (GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type);
GLAPI void GLAPIENTRY gluOrtho2D (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top);
GLAPI void GLAPIENTRY gluPartialDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep);
GLAPI void GLAPIENTRY gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
GLAPI void GLAPIENTRY gluPickMatrix (GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint *viewport);
GLAPI GLint GLAPIENTRY gluProject (GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ);
GLAPI void GLAPIENTRY gluPwlCurve (GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type);
GLAPI void GLAPIENTRY gluQuadricCallback (GLUquadric* quad, GLenum which, _GLUfuncptr CallBackFunc);
GLAPI void GLAPIENTRY gluQuadricDrawStyle (GLUquadric* quad, GLenum draw);
GLAPI void GLAPIENTRY gluQuadricNormals (GLUquadric* quad, GLenum normal);
GLAPI void GLAPIENTRY gluQuadricOrientation (GLUquadric* quad, GLenum orientation);
GLAPI void GLAPIENTRY gluQuadricTexture (GLUquadric* quad, GLboolean texture);
GLAPI GLint GLAPIENTRY gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut);
GLAPI void GLAPIENTRY gluSphere (GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks);
GLAPI void GLAPIENTRY gluTessBeginContour (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data);
GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);
GLAPI void GLAPIENTRY gluTessEndContour (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluTessEndPolygon (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ);
GLAPI void GLAPIENTRY gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data);
GLAPI void GLAPIENTRY gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data);
GLAPI GLint GLAPIENTRY gluUnProject (GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* objX, GLdouble* objY, GLdouble* objZ);
GLAPI GLint GLAPIENTRY gluUnProject4 (GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW);
#ifdef __cplusplus
}
#endif
#endif /* __glu_h__ */
-755
View File
@@ -1,755 +0,0 @@
#ifndef __glut_h__
#define __glut_h__
/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */
/* This program is freely distributable without licensing fees and is
provided without guarantee or warrantee expressed or implied. This
program is -not- in the public domain. */
#include <GL/gl.h>
#include <GL/glu.h>
#if defined(__MINGW32__)
#include <GL/mesa_wgl.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_WIN32)
/* GLUT 3.7 now tries to avoid including <windows.h>
to avoid name space pollution, but Win32's <GL/gl.h>
needs APIENTRY and WINGDIAPI defined properly.
tjump@spgs.com contributes:
If users are building glut code on MS Windows, then they should
make sure they include windows.h early, let's not get into a
header definitions war since MS has proven it's capability to
change header dependencies w/o publishing they have done so.
So, let's not include windows.h here, as it's not really required and
MS own gl/gl.h *should* include it if the dependency is there. */
/* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA
in your compile preprocessor options. */
# if !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA)
# pragma comment (lib, "winmm.lib") /* link with Windows MultiMedia lib */
/* To enable automatic SGI OpenGL for Windows library usage for GLUT,
define GLUT_USE_SGI_OPENGL in your compile preprocessor options. */
# ifdef GLUT_USE_SGI_OPENGL
# pragma comment (lib, "opengl.lib") /* link with SGI OpenGL for Windows lib */
# pragma comment (lib, "glu.lib") /* link with SGI OpenGL Utility lib */
# pragma comment (lib, "glut.lib") /* link with Win32 GLUT for SGI OpenGL lib */
# else
# pragma comment (lib, "opengl32.lib") /* link with Microsoft OpenGL lib */
# pragma comment (lib, "glu32.lib") /* link with Microsoft OpenGL Utility lib */
# pragma comment (lib, "glut32.lib") /* link with Win32 GLUT lib */
# endif
# endif
/* To disable supression of annoying warnings about floats being promoted
to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor
options. */
# ifndef GLUT_NO_WARNING_DISABLE
# pragma warning (disable:4244) /* Disable bogus VC++ 4.2 conversion warnings. */
# pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */
# endif
/* Win32 has an annoying issue where there are multiple C run-time
libraries (CRTs). If the executable is linked with a different CRT
from the GLUT DLL, the GLUT DLL will not share the same CRT static
data seen by the executable. In particular, atexit callbacks registered
in the executable will not be called if GLUT calls its (different)
exit routine). GLUT is typically built with the
"/MD" option (the CRT with multithreading DLL support), but the Visual
C++ linker default is "/ML" (the single threaded CRT).
One workaround to this issue is requiring users to always link with
the same CRT as GLUT is compiled with. That requires users supply a
non-standard option. GLUT 3.7 has its own built-in workaround where
the executable's "exit" function pointer is covertly passed to GLUT.
GLUT then calls the executable's exit function pointer to ensure that
any "atexit" calls registered by the application are called if GLUT
needs to exit.
Note that the __glut*WithExit routines should NEVER be called directly.
To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
/* XXX This is from Win32's <process.h> */
# if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__cdecl)
/* Define __cdecl for non-Microsoft compilers. */
# define __cdecl
# define GLUT_DEFINED___CDECL
# endif
# ifndef _CRTIMP
# ifdef _NTSDK
/* Definition compatible with NT SDK */
# define _CRTIMP
# else
/* Current definition */
# ifdef _DLL
# define _CRTIMP __declspec(dllimport)
# else
# define _CRTIMP
# endif
# endif
# define GLUT_DEFINED__CRTIMP
# endif
# ifndef GLUT_BUILDING_LIB
extern _CRTIMP void __cdecl exit(int);
# endif
/* GLUT callback calling convention for Win32. */
# define GLUTCALLBACK __cdecl
/* for callback/function pointer defs */
# define GLUTAPIENTRYV __cdecl
/* glut-win32 specific macros, defined to prevent collision with
and redifinition of Windows system defs, also removes requirement of
pretty much any standard windows header from this file */
#if (_MSC_VER >= 800) || defined(__MINGW32__) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
# define GLUTAPIENTRY __stdcall
#else
# define GLUTAPIENTRY
#endif
/* GLUT API entry point declarations for Win32. */
#if (defined(BUILD_GLUT32) || defined(GLUT_BUILDING_LIB)) && defined(_DLL)
# define GLUTAPI __declspec(dllexport)
#elif defined(_DLL)
# define GLUTAPI __declspec(dllimport)
#else
# define GLUTAPI extern
#endif
#if defined(_WIN32) && !defined(_WINDEF_) && !defined(MESA)
# if !defined(MESA_MINWARN)
# pragma message( "note: WINDOWS.H not included, providing Mesa definition of CALLBACK macro" )
# pragma message( "----: and PROC typedef. If you receive compiler warnings about either ")
# pragma message( "----: being multiply defined you should include WINDOWS.H priot to gl/glut.h" )
# endif
# define CALLBACK __stdcall
#if !defined(__MINGW32__)
typedef int (GLUTAPIENTRY *PROC)();
typedef void *HGLRC;
typedef void *HDC;
#endif
typedef unsigned long COLORREF;
#endif
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(MESA)
# if !defined(MESA_MINWARN)
# pragma message( "note: WINDOWS.H not included, providing Mesa definition of wgl functions" )
# pragma message( "----: and macros. If you receive compiler warnings about any being multiply ")
# pragma message( "----: defined you should include WINDOWS.H priot to gl/glut.h" )
# endif
# define WGL_FONT_LINES 0
# define WGL_FONT_POLYGONS 1
# ifdef UNICODE
# define wglUseFontBitmaps wglUseFontBitmapsW
# define wglUseFontOutlines wglUseFontOutlinesW
# else
# define wglUseFontBitmaps wglUseFontBitmapsA
# define wglUseFontOutlines wglUseFontOutlinesA
# endif /* !UNICODE */
typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR;
typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT;
# pragma warning( push )
# pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */
# define WGLAPI __declspec(dllimport)
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC);
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC,HGLRC);
WGLAPI int GLAPIENTRY wglSetPixelFormat(HDC, int, const PIXELFORMATDESCRIPTOR *);
WGLAPI int GLAPIENTRY wglSwapBuffers(HDC hdc);
WGLAPI HDC GLAPIENTRY wglGetCurrentDC(void);
WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC);
WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int);
WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void);
WGLAPI PROC GLAPIENTRY wglGetProcAddress(const char*);
WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *);
WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC);
WGLAPI int GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR);
WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR);
WGLAPI int GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *);
WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc);
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC, HGLRC);
WGLAPI int GLAPIENTRY wglRealizeLayerPalette(HDC, int, int);
WGLAPI int GLAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *);
WGLAPI int GLAPIENTRY wglShareLists(HGLRC, HGLRC);
WGLAPI int GLAPIENTRY wglSwapLayerBuffers(HDC, unsigned int);
WGLAPI int GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, unsigned long);
WGLAPI int GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long);
WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
WGLAPI int GLAPIENTRY SwapBuffers(HDC);
WGLAPI int GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *);
WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR);
WGLAPI int GLAPIENTRY GetPixelFormat(HDC);
WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
# undef WGLAPI
# pragma warning( pop )
#endif
#else /* _WIN32 not defined */
/* Define GLUTAPIENTRY and GLUTCALLBACK to nothing if we aren't on Win32. */
# define GLUTAPIENTRY GLAPIENTRY
# define GLUTAPIENTRYV
# define GLUTCALLBACK
# define GLUTAPI extern
#endif
/**
GLUT API revision history:
GLUT_API_VERSION is updated to reflect incompatible GLUT
API changes (interface changes, semantic changes, deletions,
or additions).
GLUT_API_VERSION=1 First public release of GLUT. 11/29/94
GLUT_API_VERSION=2 Added support for OpenGL/GLX multisampling,
extension. Supports new input devices like tablet, dial and button
box, and Spaceball. Easy to query OpenGL extensions.
GLUT_API_VERSION=3 glutMenuStatus added.
GLUT_API_VERSION=4 glutInitDisplayString, glutWarpPointer,
glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic
video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc,
glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat,
glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!).
GLUT_API_VERSION=5 glutGetProcAddress (added by BrianP)
**/
#ifndef GLUT_API_VERSION /* allow this to be overriden */
#define GLUT_API_VERSION 5
#endif
/**
GLUT implementation revision history:
GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT
API revisions and implementation revisions (ie, bug fixes).
GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of
GLUT Xlib-based implementation. 11/29/94
GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of
GLUT Xlib-based implementation providing GLUT version 2
interfaces.
GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95
GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95
GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95
GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96
GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner
and video resize. 1/3/97
GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines.
GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release.
GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling.
GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support.
GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface.
GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa <GL/glut.h>
**/
#ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */
#define GLUT_XLIB_IMPLEMENTATION 15
#endif
/* Display mode bit masks. */
#define GLUT_RGB 0
#define GLUT_RGBA GLUT_RGB
#define GLUT_INDEX 1
#define GLUT_SINGLE 0
#define GLUT_DOUBLE 2
#define GLUT_ACCUM 4
#define GLUT_ALPHA 8
#define GLUT_DEPTH 16
#define GLUT_STENCIL 32
#if (GLUT_API_VERSION >= 2)
#define GLUT_MULTISAMPLE 128
#define GLUT_STEREO 256
#endif
#if (GLUT_API_VERSION >= 3)
#define GLUT_LUMINANCE 512
#endif
/* Mouse buttons. */
#define GLUT_LEFT_BUTTON 0
#define GLUT_MIDDLE_BUTTON 1
#define GLUT_RIGHT_BUTTON 2
/* Mouse button state. */
#define GLUT_DOWN 0
#define GLUT_UP 1
#if (GLUT_API_VERSION >= 2)
/* function keys */
#define GLUT_KEY_F1 1
#define GLUT_KEY_F2 2
#define GLUT_KEY_F3 3
#define GLUT_KEY_F4 4
#define GLUT_KEY_F5 5
#define GLUT_KEY_F6 6
#define GLUT_KEY_F7 7
#define GLUT_KEY_F8 8
#define GLUT_KEY_F9 9
#define GLUT_KEY_F10 10
#define GLUT_KEY_F11 11
#define GLUT_KEY_F12 12
/* directional keys */
#define GLUT_KEY_LEFT 100
#define GLUT_KEY_UP 101
#define GLUT_KEY_RIGHT 102
#define GLUT_KEY_DOWN 103
#define GLUT_KEY_PAGE_UP 104
#define GLUT_KEY_PAGE_DOWN 105
#define GLUT_KEY_HOME 106
#define GLUT_KEY_END 107
#define GLUT_KEY_INSERT 108
#endif
/* Entry/exit state. */
#define GLUT_LEFT 0
#define GLUT_ENTERED 1
/* Menu usage state. */
#define GLUT_MENU_NOT_IN_USE 0
#define GLUT_MENU_IN_USE 1
/* Visibility state. */
#define GLUT_NOT_VISIBLE 0
#define GLUT_VISIBLE 1
/* Window status state. */
#define GLUT_HIDDEN 0
#define GLUT_FULLY_RETAINED 1
#define GLUT_PARTIALLY_RETAINED 2
#define GLUT_FULLY_COVERED 3
/* Color index component selection values. */
#define GLUT_RED 0
#define GLUT_GREEN 1
#define GLUT_BLUE 2
/* Layers for use. */
#define GLUT_NORMAL 0
#define GLUT_OVERLAY 1
#if defined(_WIN32) || defined (GLUT_IMPORT_LIB)
/* Stroke font constants (use these in GLUT program). */
#define GLUT_STROKE_ROMAN ((void*)0)
#define GLUT_STROKE_MONO_ROMAN ((void*)1)
/* Bitmap font constants (use these in GLUT program). */
#define GLUT_BITMAP_9_BY_15 ((void*)2)
#define GLUT_BITMAP_8_BY_13 ((void*)3)
#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
#if (GLUT_API_VERSION >= 3)
#define GLUT_BITMAP_HELVETICA_10 ((void*)6)
#define GLUT_BITMAP_HELVETICA_12 ((void*)7)
#define GLUT_BITMAP_HELVETICA_18 ((void*)8)
#endif
#else
/* Stroke font opaque addresses (use constants instead in source code). */
GLUTAPI void *glutStrokeRoman;
GLUTAPI void *glutStrokeMonoRoman;
/* Stroke font constants (use these in GLUT program). */
#define GLUT_STROKE_ROMAN (&glutStrokeRoman)
#define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
/* Bitmap font opaque addresses (use constants instead in source code). */
GLUTAPI void *glutBitmap9By15;
GLUTAPI void *glutBitmap8By13;
GLUTAPI void *glutBitmapTimesRoman10;
GLUTAPI void *glutBitmapTimesRoman24;
GLUTAPI void *glutBitmapHelvetica10;
GLUTAPI void *glutBitmapHelvetica12;
GLUTAPI void *glutBitmapHelvetica18;
/* Bitmap font constants (use these in GLUT program). */
#define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15)
#define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13)
#define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10)
#define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24)
#if (GLUT_API_VERSION >= 3)
#define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10)
#define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12)
#define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18)
#endif
#endif
/* glutGet parameters. */
#define GLUT_WINDOW_X 100
#define GLUT_WINDOW_Y 101
#define GLUT_WINDOW_WIDTH 102
#define GLUT_WINDOW_HEIGHT 103
#define GLUT_WINDOW_BUFFER_SIZE 104
#define GLUT_WINDOW_STENCIL_SIZE 105
#define GLUT_WINDOW_DEPTH_SIZE 106
#define GLUT_WINDOW_RED_SIZE 107
#define GLUT_WINDOW_GREEN_SIZE 108
#define GLUT_WINDOW_BLUE_SIZE 109
#define GLUT_WINDOW_ALPHA_SIZE 110
#define GLUT_WINDOW_ACCUM_RED_SIZE 111
#define GLUT_WINDOW_ACCUM_GREEN_SIZE 112
#define GLUT_WINDOW_ACCUM_BLUE_SIZE 113
#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114
#define GLUT_WINDOW_DOUBLEBUFFER 115
#define GLUT_WINDOW_RGBA 116
#define GLUT_WINDOW_PARENT 117
#define GLUT_WINDOW_NUM_CHILDREN 118
#define GLUT_WINDOW_COLORMAP_SIZE 119
#if (GLUT_API_VERSION >= 2)
#define GLUT_WINDOW_NUM_SAMPLES 120
#define GLUT_WINDOW_STEREO 121
#endif
#if (GLUT_API_VERSION >= 3)
#define GLUT_WINDOW_CURSOR 122
#endif
#define GLUT_SCREEN_WIDTH 200
#define GLUT_SCREEN_HEIGHT 201
#define GLUT_SCREEN_WIDTH_MM 202
#define GLUT_SCREEN_HEIGHT_MM 203
#define GLUT_MENU_NUM_ITEMS 300
#define GLUT_DISPLAY_MODE_POSSIBLE 400
#define GLUT_INIT_WINDOW_X 500
#define GLUT_INIT_WINDOW_Y 501
#define GLUT_INIT_WINDOW_WIDTH 502
#define GLUT_INIT_WINDOW_HEIGHT 503
#define GLUT_INIT_DISPLAY_MODE 504
#if (GLUT_API_VERSION >= 2)
#define GLUT_ELAPSED_TIME 700
#endif
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
#define GLUT_WINDOW_FORMAT_ID 123
#endif
#if (GLUT_API_VERSION >= 2)
/* glutDeviceGet parameters. */
#define GLUT_HAS_KEYBOARD 600
#define GLUT_HAS_MOUSE 601
#define GLUT_HAS_SPACEBALL 602
#define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
#define GLUT_HAS_TABLET 604
#define GLUT_NUM_MOUSE_BUTTONS 605
#define GLUT_NUM_SPACEBALL_BUTTONS 606
#define GLUT_NUM_BUTTON_BOX_BUTTONS 607
#define GLUT_NUM_DIALS 608
#define GLUT_NUM_TABLET_BUTTONS 609
#endif
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
#define GLUT_DEVICE_IGNORE_KEY_REPEAT 610
#define GLUT_DEVICE_KEY_REPEAT 611
#define GLUT_HAS_JOYSTICK 612
#define GLUT_OWNS_JOYSTICK 613
#define GLUT_JOYSTICK_BUTTONS 614
#define GLUT_JOYSTICK_AXES 615
#define GLUT_JOYSTICK_POLL_RATE 616
#endif
#if (GLUT_API_VERSION >= 3)
/* glutLayerGet parameters. */
#define GLUT_OVERLAY_POSSIBLE 800
#define GLUT_LAYER_IN_USE 801
#define GLUT_HAS_OVERLAY 802
#define GLUT_TRANSPARENT_INDEX 803
#define GLUT_NORMAL_DAMAGED 804
#define GLUT_OVERLAY_DAMAGED 805
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
/* glutVideoResizeGet parameters. */
#define GLUT_VIDEO_RESIZE_POSSIBLE 900
#define GLUT_VIDEO_RESIZE_IN_USE 901
#define GLUT_VIDEO_RESIZE_X_DELTA 902
#define GLUT_VIDEO_RESIZE_Y_DELTA 903
#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904
#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905
#define GLUT_VIDEO_RESIZE_X 906
#define GLUT_VIDEO_RESIZE_Y 907
#define GLUT_VIDEO_RESIZE_WIDTH 908
#define GLUT_VIDEO_RESIZE_HEIGHT 909
#endif
/* glutUseLayer parameters. */
#define GLUT_NORMAL 0
#define GLUT_OVERLAY 1
/* glutGetModifiers return mask. */
#define GLUT_ACTIVE_SHIFT 1
#define GLUT_ACTIVE_CTRL 2
#define GLUT_ACTIVE_ALT 4
/* glutSetCursor parameters. */
/* Basic arrows. */
#define GLUT_CURSOR_RIGHT_ARROW 0
#define GLUT_CURSOR_LEFT_ARROW 1
/* Symbolic cursor shapes. */
#define GLUT_CURSOR_INFO 2
#define GLUT_CURSOR_DESTROY 3
#define GLUT_CURSOR_HELP 4
#define GLUT_CURSOR_CYCLE 5
#define GLUT_CURSOR_SPRAY 6
#define GLUT_CURSOR_WAIT 7
#define GLUT_CURSOR_TEXT 8
#define GLUT_CURSOR_CROSSHAIR 9
/* Directional cursors. */
#define GLUT_CURSOR_UP_DOWN 10
#define GLUT_CURSOR_LEFT_RIGHT 11
/* Sizing cursors. */
#define GLUT_CURSOR_TOP_SIDE 12
#define GLUT_CURSOR_BOTTOM_SIDE 13
#define GLUT_CURSOR_LEFT_SIDE 14
#define GLUT_CURSOR_RIGHT_SIDE 15
#define GLUT_CURSOR_TOP_LEFT_CORNER 16
#define GLUT_CURSOR_TOP_RIGHT_CORNER 17
#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
/* Inherit from parent window. */
#define GLUT_CURSOR_INHERIT 100
/* Blank cursor. */
#define GLUT_CURSOR_NONE 101
/* Fullscreen crosshair (if available). */
#define GLUT_CURSOR_FULL_CROSSHAIR 102
#endif
/* GLUT initialization sub-API. */
GLUTAPI void GLUTAPIENTRY glutInit(int *argcp, char **argv);
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
GLUTAPI void GLUTAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
#ifndef GLUT_BUILDING_LIB
static void GLUTAPIENTRY glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
#define glutInit glutInit_ATEXIT_HACK
#endif
#endif
GLUTAPI void GLUTAPIENTRY glutInitDisplayMode(unsigned int mode);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
GLUTAPI void GLUTAPIENTRY glutInitDisplayString(const char *string);
#endif
GLUTAPI void GLUTAPIENTRY glutInitWindowPosition(int x, int y);
GLUTAPI void GLUTAPIENTRY glutInitWindowSize(int width, int height);
GLUTAPI void GLUTAPIENTRY glutMainLoop(void);
/* GLUT window sub-API. */
GLUTAPI int GLUTAPIENTRY glutCreateWindow(const char *title);
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
GLUTAPI int GLUTAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
#ifndef GLUT_BUILDING_LIB
static int GLUTAPIENTRY glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
#define glutCreateWindow glutCreateWindow_ATEXIT_HACK
#endif
#endif
GLUTAPI int GLUTAPIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
GLUTAPI void GLUTAPIENTRY glutDestroyWindow(int win);
GLUTAPI void GLUTAPIENTRY glutPostRedisplay(void);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
GLUTAPI void GLUTAPIENTRY glutPostWindowRedisplay(int win);
#endif
GLUTAPI void GLUTAPIENTRY glutSwapBuffers(void);
GLUTAPI int GLUTAPIENTRY glutGetWindow(void);
GLUTAPI void GLUTAPIENTRY glutSetWindow(int win);
GLUTAPI void GLUTAPIENTRY glutSetWindowTitle(const char *title);
GLUTAPI void GLUTAPIENTRY glutSetIconTitle(const char *title);
GLUTAPI void GLUTAPIENTRY glutPositionWindow(int x, int y);
GLUTAPI void GLUTAPIENTRY glutReshapeWindow(int width, int height);
GLUTAPI void GLUTAPIENTRY glutPopWindow(void);
GLUTAPI void GLUTAPIENTRY glutPushWindow(void);
GLUTAPI void GLUTAPIENTRY glutIconifyWindow(void);
GLUTAPI void GLUTAPIENTRY glutShowWindow(void);
GLUTAPI void GLUTAPIENTRY glutHideWindow(void);
#if (GLUT_API_VERSION >= 3)
GLUTAPI void GLUTAPIENTRY glutFullScreen(void);
GLUTAPI void GLUTAPIENTRY glutSetCursor(int cursor);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
GLUTAPI void GLUTAPIENTRY glutWarpPointer(int x, int y);
#endif
/* GLUT overlay sub-API. */
GLUTAPI void GLUTAPIENTRY glutEstablishOverlay(void);
GLUTAPI void GLUTAPIENTRY glutRemoveOverlay(void);
GLUTAPI void GLUTAPIENTRY glutUseLayer(GLenum layer);
GLUTAPI void GLUTAPIENTRY glutPostOverlayRedisplay(void);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
GLUTAPI void GLUTAPIENTRY glutPostWindowOverlayRedisplay(int win);
#endif
GLUTAPI void GLUTAPIENTRY glutShowOverlay(void);
GLUTAPI void GLUTAPIENTRY glutHideOverlay(void);
#endif
/* GLUT menu sub-API. */
GLUTAPI int GLUTAPIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int));
#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
GLUTAPI int GLUTAPIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int));
#ifndef GLUT_BUILDING_LIB
static int GLUTAPIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); }
#define glutCreateMenu glutCreateMenu_ATEXIT_HACK
#endif
#endif
GLUTAPI void GLUTAPIENTRY glutDestroyMenu(int menu);
GLUTAPI int GLUTAPIENTRY glutGetMenu(void);
GLUTAPI void GLUTAPIENTRY glutSetMenu(int menu);
GLUTAPI void GLUTAPIENTRY glutAddMenuEntry(const char *label, int value);
GLUTAPI void GLUTAPIENTRY glutAddSubMenu(const char *label, int submenu);
GLUTAPI void GLUTAPIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
GLUTAPI void GLUTAPIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
GLUTAPI void GLUTAPIENTRY glutRemoveMenuItem(int item);
GLUTAPI void GLUTAPIENTRY glutAttachMenu(int button);
GLUTAPI void GLUTAPIENTRY glutDetachMenu(int button);
/* GLUT window callback sub-API. */
GLUTAPI void GLUTAPIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void));
GLUTAPI void GLUTAPIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width, int height));
GLUTAPI void GLUTAPIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
GLUTAPI void GLUTAPIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
GLUTAPI void GLUTAPIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
GLUTAPI void GLUTAPIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
GLUTAPI void GLUTAPIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state));
GLUTAPI void GLUTAPIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int state));
GLUTAPI void GLUTAPIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void));
GLUTAPI void GLUTAPIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value);
GLUTAPI void GLUTAPIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int state));
#if (GLUT_API_VERSION >= 2)
GLUTAPI void GLUTAPIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
GLUTAPI void GLUTAPIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
GLUTAPI void GLUTAPIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
GLUTAPI void GLUTAPIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)(int button, int state));
GLUTAPI void GLUTAPIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int button, int state));
GLUTAPI void GLUTAPIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial, int value));
GLUTAPI void GLUTAPIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
GLUTAPI void GLUTAPIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
#if (GLUT_API_VERSION >= 3)
GLUTAPI void GLUTAPIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int status, int x, int y));
GLUTAPI void GLUTAPIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(void));
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
GLUTAPI void GLUTAPIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(int state));
#endif
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
GLUTAPI void GLUTAPIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
GLUTAPI void GLUTAPIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
GLUTAPI void GLUTAPIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsigned int buttonMask, int x, int y, int z), int pollInterval);
#endif
#endif
#endif
/* GLUT color index sub-API. */
GLUTAPI void GLUTAPIENTRY glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue);
GLUTAPI GLfloat GLUTAPIENTRY glutGetColor(int ndx, int component);
GLUTAPI void GLUTAPIENTRY glutCopyColormap(int win);
/* GLUT state retrieval sub-API. */
GLUTAPI int GLUTAPIENTRY glutGet(GLenum type);
GLUTAPI int GLUTAPIENTRY glutDeviceGet(GLenum type);
#if (GLUT_API_VERSION >= 2)
/* GLUT extension support sub-API */
GLUTAPI int GLUTAPIENTRY glutExtensionSupported(const char *name);
#endif
#if (GLUT_API_VERSION >= 3)
GLUTAPI int GLUTAPIENTRY glutGetModifiers(void);
GLUTAPI int GLUTAPIENTRY glutLayerGet(GLenum type);
#endif
#if (GLUT_API_VERSION >= 5)
typedef void (*GLUTproc)();
GLUTAPI GLUTproc GLUTAPIENTRY glutGetProcAddress(const char *procName);
#endif
/* GLUT font sub-API */
GLUTAPI void GLUTAPIENTRY glutBitmapCharacter(void *font, int character);
GLUTAPI int GLUTAPIENTRY glutBitmapWidth(void *font, int character);
GLUTAPI void GLUTAPIENTRY glutStrokeCharacter(void *font, int character);
GLUTAPI int GLUTAPIENTRY glutStrokeWidth(void *font, int character);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
GLUTAPI int GLUTAPIENTRY glutBitmapLength(void *font, const unsigned char *string);
GLUTAPI int GLUTAPIENTRY glutStrokeLength(void *font, const unsigned char *string);
#endif
/* GLUT pre-built models sub-API */
GLUTAPI void GLUTAPIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
GLUTAPI void GLUTAPIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
GLUTAPI void GLUTAPIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
GLUTAPI void GLUTAPIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
GLUTAPI void GLUTAPIENTRY glutWireCube(GLdouble size);
GLUTAPI void GLUTAPIENTRY glutSolidCube(GLdouble size);
GLUTAPI void GLUTAPIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
GLUTAPI void GLUTAPIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
GLUTAPI void GLUTAPIENTRY glutWireDodecahedron(void);
GLUTAPI void GLUTAPIENTRY glutSolidDodecahedron(void);
GLUTAPI void GLUTAPIENTRY glutWireTeapot(GLdouble size);
GLUTAPI void GLUTAPIENTRY glutSolidTeapot(GLdouble size);
GLUTAPI void GLUTAPIENTRY glutWireOctahedron(void);
GLUTAPI void GLUTAPIENTRY glutSolidOctahedron(void);
GLUTAPI void GLUTAPIENTRY glutWireTetrahedron(void);
GLUTAPI void GLUTAPIENTRY glutSolidTetrahedron(void);
GLUTAPI void GLUTAPIENTRY glutWireIcosahedron(void);
GLUTAPI void GLUTAPIENTRY glutSolidIcosahedron(void);
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
/* GLUT video resize sub-API. */
GLUTAPI int GLUTAPIENTRY glutVideoResizeGet(GLenum param);
GLUTAPI void GLUTAPIENTRY glutSetupVideoResizing(void);
GLUTAPI void GLUTAPIENTRY glutStopVideoResizing(void);
GLUTAPI void GLUTAPIENTRY glutVideoResize(int x, int y, int width, int height);
GLUTAPI void GLUTAPIENTRY glutVideoPan(int x, int y, int width, int height);
/* GLUT debugging sub-API. */
GLUTAPI void GLUTAPIENTRY glutReportErrors(void);
#endif
#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
/* GLUT device control sub-API. */
/* glutSetKeyRepeat modes. */
#define GLUT_KEY_REPEAT_OFF 0
#define GLUT_KEY_REPEAT_ON 1
#define GLUT_KEY_REPEAT_DEFAULT 2
/* Joystick button masks. */
#define GLUT_JOYSTICK_BUTTON_A 1
#define GLUT_JOYSTICK_BUTTON_B 2
#define GLUT_JOYSTICK_BUTTON_C 4
#define GLUT_JOYSTICK_BUTTON_D 8
GLUTAPI void GLUTAPIENTRY glutIgnoreKeyRepeat(int ignore);
GLUTAPI void GLUTAPIENTRY glutSetKeyRepeat(int repeatMode);
GLUTAPI void GLUTAPIENTRY glutForceJoystickFunc(void);
/* GLUT game mode sub-API. */
/* glutGameModeGet. */
#define GLUT_GAME_MODE_ACTIVE 0
#define GLUT_GAME_MODE_POSSIBLE 1
#define GLUT_GAME_MODE_WIDTH 2
#define GLUT_GAME_MODE_HEIGHT 3
#define GLUT_GAME_MODE_PIXEL_DEPTH 4
#define GLUT_GAME_MODE_REFRESH_RATE 5
#define GLUT_GAME_MODE_DISPLAY_CHANGED 6
GLUTAPI void GLUTAPIENTRY glutGameModeString(const char *string);
GLUTAPI int GLUTAPIENTRY glutEnterGameMode(void);
GLUTAPI void GLUTAPIENTRY glutLeaveGameMode(void);
GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode);
#endif
#ifdef __cplusplus
}
#endif
#endif /* __glut_h__ */
-192
View File
@@ -1,192 +0,0 @@
/*******************************************************************************
/
/ File: GLView.h
/
/ Copyright 1993-98, Be Incorporated, All Rights Reserved.
/
*******************************************************************************/
#ifndef BGLVIEW_H
#define BGLVIEW_H
#include <GL/gl.h>
#define BGL_RGB 0
#define BGL_INDEX 1
#define BGL_SINGLE 0
#define BGL_DOUBLE 2
#define BGL_DIRECT 0
#define BGL_INDIRECT 4
#define BGL_ACCUM 8
#define BGL_ALPHA 16
#define BGL_DEPTH 32
#define BGL_OVERLAY 64
#define BGL_UNDERLAY 128
#define BGL_STENCIL 512
#ifdef __cplusplus
#include <AppKit.h>
#include <interface/Window.h>
#include <interface/View.h>
#include <interface/Bitmap.h>
#include <game/WindowScreen.h>
#include <game/DirectWindow.h>
class BGLView : public BView {
public:
BGLView(BRect rect, char *name,
ulong resizingMode, ulong mode,
ulong options);
virtual ~BGLView();
void LockGL();
void UnlockGL();
void SwapBuffers();
void SwapBuffers( bool vSync );
BView * EmbeddedView();
status_t CopyPixelsOut(BPoint source, BBitmap *dest);
status_t CopyPixelsIn(BBitmap *source, BPoint dest);
virtual void ErrorCallback(unsigned long errorCode); // Mesa's GLenum is uint where Be's ones was ulong!
virtual void Draw(BRect updateRect);
virtual void AttachedToWindow();
virtual void AllAttached();
virtual void DetachedFromWindow();
virtual void AllDetached();
virtual void FrameResized(float width, float height);
virtual status_t Perform(perform_code d, void *arg);
/* The public methods below, for the moment,
are just pass-throughs to BView */
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void MessageReceived(BMessage *msg);
virtual void SetResizingMode(uint32 mode);
virtual void Show();
virtual void Hide();
virtual BHandler *ResolveSpecifier(BMessage *msg, int32 index,
BMessage *specifier, int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
/* New public functions */
void DirectConnected( direct_buffer_info *info );
void EnableDirectMode( bool enabled );
void * getGC() { return m_gc; }
private:
virtual void _ReservedGLView1();
virtual void _ReservedGLView2();
virtual void _ReservedGLView3();
virtual void _ReservedGLView4();
virtual void _ReservedGLView5();
virtual void _ReservedGLView6();
virtual void _ReservedGLView7();
virtual void _ReservedGLView8();
BGLView(const BGLView &);
BGLView &operator=(const BGLView &);
void dither_front();
bool confirm_dither();
void draw(BRect r);
void * m_gc;
uint32 m_options;
uint32 m_ditherCount;
BLocker m_drawLock;
BLocker m_displayLock;
void * m_clip_info;
void * _Unused1;
BBitmap * m_ditherMap;
BRect m_bounds;
int16 * m_errorBuffer[2];
uint64 _reserved[8];
/* Direct Window stuff */
private:
void drawScanline( int x1, int x2, int y, void *data );
static void scanlineHandler(struct rasStateRec *state, GLint x1, GLint x2);
void lock_draw();
void unlock_draw();
bool validateView();
};
class BGLScreen : public BWindowScreen {
public:
BGLScreen(char *name,
ulong screenMode, ulong options,
status_t *error, bool debug=false);
~BGLScreen();
void LockGL();
void UnlockGL();
void SwapBuffers();
virtual void ErrorCallback(unsigned long errorCode); // Mesa's GLenum is uint where Be's ones was ulong!
virtual void ScreenConnected(bool connected);
virtual void FrameResized(float width, float height);
virtual status_t Perform(perform_code d, void *arg);
/* The public methods below, for the moment,
are just pass-throughs to BWindowScreen */
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void MessageReceived(BMessage *msg);
virtual void Show();
virtual void Hide();
virtual BHandler *ResolveSpecifier(BMessage *msg,
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
private:
virtual void _ReservedGLScreen1();
virtual void _ReservedGLScreen2();
virtual void _ReservedGLScreen3();
virtual void _ReservedGLScreen4();
virtual void _ReservedGLScreen5();
virtual void _ReservedGLScreen6();
virtual void _ReservedGLScreen7();
virtual void _ReservedGLScreen8();
BGLScreen(const BGLScreen &);
BGLScreen &operator=(const BGLScreen &);
void * m_gc;
long m_options;
BLocker m_drawLock;
int32 m_colorSpace;
uint32 m_screen_mode;
uint64 _reserved[7];
};
#endif // __cplusplus
#endif // BGLVIEW_H
-113
View File
@@ -1,113 +0,0 @@
/*****************************************************************************/
// File: BitmapStream.h
// Class: BBitmapStream
// Reimplemented by: Travis Smith, Michael Wilber, Translation Kit Team
// Reimplementation: 2002-04
//
// Description: BPositionIO based object to read/write bitmap format to/from
// a BBitmap object.
//
// The BTranslationUtils class uses this object and makes it
// easy for users to load bitmaps.
//
// Copyright (c) 2002 OpenBeOS Project
//
// Original Version: Copyright 1998, Be Incorporated, All Rights Reserved.
// Copyright 1995-1997, Jon Watte
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
/*****************************************************************************/
#if !defined(_BITMAP_STREAM_H)
#define _BITMAP_STREAM_H
#include <BeBuild.h>
#include <TranslationDefs.h>
#include <DataIO.h>
#include <TranslatorFormats.h>
#include <ByteOrder.h>
class BBitmap;
class BBitmapStream : public BPositionIO {
public:
BBitmapStream(BBitmap *bitmap = NULL);
// Initializes the stream to use map as the bitmap for stream
// operations. If map is null, a BBitmap is created when properly
// formatted data is written to the stream.
~BBitmapStream();
// Destroys the BBitmap held by this object if it has not been
// detached and frees fpBigEndianHeader
// Overrides from BPositionIO
ssize_t ReadAt(off_t pos, void *buffer, size_t size);
// reads data from the bitmap into buffer
ssize_t WriteAt(off_t pos, const void *data, size_t size);
// writes the data from data into this bitmap
// (if the data is properly formatted)
off_t Seek(off_t position, uint32 whence);
// sets the stream position member
off_t Position() const;
// returns the current stream position
off_t Size() const;
// returns the size of the data
status_t SetSize(off_t size);
// sets the amount of memory to be used by this object
status_t DetachBitmap(BBitmap **outMap);
// "Detaches" the bitmap used by this stream and returns it
// to the user through outMap. This allows the user to
// use the bitmap even after the BBitmapStream that it
// came from has been deleted.
protected:
TranslatorBitmap fHeader;
// stores the bitmap header information in the
// host format, used to determine the format of
// the bitmap data and to see if the data is valid
BBitmap *fBitmap;
// the actual bitmap used by this object
size_t fPosition;
// current data position
size_t fSize;
// size of the data stored
bool fDetached;
// true if the bitmap has been detached, false if not
void SwapHeader(const TranslatorBitmap *source,
TranslatorBitmap *destination);
// swaps the byte order of source, no matter what the
// byte order of source is, and copies the result to
// destination
private:
TranslatorBitmap *fpBigEndianHeader;
// same data as in fHeader, but in Big Endian format
// (Intel machines are Little Endian)
// For maintaining binary compatibility with past and future
// versions of this object
long fUnused[5];
virtual void _ReservedBitmapStream1();
virtual void _ReservedBitmapStream2();
};
#endif /* _BITMAP_STREAM_H */
@@ -1,66 +0,0 @@
/********************************************************************************
/
/ File: TranslationDefs.h
/
/ Description: Miscellaneous basic definitions for the Translation Kit
/
/ Copyright 1998, Be Incorporated, All Rights Reserved.
/ Copyright 1995-1997, Jon Watte
/
/ 2002 - translation_data struct added by Michael Wilber, OBOS TransKit Team
********************************************************************************/
#if !defined(_TRANSLATION_DEFS_H)
#define _TRANSLATION_DEFS_H
#include <BeBuild.h>
#include <SupportDefs.h>
#include <TranslationErrors.h>
typedef unsigned long translator_id;
/* when you export this struct, end with an empty */
/* record that has 0 for "type" */
/* These are defines, because they reflect the state at which the app was compiled */
#define B_TRANSLATION_CURRENT_VERSION B_BEOS_VERSION
#define B_TRANSLATION_MIN_VERSION 161
extern const char * B_TRANSLATOR_MIME_TYPE;
struct translation_format {
uint32 type; /* B_ASCII_TYPE, ...*/
uint32 group; /* B_TRANSLATOR_BITMAP, B_TRANSLATOR_TEXT, ...*/
float quality; /* ability of the format to retain the data of its group (0.0-1.0) */
float capability; /* ability of the translator to decode the format (0.0-1.0) */
char MIME[251]; /* MIME string*/
char name[251]; /* only descriptive */
};
/* This struct is different from the format struct for a reason: */
/* to separate the notion of formats from the notion of translations */
struct translator_info { /* Info about a specific translation*/
uint32 type; /* B_ASCII_TYPE, ...*/
translator_id translator; /* Filled in by BTranslationRoster*/
uint32 group; /* B_TRANSLATOR_BITMAP, B_TRANSLATOR_TEXT, ...*/
float quality; /* ability of the format to retain the data of its group (0.0-1.0) */
float capability; /* ability of the translator to decode the format (0.0-1.0) */
char name[251];
char MIME[251];
};
// BEGIN: Haiku R1 Extensions
#define B_TRANSLATION_MAKE_VERSION(major,minor,revision) ((major << 8) | ((minor << 4) & 0xf0) | (revision & 0x0f))
#define B_TRANSLATION_MAJOR_VERSION(v) (v >> 8)
#define B_TRANSLATION_MINOR_VERSION(v) ((v >> 4) & 0xf)
#define B_TRANSLATION_REVISION_VERSION(v) (v & 0xf)
// END: Haiku R1 Extensions
#endif /* _TRANSLATION_DEFS_H */
@@ -1,27 +0,0 @@
/********************************************************************************
/
/ File: TranslationErrors.h
/
/ Description: Error codes for the Translation Kit
/
/ Copyright 1998, Be Incorporated, All Rights Reserved.
/ Copyright 1995-1997, Jon Watte
/
********************************************************************************/
#if !defined(_TRANSLATION_ERRORS_H)
#define _TRANSLATION_ERRORS_H
#include <Errors.h>
enum B_TRANSLATION_ERROR {
B_TRANSLATION_BASE_ERROR = B_TRANSLATION_ERROR_BASE,
B_NO_TRANSLATOR = B_TRANSLATION_BASE_ERROR, /* no translator exists for data */
B_ILLEGAL_DATA, /* data is not what it said it was */
/* aliases */
B_NOT_INITIALIZED = B_NO_INIT
};
#endif /* _TRANSLATION_ERRORS_H */
@@ -1,18 +0,0 @@
/***************************************************************
/
/ File: TranslationKit.h
/
/ Copyright 1998, Be Incorporated.
/
***************************************************************/
#include <BitmapStream.h>
#include <TranslationDefs.h>
#include <TranslationErrors.h>
#include <TranslationUtils.h>
#include <TranslatorFormats.h>
#include <TranslatorRoster.h>
#include <Translator.h>
/* we do not include TranslatorAddOn.h because it's only used when building an add-on */
@@ -1,126 +0,0 @@
/*****************************************************************************/
// File: TranslationUtils.h
// Class: BTranslationUtils
// Reimplemented by: Michael Wilber, Translation Kit Team
// Reimplementation: 2002-04
//
// Description: Utility functions for the Translation Kit
//
//
// Copyright (c) 2002 OpenBeOS Project
//
// Original Version: Copyright 1998, Be Incorporated, All Rights Reserved.
// Copyright 1995-1997, Jon Watte
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
/*****************************************************************************/
#if !defined(_TRANSLATION_UTILS_H)
#define _TRANSLATION_UTILS_H
#include <TranslationDefs.h>
#include <SupportDefs.h>
class BBitmap;
class BTranslatorRoster;
class BPositionIO;
class BMenu;
// This class is a little different from many other classes.
// You don't create an instance of it; you just call its various
// static member functions for utility-like operations.
class BTranslationUtils {
BTranslationUtils();
~BTranslationUtils();
BTranslationUtils(const BTranslationUtils &);
BTranslationUtils & operator=(const BTranslationUtils &);
public:
// BITMAP getters - allocate the BBitmap; you call delete on it!
static BBitmap *GetBitmap(const char *kName, BTranslatorRoster *roster = NULL);
// Get bitmap - first try as file name, then as B_TRANSLATOR_BITMAP
// resource type from app file -- can be of any kind for which a
// translator is installed (TGA, etc)
static BBitmap *GetBitmap(uint32 type, int32 id,
BTranslatorRoster *roster = NULL);
// Get bitmap - from app resource by id
static BBitmap *GetBitmap(uint32 type, const char *kName,
BTranslatorRoster *roster = NULL);
// Get Bitmap - from app resource by name
static BBitmap *GetBitmapFile(const char *kName,
BTranslatorRoster *roster = NULL);
// Get bitmap - from file only
static BBitmap *GetBitmap(const entry_ref *kRef,
BTranslatorRoster *roster = NULL);
// Get bitmap - from open file (or BMemoryIO)
static BBitmap *GetBitmap(BPositionIO *stream,
BTranslatorRoster *roster = NULL);
// Get bitmap - from open file or IO type object
// This function does the real work for the other GetBitmap functions
static status_t GetStyledText(BPositionIO *fromStream, BTextView *intoView,
BTranslatorRoster *roster = NULL);
// For styled text, we can translate from a stream
// directly into a BTextView
static status_t PutStyledText(BTextView *fromView, BPositionIO *intoStream,
BTranslatorRoster *roster = NULL);
// Saving is slightly different -- given the BTextView, a
// B_STYLED_TEXT_FORMAT stream is written to intoStream. You can then call
// Translate() yourself to translate that stream into something else if
// you want, if it is a temp file or a BMallocIO. It's also OK to write
// the B_STYLED_TEXT_FORMAT to a file, although the StyledEdit format
// (TEXT file + style attributes) is preferred. This convenience function
// is only marginally part of the Translation Kit, but what the hey :-)
static status_t WriteStyledEditFile(BTextView *fromView, BFile *intoFile);
// Writes the styled text data from fromView to intoFile
static BMessage *GetDefaultSettings(translator_id forTranslator,
BTranslatorRoster *roster = NULL);
// Get default settings for the translator with the id forTranslator
static BMessage *GetDefaultSettings(const char *kTranslatorName,
int32 translatorVersion);
// Get default settings for the translator with the name kTranslatorName
// Envious of that "Save As" menu in ShowImage? Well, you can have your own!
// AddTranslationItems will add menu items for all translations from the
// basic format you specify (B_TRANSLATOR_BITMAP, B_TRANSLATOR_TEXT etc).
// The translator ID and format constant chosen will be added to the message
// that is sent to you when the menu item is selected.
enum {
B_TRANSLATION_MENU = 'BTMN'
};
static status_t AddTranslationItems(BMenu *intoMenu, uint32 fromType,
const BMessage *kModel = NULL, // default B_TRANSLATION_MENU
const char *kTranslatorIdName = NULL, // default "be:translator"
const char *kTranslatorTypeName = NULL, // default "be:type"
BTranslatorRoster *roster = NULL);
};
#endif /* _TRANSLATION_UTILS_H */
-137
View File
@@ -1,137 +0,0 @@
/*****************************************************************************/
// File: Translator.h
// Class: BTranslator
// Reimplemented by: Michael Wilber, Translation Kit Team
// Reimplementation: 2002-06-15
//
// Description: This file contains the BTranslator class, the base class for
// all translators that don't use the BeOS R4/R4.5 add-on method.
//
//
// Copyright (c) 2002 OpenBeOS Project
//
// Original Version: Copyright 1998, Be Incorporated, All Rights Reserved.
// Copyright 1995-1997, Jon Watte
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
/*****************************************************************************/
#ifndef _TRANSLATOR_H
#define _TRANSLATOR_H
#include <TranslationDefs.h>
#include <Archivable.h>
class BTranslator : public BArchivable {
public:
BTranslator();
// Sets refcount to 1 (the object is initially Acquired()'d once)
BTranslator *Acquire();
// return actual object and increment the refcount
BTranslator *Release();
// Decrements the refcount and returns pointer to the object.
// When the refcount is zero, NULL is returned and the object is
// deleted
int32 ReferenceCount();
// returns the refcount, THIS IS NOT THREAD SAFE, ITS ONLY FOR "FUN"
virtual const char *TranslatorName() const = 0;
// returns the short name of the translator
virtual const char *TranslatorInfo() const = 0;
// returns a verbose name/description for the translator
virtual int32 TranslatorVersion() const = 0;
// returns the version of the translator
virtual const translation_format *InputFormats(int32 *out_count)
const = 0;
// returns the input formats and the count of input formats
// that this translator supports
virtual const translation_format *OutputFormats(int32 *out_count)
const = 0;
// returns the output formats and the count of output formats
// that this translator supports
virtual status_t Identify(BPositionIO *inSource,
const translation_format *inFormat, BMessage *ioExtension,
translator_info *outInfo, uint32 outType) = 0;
// determines whether or not this translator can convert the
// data in inSource to the type outType
virtual status_t Translate(BPositionIO *inSource,
const translator_info *inInfo, BMessage *ioExtension,
uint32 outType, BPositionIO *outDestination) = 0;
// this function is the whole point of the Translation Kit,
// it translates the data in inSource to outDestination
// using the format outType
virtual status_t MakeConfigurationView(BMessage *ioExtension,
BView **outView, BRect *outExtent);
// this function creates a view that allows the user to
// configure the translator, this function is not
// required for all translators
virtual status_t GetConfigurationMessage(BMessage *ioExtension);
// puts information about the current configuration of the
// translator into ioExtension so that it can be used with
// Identify or Translate or whatever, this function is
// not required for all translators
protected:
virtual ~BTranslator();
// this is protected because the object is deleted by the
// Release() function instead of being deleted directly by
// the user
private:
int32 fRefCount;
// number of times this object has been referenced
// by the Acquire() function
sem_id fSem;
// used to lock object for Acquire() and Release()
// For binary compatibility with past and future
// version of this class
uint32 fUnused[8];
virtual status_t _Reserved_Translator_0(int32, void *);
virtual status_t _Reserved_Translator_1(int32, void *);
virtual status_t _Reserved_Translator_2(int32, void *);
virtual status_t _Reserved_Translator_3(int32, void *);
virtual status_t _Reserved_Translator_4(int32, void *);
virtual status_t _Reserved_Translator_5(int32, void *);
virtual status_t _Reserved_Translator_6(int32, void *);
virtual status_t _Reserved_Translator_7(int32, void *);
};
// The post-4.5 API suggests implementing this function in your translator
// add-on rather than the separate functions and variables of the previous
// API. You will be called for values of n starting at 0 and increasing;
// return 0 when you can't make another kind of translator (i.e. for n=1
// if you only implement one subclass of BTranslator). Ignore flags for now.
extern "C" _EXPORT BTranslator *make_nth_translator(int32 n, image_id you,
uint32 flags, ...);
#endif /* _TRANSLATOR_H */
@@ -1,92 +0,0 @@
/********************************************************************************
/
/ File: TranslatorAddOn.h
/
/ Description: This header file defines the interface that should be
/ implemented and exported by a Tanslation Kit add-on.
/ You will only need to include this header when building
/ an actual add-on, not when just using the kit.
/
/ Copyright 1998, Be Incorporated, All Rights Reserved.
/ Copyright 1995-1997, Jon Watte
/
********************************************************************************/
#ifndef _TRANSLATOR_ADD_ON_H
#define _TRANSLATOR_ADD_ON_H
#include <TranslationDefs.h>
class BView;
class BRect;
class BPositionIO;
/* This is the 4.0 and 4.5 compatible API. For later versions, use the */
/* BTranslator-based API (make_nth_translator) */
/* These variables and functions should be exported by a translator add-on */
extern "C" {
_EXPORT extern char translatorName[]; /* required, C string, ex "Jon's Sound" */
_EXPORT extern char translatorInfo[]; /* required, descriptive C string, ex "Jon's Sound Translator (shareware $5: [email protected]) v1.00" */
_EXPORT extern int32 translatorVersion; /* required, integer, ex 100 */
_EXPORT extern translation_format inputFormats[]; /* optional (else Identify is always called) */
_EXPORT extern translation_format outputFormats[]; /* optional (else Translate is called anyway) */
/* Translators that don't export outputFormats */
/* will not be considered by files looking for */
/* specific output formats. */
/* Return B_NO_TRANSLATOR if not handling this data. */
/* Even if inputFormats exists, may be called for data without hints */
/* Ff outType is not 0, must be able to export in wanted format */
_EXPORT extern status_t Identify( /* required */
BPositionIO * inSource,
const translation_format * inFormat, /* can beNULL */
BMessage * ioExtension, /* can be NULL */
translator_info * outInfo,
uint32 outType);
/* Return B_NO_TRANSLATOR if not handling the output format */
/* If outputFormats exists, will only be called for those formats */
_EXPORT extern status_t Translate( /* required */
BPositionIO * inSource,
const translator_info * inInfo,
BMessage * ioExtension, /* can be NULL */
uint32 outType,
BPositionIO * outDestination);
/* The view will get resized to what the parent thinks is */
/* reasonable. However, it will still receive MouseDowns etc. */
/* Your view should change settings in the translator immediately, */
/* taking care not to change parameters for a translation that is */
/* currently running. Typically, you'll have a global struct for */
/* settings that is atomically copied into the translator function */
/* as a local when translation starts. */
/* Store your settings wherever you feel like it. */
_EXPORT extern status_t MakeConfig( /* optional */
BMessage * ioExtension, /* can be NULL */
BView * * outView,
BRect * outExtent);
/* Copy your current settings to a BMessage that may be passed */
/* to BTranslators::Translate at some later time when the user wants to */
/* use whatever settings you're using right now. */
_EXPORT extern status_t GetConfigMessage( /* optional */
BMessage * ioExtension);
}
#endif /* _TRANSLATOR_ADD_ON_H */
@@ -1,179 +0,0 @@
/********************************************************************************
/
/ File: TranslatorFormats.h
/
/ Description: Defines for common "lowest common denominator" formats
/ used in the Translation Kit.
/
/ Copyright 1998, Be Incorporated, All Rights Reserved.
/ Copyright 1995-1997, Jon Watte
/
********************************************************************************/
#ifndef _TRANSLATOR_FORMATS_H
#define _TRANSLATOR_FORMATS_H
#include <GraphicsDefs.h>
#include <Rect.h>
/* extensions used in the extension BMessage. Use of these */
/* is described in the documentation. */
_IMPEXP_TRANSLATION extern char B_TRANSLATOR_EXT_HEADER_ONLY[];
_IMPEXP_TRANSLATION extern char B_TRANSLATOR_EXT_DATA_ONLY[];
_IMPEXP_TRANSLATION extern char B_TRANSLATOR_EXT_COMMENT[];
_IMPEXP_TRANSLATION extern char B_TRANSLATOR_EXT_TIME[];
_IMPEXP_TRANSLATION extern char B_TRANSLATOR_EXT_FRAME[];
_IMPEXP_TRANSLATION extern char B_TRANSLATOR_EXT_BITMAP_RECT[];
_IMPEXP_TRANSLATION extern char B_TRANSLATOR_EXT_BITMAP_COLOR_SPACE[];
_IMPEXP_TRANSLATION extern char B_TRANSLATOR_EXT_BITMAP_PALETTE[];
_IMPEXP_TRANSLATION extern char B_TRANSLATOR_EXT_SOUND_CHANNEL[];
_IMPEXP_TRANSLATION extern char B_TRANSLATOR_EXT_SOUND_MONO[];
_IMPEXP_TRANSLATION extern char B_TRANSLATOR_EXT_SOUND_MARKER[];
_IMPEXP_TRANSLATION extern char B_TRANSLATOR_EXT_SOUND_LOOP[];
#if defined(_DATATYPES_COMPATIBLE_)
#define kCommentExtension "/comment"
#define kTimeExtension "/time"
#define kFrameExtension "/frame"
#define kBitsRectExtension "bits/Rect"
#define kBitsSpaceExtension "bits/space"
#define kHeaderExtension "/headerOnly"
#define kDataExtension "/dataOnly"
#define kNoisChannelExtension "nois/channel"
#define kNoisMonoExtension "nois/mono"
#define kNoisMarkerExtension "nois/marker"
#define kNoisLoopExtension "nois/loop"
#endif
/* For each data group, there is a "standard" format that */
/* all translators should support. */
/* These type codes are lower-case because they are already */
/* established standards in the Be developer community. */
enum TranslatorGroups {
B_TRANSLATOR_BITMAP = 'bits', /* TranslatorBitmap */
B_TRANSLATOR_PICTURE = 'pict', /* BPicture data */
B_TRANSLATOR_TEXT = 'TEXT', /* B_ASCII_TYPE */
B_TRANSLATOR_SOUND = 'nois', /* TranslatorSound */
B_TRANSLATOR_MIDI = 'midi', /* standard MIDI */
B_TRANSLATOR_MEDIA = 'mhi!', /* a stream of stuff */
B_TRANSLATOR_NONE = 'none',
B_TRANSLATOR_ANY_TYPE = 0
};
#if defined(_DATATYPES_COMPATIBLE_)
#define kAnyType 0
#endif
/* some pre-defined data format type codes */
enum {
/* bitmap formats (B_TRANSLATOR_BITMAP) */
B_GIF_FORMAT = 'GIF ',
B_JPEG_FORMAT = 'JPEG',
B_PNG_FORMAT = 'PNG ',
B_PPM_FORMAT = 'PPM ',
B_TGA_FORMAT = 'TGA ',
B_BMP_FORMAT = 'BMP ',
B_TIFF_FORMAT = 'TIFF',
/* line drawing formats (B_TRANSLATOR_PICTURE) */
B_DXF_FORMAT = 'DXF ',
B_EPS_FORMAT = 'EPS ',
B_PICT_FORMAT = 'PICT', /* MacOS PICT file */
/* sound file formats (B_TRANSLATOR_SOUND) */
B_WAV_FORMAT = 'WAV ',
B_AIFF_FORMAT = 'AIFF',
B_CD_FORMAT = 'CD ', /* 44 kHz, stereo, 16 bit, linear, big-endian */
B_AU_FORMAT = 'AU ', /* Sun ulaw */
/* text file formats (B_TRANSLATOR_TEXT) */
B_STYLED_TEXT_FORMAT = 'STXT'
};
/* This is the standard bitmap format */
/* Note that data is always in big-endian format in the stream! */
struct TranslatorBitmap {
uint32 magic; /* B_TRANSLATOR_BITMAP */
BRect bounds;
uint32 rowBytes;
color_space colors;
uint32 dataSize;
}; /* data follows, padded to rowBytes */
/* This is the standard sound format */
/* Note that data is always in big-endian format in the stream! */
struct TranslatorSound {
uint32 magic; /* B_TRANSLATOR_SOUND */
uint32 channels; /* Left should always be first */
float sampleFreq; /* 16 bit linear is assumed */
uint32 numFrames;
}; /* data follows */
/* This is the standard styled text format */
/* Note that it is of group type text! */
/* Skip any records types you don't know about. */
/* Always big-endian. */
struct TranslatorStyledTextRecordHeader {
uint32 magic;
uint32 header_size;
uint32 data_size;
}; /* any number of records */
struct TranslatorStyledTextStreamHeader {
#if defined(__cplusplus)
enum {
STREAM_HEADER_MAGIC = 'STXT'
};
#endif
TranslatorStyledTextRecordHeader header;
int32 version; /* 100 */
}; /* no data for this header */
struct TranslatorStyledTextTextHeader {
#if defined(__cplusplus)
enum {
TEXT_HEADER_MAGIC = 'TEXT'
};
#endif
TranslatorStyledTextRecordHeader header;
int32 charset; /* Always write B_UTF8 for now! */
}; /* text data follows */
struct TranslatorStyledTextStyleHeader {
#if defined(__cplusplus)
enum {
STYLE_HEADER_MAGIC = 'STYL'
};
#endif
TranslatorStyledTextRecordHeader header;
uint32 apply_offset;
uint32 apply_length;
}; /* flattened R3 BTextView style records for preceding text */
#if 0
/* format of the STYL record data (always big-endian) FYI: */
struct {
uchar magic[4]; /* 41 6c 69 21 */
uchar version[4]; /* 00 00 00 00 */
int32 count;
struct {
int32 offset;
char family[64];
char style[64];
float size;
float shear; /* typically 90.0 */
uint16 face; /* typically 0 */
uint8 red;
uint8 green;
uint8 blue;
uint8 alpha; /* 255 == opaque */
uint16 _reserved_; /* 0 */
} styles[];
};
#endif
#endif /* _TRANSLATOR_FORMATS_H */
@@ -1,240 +0,0 @@
/*****************************************************************************/
// File: TranslatorRoster.h
// Class: BTranslatorRoster
// Reimplemented by: Michael Wilber, Translation Kit Team
// Reimplementation: 2002-06-11
//
// Description: This class is the guts of the translation kit, it makes the
// whole thing happen. It bridges the applications using this
// object with the translators that the apps need to access.
//
//
// Copyright (c) 2002 OpenBeOS Project
//
// Original Version: Copyright 1998, Be Incorporated, All Rights Reserved.
// Copyright 1995-1997, Jon Watte
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
/*****************************************************************************/
#ifndef _TRANSLATOR_ROSTER_H
#define _TRANSLATOR_ROSTER_H
#include <TranslationDefs.h>
#include <OS.h>
#include <StorageDefs.h>
#include <InterfaceDefs.h>
#include <Archivable.h>
#include <TranslatorFormats.h>
#include <TranslationDefs.h>
#include <TranslationErrors.h>
#include <Translator.h>
#include <String.h>
#include <image.h>
#include <File.h>
#include <Directory.h>
#include <Volume.h>
#include <string.h>
#include <OS.h>
#include <stdlib.h>
#include <stdio.h>
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
#include <alloca.h>
struct translation_format;
class BBitmap;
class BView;
class BPositionIO;
class BQuery;
class BMessage;
const char kgDefaultTranslatorPath[] = "/boot/home/config/add-ons/Translators:/boot/home/config/add-ons/Datatypes:/system/add-ons/Translators";
// used by BTranslatorRoster to store the list of translators
struct translator_node {
BTranslator *translator;
char *path;
image_id image;
translator_id id;
translator_node *next;
};
class BTranslatorRoster : public BArchivable {
// private, unimplemented functions
// (I'm not sure if there is a need for them anyway)
BTranslatorRoster(const BTranslatorRoster &);
BTranslatorRoster & operator=(const BTranslatorRoster &);
public:
BTranslatorRoster();
// initializes the object with no translators
BTranslatorRoster(BMessage *model);
// initializes the object and loads all translators from the
// "be:translator_path" string array in model
~BTranslatorRoster();
// frees memory used by this object
virtual status_t Archive(BMessage *into, bool deep = true) const;
// store the BTranslatorRoster in into so it can later be
// used with Instantiate or the BMessage constructor
static BArchivable *Instantiate(BMessage *from);
// creates a BTranslatorRoster object from the from archive
static const char *Version(int32 *outCurVersion, int32 *outMinVersion,
int32 inAppVersion = B_TRANSLATION_CURRENT_VERSION);
// returns the version of BTranslator roster as a string
// and through the int32 pointers; inAppVersion appears
// to be ignored
static BTranslatorRoster *Default();
// returns the "default" set of translators, they are translators
// that are loaded from the default paths
// /boot/home/config/add-ons/Translators,
// /boot/home/config/add-ons/Datatypes,
// /system/add-ons/Translators or the paths in the
// TRANSLATORS environment variable, if it exists
status_t AddTranslators(const char *load_path = NULL);
// this adds a translator, all of the translators in a folder or
// the default translators if the path is NULL
status_t AddTranslator(BTranslator * translator);
// adds a translator that you've created yourself to the
// BTranslatorRoster; this is useful if you have translators
// that you don't want to make public or don't want loaded as
// an add-on
virtual status_t Identify(BPositionIO *inSource, BMessage *ioExtension,
translator_info *outInfo, uint32 inHintType = 0,
const char *inHintMIME = NULL, uint32 inWantType = 0);
// identifies the translator that can handle the data in inSource
virtual status_t GetTranslators(BPositionIO *inSource,
BMessage *ioExtension, translator_info **outInfo, int32 *outNumInfo,
uint32 inHintType = 0, const char *inHintMIME = NULL,
uint32 inWantType = 0);
// finds all translators for the given type
virtual status_t GetAllTranslators(translator_id **outList,
int32 *outCount);
// returns all translators that this object contains
virtual status_t GetTranslatorInfo(translator_id forTranslator,
const char **outName, const char **outInfo, int32 *outVersion);
// gets user visible info about a specific translator
virtual status_t GetInputFormats(translator_id forTranslator,
const translation_format **outFormats, int32 *outNumFormats);
// finds all input formats for a translator;
// note that translators don't always publish the formats
// that they support
virtual status_t GetOutputFormats(translator_id forTranslator,
const translation_format **outFormats, int32 *outNumFormats);
// finds all output formats for a translator;
// note that translators don't always publish the formats
// that they support
virtual status_t Translate(BPositionIO *inSource,
const translator_info *inInfo, BMessage *ioExtension,
BPositionIO *outDestination, uint32 inWantOutType,
uint32 inHintType = 0, const char *inHintMIME = NULL);
// the whole point of this entire kit boils down to this function;
// this translates the data in inSource into outDestination
// using the format inWantOutType
virtual status_t Translate(translator_id inTranslator,
BPositionIO *inSource, BMessage *ioExtension,
BPositionIO *outDestination, uint32 inWantOutType);
// the whole point of this entire kit boils down to this function;
// this translates the data in inSource into outDestination
// using the format inWantOutType and the translator inTranslator
virtual status_t MakeConfigurationView(translator_id forTranslator,
BMessage *ioExtension, BView **outView, BRect *outExtent);
// create the view for forTranslator that allows the user
// to configure it;
// NOTE: translators are not required to support this function
virtual status_t GetConfigurationMessage(translator_id forTranslator,
BMessage *ioExtension);
// this is used to save the settings for a translator so that
// they can be written to disk or used in an Indentify or
// Translate call
status_t GetRefFor(translator_id translator, entry_ref *out_ref);
// I'm guessing that this returns the entry_ref for the
// translator add-on file for the translator_id translator
private:
void Initialize();
// class initialization code used by all constructors
translator_node *FindTranslatorNode(translator_id id);
// used to find the translator_node for the translator_id id
// returns NULL if the id is not valid
status_t LoadTranslator(const char *path);
// loads the translator add-on specified by path
void LoadDir(const char *path, int32 &loadErr, int32 &nLoaded);
// loads all of the translator add-ons from path and
// returns error status in loadErr and the number of
// translators loaded in nLoaded
bool CheckFormats(const translation_format *inputFormats,
int32 inputFormatsCount, uint32 hintType, const char *hintMIME,
const translation_format **outFormat);
// determines how the Identify function is called
// adds the translator to the list of translators
// that this object maintains
status_t AddTranslatorToList(BTranslator *translator);
status_t AddTranslatorToList(BTranslator *translator,
const char *path, image_id image, bool acquire);
static BTranslatorRoster *fspDefaultTranslators;
// object that contains the default translators
// list of translators maintained by this object
translator_node *fpTranslators;
translator_node *fpLastTranslator;
sem_id fSem;
// semaphore used to lock this object
// used to maintain binary combatibility with
// past and future versions of this object
int32 fUnused[4];
virtual void ReservedTranslatorRoster1();
virtual void ReservedTranslatorRoster2();
virtual void ReservedTranslatorRoster3();
virtual void ReservedTranslatorRoster4();
virtual void ReservedTranslatorRoster5();
virtual void ReservedTranslatorRoster6();
};
#endif /* _TRANSLATOR_ROSTER_H */