From abdc387d7fabe5f18cc3cb448c15aa898f9fdaaa Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 4 Dec 2002 08:12:34 +0000 Subject: "" svn path=/trunk/; revision=273 --- externals/grill/vasp/source/buflib.cpp | 22 +++++++++++++--------- externals/grill/vasp/source/buflib.h | 4 ++-- externals/grill/vasp/source/classes.cpp | 3 ++- externals/grill/vasp/source/main.cpp | 4 ++-- externals/grill/vasp/source/main.h | 4 ++-- externals/grill/vasp/source/obj_frames.cpp | 2 +- 6 files changed, 22 insertions(+), 17 deletions(-) (limited to 'externals/grill/vasp/source') diff --git a/externals/grill/vasp/source/buflib.cpp b/externals/grill/vasp/source/buflib.cpp index 30b500c4..36bc90c7 100644 --- a/externals/grill/vasp/source/buflib.cpp +++ b/externals/grill/vasp/source/buflib.cpp @@ -32,7 +32,7 @@ public: class BufEntry { public: - BufEntry(t_symbol *s,I fr); + BufEntry(t_symbol *s,I fr,BL zero = true); ~BufEntry(); V IncRef(); @@ -62,11 +62,12 @@ static V FreeLibSym(t_symbol *s); -BufEntry::BufEntry(t_symbol *s,I fr): +BufEntry::BufEntry(t_symbol *s,I fr,BL zero): sym(s), //magic(LIBMAGIC), alloc(fr),len(fr),data(new S[fr]), refcnt(0),nxt(NULL) { + if(zero) flext::ZeroMem(data,len*sizeof(*data)); // ASSERT(!flext_base::GetThing(sym)); // flext_base::SetThing(sym,this); } @@ -129,7 +130,7 @@ static t_symbol *GetLibSym() #ifdef __MWERKS__ std:: #endif - sprintf(tmp,"vasp!%04i",libcnt); // what if libcnt has > 4 digits? + sprintf(tmp,"vasp!%04i",libcnt); //! \todo what if libcnt has > 4 digits? libcnt++; return gensym(tmp); } @@ -181,7 +182,7 @@ static V LibTick(V *) #endif } -BufEntry *BufLib::NewImm(I fr) +BufEntry *BufLib::NewImm(I fr,BL zero) { if(!libclk) { libclk = (t_clock *)clock_new(NULL,(t_method)LibTick); @@ -193,7 +194,7 @@ BufEntry *BufLib::NewImm(I fr) s = GetLibSym(); // } while(s->s_thing); - BufEntry *entry = new BufEntry(s,fr); + BufEntry *entry = new BufEntry(s,fr,zero); #ifdef FLEXT_THREADS libmtx.Lock(); @@ -213,18 +214,21 @@ BufEntry *BufLib::NewImm(I fr) static F reuse_maxloserel = (F)REUSE_MAXLOSEREL; static I reuse_maxloseabs = REUSE_MAXLOSEABS; -BufEntry *BufLib::Resize(BufEntry *e,I fr,BL keep) +BufEntry *BufLib::Resize(BufEntry *e,I fr,BL keep,BL zero) { if(e->alloc >= fr && fr >= e->alloc*(1-reuse_maxloserel) && fr >= (e->alloc-reuse_maxloseabs)) { // reuse buffer e->len = fr; } else { - S *nd = new S[fr]; + S *nd = new S[fr]; if(keep) { I l = fr; - if(e->len < l) l = e->len; - flext::CopyMem(e->data,nd,l); + if(e->len < l) { + l = e->len; + if(zero) flext::ZeroMem(nd+l,(fr-l)*sizeof(*nd)); + } + flext::CopyMem(nd,e->data,l*sizeof(*nd)); } delete[] e->data; diff --git a/externals/grill/vasp/source/buflib.h b/externals/grill/vasp/source/buflib.h index f64bd8d1..b53be9c8 100644 --- a/externals/grill/vasp/source/buflib.h +++ b/externals/grill/vasp/source/buflib.h @@ -24,12 +24,12 @@ namespace BufLib { VBuffer *Get(const VSymbol &s,I chn = 0,I len = -1,I offs = 0); - BufEntry *NewImm(I fr); + BufEntry *NewImm(I fr,BL zero = true); V IncRef(t_symbol *s); V DecRef(t_symbol *s); - BufEntry *Resize(BufEntry *e,I fr,BL keep = false); + BufEntry *Resize(BufEntry *e,I fr,BL keep = false,BL zero = true); } diff --git a/externals/grill/vasp/source/classes.cpp b/externals/grill/vasp/source/classes.cpp index 658cf0a7..46d07147 100644 --- a/externals/grill/vasp/source/classes.cpp +++ b/externals/grill/vasp/source/classes.cpp @@ -101,7 +101,7 @@ vasp_op::vasp_op(BL op) V vasp_op::m_dobang() { #ifdef FLEXT_THREADS - if(detach) + if(detach) FLEXT_CALLMETHOD(m_bang); else #endif @@ -216,6 +216,7 @@ V vasp_tx::m_bang() #ifdef FLEXT_THREADS thrid = 0; #endif + Unlock(); } diff --git a/externals/grill/vasp/source/main.cpp b/externals/grill/vasp/source/main.cpp index def63a43..15525aac 100644 --- a/externals/grill/vasp/source/main.cpp +++ b/externals/grill/vasp/source/main.cpp @@ -11,7 +11,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "classes.h" -const C *VASP_VERSION = "0.1.1"; +const C *VASP_VERSION = "0.1.2pre2"; V lib_setup() { @@ -20,7 +20,7 @@ V lib_setup() post(" VASP modular %s ",VASP_VERSION); post(" vector assembling signal processor "); post(" (C)2002 Thomas Grill "); -#if defined(_DEBUG) && !defined(__MWERKS__) +#ifdef _DEBUG post(" DEBUG BUILD - " __DATE__ " " __TIME__); #endif post(""); diff --git a/externals/grill/vasp/source/main.h b/externals/grill/vasp/source/main.h index 53d732c2..0fad36d8 100644 --- a/externals/grill/vasp/source/main.h +++ b/externals/grill/vasp/source/main.h @@ -13,8 +13,8 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include -#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400) -#error You need at least flext version 0.4.0 +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401) +#error You need at least flext version 0.4.1 #endif diff --git a/externals/grill/vasp/source/obj_frames.cpp b/externals/grill/vasp/source/obj_frames.cpp index 70210d61..fb618e51 100644 --- a/externals/grill/vasp/source/obj_frames.cpp +++ b/externals/grill/vasp/source/obj_frames.cpp @@ -136,7 +136,7 @@ public: virtual Vasp *x_work() { Vasp *ret = new Vasp(ref); - if(setf) ret->FramesM(frms); + if(setf) ret->FramesM(factor); return ret; } -- cgit v1.2.1