aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/vasp/source/vbuffer.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2002-12-02 19:21:08 +0000
committerThomas Grill <xovo@users.sourceforge.net>2002-12-02 19:21:08 +0000
commit9815096db22c73cacdbb65512d1b61d633db7fa8 (patch)
tree4a6582ead85b8efd031f68e717fbc8a5b3a3df3f /externals/grill/vasp/source/vbuffer.cpp
parent0a109da279e9df66fb5ea7d6bdaeffed16592f02 (diff)
"version 0.1.1"
svn path=/trunk/; revision=267
Diffstat (limited to 'externals/grill/vasp/source/vbuffer.cpp')
-rw-r--r--externals/grill/vasp/source/vbuffer.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/externals/grill/vasp/source/vbuffer.cpp b/externals/grill/vasp/source/vbuffer.cpp
new file mode 100644
index 00000000..137e066c
--- /dev/null
+++ b/externals/grill/vasp/source/vbuffer.cpp
@@ -0,0 +1,40 @@
+#include "vbuffer.h"
+#include "buflib.h"
+
+V VSymbol::Inc() { if(sym) BufLib::IncRef(sym); }
+V VSymbol::Dec() { if(sym) BufLib::DecRef(sym); }
+
+///////////////////////////////////////////////////////////////////////////
+// SysBuf class
+///////////////////////////////////////////////////////////////////////////
+
+SysBuf &SysBuf::Set(const VSymbol &s,I c,I l,I o)
+{
+ buf.Set(s.Symbol());
+
+ chn = c;
+ if(chn > Channels()) {
+ I chn1 = Channels()-1;
+ post("vasp - buffer %s: Channel index (%i) is out of range, set to highest (%i)",s.Name(),chn,chn1);
+ chn = chn1; // simply correct the channel??
+ }
+ offs = o;
+ if(offs < 0) {
+ post("vasp - buffer %s: Offset (%i) is out of range, set to 0",s.Name(),offs);
+ offs = 0;
+ }
+ if(offs > Frames()) {
+// post("vasp - buffer %s: Offset (%i) is out of range, set to %i",s.Name(),offs,Frames());
+ offs = Frames();
+ }
+ len = l >= 0?l:Frames();
+ if(offs+len > Frames()) {
+ I len1 = Frames()-offs;
+ if(l >= 0) post("vasp - buffer %s: Length (%i) is out of range, corrected to %i",s.Name(),len,len1);
+ len = len1;
+ }
+
+ return *this;
+}
+
+