315 lines
13 KiB
Plaintext
315 lines
13 KiB
Plaintext
// OBJECT.och oszt ly implement ci¢.
|
||
// Gener lva: 1999.10.10, 14:31:52, OBJCCC v2.2.03
|
||
// Meta oszt ly defin¡ci¢: Van
|
||
|
||
#ifndef CA_NIL_N
|
||
#define CA_NIL_N 2
|
||
#define CM_NIL_N 3
|
||
#endif // CA_NIL_N
|
||
|
||
|
||
#ifndef _CA_CM_ONLY_
|
||
#ifndef _OBJECT_OCH_
|
||
#define _OBJECT_OCH_
|
||
|
||
|
||
|
||
// Specifik lva: oinit()
|
||
// Specifik lva: getclass()
|
||
// Specifik lva: isclass()
|
||
// Specifik lva: getattrib(attribId)
|
||
// Specifik lva: setattrib(attribId,value)
|
||
|
||
#xtranslate OBJECT.<obj>:oinit => (OBJGEN.(<obj>):(4))
|
||
#xtranslate OBJECT.<obj>:getclass => (OBJGEN.(<obj>):(5))
|
||
#xtranslate OBJECT.<obj>:isclass => (OBJGEN.(<obj>):(6))
|
||
#xtranslate OBJECT.<obj>:getattrib => (OBJGEN.(<obj>):(7))
|
||
#xtranslate OBJECT.<obj>:setattrib => (OBJGEN.(<obj>):(8))
|
||
|
||
#endif // _OBJECT_OCH_
|
||
#endif // _CA_CM_ONLY_
|
||
|
||
#ifndef CA_OBJECT_N
|
||
#define CA_OBJECT_N 2
|
||
#define CM_OBJECT_N 8
|
||
#endif // CA_OBJECT_N
|
||
|
||
#ifndef _CA_CM_ONLY_
|
||
#ifndef _BEHAVIOR_OCH_
|
||
#define _BEHAVIOR_OCH_
|
||
|
||
**********************************************************************
|
||
#xtranslate C.OBJECT:<m> => (BEHAVIOR.clOBJECT():<m>)
|
||
#xtranslate C.OBJECT:self() => (clOBJECT())
|
||
|
||
|
||
|
||
|
||
#xtranslate BEHAVIOR.<obj>:oinit => (OBJGEN.(<obj>):(4))
|
||
#xtranslate BEHAVIOR.<obj>:getclass => (OBJGEN.(<obj>):(5))
|
||
#xtranslate BEHAVIOR.<obj>:isclass => (OBJGEN.(<obj>):(6))
|
||
#xtranslate BEHAVIOR.<obj>:getattrib => (OBJGEN.(<obj>):(7))
|
||
#xtranslate BEHAVIOR.<obj>:setattrib => (OBJGEN.(<obj>):(8))
|
||
|
||
|
||
#xtranslate BEHAVIOR.<obj>:parent => <obj>\[CA_OBJECT_N+1\]
|
||
#xtranslate BEHAVIOR.<obj>:name => <obj>\[CA_OBJECT_N+2\]
|
||
#xtranslate BEHAVIOR.<obj>:objsize => <obj>\[CA_OBJECT_N+3\]
|
||
#xtranslate BEHAVIOR.<obj>:attribs => <obj>\[CA_OBJECT_N+4\]
|
||
#xtranslate BEHAVIOR.<obj>:methods => <obj>\[CA_OBJECT_N+5\]
|
||
#xtranslate BEHAVIOR.<obj>:classid => <obj>\[CA_OBJECT_N+6\]
|
||
#xtranslate BEHAVIOR.<obj>:parentclassids => <obj>\[CA_OBJECT_N+7\]
|
||
#xtranslate BEHAVIOR.<obj>:amblock => <obj>\[CA_OBJECT_N+8\]
|
||
#xtranslate BEHAVIOR.<obj>:methodsblock => <obj>\[CA_OBJECT_N+9\]
|
||
|
||
// Specifik lva: onew()
|
||
// Specifik lva: ocreate()
|
||
// Specifik lva: rawoinit(parent,name,nAttribs,nMethods,amBlock,methodsBlock)
|
||
// ™r”k”lve: oinit(parent,name,nAttribs,nMethods,amBlock,methodsBlock)
|
||
// Specifik lva: oinitclass()
|
||
// Specifik lva: getmethodsimplement()
|
||
// ™r”k”lve: isclass()
|
||
// Specifik lva: attribidx(name)
|
||
// Specifik lva: needclassid()
|
||
// Specifik lva: isinheritfrom(parentClass)
|
||
|
||
#xtranslate BEHAVIOR.<obj>:onew => (OBJGEN.(<obj>):(CM_OBJECT_N+1))
|
||
#xtranslate BEHAVIOR.<obj>:ocreate => (OBJGEN.(<obj>):(CM_OBJECT_N+2))
|
||
#xtranslate BEHAVIOR.<obj>:rawoinit => (OBJGEN.(<obj>):(CM_OBJECT_N+3))
|
||
// ™r”k”lve: oinit(parent,name,nAttribs,nMethods,amBlock,methodsBlock)
|
||
#xtranslate BEHAVIOR.<obj>:oinitclass => (OBJGEN.(<obj>):(CM_OBJECT_N+4))
|
||
#xtranslate BEHAVIOR.<obj>:getmethodsimplement => (OBJGEN.(<obj>):(CM_OBJECT_N+5))
|
||
// ™r”k”lve: isclass()
|
||
#xtranslate BEHAVIOR.<obj>:attribidx => (OBJGEN.(<obj>):(CM_OBJECT_N+6))
|
||
#xtranslate BEHAVIOR.<obj>:needclassid => (OBJGEN.(<obj>):(CM_OBJECT_N+7))
|
||
#xtranslate BEHAVIOR.<obj>:isinheritfrom => (OBJGEN.(<obj>):(CM_OBJECT_N+8))
|
||
|
||
#endif // _BEHAVIOR_OCH_
|
||
#endif // _CA_CM_ONLY_
|
||
|
||
#ifndef CA_BEHAVIOR_N
|
||
#define CA_BEHAVIOR_N CA_OBJECT_N+10
|
||
#define CM_BEHAVIOR_N CM_OBJECT_N+8
|
||
#xtranslate BEHAVIOR.<obj>:objmethodsimplement => <obj>\[CA_OBJECT_N+10\]
|
||
#endif // CA_BEHAVIOR_N
|
||
|
||
|
||
**********************************************************************
|
||
#ifdef _OBJECT_PRG_
|
||
#ifndef _OBJECT_PRG_OCH_
|
||
#define _OBJECT_PRG_OCH_
|
||
|
||
|
||
**********************************************************************
|
||
#xtranslate othis:<m> => OBJECT.(othis):<m>
|
||
#xtranslate thisclass:<m> => BEHAVIOR.(this:getClass()):<m>
|
||
#define CTHIS OBJECT
|
||
|
||
|
||
**********************************************************************
|
||
#xtranslate this:<m> => OBJECT.(this):<m>
|
||
|
||
#xcommand implement oinit() => static function ob_oinit(this)
|
||
#xcommand implement getclass() => static function ob_getClass(this)
|
||
#xcommand implement isclass() => static function ob_isClass(this)
|
||
#xcommand implement getattrib(attribId) => ;
|
||
static function ob_getAttrib(this,attribId)
|
||
#xcommand implement setattrib(attribId,value) => ;
|
||
static function ob_setAttrib(this,attribId,value)
|
||
|
||
#ifdef _IMPLEMENT_EXPORT_
|
||
#xcommand implement export oinit() => function ob_oinit(this)
|
||
#xcommand implement export getclass() => function ob_getClass(this)
|
||
#xcommand implement export isclass() => function ob_isClass(this)
|
||
#xcommand implement export getattrib(attribId) => ;
|
||
function ob_getAttrib(this,attribId)
|
||
#xcommand implement export setattrib(attribId,value) => ;
|
||
function ob_setAttrib(this,attribId,value)
|
||
#endif // _IMPLEMENT_EXPORT_
|
||
|
||
|
||
**********************************************************************
|
||
static function setCMethods(pOsztaly)
|
||
// Egy t”mb”t felt”lt az oszt ly m–veleti blokkjaival.
|
||
pOsztaly[(4)]:={|this| ob_oinit(this)}
|
||
pOsztaly[(5)]:={|this| ob_getClass(this)}
|
||
pOsztaly[(6)]:={|this| ob_isClass(this)}
|
||
pOsztaly[(7)]:={|this,attribId| ob_getAttrib(this,attribId)}
|
||
pOsztaly[(8)]:={|this,attribId,value| ob_setAttrib(this,attribId,value)}
|
||
return pOsztaly
|
||
|
||
**********************************************************************
|
||
static function setCams(ta,tm)
|
||
// Egy t”mb”t felt”lt az oszt ly ltal def. objektumok attrib£tumaival ‚s m–veleteivel.
|
||
|
||
tm[(4)-CM_NIL_N] := {(4),'oinit','',nil}
|
||
tm[(5)-CM_NIL_N] := {(5),'getclass','',nil}
|
||
tm[(6)-CM_NIL_N] := {(6),'isclass','',nil}
|
||
tm[(7)-CM_NIL_N] := {(7),'getattrib','attribId',nil}
|
||
tm[(8)-CM_NIL_N] := {(8),'setattrib','attribId,value',nil}
|
||
return nil
|
||
|
||
#ifndef _NO_CLOBJECT_
|
||
#ifdef _STRICT_PARENT_
|
||
#ifdef _CA_CM_ONLY_
|
||
#include "meta.och"
|
||
#else // _CA_CM_ONLY_
|
||
#define _CA_CM_ONLY_
|
||
#include "meta.och"
|
||
#undef _CA_CM_ONLY_
|
||
#endif // _CA_CM_ONLY_
|
||
#else
|
||
#include "meta.och"
|
||
#endif // _STRICT_PARENT_
|
||
**********************************************************************
|
||
function clOBJECT()
|
||
// El“szedi az oszt lyt. (class)
|
||
static osztaly
|
||
if (osztaly==nil)
|
||
osztaly:=META.clBEHAVIOR():onew(;
|
||
nil,;
|
||
"OBJECT",;
|
||
CA_OBJECT_N,;
|
||
CM_OBJECT_N,;
|
||
{|ta,tm|setCams(ta,tm)},;
|
||
{|t|setCMethods(t)})
|
||
endif
|
||
return osztaly
|
||
#endif // _NO_CLOBJECT_
|
||
|
||
#ifndef _NO_BEHAVIOR_
|
||
|
||
**********************************************************************
|
||
#xtranslate class:<m> => BEHAVIOR.(class):<m>
|
||
|
||
#xcommand cimplement onew() => static function be_onew(class)
|
||
#xcommand cimplement ocreate() => static function be_ocreate(class)
|
||
#xcommand cimplement rawoinit(parent,name,nAttribs,nMethods,amBlock,methodsBlock) => ;
|
||
static function be_rawoinit(class,parent,name,nAttribs,nMethods,amBlock,methodsBlock)
|
||
#xcommand cimplement oinit(parent,name,nAttribs,nMethods,amBlock,methodsBlock) => ;
|
||
static function be_oinit(class,parent,name,nAttribs,nMethods,amBlock,methodsBlock)
|
||
#xcommand cimplement oinitclass() => static function retobj(class)
|
||
#xcommand cimplement getmethodsimplement() => ;
|
||
static function be_getMethodsImplement(class)
|
||
#xcommand cimplement isclass() => static function be_isClass(class)
|
||
#xcommand cimplement attribidx(name) => ;
|
||
static function be_attribIdx(class,name)
|
||
#xcommand cimplement needclassid() => static function be_needClassId(class)
|
||
#xcommand cimplement isinheritfrom(parentClass) => ;
|
||
static function be_isInheritFrom(class,parentClass)
|
||
|
||
#ifdef _IMPLEMENT_EXPORT_
|
||
#xcommand cimplement export onew() => function be_onew(class)
|
||
#xcommand cimplement export ocreate() => function be_ocreate(class)
|
||
#xcommand cimplement export rawoinit(parent,name,nAttribs,nMethods,amBlock,methodsBlock) => ;
|
||
function be_rawoinit(class,parent,name,nAttribs,nMethods,amBlock,methodsBlock)
|
||
#xcommand cimplement export oinit(parent,name,nAttribs,nMethods,amBlock,methodsBlock) => ;
|
||
function be_oinit(class,parent,name,nAttribs,nMethods,amBlock,methodsBlock)
|
||
#xcommand cimplement export oinitclass() => function retobj(class)
|
||
#xcommand cimplement export getmethodsimplement() => ;
|
||
function be_getMethodsImplement(class)
|
||
#xcommand cimplement export isclass() => function be_isClass(class)
|
||
#xcommand cimplement export attribidx(name) => ;
|
||
function be_attribIdx(class,name)
|
||
#xcommand cimplement export needclassid() => function be_needClassId(class)
|
||
#xcommand cimplement export isinheritfrom(parentClass) => ;
|
||
function be_isInheritFrom(class,parentClass)
|
||
#endif // _IMPLEMENT_EXPORT_
|
||
|
||
#xtranslate superclass:oinit => (OBJGENM.(eval(BEHAVIOR.clOBJECT():objmethodsimplement)).(class):(4))
|
||
#xtranslate superclass:getclass => (OBJGENM.(eval(BEHAVIOR.clOBJECT():objmethodsimplement)).(class):(5))
|
||
#xtranslate superclass:isclass => (OBJGENM.(eval(BEHAVIOR.clOBJECT():objmethodsimplement)).(class):(6))
|
||
#xtranslate superclass:getattrib => (OBJGENM.(eval(BEHAVIOR.clOBJECT():objmethodsimplement)).(class):(7))
|
||
#xtranslate superclass:setattrib => (OBJGENM.(eval(BEHAVIOR.clOBJECT():objmethodsimplement)).(class):(8))
|
||
|
||
**********************************************************************
|
||
static function setMCMethods(pOsztaly)
|
||
// Egy t”mb”t felt”lt a metaoszt ly m–veleti blokkjaival.
|
||
pOsztaly[(CM_OBJECT_N+1)]:={|class| be_onew(class)}
|
||
pOsztaly[(CM_OBJECT_N+2)]:={|class| be_ocreate(class)}
|
||
pOsztaly[(CM_OBJECT_N+3)]:={|class,parent,name,nAttribs,nMethods,amBlock,methodsBlock| be_rawoinit(class,parent,name,nAttribs,nMethods,amBlock,methodsBlock)}
|
||
pOsztaly[(4)]:={|class,parent,name,nAttribs,nMethods,amBlock,methodsBlock| be_oinit(class,parent,name,nAttribs,nMethods,amBlock,methodsBlock)}
|
||
pOsztaly[(CM_OBJECT_N+4)]:={|class| retobj(class)}
|
||
pOsztaly[(CM_OBJECT_N+5)]:={|class| be_getMethodsImplement(class)}
|
||
pOsztaly[(6)]:={|class| be_isClass(class)}
|
||
pOsztaly[(CM_OBJECT_N+6)]:={|class,name| be_attribIdx(class,name)}
|
||
pOsztaly[(CM_OBJECT_N+7)]:={|class| be_needClassId(class)}
|
||
pOsztaly[(CM_OBJECT_N+8)]:={|class,parentClass| be_isInheritFrom(class,parentClass)}
|
||
return pOsztaly
|
||
|
||
**********************************************************************
|
||
static function setMCams(ta,tm)
|
||
// Egy t”mb”t felt”lt a metaoszt ly ltal def. objektumok attrib£tumaival ‚s m–veleteivel.
|
||
ta[CA_OBJECT_N+1-CA_NIL_N] := {CA_OBJECT_N+1,'parent',nil}
|
||
ta[CA_OBJECT_N+2-CA_NIL_N] := {CA_OBJECT_N+2,'name',nil}
|
||
ta[CA_OBJECT_N+3-CA_NIL_N] := {CA_OBJECT_N+3,'objsize',nil}
|
||
ta[CA_OBJECT_N+4-CA_NIL_N] := {CA_OBJECT_N+4,'attribs',nil}
|
||
ta[CA_OBJECT_N+5-CA_NIL_N] := {CA_OBJECT_N+5,'methods',nil}
|
||
ta[CA_OBJECT_N+6-CA_NIL_N] := {CA_OBJECT_N+6,'classid',nil}
|
||
ta[CA_OBJECT_N+7-CA_NIL_N] := {CA_OBJECT_N+7,'parentclassids',nil}
|
||
ta[CA_OBJECT_N+8-CA_NIL_N] := {CA_OBJECT_N+8,'amblock',nil}
|
||
ta[CA_OBJECT_N+9-CA_NIL_N] := {CA_OBJECT_N+9,'methodsblock',nil}
|
||
ta[CA_OBJECT_N+10-CA_NIL_N] := {CA_OBJECT_N+10,'objmethodsimplement',nil}
|
||
|
||
tm[(CM_OBJECT_N+1)-CM_NIL_N] := {(CM_OBJECT_N+1),'onew','',nil}
|
||
tm[(CM_OBJECT_N+2)-CM_NIL_N] := {(CM_OBJECT_N+2),'ocreate','',nil}
|
||
tm[(CM_OBJECT_N+3)-CM_NIL_N] := {(CM_OBJECT_N+3),'rawoinit','parent,name,nAttribs,nMethods,amBlock,methodsBlock',nil}
|
||
tm[(4)-CM_NIL_N] := {(4),'oinit','parent,name,nAttribs,nMethods,amBlock,methodsBlock',nil}
|
||
tm[(CM_OBJECT_N+4)-CM_NIL_N] := {(CM_OBJECT_N+4),'oinitclass','',nil}
|
||
tm[(CM_OBJECT_N+5)-CM_NIL_N] := {(CM_OBJECT_N+5),'getmethodsimplement','',nil}
|
||
tm[(6)-CM_NIL_N] := {(6),'isclass','',nil}
|
||
tm[(CM_OBJECT_N+6)-CM_NIL_N] := {(CM_OBJECT_N+6),'attribidx','name',nil}
|
||
tm[(CM_OBJECT_N+7)-CM_NIL_N] := {(CM_OBJECT_N+7),'needclassid','',nil}
|
||
tm[(CM_OBJECT_N+8)-CM_NIL_N] := {(CM_OBJECT_N+8),'isinheritfrom','parentClass',nil}
|
||
return nil
|
||
|
||
**********************************************************************
|
||
#ifndef _NO_MCBEHAVIOR_
|
||
#ifdef _STRICT_PARENT_
|
||
#ifdef _CA_CM_ONLY_
|
||
#include "meta.och" // "metaclas.och"
|
||
#else // _CA_CM_ONLY_
|
||
#define _CA_CM_ONLY_
|
||
#include "meta.och" // "metaclas.och"
|
||
#undef _CA_CM_ONLY_
|
||
#endif // _CA_CM_ONLY_
|
||
#else
|
||
#include "meta.och" // "metaclas.och"
|
||
#endif // _STRICT_PARENT_
|
||
function mcBEHAVIOR()
|
||
// El“szedi az oszt ly metaoszt ly t. (metaclass)
|
||
static metaOsztaly
|
||
if (metaOsztaly==nil)
|
||
metaOsztaly:=META.clMETA():onew(;
|
||
clOBJECT(),;
|
||
"BEHAVIOR",;
|
||
CA_BEHAVIOR_N,;
|
||
CM_BEHAVIOR_N,;
|
||
{|ta,tm|setMCams(ta,tm)},;
|
||
{|t|setMCMethods(t)})
|
||
endif
|
||
return metaOsztaly
|
||
#endif // _NO_MCBEHAVIOR_
|
||
|
||
#endif // _NO_BEHAVIOR_
|
||
#ifdef _IMPLEMENT_ONEW_
|
||
**********************************************************************
|
||
cimplement onew()
|
||
local o:=class:ocreate()
|
||
|
||
OBJECT.o:oinit()
|
||
return o
|
||
#endif // _IMPLEMENT_ONEW_
|
||
|
||
**********************************************************************
|
||
#ifdef _IMPLEMENT_OINIT_
|
||
implement oinit()
|
||
super:oinit()
|
||
return this
|
||
#endif // _IMPLEMENT_OINIT_
|
||
|
||
**********************************************************************
|
||
**********************************************************************
|
||
#endif // _OBJECT_PRG_OCH_
|
||
#endif // _OBJECT_PRG_
|