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

89 lines
2.1 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$
*/
//*******************************************************************
// incl.prg: Az INCL oszt ly implement ci¢ja.
// 1999, Csisz r Levente
//*******************************************************************
#include "debug.ch"
//*******************************************************************
#include "objgen.ch"
#include "lreader.och"
#include "freader.och"
#define _INCL_PRG_
#define _IMPLEMENT_ONEW_
#include "incl.och"
//*******************************************************************
implement oinit(lreader,includeList,maxInclDeep)
super:oinit()
this:lreader:=lreader
this:includeList:=includeList
this:maxInclDeep:=maxInclDeep
return this
//*******************************************************************
implement openIncludeFile(filename)
// Ret: 0: siker<65>lt, 1: nyit si hiba, 2: nem tal lhat¢, 3: t£l sok
// egym sba skatuly z s.
// Ha a name tartalmaz path-t, akkor megnzi a kurrens direktoriban
// is, egybknt pedig csak az includeList-ben.
local fr,l
if (this:maxInclDeep>0 .and.;
len(LREADER.(this:lreader):readerStack)>=this:maxInclDeep)
return 3
endif
// Œgy ktszer is j”n hiba<62>zenet, egyszer az freader-t“l, egyszer
// pedig a hparser-t“l, de ez nem baj.
// Mj.: Ha csak egy <20>zenetet akarunk, akkor az freader
// hiba<62>zeneteit rtelmezni kell, s hparser(include)
// hiba<62>zenetekk alak¡tani.
fr:=C.FREADER:onew(LREADER.(this:lreader):errorStream)
l:=len(FREADER.fr:errorStream)
if (!dirFName(filename)=="")
FREADER.fr:dOpen({""},filename)
if (FREADER.fr:isError(l))
// Nem siker<65>lt megnyitni.
return 1
endif
endif
if (!FREADER.fr:isOpen())
FREADER.fr:dOpen(this:includeList,filename)
endif
if (FREADER.fr:isError(l))
// Nem siker<65>lt megnyitni.
return 1
endif
if (!FREADER.fr:isOpen())
return 2
endif
// Itt kell befzni a l ncba.
LREADER.(this:lreader):pushReader(fr)
PDEBUG(outstd("include: "+filename))
return 0
//*******************************************************************