diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2009-04-01 21:13:09 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2009-04-01 21:13:09 +0000 |
commit | 0ed7a8b68dd73e2b0473b8127aeca99f3bac9061 (patch) | |
tree | 5c67818b38a5cc2f9caa5ca7f8640ca356adf02b /externals/grill/flext/source/flxlet.cpp | |
parent | bb4c7f6a245394d09dac9adfb2efb093d3d98452 (diff) |
cleaned up grill externals - replaced with svn:externals to svn.grrrr.org/ext/trunk/
svn path=/trunk/; revision=10951
Diffstat (limited to 'externals/grill/flext/source/flxlet.cpp')
-rw-r--r-- | externals/grill/flext/source/flxlet.cpp | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/externals/grill/flext/source/flxlet.cpp b/externals/grill/flext/source/flxlet.cpp deleted file mode 100644 index 9fa9486a..00000000 --- a/externals/grill/flext/source/flxlet.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - -flext - C++ layer for Max/MSP and pd (pure data) externals - -Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) -For information on usage and redistribution, and for a DISCLAIMER OF ALL -WARRANTIES, see the file, "license.txt," in this distribution. - -*/ - -/*! \file flxlet.cpp - \brief Implementation of the variable inlet/outlet functionality. -*/ - -#include "flext.h" -#include "flinternal.h" -#include <string.h> -#include <stdarg.h> - -#define MAXLETS 256 - -flext_base::xlet flext_base::inlist[MAXLETS],flext_base::outlist[MAXLETS]; - -flext_base::xlet::xlet(): tp(xlet_none),desc(NULL) {} -flext_base::xlet::~xlet() { if(desc) delete[] desc; } - -void flext_base::xlet::Desc(const char *c) -{ - if(desc) delete[] desc; - if(c) { - size_t l = strlen(c); - desc = new char[l+1]; - memcpy(desc,c,l+1); - } - else - desc = NULL; -} - -void flext_base::AddInlet(xlettype tp,int mult,const char *desc) -{ - if(UNLIKELY(incnt+mult >= MAXLETS)) - post("%s - too many inlets",thisName()); - else - for(int i = 0; i < mult; ++i) { - xlet &x = inlist[incnt++]; - x.tp = tp; - x.Desc(desc); - } -} - -void flext_base::AddOutlet(xlettype tp,int mult,const char *desc) -{ - if(UNLIKELY(outcnt+mult >= MAXLETS)) - post("%s - too many outlets",thisName()); - else - for(int i = 0; i < mult; ++i) { - xlet &x = outlist[outcnt++]; - x.tp = tp; - x.Desc(desc); - } -} - -void flext_base::DescInlet(int ix,const char *d) -{ - if(UNLIKELY(ix >= incnt)) - post("%s - inlet %i not found",thisName(),ix); - else - inlist[ix].Desc(d); -} - -void flext_base::DescOutlet(int ix,const char *d) -{ - if(UNLIKELY(ix >= incnt)) - post("%s - outlet %i not found",thisName(),ix); - else - outlist[ix].Desc(d); -} - -unsigned long flext_base::XletCode(xlettype tp,...) -{ - unsigned long code = 0; - - va_list marker; - va_start(marker,tp); - int cnt = 0; - xlettype arg = tp; - for(; arg; ++cnt) { -#ifdef FLEXT_DEBUG - if(cnt > 9) { - error("%s - Too many in/outlets defined - truncated to 9",thisName()); - break; - } -#endif - - code = code*10+(int)arg; - arg = (xlettype)va_arg(marker,int); - } - va_end(marker); - - return code; -} - -void flext_base::AddInlets(unsigned long code) -{ - for(; code; code /= 10) AddInlet((xlettype)(code%10)); -} - -void flext_base::AddOutlets(unsigned long code) -{ - for(; code; code /= 10) AddOutlet((xlettype)(code%10)); -} - |