langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

@ -0,0 +1,4 @@
class camera =
object (self)
(*functions go here...*)
end

View file

@ -0,0 +1,4 @@
class mobile_phone =
object (self)
(*functions go here...*)
end

View file

@ -0,0 +1,6 @@
class camera_phone =
object (self)
inherit camera
inherit mobile_phone
(*functions go here...*)
end

View file

@ -0,0 +1,53 @@
@interface Camera : NSObject {
}
@end
@implementation Camera
@end
@interface MobilePhone : NSObject {
}
@end
@implementation MobilePhone
@end
@interface CameraPhone : NSObject {
Camera *camera;
MobilePhone *phone;
}
@end
@implementation CameraPhone
-(id)init {
if ((self = [super init])) {
camera = [[Camera alloc] init];
phone = [[MobilePhone alloc] init];
}
return self;
}
-(void)dealloc {
[camera release];
[phone release];
[super dealloc];
}
-(void)forwardInvocation:(NSInvocation *)anInvocation {
SEL aSelector = [anInvocation selector];
if ([camera respondsToSelector:aSelector])
[anInvocation invokeWithTarget:camera];
else if ([phone respondsToSelector:aSelector])
[anInvocation invokeWithTarget:phone];
else
[self doesNotRecognizeSelector:aSelector];
}
-(BOOL)respondsToSelector:(SEL)aSelector {
return [camera respondsToSelector:aSelector]
|| [phone respondsToSelector:aSelector]
|| [super respondsToSelector:aSelector];
}
@end

View file

@ -0,0 +1,24 @@
class Camera
string cbuf
method TakePhoto()
end method
method ViewPhoto()
end method
end class
class MobilePhone
string pbuf
method MakeCall()
end method
method TakeCall()
end method
end class
class CameraPhone
has Camera,MobilePhone
end class
CameraPhone cp
cp.ViewPhoto
cp.MakeCall

View file

@ -0,0 +1,5 @@
class Camera end
class MobilePhone end
class CameraPhone from Camera MobilePhone end

View file

@ -0,0 +1,6 @@
class Camera {}
class MobilePhone {}
class CameraPhone is Camera is MobilePhone {}
say CameraPhone.^mro; # undefined type object
say CameraPhone.new.^mro; # instantiated object

View file

@ -0,0 +1,16 @@
;;; load object support
lib objectclass;
define :class Camera;
;;; slots go here
enddefine;
define :class MobilePhone;
;;; slots go here
enddefine;
define :class CameraPhone is Camera, MobilePhone;
;;; extra slots go here
enddefine;
;;; methods go here

View file

@ -0,0 +1,8 @@
Class Camera
EndClass
Class Mobil
EndClass
Class CameraMobile Extends Camera Extends Mobil
EndClass

View file

@ -0,0 +1,3 @@
define: #Camera.
define: #MobilePhone.
define: #CameraPhone &parents: {Camera. MobilePhone}.