add the beginnings of a library for mods and a mod using the new features

of qfcc. doesn't do much yet.
This commit is contained in:
Bill Currie 2002-08-14 15:40:30 +00:00
parent 520a3c0a90
commit bbaaaae81c
26 changed files with 935 additions and 0 deletions

5
ruamoko/game/.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
*.d
*.dat
*.qfo
*.sym
.vimrc

31
ruamoko/game/Makefile Normal file
View file

@ -0,0 +1,31 @@
QFCC=qfcc
QCFLAGS=-qq -g -Werror
QCPPFLAGS=-I../include
game_source = \
axe.r \
gameent.r \
message.r \
sound.r \
tempent.r \
trace.r \
vector.r \
world.r
game_obj = $(addsuffix .qfo,$(basename $(game_source)))
game_dep = $(addsuffix .d,$(basename $(game_source)))
%.qfo: %.r
@$(QFCC) -M $(QCPPFLAGS) -c $< | sed -e 's/\.r\.o\>/.qfo/' > `basename $@ .qfo`.d
$(QFCC) $(QCFLAGS) $(QCPPFLAGS) -c -o $@ $<
%.qfo: %.qc
$(QFCC) $(QCFLAGS) $(QCPPFLAGS) -c -o $@ $<
game.dat: $(game_obj) ../lib/libr.pak
$(QFCC) -qq -g -o $@ $(game_obj) -l../lib/libr.pak
clean:
rm -f *.qfo *.dat *.sym *.d
-include $(game_dep)

15
ruamoko/game/axe.h Normal file
View file

@ -0,0 +1,15 @@
#ifndef __axe_h
#define __axe_h
#include "entity.h"
#include "weapon.h"
@interface Axe : Object <Weapon>
{
Entity owner;
float damage;
}
-init;
@end
#endif//__axe_h

54
ruamoko/game/axe.r Normal file
View file

@ -0,0 +1,54 @@
#include "axe.h"
#include "gameent.h"
#include "message.h"
#include "sound.h"
#include "tempent.h"
#include "trace.h"
#include "vector.h"
#include "world.h"
@implementation Axe
-init
{
[super init];
damage = (deathmatch > 3) ? 75.0 : 20.0;
return self;
}
-setOwner:(Entity)o
{
owner = o;
return self;
}
-fire
{
local entity s = [owner ent];
local vector org, source;
makevectors (s.v_angle);
source = s.origin + '0 0 16';
traceline (source, source + v_forward * 64, NO, s);
if (trace_fraction == 1.0)
return self;
org = trace_endpos - v_forward * 4;
if ([trace_ent.@this takeDamage:self inflictor:s attacker:s :damage])
SpawnBlood (org, 20);
else {
sound (s, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_GUNSHOT);
WriteByte (MSG_MULTICAST, 3);
WriteCoord (MSG_MULTICAST, org_x);
WriteCoord (MSG_MULTICAST, org_y);
WriteCoord (MSG_MULTICAST, org_z);
multicast (org, MULTICAST_PVS);
}
return self;
}
@end

23
ruamoko/game/gameent.h Normal file
View file

@ -0,0 +1,23 @@
#ifndef __gameent_h
#define __gameent_h
#include "entity.h"
@extern .vector angles;
@extern .float modelindex;
@extern .float movetype;
@extern .string model;
@extern .float frame;
@extern .float colormap;
@extern .vector mins;
@extern .vector maxs;
@extern .vector velocity;
@extern .vector origin;
@extern .float flags;
@extern .vector v_angle;
@interface GameEntity : Entity
-(BOOL)takeDamage:weapon :inflictor :attacker :(float)damage;
@end
#endif//__gameent_h

21
ruamoko/game/gameent.r Normal file
View file

