Commit 1854839e authored by IOhannes m zmölnig's avatar IOhannes m zmölnig
Browse files

remove trailing whitespace and replace TABs with SPCs

(defun emacs-format-gem ()
   "Format the whole buffer."
   (c-set-style "stroustrup")
   (untabify (point-min) (point-max))
   (delete-trailing-whitespace)
   (save-buffer)
)
parent 0b181e63

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -187,8 +187,8 @@ std::string CPPExtern::findFile(const std::string&file) const {
bool CPPExtern :: checkGemVersion(const int major, const int minor) {
if(!GemVersion::versionCheck(major, minor)) {
::error("GEM version mismatch: compiled for %d.%d but we are running %s",
major, minor,
GemVersion::versionString());
major, minor,
GemVersion::versionString());
return false;
}
return true;
......
......@@ -45,12 +45,12 @@ DESCRIPTION
-----------------------------------------------------------------*/
struct GEM_EXTERN Obj_header
{
//////////
// The obligatory object header
t_object pd_obj;
//////////
// The obligatory object header
t_object pd_obj;
//////////
// Our data structure
//////////
// Our data structure
CPPExtern *data;
// This has a dummy arg so that NT won't complain
......@@ -93,15 +93,15 @@ class GEM_EXTERN CPPExtern
//////////
// Constructor
CPPExtern(void);
CPPExtern(void);
//////////
// The Pd header
t_object *x_obj;
//////////
// Destructor
virtual ~CPPExtern(void) = 0;
//////////
// Destructor
virtual ~CPPExtern(void) = 0;
//////////
// Get the object's canvas
......@@ -118,15 +118,15 @@ class GEM_EXTERN CPPExtern
protected:
//////////
// Creation callback
static void real_obj_setupCallback(t_class *) {}
//////////
// Creation callback
static void real_obj_setupCallback(t_class *) {}
///////////
// called directly before the destructor
// normally you should not override this (use the dtor!)
// if you do override this, make sure that you call the parent as well
virtual void beforeDeletion();
///////////
// called directly before the destructor
// normally you should not override this (use the dtor!)
// if you do override this, make sure that you call the parent as well
virtual void beforeDeletion();
private:
......@@ -150,8 +150,8 @@ class GEM_EXTERN CPPExtern
std::string findFile(const std::string&filename) const;
private:
mutable bool m_endpost; /* internal state for startpost/post/endpost */
static bool checkGemVersion(const int major, const int minor);
mutable bool m_endpost; /* internal state for startpost/post/endpost */
static bool checkGemVersion(const int major, const int minor);
CPPExtern(const CPPExtern&);
virtual CPPExtern&operator=(const CPPExtern&);
};
......@@ -160,17 +160,17 @@ class GEM_EXTERN CPPExtern
// This should be used in the header
////////////////////////////////////////
#define CPPEXTERN_HEADER(NEW_CLASS, PARENT_CLASS) \
public: \
static void obj_freeCallback(void *data) \
{ CPPExtern *mydata = ((Obj_header *)data)->data; \
GetMyClass(data)->beforeDeletion(); \
delete mydata; \
((Obj_header *)data)->Obj_header::~Obj_header(); } \
static void real_obj_setupCallback(t_class *classPtr) \
{ PARENT_CLASS::real_obj_setupCallback(classPtr); \
NEW_CLASS::obj_setupCallback(classPtr); } \
private: \
#define CPPEXTERN_HEADER(NEW_CLASS, PARENT_CLASS) \
public: \
static void obj_freeCallback(void *data) \
{ CPPExtern *mydata = ((Obj_header *)data)->data; \
GetMyClass(data)->beforeDeletion(); \
delete mydata; \
((Obj_header *)data)->Obj_header::~Obj_header(); } \
static void real_obj_setupCallback(t_class *classPtr) \
{ PARENT_CLASS::real_obj_setupCallback(classPtr); \
NEW_CLASS::obj_setupCallback(classPtr); } \
private: \
static inline NEW_CLASS *GetMyClass(void *data) {return((NEW_CLASS *)((Obj_header *)data)->data);} \
static void obj_setupCallback(t_class *classPtr);
......@@ -182,7 +182,7 @@ static void obj_setupCallback(t_class *classPtr);
//
// NO ARGUMENTS
/////////////////////////////////////////////////
#define CPPEXTERN_NEW(NEW_CLASS) \
#define CPPEXTERN_NEW(NEW_CLASS) \
REAL_NEW__CLASS(NEW_CLASS); \
static void* create_ ## NEW_CLASS (void) \
REAL_NEW__CREATE1(NEW_CLASS) \
......@@ -207,7 +207,7 @@ static void obj_setupCallback(t_class *classPtr);
//
// GIMME ARGUMENT
/////////////////////////////////////////////////
#define CPPEXTERN_NEW_WITH_GIMME(NEW_CLASS) \
#define CPPEXTERN_NEW_WITH_GIMME(NEW_CLASS) \
REAL_NEW__CLASS(NEW_CLASS); \
static void* create_ ## NEW_CLASS (t_symbol*s, int argc, t_atom*argv) \
REAL_NEW__CREATE1(NEW_CLASS) \
......@@ -220,7 +220,7 @@ static void obj_setupCallback(t_class *classPtr);
//
// TWO ARGUMENTS
/////////////////////////////////////////////////
#define CPPEXTERN_NEW_WITH_TWO_ARGS(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO) \
#define CPPEXTERN_NEW_WITH_TWO_ARGS(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO) \
REAL_NEW__CLASS(NEW_CLASS); \
static void* create_ ## NEW_CLASS (TYPE arg, TTWO arg2) \
REAL_NEW__CREATE1(NEW_CLASS) \
......@@ -233,7 +233,7 @@ static void obj_setupCallback(t_class *classPtr);
//
// THREE ARGUMENTS
/////////////////////////////////////////////////
#define CPPEXTERN_NEW_WITH_THREE_ARGS(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO, TTHREE, PD_THREE) \
#define CPPEXTERN_NEW_WITH_THREE_ARGS(NEW_CLASS, TYPE, PD_TYPE, TTWO, PD_TWO, TTHREE, PD_THREE) \
REAL_NEW__CLASS(NEW_CLASS); \
static void* create_ ## NEW_CLASS (TYPE arg, TTWO arg2, TTHREE arg3) \
REAL_NEW__CREATE1(NEW_CLASS) \
......@@ -338,11 +338,11 @@ static void obj_setupCallback(t_class *classPtr);
# else
# define POST_AUTOREGISTER(NEW_CLASS)
# endif
# define AUTO_REGISTER_CLASS(NEW_CLASS) \
class NEW_CLASS ## _cppclass { \
public: \
# define AUTO_REGISTER_CLASS(NEW_CLASS) \
class NEW_CLASS ## _cppclass { \
public: \
NEW_CLASS ## _cppclass(void) {POST_AUTOREGISTER(NEW_CLASS); NEW_CLASS ## _setup(); } \
}; \
}; \
static NEW_CLASS ## _cppclass NEW_CLASS ## _instance
#endif
......@@ -358,7 +358,7 @@ static void obj_setupCallback(t_class *classPtr);
# define SET_HELPSYMBOL(NEW_CLASS) \
class_sethelpsymbol(NEW_CLASS ## _class, gensym(HELPSYMBOL_BASE #NEW_CLASS))
# else
# define SET_HELPSYMBOL(NEW_CLASS) \
# define SET_HELPSYMBOL(NEW_CLASS) \
class_sethelpsymbol(NEW_CLASS ## _class, gensym(HELPSYMBOL_BASE HELPSYMBOL))
# endif
......@@ -376,4 +376,4 @@ static void obj_setupCallback(t_class *classPtr);
// macros for boilerplate code to object messages
#include "RTE/MessageCallbacks.h"
#endif // for header file
#endif // for header file
......@@ -235,22 +235,22 @@ void GemBase::beforeDeletion(void) {
void GemBase :: obj_setupCallback(t_class *classPtr)
{
class_addmethod(classPtr, reinterpret_cast<t_method>(&GemBase::gem_MessCallback),
gensym("gem_state"), A_GIMME, A_NULL);
gensym("gem_state"), A_GIMME, A_NULL);
struct _CallbackClass_gemContext {
static void callback(void*data, t_float v0) {
GemBase*obj=GetMyClass(data);
bool state=(bool)v0;
if(!state && obj->gem_amRendering) {
if(obj->m_enabled) {
//obj->post("stop rendering");
obj->stopRendering();
obj->m_state=obj->ENABLED;
}
}
obj->gem_amRendering=(!state);
GemBase*obj=GetMyClass(data);
bool state=(bool)v0;
if(!state && obj->gem_amRendering) {
if(obj->m_enabled) {
//obj->post("stop rendering");
obj->stopRendering();
obj->m_state=obj->ENABLED;
}
}
obj->gem_amRendering=(!state);
}
explicit _CallbackClass_gemContext (struct _class*c) {
class_addmethod(c, reinterpret_cast<t_method>(callback), gensym("__gem_context"), A_FLOAT, A_NULL);
class_addmethod(c, reinterpret_cast<t_method>(callback), gensym("__gem_context"), A_FLOAT, A_NULL);
}
};
_CallbackClass_gemContext _CallbackClassInstance_gemContext (classPtr);
......
......@@ -42,10 +42,10 @@ class GEM_EXTERN GemBase : public CPPExtern
//////////
// Destructor
virtual ~GemBase();
virtual ~GemBase();
//////////
virtual void render(GemState *state) = 0;
virtual void render(GemState *state) = 0;
//////////
void continueRender(GemState *state);
......@@ -53,22 +53,22 @@ class GEM_EXTERN GemBase : public CPPExtern
//////////
// After objects below you in the chain have finished.
// You should reset all GEM/OpenGL states here.
virtual void postrender(GemState *) { ; }
virtual void postrender(GemState *) { ; }
//////////
// Called when rendering stops
#if 1/*(jmz) this seems to be for gem2pdp*/
virtual void stoprender() { realStopRendering(); }
virtual void stoprender() { realStopRendering(); }
#endif
//////////
// If you care about the start of rendering
virtual void startRendering() { ; }
virtual void startRendering() { ; }
//////////
// If you care about the stop of rendering
virtual void stopRendering() { ; }
virtual void stopRendering() { ; }
//////////
......@@ -78,18 +78,18 @@ class GEM_EXTERN GemBase : public CPPExtern
//////////
// If anything in the object has changed
virtual void setModified();
virtual void setModified();
//////////
// Don't mess with this unless you know what you are doing.
GemCache *m_cache;
GemCache *m_cache;
//////////
// check whether this object has changed
bool m_modified;
//////////
// The outlet
t_outlet *m_out1;
t_outlet *m_out1;
//////////
......@@ -103,22 +103,22 @@ class GEM_EXTERN GemBase : public CPPExtern
//////////
// creation callback
static void real_obj_setupCallback(t_class *classPtr)
static void real_obj_setupCallback(t_class *classPtr)
{ CPPExtern::real_obj_setupCallback(classPtr); GemBase::obj_setupCallback(classPtr); }
enum RenderState {INIT, ENABLED, DISABLED, RENDERING, MODIFIED};
private:
void realStopRendering();
void realStopRendering();
void gem_startstopMess(int state);
void gem_renderMess(GemCache* cache, GemState* state);
static inline GemBase *GetMyClass(void *data) {return((GemBase *)((Obj_header *)data)->data);}
friend class gemhead;
static void obj_setupCallback(t_class *classPtr);
static void gem_MessCallback(void *, t_symbol *,int, t_atom*);
static void obj_setupCallback(t_class *classPtr);
static void gem_MessCallback(void *, t_symbol *,int, t_atom*);
/* whether the object is internally disabled or not
* objects are to be disabled, if the system cannot make use of them, e.g. because of unsupported openGL features
......@@ -132,4 +132,4 @@ class GEM_EXTERN GemBase : public CPPExtern
virtual void beforeDeletion(void);
};
#endif // for header file
#endif // for header file
......@@ -79,7 +79,7 @@ void GemGluObj :: numSlicesMess(int numSlices, int numStacks)
void GemGluObj :: obj_setupCallback(t_class *classPtr)
{
class_addmethod(classPtr, reinterpret_cast<t_method>(&GemGluObj::numSlicesMessCallback),
gensym("numslices"), A_GIMME, A_NULL);
gensym("numslices"), A_GIMME, A_NULL);
}
void GemGluObj :: numSlicesMessCallback(void *data, t_symbol*, int argc, t_atom*argv)
{
......
......@@ -52,41 +52,41 @@ class GEM_EXTERN GemGluObj : public GemShape
{
public:
//////////
// Constructor
//////////
// Constructor
GemGluObj(t_floatarg size, t_floatarg slices=10.f, t_floatarg stacks=0.f);
protected:
//////////
// Destructor
virtual ~GemGluObj();
//////////
// Destructor
virtual ~GemGluObj();
//////////
// The number of slices in the quadric
void numSlicesMess(int numSlices);
void numSlicesMess(int numSlices, int numStacks);
//////////
// The number of slices in the quadric
void numSlicesMess(int numSlices);
void numSlicesMess(int numSlices, int numStacks);
//////////
// The number of slices
int m_numSlices, m_numStacks;
//////////
// The number of slices
int m_numSlices, m_numStacks;
//////////
t_inlet *m_sliceInlet;
//////////
// creation callback
static void real_obj_setupCallback(t_class *classPtr)
{ GemShape::real_obj_setupCallback(classPtr); GemGluObj::obj_setupCallback(classPtr); }
//////////
// creation callback
static void real_obj_setupCallback(t_class *classPtr)
{ GemShape::real_obj_setupCallback(classPtr); GemGluObj::obj_setupCallback(classPtr); }
private:
static inline GemGluObj *GetMyClass(void *data) {return((GemGluObj *)((Obj_header *)data)->data);}
static inline GemGluObj *GetMyClass(void *data) {return((GemGluObj *)((Obj_header *)data)->data);}
//////////
// Static member functions
static void obj_setupCallback(t_class *classPtr);
static void numSlicesMessCallback(void *data, t_symbol*, int, t_atom*);
//////////
// Static member functions
static void obj_setupCallback(t_class *classPtr);
static void numSlicesMessCallback(void *data, t_symbol*, int, t_atom*);
};
#endif // for header file
#endif // for header file
......@@ -36,9 +36,9 @@ GemPathBase :: GemPathBase(int argc, t_atom *argv)
m_numDimens = (int)atom_getfloat(&argv[0]);
if (m_numDimens < 1) m_numDimens = 1;
if (m_numDimens > 64) {
error("too many dimensions, must be below 64");
m_numDimens = 64;
}
error("too many dimensions, must be below 64");
m_numDimens = 64;
}
}
}
......
......@@ -35,25 +35,25 @@ class GEM_EXTERN GemPathBase : public CPPExtern
//////////
// Constructor
GemPathBase(int argc, t_atom *argv);
GemPathBase(int argc, t_atom *argv);
protected:
//////////
// Destructor
virtual ~GemPathBase();
//////////
// Destructor
virtual ~GemPathBase();
//////////
// When an open is received
virtual void openMess(t_symbol *arrayname);
//////////
// When an open is received
virtual void openMess(t_symbol *arrayname);
//////////
// When a float val is received
virtual void floatMess(t_float val);
///////////
// do the actual interpolation
virtual void lookupFunc(t_float x, t_float *ret, int numDimen, int npnts, t_float *pnts) = 0;
///////////
// do the actual interpolation
virtual void lookupFunc(t_float x, t_float *ret, int numDimen, int npnts, t_float *pnts) = 0;
//////////
// The number of dimensions
......@@ -68,4 +68,4 @@ class GEM_EXTERN GemPathBase : public CPPExtern
t_outlet *m_out1;
};
#endif // for header file
#endif // for header file
......@@ -97,31 +97,31 @@ void GemPixDualObj :: render(GemState *state)
//
/////////////////////////////////////////////////////////
#define PROCESS_DUALIMAGE_SIMD(CS) \
switch(m_simd){ \
case (GEM_SIMD_MMX): \
process##CS ##_MMX(image, m_pixRight->image); \
break; \
case(GEM_SIMD_SSE2): \
process##CS ##_SSE2(image, m_pixRight->image); \
break; \
case(GEM_SIMD_ALTIVEC): \
process##CS ##_Altivec(image, m_pixRight->image); \
break; \
default: \
process##CS ##_##CS(image, m_pixRight->image); \
switch(m_simd){ \
case (GEM_SIMD_MMX): \
process##CS ##_MMX(image, m_pixRight->image); \
break; \
case(GEM_SIMD_SSE2): \
process##CS ##_SSE2(image, m_pixRight->image); \
break; \
case(GEM_SIMD_ALTIVEC): \
process##CS ##_Altivec(image, m_pixRight->image); \
break; \
default: \
process##CS ##_##CS(image, m_pixRight->image); \
}
#define PROCESS_DUALIMAGE(CS1, CS2) \
process##CS1 ##_##CS2 (image, m_pixRight->image);
#define PROCESS_COLORSPACE(FUN_RGBA, FUN_YUV, FUN_GRAY) \
switch (m_pixRight->image.format) { \
case GL_RGBA: case GL_BGRA_EXT: \
found=true; FUN_RGBA; break; \
case GL_LUMINANCE: \
found=true; FUN_GRAY; break; \
case GL_YCBCR_422_GEM: \
found=true; FUN_YUV ; break; \
#define PROCESS_COLORSPACE(FUN_RGBA, FUN_YUV, FUN_GRAY) \
switch (m_pixRight->image.format) { \
case GL_RGBA: case GL_BGRA_EXT: \
found=true; FUN_RGBA; break; \
case GL_LUMINANCE: \
found=true; FUN_GRAY; break; \
case GL_YCBCR_422_GEM: \
found=true; FUN_YUV ; break; \
default:break;}
void GemPixDualObj :: processImage(imageStruct &image)
......@@ -135,12 +135,12 @@ void GemPixDualObj :: processImage(imageStruct &image)
if (!m_pixRightValid || !&image || !&m_pixRight || !&m_pixRight->image) return;
if (image.xsize != m_pixRight->image.xsize ||
image.ysize != m_pixRight->image.ysize) {
image.ysize != m_pixRight->image.ysize) {
error("two images do not have equal dimensions (%dx%d != %dx%d)",
image.xsize, image.ysize,
m_pixRight->image.xsize, m_pixRight->image.ysize);
image.xsize, image.ysize,
m_pixRight->image.xsize, m_pixRight->image.ysize);
m_pixRightValid = 0;
return;
return;
}
if(image.upsidedown != m_pixRight->image.upsidedown) {
......@@ -153,18 +153,18 @@ void GemPixDualObj :: processImage(imageStruct &image)
case GL_RGBA:
case GL_BGRA_EXT:
PROCESS_COLORSPACE(PROCESS_DUALIMAGE_SIMD(RGBA),
PROCESS_DUALIMAGE(RGBA, YUV),
PROCESS_DUALIMAGE(RGBA, Gray));
PROCESS_DUALIMAGE(RGBA, YUV),
PROCESS_DUALIMAGE(RGBA, Gray));
break;
case GL_LUMINANCE:
PROCESS_COLORSPACE(PROCESS_DUALIMAGE(Gray, RGBA),
PROCESS_DUALIMAGE(Gray, YUV),
PROCESS_DUALIMAGE_SIMD(Gray));
PROCESS_DUALIMAGE(Gray, YUV),
PROCESS_DUALIMAGE_SIMD(Gray));
break;
case GL_YCBCR_422_GEM:
PROCESS_COLORSPACE(PROCESS_DUALIMAGE(YUV, RGBA),
PROCESS_DUALIMAGE_SIMD(YUV),
PROCESS_DUALIMAGE(YUV, Gray));
PROCESS_DUALIMAGE_SIMD(YUV),
PROCESS_DUALIMAGE(YUV, Gray));
break;
default: break;
}
......@@ -247,7 +247,7 @@ void GemPixDualObj :: rightRender(GemState *statePtr)
void GemPixDualObj :: obj_setupCallback(t_class *classPtr)
{
class_addmethod(classPtr, reinterpret_cast<t_method>(&GemPixDualObj::gem_rightMessCallback),
gensym("gem_right"), A_GIMME, A_NULL);
gensym("gem_right"), A_GIMME, A_NULL);
}
void GemPixDualObj :: gem_rightMessCallback(void *data, t_symbol *s, int argc, t_atom *argv)
{
......
......@@ -40,151 +40,151 @@ class GEM_EXTERN GemPixDualObj : public GemPixObj
//////////
// Constructor
GemPixDualObj();
GemPixDualObj();
protected:
//////////
// Destructor
virtual ~GemPixDualObj();
//////////
// Destructor
virtual ~GemPixDualObj();
void render(GemState *state);
void render(GemState *state);
//////////
// Derived classes should NOT override this!
// This makes sure that the images are the same size.
// This calls the other process functions based on the input images.
virtual void processImage(imageStruct &image);
//////////
// Derived classes should NOT override this!
// This makes sure that the images are the same size.
// This calls the other process functions based on the input images.
virtual void processImage(imageStruct &image);
#ifndef NEW_DUAL_PIX
//////////
// The derived class HAS override this.
// This is called whenever a new image comes through and
// both of the image structs are RGBA
virtual void processDualImage(imageStruct &image, imageStruct &right) = 0;
//////////
// The derived class CAN override this.
// This is called whenever a new image comes through and both
// of the image structs are gray8.
// The default behavior is to output an error.
virtual void processDualGray(imageStruct &image, imageStruct &right);
//////////
// The derived class CAN override this.
// This is called whenever a new image comes through and
// the left image is an RGBA while the right is a gray8.
// The default behavior is to output an error.
virtual void processRightGray(imageStruct &image, imageStruct &right);
//////////
// The derived class CAN override this.
// This is called whenever a new image comes through and
// the left image is a gray8, the right is an RGBA
// The default behavior is to output an error.
virtual void processLeftGray(imageStruct &image, imageStruct &right);
//////////
// The derived class CAN override this.
// This is called whenever a new image comes through and both
// of the image structs are YUV.
// The default behavior is to output an error.
virtual void processDualYUV(imageStruct &image, imageStruct &right);
//////////
// The derived class CAN override this.
// This is called whenever a new image comes through and
// the left image is an RGBA while the right is a YUV.
// The default behavior is to output an error.
virtual void processRightYUV(imageStruct &image