diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2002-12-22 01:28:34 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2002-12-22 01:28:34 +0000 |
commit | 99a29c1926eee84f100ad9ea59a8c33f7878c342 (patch) | |
tree | 8b9235a630b5839350529d9e255d4f87c2389b5b /externals/grill/vasp/source | |
parent | 927c48a90eb2a5ebf9e221041cd963c7377c8349 (diff) |
"no message"
svn path=/trunk/; revision=306
Diffstat (limited to 'externals/grill/vasp/source')
-rw-r--r-- | externals/grill/vasp/source/buflib.cpp | 40 | ||||
-rw-r--r-- | externals/grill/vasp/source/buflib.h | 4 | ||||
-rw-r--r-- | externals/grill/vasp/source/classes.cpp | 8 | ||||
-rw-r--r-- | externals/grill/vasp/source/classes.h | 14 | ||||
-rw-r--r-- | externals/grill/vasp/source/main.cpp | 2 | ||||
-rw-r--r-- | externals/grill/vasp/source/ops_assign.cpp | 4 | ||||
-rw-r--r-- | externals/grill/vasp/source/ops_feature.cpp | 16 | ||||
-rw-r--r-- | externals/grill/vasp/source/ops_qminmax.cpp | 18 | ||||
-rw-r--r-- | externals/grill/vasp/source/ops_rearr.cpp | 8 | ||||
-rw-r--r-- | externals/grill/vasp/source/ops_resmp.cpp | 8 | ||||
-rw-r--r-- | externals/grill/vasp/source/ops_search.cpp | 8 | ||||
-rw-r--r-- | externals/grill/vasp/source/vbuffer.h | 5 |
12 files changed, 66 insertions, 69 deletions
diff --git a/externals/grill/vasp/source/buflib.cpp b/externals/grill/vasp/source/buflib.cpp index 78866a8e..938a1969 100644 --- a/externals/grill/vasp/source/buflib.cpp +++ b/externals/grill/vasp/source/buflib.cpp @@ -24,23 +24,23 @@ WARRANTIES, see the file, "license.txt," in this distribution. class FreeEntry { public: - FreeEntry(t_symbol *s): sym(s),nxt(NULL) {} + FreeEntry(const t_symbol *s): sym(s),nxt(NULL) {} - t_symbol *sym; + const t_symbol *sym; FreeEntry *nxt; }; class BufEntry { public: - BufEntry(t_symbol *s,I fr,BL zero = true); + BufEntry(const t_symbol *s,I fr,BL zero = true); ~BufEntry(); V IncRef(); V DecRef(); // UL magic; - t_symbol *sym; + const t_symbol *sym; I refcnt,tick; BufEntry *nxt; @@ -57,12 +57,12 @@ static I libcnt = 0,libtick = 0; static flext::ThrMutex libmtx; #endif -static V FreeLibSym(t_symbol *s); +static V FreeLibSym(const t_symbol *s); -BufEntry::BufEntry(t_symbol *s,I fr,BL zero): +BufEntry::BufEntry(const t_symbol *s,I fr,BL zero): sym(s), //magic(LIBMAGIC), alloc(fr),len(fr),data(new S[fr]), refcnt(0),nxt(NULL) @@ -97,7 +97,7 @@ VBuffer *BufLib::Get(const VSymbol &s,I chn,I len,I offs) return new SysBuf(s,chn,len,offs); } -V BufLib::IncRef(t_symbol *s) +V BufLib::IncRef(const t_symbol *s) { if(s) { BufEntry *e = FindInLib(s); @@ -105,7 +105,7 @@ V BufLib::IncRef(t_symbol *s) } } -V BufLib::DecRef(t_symbol *s) +V BufLib::DecRef(const t_symbol *s) { if(s) { BufEntry *e = FindInLib(s); @@ -149,11 +149,11 @@ static V Collect() #ifdef FLEXT_THREADS static bool libthractive = false; -static pthread_t libthrid; +//static flext::thrid_t libthrid; static bool libthrexit = false; // currently not used static flext::ThrCond *libthrcond = NULL; -static V *LibThr(V *) +static V LibThr(flext::thr_params *) { flext::RelPriority(-2); @@ -162,7 +162,6 @@ static V *LibThr(V *) // TODO - should process return value of TimedWait Collect(); } - return NULL; } #endif @@ -180,14 +179,14 @@ static V LibTick(V *) } -static t_symbol *GetLibSym() +static const t_symbol *GetLibSym() { if(freehead) { // reuse from free-list FreeEntry *r = freehead; freehead = r->nxt; if(!freehead) freetail = NULL; - t_symbol *s = r->sym; + const t_symbol *s = r->sym; delete r; return s; } @@ -205,7 +204,7 @@ static t_symbol *GetLibSym() clock_delay(libclk,LIBTICK); } -static V FreeLibSym(t_symbol *sym) +static V FreeLibSym(const t_symbol *sym) { FreeEntry *f = new FreeEntry(sym); if(!freehead) freehead = f; @@ -218,8 +217,8 @@ BufEntry *BufLib::NewImm(I fr,BL zero) { #ifdef FLEXT_THREADS if(!libthractive) { - int ret = pthread_create(&libthrid,NULL,LibThr,NULL); - if(ret) + bool ret = flext::LaunchThread(LibThr,NULL); + if(!ret) error("vasp - Could not launch helper thread"); else { libthrcond = new flext::ThrCond; @@ -232,11 +231,7 @@ BufEntry *BufLib::NewImm(I fr,BL zero) clock_delay(libclk,LIBTICK); } - t_symbol *s = NULL; -// do { - s = GetLibSym(); -// } while(s->s_thing); - + const t_symbol *s = GetLibSym(); BufEntry *entry = new BufEntry(s,fr,zero); #ifdef FLEXT_THREADS @@ -300,6 +295,3 @@ I ImmBuf::Frames() const { return entry->len; } V ImmBuf::Frames(I fr,BL keep) { entry = BufLib::Resize(entry,fr,keep); } S *ImmBuf::Data() { return entry->data; } - - - diff --git a/externals/grill/vasp/source/buflib.h b/externals/grill/vasp/source/buflib.h index b53be9c8..545e8103 100644 --- a/externals/grill/vasp/source/buflib.h +++ b/externals/grill/vasp/source/buflib.h @@ -26,8 +26,8 @@ namespace BufLib BufEntry *NewImm(I fr,BL zero = true); - V IncRef(t_symbol *s); - V DecRef(t_symbol *s); + V IncRef(const t_symbol *s); + V DecRef(const t_symbol *s); 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 fa9ff7d4..78c6a0ca 100644 --- a/externals/grill/vasp/source/classes.cpp +++ b/externals/grill/vasp/source/classes.cpp @@ -87,8 +87,8 @@ BL vasp_base::ToOutVasp(I oix,Vasp &v) vasp_op::vasp_op(BL op) #ifdef FLEXT_THREADS - :detach(false),prior(-2), - thrid(0) + :detach(false),prior(-2) +// ,thrid(0) #endif { FLEXT_ADDBANG(0,m_dobang); @@ -183,7 +183,7 @@ V vasp_tx::m_bang() Lock(); #ifdef FLEXT_THREADS -// RelPriority(prior); + if(!IsSystemThread()) RelPriority(prior); #endif if(ref.Check()) @@ -211,7 +211,7 @@ V vasp_tx::m_bang() } #ifdef FLEXT_THREADS - thrid = 0; +// thrid = 0; #endif Unlock(); diff --git a/externals/grill/vasp/source/classes.h b/externals/grill/vasp/source/classes.h index 64719cd3..c032abd7 100644 --- a/externals/grill/vasp/source/classes.h +++ b/externals/grill/vasp/source/classes.h @@ -106,7 +106,7 @@ protected: BL detach; // detached operation? I prior; // thread priority - thrid_t thrid; +// thrid_t thrid; #else FLEXT_CALLBACK(m_bang) @@ -256,8 +256,8 @@ protected: \ virtual Vasp *tx_work() \ { \ OpParam p(thisName(),0); \ - CVasp cdst(dst); \ - return VaspOp::m_##op(p,CVasp(ref),&cdst); \ + CVasp cdst(dst),cref(ref); \ + return VaspOp::m_##op(p,cref,&cdst); \ } \ virtual V m_help() { post("%s - " help,thisName()); } \ }; \ @@ -275,8 +275,8 @@ protected: \ virtual Vasp *tx_work(const Argument &arg) \ { \ OpParam p(thisName(),1); \ - CVasp cdst(dst); \ - return VaspOp::m_##op(p,CVasp(ref),arg,&cdst); \ + CVasp cdst(dst),cref(ref); \ + return VaspOp::m_##op(p,cref,arg,&cdst); \ } \ virtual V m_help() { post("%s - " help,thisName()); } \ }; \ @@ -294,8 +294,8 @@ protected: \ virtual Vasp *tx_work(const Argument &arg) \ { \ OpParam p(thisName(),args); \ - CVasp cdst(dst); \ - return VaspOp::m_##op(p,CVasp(ref),arg,&cdst); \ + CVasp cdst(dst),cref(ref); \ + return VaspOp::m_##op(p,cref,arg,&cdst); \ } \ virtual V m_help() { post("%s - " help,thisName()); } \ }; \ diff --git a/externals/grill/vasp/source/main.cpp b/externals/grill/vasp/source/main.cpp index b50cded2..f4ef924d 100644 --- a/externals/grill/vasp/source/main.cpp +++ b/externals/grill/vasp/source/main.cpp @@ -12,7 +12,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "classes.h" -const C *VASP_VERSION = "0.1.2pre6"; +const C *VASP_VERSION = "0.1.2pre7"; V lib_setup() { diff --git a/externals/grill/vasp/source/ops_assign.cpp b/externals/grill/vasp/source/ops_assign.cpp index 2495d68a..05d40375 100644 --- a/externals/grill/vasp/source/ops_assign.cpp +++ b/externals/grill/vasp/source/ops_assign.cpp @@ -69,7 +69,7 @@ public: virtual V m_to(I,const t_atom *) { post("s - destination vasp is ignored!",thisName()); } - virtual Vasp *do_copy(OpParam &p,CVasp &dst) { return VaspOp::m_copy(p,CVasp(ref),dst); } + virtual Vasp *do_copy(OpParam &p,CVasp &dst) { CVasp cref(ref); return VaspOp::m_copy(p,cref,dst); } virtual Vasp *tx_work(const Argument &arg) { @@ -100,7 +100,7 @@ public: vasp_ccopy(I argc,const t_atom *argv): vasp_copy(argc,argv) {} - virtual Vasp *do_copy(OpParam &p,CVasp &dst) { return VaspOp::m_ccopy(p,CVasp(ref),dst); } + virtual Vasp *do_copy(OpParam &p,CVasp &dst) { CVasp cref(ref); return VaspOp::m_ccopy(p,cref,dst); } virtual V m_help() { post("%s - Copies complex pairs of the triggering vasp to the argument vasp",thisName()); } }; diff --git a/externals/grill/vasp/source/ops_feature.cpp b/externals/grill/vasp/source/ops_feature.cpp index 3e33f313..9ceac7ff 100644 --- a/externals/grill/vasp/source/ops_feature.cpp +++ b/externals/grill/vasp/source/ops_feature.cpp @@ -148,8 +148,8 @@ public: virtual Vasp *do_peaks(OpParam &p) { - CVasp cdst(dst); - return VaspOp::m_peaks(p,CVasp(ref),&cdst); + CVasp cdst(dst),cref(ref); + return VaspOp::m_peaks(p,cref,&cdst); } virtual Vasp *tx_work(const Argument &arg) @@ -180,8 +180,8 @@ public: vasp_valleys(I argc,const t_atom *argv): vasp_peaks(argc,argv) {} virtual Vasp *do_peaks(OpParam &p) { - CVasp cdst(dst); - return VaspOp::m_valleys(p,CVasp(ref),&cdst); + CVasp cdst(dst),cref(ref); + return VaspOp::m_valleys(p,cref,&cdst); } }; FLEXT_LIB_V("vasp, vasp.valleys",vasp_valleys) @@ -195,8 +195,8 @@ public: vasp_rpeaks(I argc,const t_atom *argv): vasp_peaks(argc,argv) {} virtual Vasp *do_peaks(OpParam &p) { - CVasp cdst(dst); - return VaspOp::m_rpeaks(p,CVasp(ref),&cdst); + CVasp cdst(dst),cref(ref); + return VaspOp::m_rpeaks(p,cref,&cdst); } }; FLEXT_LIB_V("vasp, vasp.rpeaks",vasp_rpeaks) @@ -210,8 +210,8 @@ public: vasp_rvalleys(I argc,const t_atom *argv): vasp_peaks(argc,argv) {} virtual Vasp *do_peaks(OpParam &p) { - CVasp cdst(dst); - return VaspOp::m_rvalleys(p,CVasp(ref),&cdst); + CVasp cdst(dst),cref(ref); + return VaspOp::m_rvalleys(p,cref,&cdst); } }; FLEXT_LIB_V("vasp, vasp.rvalleys",vasp_rvalleys) diff --git a/externals/grill/vasp/source/ops_qminmax.cpp b/externals/grill/vasp/source/ops_qminmax.cpp index debbfbd2..6fe8ee26 100644 --- a/externals/grill/vasp/source/ops_qminmax.cpp +++ b/externals/grill/vasp/source/ops_qminmax.cpp @@ -84,7 +84,8 @@ public: virtual Vasp *do_opt(OpParam &p) { p.norm.minmax = BIG; - Vasp *ret = VaspOp::m_qmin(p,CVasp(ref)); + CVasp cref(ref); + Vasp *ret = VaspOp::m_qmin(p,cref); if(p.norm.minmax == BIG) p.norm.minmax = 0; return ret; } @@ -124,7 +125,8 @@ public: virtual Vasp *do_opt(OpParam &p) { p.norm.minmax = BIG; - Vasp *ret = VaspOp::m_qamin(p,CVasp(ref)); + CVasp cref(ref); + Vasp *ret = VaspOp::m_qamin(p,cref); if(p.norm.minmax == BIG) p.norm.minmax = 0; return ret; } @@ -157,7 +159,8 @@ public: virtual Vasp *do_opt(OpParam &p) { p.norm.minmax = -BIG; - Vasp *ret = VaspOp::m_qmax(p,CVasp(ref)); + CVasp cref(ref); + Vasp *ret = VaspOp::m_qmax(p,cref); if(p.norm.minmax == -BIG) p.norm.minmax = 0; return ret; } @@ -190,7 +193,8 @@ public: virtual Vasp *do_opt(OpParam &p) { p.norm.minmax = 0; - return VaspOp::m_qamax(p,CVasp(ref)); + CVasp cref(ref); + return VaspOp::m_qamax(p,cref); } virtual V m_help() { post("%s - Get a vasp's maximum absolute sample value",thisName()); } @@ -225,7 +229,8 @@ public: virtual Vasp *do_opt(OpParam &p) { p.norm.minmax = BIG; - Vasp *ret = VaspOp::m_qrmin(p,CVasp(ref)); + CVasp cref(ref); + Vasp *ret = VaspOp::m_qrmin(p,cref); if(p.norm.minmax == BIG) p.norm.minmax = 0; return ret; } @@ -266,7 +271,8 @@ public: virtual Vasp *do_opt(OpParam &p) { p.norm.minmax = 0; - return VaspOp::m_qrmax(p,CVasp(ref)); + CVasp cref(ref); + return VaspOp::m_qrmax(p,cref); } virtual V m_help() { post("%s - Get a vasp's maximum complex radius",thisName()); } diff --git a/externals/grill/vasp/source/ops_rearr.cpp b/externals/grill/vasp/source/ops_rearr.cpp index 80093c17..0da06cfd 100644 --- a/externals/grill/vasp/source/ops_rearr.cpp +++ b/externals/grill/vasp/source/ops_rearr.cpp @@ -116,8 +116,8 @@ public: virtual Vasp *do_shift(OpParam &p) { - CVasp cdst(dst); - return VaspOp::m_shift(p,CVasp(ref),arg,&cdst); + CVasp cdst(dst),cref(ref); + return VaspOp::m_shift(p,cref,arg,&cdst); } virtual Vasp *tx_work(const Argument &arg) @@ -150,8 +150,8 @@ public: virtual Vasp *do_shift(OpParam &p) { - CVasp cdst(dst); - return VaspOp::m_xshift(p,CVasp(ref),arg,&cdst); + CVasp cdst(dst),cref(ref); + return VaspOp::m_xshift(p,cref,arg,&cdst); } virtual V m_help() { post("%s - Shifts buffer data symmetrically (in two halves)",thisName()); } diff --git a/externals/grill/vasp/source/ops_resmp.cpp b/externals/grill/vasp/source/ops_resmp.cpp index 16780df8..0c578284 100644 --- a/externals/grill/vasp/source/ops_resmp.cpp +++ b/externals/grill/vasp/source/ops_resmp.cpp @@ -224,8 +224,8 @@ public: virtual Vasp *do_shift(OpParam &p) { - CVasp cdst(dst); - return VaspOp::m_tilt(p,CVasp(ref),arg,&cdst); + CVasp cdst(dst),cref(ref); + return VaspOp::m_tilt(p,cref,arg,&cdst); } virtual Vasp *tx_work(const Argument &arg) @@ -261,8 +261,8 @@ public: virtual Vasp *do_shift(OpParam &p) { - CVasp cdst(dst); - return VaspOp::m_xtilt(p,CVasp(ref),arg,&cdst); + CVasp cdst(dst),cref(ref); + return VaspOp::m_xtilt(p,cref,arg,&cdst); } virtual V m_help() { post("%s - Resamples buffer data symmetrically (in two halves)",thisName()); } diff --git a/externals/grill/vasp/source/ops_search.cpp b/externals/grill/vasp/source/ops_search.cpp index f514d6f3..6401f558 100644 --- a/externals/grill/vasp/source/ops_search.cpp +++ b/externals/grill/vasp/source/ops_search.cpp @@ -169,8 +169,8 @@ public: vasp_soffset(I argc,t_atom *argv): vasp_search(argc,argv) {} virtual Vasp *do_work(OpParam &p) { - CVasp cdst(dst); - return VaspOp::m_soffset(p,CVasp(ref),arg,&cdst); + CVasp cdst(dst),cref(ref); + return VaspOp::m_soffset(p,cref,arg,&cdst); } }; FLEXT_LIB_V("vasp, vasp.offset= vasp.o=",vasp_soffset) @@ -184,8 +184,8 @@ public: vasp_sframes(I argc,t_atom *argv): vasp_search(argc,argv) {} virtual Vasp *do_work(OpParam &p) { - CVasp cdst(dst); - return VaspOp::m_sframes(p,CVasp(ref),arg,&cdst); + CVasp cdst(dst),cref(ref); + return VaspOp::m_sframes(p,cref,arg,&cdst); } }; FLEXT_LIB_V("vasp, vasp.frames= vasp.f=",vasp_sframes) diff --git a/externals/grill/vasp/source/vbuffer.h b/externals/grill/vasp/source/vbuffer.h index c3303099..5233f580 100644 --- a/externals/grill/vasp/source/vbuffer.h +++ b/externals/grill/vasp/source/vbuffer.h @@ -16,7 +16,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. class VSymbol { public: - VSymbol(t_symbol *s = NULL): sym(s) { Inc(); } + VSymbol(const t_symbol *s = NULL): sym(s) { Inc(); } VSymbol(const VSymbol &s): sym(s.sym) { Inc(); } ~VSymbol() { Dec(); } @@ -28,7 +28,6 @@ public: VSymbol &operator =(const VSymbol &s) { Dec(); sym = s.sym; Inc(); return *this; } - t_symbol *Symbol() { return sym; } const t_symbol *Symbol() const { return sym; } const C *Name() const { return flext::GetAString(Symbol()); } @@ -36,7 +35,7 @@ protected: V Inc(); V Dec(); - t_symbol *sym; + const t_symbol *sym; }; class VBuffer |