@ -0,0 +1,21 @@
#include "gameent.h"
.vector angles;
.float modelindex;
.float movetype;
.string model;
.float frame;
.float colormap;
.vector mins;
.vector maxs;
.vector velocity;
.vector origin;
.float flags;
.vector v_angle;
@implementation GameEntity
-(BOOL)takeDamage:weapon :inflictor :attacker :damage
{
return NO;
}
@end

51
ruamoko/game/message.h Normal file
View file

@ -0,0 +1,51 @@
#ifndef __message_h
#define __message_h
// protocol bytes
#define SVC_TEMPENTITY 23
#define SVC_KILLEDMONSTER 27
#define SVC_FOUNDSECRET 28
#define SVC_INTERMISSION 30
#define SVC_FINALE 31
#define SVC_CDTRACK 32
#define SVC_SELLSCREEN 33
#define SVC_SMALLKICK 34
#define SVC_BIGKICK 35
#define SVC_MUZZLEFLASH 39
// messages
#define MSG_BROADCAST 0
#define MSG_ONE 1
#define MSG_ALL 2
#define MSG_INIT 3
#define MSG_MULTICAST 4
// message levels
#define PRINT_LOW 0
#define PRINT_MEDIUM 1
#define PRINT_HIGH 2
#define PRINT_CHAT 3
// multicast sets
#define MULTICAST_ALL 0
#define MULTICAST_PHS 1
#define MULTICAST_PVS 2
#define MULTICAST_ALL_R 3
#define MULTICAST_PHS_R 4
#define MULTICAST_PVS_R 5
//
// direct client message generation
//
@extern void(float to, float f) WriteByte;
@extern void(float to, float f) WriteChar;
@extern void(float to, float f) WriteShort;
@extern void(float to, float f) WriteLong;
@extern void(float to, float f) WriteCoord;
@extern void(float to, float f) WriteAngle;
@extern void(float to, string s) WriteString;
@extern void(float to, entity s) WriteEntity;
@extern void(vector where, float set) multicast;
#endif//__message_h

12
ruamoko/game/message.r Normal file
View file

@ -0,0 +1,12 @@
#include "message.h"
void(float to, float f) WriteByte = #52;
void(float to, float f) WriteChar = #53;
void(float to, float f) WriteShort = #54;
void(float to, float f) WriteLong = #55;
void(float to, float f) WriteCoord = #56;
void(float to, float f) WriteAngle = #57;
void(float to, string s) WriteString = #58;
void(float to, entity s) WriteEntity = #59;
// sends the temp message to a set of clients, possibly in PVS or PHS
void(vector where, float set) multicast = #82;

18
ruamoko/game/sound.h Normal file
View file

@ -0,0 +1,18 @@
#ifndef __sound_h
#define __sound_h
#define CHAN_AUTO 0
#define CHAN_WEAPON 1
#define CHAN_VOICE 2
#define CHAN_ITEM 3
#define CHAN_BODY 4
#define CHAN_NO_PHS_ADD 8
#define ATTN_NONE 0
#define ATTN_NORM 1
#define ATTN_IDLE 2
#define ATTN_STATIC 3
@extern void(entity e, float chan, string samp, float vol, float atten) sound;
#endif

3
ruamoko/game/sound.r Normal file
View file

@ -0,0 +1,3 @@
#include "sound.h"
void(entity e, float chan, string samp, float vol, float atten) sound = #0;

21
ruamoko/game/tempent.h Normal file
View file

@ -0,0 +1,21 @@
#ifndef __tempent_h
#define __tempent_h
#define TE_SPIKE 0
#define TE_SUPERSPIKE 1
#define TE_GUNSHOT 2
#define TE_EXPLOSION 3
#define TE_TAREXPLOSION 4
#define TE_LIGHTNING1 5
#define TE_LIGHTNING2 6
#define TE_WIZSPIKE 7
#define TE_KNIGHTSPIKE 8
#define TE_LIGHTNING3 9
#define TE_LAVASPLASH 10
#define TE_TELEPORT 11
#define TE_BLOOD 12
#define TE_LIGHTNINGBLOOD 13
@extern void(vector org, float damage) SpawnBlood;
#endif//__tempent_h

