Files
harbour-core/harbour/samples/cccppc/package.prg
1999-11-09 01:37:27 +00:00

127 lines
2.9 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* $Id$
*/
#include "objgen.ch"
#define _PACKAGE_PRG_
#define _IMPLEMENT_ONEW_
#include "package.och"
*********************************************************************
implement oinit(parent,name,nAttribs,nMethods,amBlock,methodsBlock,pkgId)
local t
this:parentPkg :=parent
this:name :=name
this:nAttribs :=nAttribs
this:amBlock :=amBlock
this:methodsBlock :=methodsBlock
this:pkgId :=pkgId
t:=array(nMethods)
t[1]:=this
this:pkgMethodsImplement:={||t}
this:attribs:=array(nAttribs)
this:methods:=array(nMethods)
evalMethodsBlocks(this)
evalAmBlocks(this)
return this
*********************************************************************
implement connectTo(obj)
// Ez lnyegben a ocreate()
local t
// Itt meg kellene nzni, erre az objektumra van-e m r
// install lva valamilyen csomag ebb“l a f b¢l.
// Ha van, akkor ha az install land¢ “se az install ltnak ==>
// nem kell semmit sem csin lni, ha nem le kell cserlni.
// Esetleg, ha egyik sem “se a m siknak, akkor hibajelzst
// lehetne adni.
// Ez az implement ci¢ nem j¢l mk”dik, ha egyik sem “se a
// m siknak, de van k”z”s “s<E2809C>k.
t:=obj[2] // Itt vannak az attrib£tumok.
if (t==nil)
obj[2]:=t:=array(this:pkgId)
elseif (len(t)<this:pkgId)
asize(t,this:pkgId)
endif
t[this:pkgId]:=array(this:nAttribs)
#ifdef OLD
// Ez majd ks“bb.
if (t[this:pkgId]==nil)
t[this:pkgId]:=array(this:nAttribs)
elseif (len(t[this:pkgId])<this:nAttribs)
asize(t[this:pkgId],this:nAttribs)
endif
#endif
t:=obj[1][2] // Itt vannak a mveletek.
if (t==nil)
obj[2]:=t:=array(this:pkgId)
elseif (len(t)<this:pkgId)
asize(t,this:pkgId)
endif
t[this:pkgId]:=eval(PACKAGE.this:pkgMethodsImplement)
return this
*********************************************************************
cimplement nextId()
if (class:numId==nil)
class:numId:=0
endif
class:numId++
return class:numId
**********************************************************************
static function evalAmBlocks(aClass)
local m,c,i
// local t
m:={}
c:=aClass
while(c!=nil)
if (nil!=PACKAGE.c:amBlock)
aadd(m,PACKAGE.c:amBlock)
endif
c:=PACKAGE.c:parentPkg
end while
for i:=len(m) to 1 step -1
eval(m[i],PACKAGE.aClass:attribs,PACKAGE.aClass:methods)
end for
return aClass
**********************************************************************
static function evalMethodsBlocks(aClass)
local t,m,c,i
t:=eval(PACKAGE.aClass:pkgMethodsImplement)
m:={}
c:=aClass
while(c!=nil)
if (nil!=PACKAGE.c:methodsBlock)
aadd(m,PACKAGE.c:methodsBlock)
endif
c:=PACKAGE.c:parentPkg
end while
for i:=len(m) to 1 step -1
eval(m[i],t)
end for
return aClass
*********************************************************************