13
ruamoko/game/tempent.r Normal file
View file

@ -0,0 +1,13 @@
#include "message.h"
#include "tempent.h"
void(vector org, float damage) SpawnBlood =
{
WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
WriteByte (MSG_MULTICAST, TE_BLOOD);
WriteByte (MSG_MULTICAST, 1);
WriteCoord (MSG_MULTICAST, org_x);
WriteCoord (MSG_MULTICAST, org_y);
WriteCoord (MSG_MULTICAST, org_z);
multicast (org, MULTICAST_PVS);
};

17
ruamoko/game/trace.h Normal file
View file

@ -0,0 +1,17 @@
#ifndef __trace_h
#define __trace_h
// set by traceline / tracebox
@extern float trace_allsolid;
@extern float trace_startsolid;
@extern float trace_fraction;
@extern vector trace_endpos;
@extern vector trace_plane_normal;
@extern float trace_plane_dist;
@extern entity trace_ent;
@extern float trace_inopen;
@extern float trace_inwater;
@extern void(vector v1, vector v2, float nomonsters, entity forent) traceline;
#endif//__trace_h

14
ruamoko/game/trace.r Normal file
View file

@ -0,0 +1,14 @@
#include "trace.h"
// set by traceline / tracebox
float trace_allsolid;
float trace_startsolid;
float trace_fraction;
vector trace_endpos;
vector trace_plane_normal;
float trace_plane_dist;
entity trace_ent;
float trace_inopen;
float trace_inwater;
void(vector v1, vector v2, float nomonsters, entity forent) traceline = #0;

7
ruamoko/game/vector.h Normal file
View file

@ -0,0 +1,7 @@
#ifndef __vector_h
#define __vector_h
@extern vector v_forward, v_up, v_right; // set by makevectors()
@extern void(vector ang) makevectors;
#endif//__vector_h

5
ruamoko/game/vector.r Normal file
View file

@ -0,0 +1,5 @@
#include "vector.h"
vector v_forward, v_up, v_right; // set by makevectors()
void(vector ang) makevectors = #0;

11
ruamoko/game/weapon.h Normal file
View file

@ -0,0 +1,11 @@
#ifndef __weapon_h
#define __weapon_h
#include "entity.h"
@protocol Weapon
-setOwner:(Entity)o;
-fire;
@end
#endif//__weapon_h

6
ruamoko/game/world.h Normal file
View file

@ -0,0 +1,6 @@
#ifndef __world_h
#define __world_h
@extern integer deathmatch;
#endif//__world_h

74
ruamoko/game/world.r Normal file
View file

@ -0,0 +1,74 @@
#include "gameent.h"
#include "world.h"
id world;
integer deathmatch;
void(entity e, vector min, vector max) setsize = #0;
void(entity e, vector o) setorigin = #0;
#define MAX_BODIES 8
@interface BodyQue : Object
{
entity [MAX_BODIES] bodies;
integer head;
}
-init;
-add:(GameEntity)ent;
@end
@implementation BodyQue
-init
{
local integer i;
[super init];
self.head = 0;
for (i = 0; i < MAX_BODIES; i++)
self.bodies[i] = [GameEntity new];
}
-add:(GameEntity)ent
{
local entity be = bodies[head++];
local entity e = [ent ent];
be.angles = e.angles;
be.model = e.model;
be.modelindex = e.modelindex;
be.frame = e.frame;
be.colormap = e.colormap;
be.movetype = e.movetype;
be.velocity = e.velocity;
be.flags = 0;
setorigin (be, e.origin);
setsize (be, e.mins, e.maxs);
return self;
}
@end
@interface World : GameEntity
{
BodyQue bodyque;
}
-spawn:(entity)ent;
-copyToBodyQue:(GameEntity)ent;
@end
@implementation World
-spawn:(entity)ent
{
[self initWithEntity:ent];
id (bodyque) = [[BodyQue alloc] init];
}
-copyToBodyQue:(GameEntity)ent
{
[bodyque add:ent];
}
@end
void () worldspawn =
{
world = [[World alloc] initWithEntity:@self];
};

5
ruamoko/include/.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
*.d
*.dat
*.qfo
*.sym
.vimrc

19
ruamoko/include/entity.h Normal file
View file

@ -0,0 +1,19 @@
#ifndef __rua_entity_h
#define __rua_entity_h
#include "object.h"
@interface Entity : Object
{
entity ent;
}
-init;
-initWithEntity:(entity)e;
-free;
-(entity)new;
-(entity)ent;
@end
#endif//__rua_entity_h

137
ruamoko/include/object.h Normal file
View file

@ -0,0 +1,137 @@
#ifndef __rua_object_h
#define __rua_object_h
typedef enum {
NO,
YES,
} BOOL;
@extern void (id object, integer code, string fmt, ...) obj_error;
@extern void (id object, integer code, string fmt, ...) obj_verror;//FIXME not ...
//obj_error_handler (objc_error_handler func) obj_set_error_handler = #0;
@extern IMP (id receiver, SEL op) obj_msg_lookup;
@extern IMP (id receiver, SEL op) obj_msg_lookup_super;
//retval_t (id receiver, SEL op, arglist_t) obj_msg_sendv;
@extern (void []) (integer size) obj_malloc;
@extern (void []) (integer size) obj_atomic_malloc;
@extern (void []) (integer size) obj_valloc;
@extern (void []) (void [] mem, integer size) obj_realloc;
@extern (void []) (integer nelem, integer size) obj_calloc;
@extern void (void [] mem) obj_free;
//(void []) (void) obj_get_uninstalled_dtable = #0;
@extern Class (string name) obj_get_class;
@extern Class (string name) obj_lookup_class;
//Class (void [][] enum_stage) obj_next_class = #0;
@extern string (SEL selector) sel_get_name;
@extern string (SEL selector) sel_get_type;
@extern SEL (string name) sel_get_uid;
@extern SEL (string name) sel_get_any_uid;
@extern SEL (string name) sel_get_any_typed_uid;
@extern SEL (string name, string type) sel_get_typed_uid;
@extern SEL (string name) sel_register_name;
@extern SEL (string name, string type) sel_register_typed_name;
@extern BOOL (SEL aSel) sel_is_mapped;
@extern Method (Class class, SEL aSel) class_get_class_method;
@extern Method (Class class, SEL aSel) class_get_instance_method;
@extern Class (Class imposter, Class superclass) class_pose_as;
@extern id (Class class) class_create_instance;
@extern string (Class class) class_get_class_name;
@extern integer (Class class) class_get_instance_size;
@extern Class (Class class) class_get_meta_class;
@extern Class (Class class) class_get_super_class;
@extern integer (Class class) class_get_version;
@extern BOOL (Class class) class_is_class;
@extern BOOL (Class class) class_is_meta_class;
@extern void (Class class, integer version) class_set_version;
@extern (void []) (Class class) class_get_gc_object_type;
@extern void (Class class, string ivarname, BOOL gcInvisible) class_ivar_set_gcinvisible;
@extern IMP (Method method) method_get_imp;
@extern IMP (Class class, SEL sel) get_imp;
@extern id (id object) object_copy;
@extern id (id object) object_dispose;
@extern Class (id object) object_get_class;
@extern string (id object) object_get_class_name;
@extern Class (id object) object_get_meta_class;
@extern Class (id object) object_get_super_class;
@extern BOOL (id object) object_is_class;
@extern BOOL (id object) object_is_instance;
@extern BOOL (id object) object_is_meta_class;
@interface Object
{
Class isa;
}
+initialize;
-init;
+new;
+alloc;
-free;
-copy;
-shallowCopy;
-deepen;
-deepCopy;
-(Class)class;
-(Class)superClass;
-(Class)metaClass;
-(string)name;
-self;
-(integer)hash;
-(BOOL)isEqual:anObject;
-(integer)compare:anotherObject;
-(BOOL)isMetaClass;
-(BOOL)isClass;
-(BOOL)isInstance;
-(BOOL)isKindOf:(Class)aClassObject;
-(BOOL)isMemberOf:(Class)aClassObject;
-(BOOL)isKindOfClassNamed:(string)aClassName;
-(BOOL)isMemberOfClassNamed:(string)aClassName;
+(BOOL)instancesRespondTo:(SEL)aSel;
-(BOOL)respondsTo:(SEL)aSel;
+(BOOL)conformsTo:(Protocol)aProtocol;
-(BOOL)conformsTo:(Protocol)aProtocol;
+(IMP)instanceMethodFor:(SEL)aSel;
-(IMP)methodFor:(SEL)aSel;
//+(struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel;
//-(struct objc_method_description *)descriptionForMethod:(SEL)aSel;
-perform:(SEL)aSel;
-perform:(SEL)aSel with:anObject;
-perform:(SEL)aSel with:anObject1 with:anObject2;
//-(retval_t)forward:(SEL)aSel :(arglist_t)argFrame;
//-(retval_t)performv:(SEL)aSel :(arglist_t)argFrame;
+poseAs:(Class)aClassObject;
-(Class)transmuteClassTo:(Class)aClassObject;
-subclassResponsibility:(SEL)aSel;
-notImplemented:(SEL)aSel;
-shouldNotImplement:(SEL)aSel;
-doesNotRecognize:(SEL)aSel;
-error:(string)aString, ...;
//+(integer)version;
//+setVersion:(integer)aVersion;
//+(integer)streamVersion: (TypedStream*)aStream;
//-read: (TypedStream*)aStream;
//-write: (TypedStream*)aStream;
//-awake;
@end
#endif//__rua_object_h

6
ruamoko/lib/.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
*.d
*.dat
*.pak
*.qfo
*.sym
.vimrc

24
ruamoko/lib/Makefile Normal file
View file

@ -0,0 +1,24 @@
QFCC=qfcc
QCFLAGS=-qq -g -Werror
QCPPFLAGS=-I../include
libr_source = \
entity.r \
object.r
libr_obj = $(addsuffix .qfo,$(basename $(libr_source)))
libr_dep = $(addsuffix .d,$(basename $(libr_source)))
%.qfo: %.r
$(QFCC) $(QCFLAGS) $(QCPPFLAGS) -c -o $@ $<
%.qfo: %.qc
$(QFCC) $(QCFLAGS) $(QCPPFLAGS) -c -o $@ $<
libr.pak: $(libr_obj)
pak -cf $@ $^
clean:
rm -f *.qfo *.pak *.d
-include $(libr_dep)

34
ruamoko/lib/entity.r Normal file
View file

@ -0,0 +1,34 @@
#include "entity.h"
entity () spawn = #0;
void (entity e) remove = #0;
@implementation Entity
-init
{
return [self initWithEntity:[self new]];
}
-initWithEntity:(entity)e
{
self.ent = e;
e.@this = self;
return self;
}
-free
{
remove (self.ent);
return self;
}
-new
{
return spawn ();
}
-ent
{
return self.ent;
}
@end

309
ruamoko/lib/object.r Normal file
View file

@ -0,0 +1,309 @@
#include "object.h"
void (obj_module_t [] msg) __obj_exec_class = #0;
void (id object, integer code, string fmt, ...) obj_error = #0;
void (id object, integer code, string fmt, ...) obj_verror = #0;//FIXME not ...
//obj_error_handler (objc_error_handler func) obj_set_error_handler = #0;
IMP (id receiver, SEL op) obj_msg_lookup = #0;
IMP (id receiver, SEL op) obj_msg_lookup_super = #0;
id (id receiver, SEL op, ...) obj_msgSend = #0;
id (id receiver, SEL op, ...) obj_msgSend_super = #0;
//retval_t (id receiver, SEL op, arglist_t) obj_msg_sendv = #0;
(void []) (integer size) obj_malloc = #0;
(void []) (integer size) obj_atomic_malloc = #0;
(void []) (integer size) obj_valloc = #0;
(void []) (void [] mem, integer size) obj_realloc = #0;
(void []) (integer nelem, integer size) obj_calloc = #0;
void (void [] mem) obj_free = #0;
//(void []) (void) obj_get_uninstalled_dtable = #0;
Class (string name) obj_get_class = #0;
Class (string name) obj_lookup_class = #0;
//Class (void [][] enum_stage) obj_next_class = #0;
string (SEL selector) sel_get_name = #0;
string (SEL selector) sel_get_type = #0;
SEL (string name) sel_get_uid = #0;
SEL (string name) sel_get_any_uid = #0;
SEL (string name) sel_get_any_typed_uid = #0;
SEL (string name, string type) sel_get_typed_uid = #0;
SEL (string name) sel_register_name = #0;
SEL (string name, string type) sel_register_typed_name = #0;
BOOL (SEL aSel) sel_is_mapped = #0;
Method (Class class, SEL aSel) class_get_class_method = #0;
Method (Class class, SEL aSel) class_get_instance_method = #0;
Class (Class imposter, Class superclass) class_pose_as = #0;
id (Class class) class_create_instance = #0;
string (Class class) class_get_class_name = #0;
integer (Class class) class_get_instance_size = #0;
Class (Class class) class_get_meta_class = #0;
Class (Class class) class_get_super_class = #0;
integer (Class class) class_get_version = #0;
BOOL (Class class) class_is_class = #0;
BOOL (Class class) class_is_meta_class = #0;
void (Class class, integer version) class_set_version = #0;
(void []) (Class class) class_get_gc_object_type = #0;
void (Class class, string ivarname, BOOL gcInvisible) class_ivar_set_gcinvisible = #0;
IMP (Method method) method_get_imp = #0;
IMP (Class class, SEL sel) get_imp = #0;
id (id object) object_copy = #0;
id (id object) object_dispose = #0;
Class (id object) object_get_class = #0;
string (id object) object_get_class_name = #0;
Class (id object) object_get_meta_class = #0;
Class (id object) object_get_super_class = #0;
BOOL (id object) object_is_class = #0;
BOOL (id object) object_is_instance = #0;
BOOL (id object) object_is_meta_class = #0;
@implementation Object
+initialize
{
return self;
}
-init
{
return self;
}
+new
{
return [[self alloc] init];
}
+alloc
{
return class_create_instance (self);
}
-free
{
return object_dispose (self);
}
-copy
{
return [[self shallowCopy] deepen];
}
-shallowCopy
{
return object_copy (self);
}
-deepen
{
return self;
}
-deepCopy
{
return [self copy];
}
-(Class)class
{
return object_get_class (self);
}
-(Class)superClass
{
return object_get_super_class (self);
}
-(Class)metaClass
{
return object_get_meta_class (self);
}
-(string)name
{
return object_get_class_name (self);
}
-self
{
return self;
}
-(integer)hash = #0; // can't cast pointer to integer
-(BOOL)isEqual:anObject
{
return self == anObject;
}
-(integer)compare:anotherObject = #0; // can only == or != pointers
-(BOOL)isMetaClass
{
return NO;
}
-(BOOL)isClass
{
return object_is_class (self);
}
-(BOOL)isInstance
{
return object_is_instance (self);
}
-(BOOL)isKindOf:(Class)aClassObject
{
local Class class;
for (class = self.isa; class; class = class_get_super_class (class))
if (class == aClassObject)
return YES;
return NO;
}
-(BOOL)isMemberOf:(Class)aClassObject
{
return self.isa == aClassObject;
}
-(BOOL)isKindOfClassNamed:(string)aClassName
{
local Class class;
if (aClassName)
for (class = self.isa; class; class = class_get_super_class (class))
if (class_get_class_name (class) == aClassName)
return YES;
return NO;
}
-(BOOL)isMemberOfClassNamed:(string)aClassName
{
local Class class;
if (aClassName)
for (class = self.isa; class; class = class_get_super_class (class))
if (class_get_class_name (class) == aClassName)
return YES;
return aClassName && class_get_class_name (self.isa) == aClassName;
}
+(BOOL)instancesRespondTo:(SEL)aSel
{
return class_get_instance_method (self, aSel) != NIL;
}
-(BOOL)respondsTo:(SEL)aSel
{
return (object_is_instance (self)
? class_get_instance_method (self.isa, aSel)
: class_get_class_method (self.isa, aSel)) != NIL;
}
+(BOOL)conformsTo:(Protocol)aProtocol = #0;
-(BOOL)conformsTo:(Protocol)aProtocol
{
return [[self class] conformsTo:aProtocol];
}
+(IMP)instanceMethodFor:(SEL)aSel
{
return method_get_imp (class_get_instance_method (self, aSel));
}
-(IMP)methodFor:(SEL)aSel
{
return method_get_imp (object_is_instance (self)
? class_get_instance_method (self.isa, aSel)
: class_get_class_method (self.isa, aSel));
}
//+(struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSel = #0;
//-(struct objc_method_description *)descriptionForMethod:(SEL)aSel = #0;
-perform:(SEL)aSel
{
local IMP msg = obj_msg_lookup (self, aSel);
if (!msg)
return [self error:"invalid selector passed to %s",
sel_get_name (_cmd)];
return msg (self, aSel);
}
-perform:(SEL)aSel with:anObject
{
local IMP msg = obj_msg_lookup (self, aSel);
if (!msg)
return [self error:"invalid selector passed to %s",
sel_get_name (_cmd)];
return msg (self, aSel, anObject);
}
-perform:(SEL)aSel with:anObject1 with:anObject2
{
local IMP msg = obj_msg_lookup (self, aSel);
if (!msg)
return [self error:"invalid selector passed to %s",
sel_get_name (_cmd)];
return msg (self, aSel, anObject1, anObject2);
}
//-(retval_t)forward:(SEL)aSel :(arglist_t)argFrame = #0;
//-(retval_t)performv:(SEL)aSel :(arglist_t)argFrame = #0;
+poseAs:(Class)aClassObject
{
return class_pose_as (self, aClassObject);
}
-(Class)transmuteClassTo:(Class)aClassObject
{
if (object_is_instance (self))
if (class_is_class (aClassObject))
if (class_get_instance_size (aClassObject) == class_get_instance_size (isa))
if ([self isKindOf:aClassObject]) {
local Class old_isa = isa;
isa = aClassObject;
return old_isa;
}
return NIL;
}
-subclassResponsibility:(SEL)aSel
{
return [self error:"subclass should override %s",
sel_get_name(aSel)];
}
-notImplemented:(SEL)aSel
{
return [self error:"methos %s not implemented",
sel_get_name(aSel)];
}
-shouldNotImplement:(SEL)aSel
{
return [self error:"%s should not implement %s",
object_get_class_name (self), sel_get_name(aSel)];
}
-doesNotRecognize:(SEL)aSel
{
return [self error:"%s does not recognize %s",
object_get_class_name (self), sel_get_name(aSel)];
}
-error:(string)aString, ... = #0;
//+(integer)version = #0;
//+setVersion:(integer)aVersion = #0;
//+(integer)streamVersion: (TypedStream*)aStream = #0;
//-read: (TypedStream*)aStream = #0;
//-write: (TypedStream*)aStream = #0;
//-awake = #0;
@end