--- a/GLXWorkstation.st Thu Jan 13 01:12:27 1994 +0100
+++ b/GLXWorkstation.st Sun Jan 16 04:54:17 1994 +0100
@@ -41,7 +41,7 @@
Some functions are dublicated, Jeff and I developed those in parallel -
one of them will vanish - that is certain ...
-$Header: /cvs/stx/stx/libview/GLXWorkstation.st,v 1.7 1994-01-13 00:12:27 claus Exp $
+$Header: /cvs/stx/stx/libview/GLXWorkstation.st,v 1.8 1994-01-16 03:54:17 claus Exp $
written june 93 by claus
VGL stuff dec 93
many many additions jan 94 by Jeff McAffer <jeff@is.s.u-tokyo.ac.jp>
@@ -73,7 +73,7 @@
GLXrgbDoubleBuffer
} GLXWindowType;
-extern Window GLXCreateWindow(Display*,Window,int,int,int,int,int,GLXWindowType);
+extern Window GLXCreateWindow();
#undef String
@@ -104,36 +104,36 @@
* check for and fetch a boolean from ST-arg into C-dst
* ST-object must be true or false
*/
-#define _MKBOOLEAN(b) ((b==FALSE) ? false : true)
-#define _booleanVal(b) ((b==false) ? (Boolean)FALSE : (Boolean)TRUE)
+#define _MKBOOLEAN(b) ((b==FALSE) ? false : true)
+#define _booleanVal(b) ((b==false) ? (Boolean)FALSE : (Boolean)TRUE)
#define _BOOLEAN_(arg, dst) \
- if (arg==true) \
- dst = (Boolean)TRUE; \
- else if (arg==false) \
- dst = (Boolean)FALSE; \
+ if (arg==true) \
+ dst = (Boolean)TRUE; \
+ else if (arg==false) \
+ dst = (Boolean)FALSE; \
else { RETURN(false); }
/*
* check for and fetch a coord from ST-arg into C-dst
* ST-object must be Float, SmallInteger or Fraction
*/
-#define _coordVal(c) \
- ((_isFloat(c)) ? (Coord)(_floatVal(c)) \
- : (Coord)(_intVal(c)))
+#define _coordVal(c) \
+ ((_isFloat(c)) ? (Coord)(_floatVal(c)) \
+ : (Coord)(_intVal(c)))
#define _COORD_(arg, dst) \
if (_isFloat(arg)) \
dst = (Coord)(_floatVal(arg)); \
else if (_isSmallInteger(arg)) \
dst = (Coord)(_intVal(arg)); \
- else if (_isFraction(arg) \
- && _isSmallInteger(_FractionInstPtr(arg)->f_numerator) \
- && _isSmallInteger(_FractionInstPtr(arg)->f_denominator)) { \
- float n, d; \
- \
- n = (float)(_intVal(_FractionInstPtr(arg)->f_numerator)); \
- d = (float)(_intVal(_FractionInstPtr(arg)->f_denominator)); \
- dst = (Coord)(n / d); \
+ else if (_isFraction(arg) \
+ && _isSmallInteger(_FractionInstPtr(arg)->f_numerator) \
+ && _isSmallInteger(_FractionInstPtr(arg)->f_denominator)) { \
+ float n, d; \
+ \
+ n = (float)(_intVal(_FractionInstPtr(arg)->f_numerator)); \
+ d = (float)(_intVal(_FractionInstPtr(arg)->f_denominator)); \
+ dst = (Coord)(n / d); \
} else { RETURN(false); }
/*
@@ -142,7 +142,7 @@
*/
#define _icoordVal(c) ((Icoord)(_intVal(c)))
#define _ICOORD_(arg, dst) \
- if (_isSmallInteger(arg)) \
+ if (_isSmallInteger(arg)) \
dst = (Icoord)(_intVal(arg)); \
else { RETURN(false); }
@@ -152,13 +152,13 @@
*/
#define _scoordVal(c) ((Scoord)(_intVal(c)))
#define _SCOORD_(arg, dst) \
- if (_isSmallInteger(arg)) \
+ if (_isSmallInteger(arg)) \
dst = (Scoord)(_intVal(arg)); \
else { RETURN(false); }
#define _screencoordVal(c) ((Screencoord)(_intVal(c)))
#define _SCREENCOORD_(arg, dst) \
- if (_isSmallInteger(arg)) \
+ if (_isSmallInteger(arg)) \
dst = (Screencoord)(_intVal(arg)); \
else { RETURN(false); }
@@ -188,14 +188,14 @@
dst = (float)(_floatVal(arg)); \
else if (_isSmallInteger(arg)) \
dst = (float)(_intVal(arg)); \
- else if (_isFraction(arg) \
- && _isSmallInteger(_FractionInstPtr(arg)->f_numerator) \
- && _isSmallInteger(_FractionInstPtr(arg)->f_denominator)) { \
- float n, d; \
- \
- n = (float)(_intVal(_FractionInstPtr(arg)->f_numerator)); \
- d = (float)(_intVal(_FractionInstPtr(arg)->f_denominator)); \
- dst = (float)(n / d); \
+ else if (_isFraction(arg) \
+ && _isSmallInteger(_FractionInstPtr(arg)->f_numerator) \
+ && _isSmallInteger(_FractionInstPtr(arg)->f_denominator)) { \
+ float n, d; \
+ \
+ n = (float)(_intVal(_FractionInstPtr(arg)->f_numerator)); \
+ d = (float)(_intVal(_FractionInstPtr(arg)->f_denominator)); \
+ dst = (float)(n / d); \
} else { RETURN(false); }
#define _INT_(arg, dst) \
@@ -203,9 +203,9 @@
dst = (int)(_intVal(arg)); \
else { RETURN(false); }
-#define _indexedArea(object) \
- ((char *) &(_InstPtr(object)) \
- + OHDR_SIZE \
+#define _indexedArea(object) \
+ (((char *) (_InstPtr(object))) \
+ + OHDR_SIZE \
+ (_intVal(_ClassInstPtr(_qClass(object))->c_ninstvars)) * sizeof(OBJ))
/*
@@ -264,7 +264,7 @@
if (nByte < (count * sizeof(OBJ))) return (long *)NULL;
for (i=0; i<count; i++) {
o = *(OBJ *)pElem;
- if (! _isSmallInteger(o)) return (long *)NULL;
+ if (! _isSmallInteger(o)) return (long *)NULL;
vec[i] = (long)_intVal(o);
pElem += sizeof(OBJ);
}
@@ -292,7 +292,7 @@
if (nByte < (count * sizeof(OBJ))) return (short *)NULL;
for (i=0; i<count; i++) {
o = *(OBJ *)pElem;
- if (! _isSmallInteger(o)) return (short *)NULL;
+ if (! _isSmallInteger(o)) return (short *)NULL;
vec[i] = (short)_intVal(o);
pElem += sizeof(OBJ);
}
@@ -414,9 +414,9 @@
for (i=0; i<count; i++) {
o = *(OBJ *)pElem;
if (_isFloat(o))
- vec[i] = _floatVal(o);
+ vec[i] = _floatVal(o);
else if (_isSmallInteger(o))
- vec[i] = (double)(_intVal(o));
+ vec[i] = (double)(_intVal(o));
else if (_isFraction(o)
&& _isSmallInteger(_FractionInstPtr(o)->f_numerator)
&& _isSmallInteger(_FractionInstPtr(o)->f_denominator)) {
@@ -427,7 +427,7 @@
vec[i] = n / d;
} else
- return 0;
+ return 0;
pElem += sizeof(OBJ);
}
return vec;
@@ -504,16 +504,16 @@
switch (_intVal(_ClassInstPtr(cls)->c_flags) & ARRAYMASK) {
case FLOATARRAY:
- /*
- * very easy for FLOATARRAY objects - no copying needed
- */
+ /*
+ * very easy for FLOATARRAY objects - no copying needed
+ */
if (nByte < (16 * sizeof(float))) return (Matrix *)0;
return (Matrix *) _FloatArrayInstPtr(obj)->f_element;
case DOUBLEARRAY:
- /*
- * for DOUBLEARRAY objects copy and cast
- */
+ /*
+ * for DOUBLEARRAY objects copy and cast
+ */
if (nByte < (16 * sizeof(double))) return (Matrix *)0;
for (i=0; i<4; i++) {
for (j=0; j<4; j++) {
@@ -526,8 +526,8 @@
case POINTERARRAY:
if (nByte < (16 * sizeof(OBJ))) return (Matrix *)0;
/*
- * get elements one-by-one
- */
+ * get elements one-by-one
+ */
for (i=0; i<4; i++) {
for (j=0; j<4; j++) {
o = _ArrayInstPtr(obj)->a_element[x];
@@ -543,8 +543,8 @@
n = (double)(_intVal(_FractionInstPtr(o)->f_numerator));
d = (double)(_intVal(_FractionInstPtr(o)->f_denominator));
(*mp)[i][j] = n / d;
- } else
- return (Matrix *)0;
+ } else
+ return (Matrix *)0;
x++;
}
}
@@ -781,7 +781,7 @@
else if (axis == _z)
c_axis = 'z';
else {
- RETURN (false);
+ RETURN (false);
}
SETWIN(aGLXWindowId)
@@ -850,7 +850,7 @@
else if (what == _lightModel)
defType = DEFLMODEL;
else {
- RETURN (false);
+ RETURN (false);
}
_INT_ (index, i_index);
@@ -858,16 +858,16 @@
if (! _isNonNilObject(props)) fp = NULL;
else {
- cls = _qClass(props);
- if (cls == FloatArray)
+ cls = _qClass(props);
+ if (cls == FloatArray)
fp = _FloatArrayInstPtr(props)->f_element;
else {
- if ((_intVal(_ClassInstPtr(cls)->c_flags) & ARRAYMASK) == FLOATARRAY) {
- ninstVars = _intVal(_ClassInstPtr(cls)->c_ninstvars);
- fp = (float *) &(_InstPtr(props)->i_instvars[ninstVars]);
- } else {
- RETURN (false);
- }
+ if ((_intVal(_ClassInstPtr(cls)->c_flags) & ARRAYMASK) == FLOATARRAY) {
+ ninstVars = _intVal(_ClassInstPtr(cls)->c_ninstvars);
+ fp = (float *) &(_InstPtr(props)->i_instvars[ninstVars]);
+ } else {
+ RETURN (false);
+ }
}
}
SETWIN(aGLXWindowId)
@@ -922,7 +922,7 @@
else if (target == _lightModel)
defType = LMODEL;
else {
- RETURN (false);
+ RETURN (false);
}
_INT_ (index, i_index);
@@ -1753,6 +1753,36 @@
^ false
!
+glxFrontBufferIn:aGLXWindowId
+ "switch to front buffer - turning backbuffer off"
+
+%{ /* NOCONTEXT */
+ SETWIN(aGLXWindowId)
+#ifdef GLX
+ backbuffer(FALSE);
+#endif
+ frontbuffer(TRUE);
+ RETURN (true);
+%}
+.
+ ^ false
+!
+
+glxBackBufferIn:aGLXWindowId
+ "switch to back buffer - turning frontbuffer off"
+
+%{ /* NOCONTEXT */
+ SETWIN(aGLXWindowId)
+#ifdef GLX
+ frontbuffer(FALSE);
+#endif
+ backbuffer(TRUE);
+ RETURN (true);
+%}
+.
+ ^ false
+!
+
glxBackbuffer: b in: aGLXWindowId
%{ /* NOCONTEXT */
@@ -2046,9 +2076,11 @@
I defined that one too - but with a different name"
%{ /* NOCONTEXT */
- SETWIN(aGLXWindowId)
- callobj(_objectVal(obj));
- RETURN (true);
+ if (_isSmallInteger(obj)) {
+ SETWIN(aGLXWindowId)
+ callobj(_objectVal(obj));
+ RETURN (true);
+ }
%}
.
^ false
@@ -2057,9 +2089,11 @@
glxCallobj: obj in: aGLXWindowId
%{ /* NOCONTEXT */
- SETWIN(aGLXWindowId)
- callobj(_objectVal(obj));
- RETURN (true);
+ if (_isSmallInteger(obj)) {
+ SETWIN(aGLXWindowId)
+ callobj(_objectVal(obj));
+ RETURN (true);
+ }
%}
.
^ false
@@ -2193,17 +2227,21 @@
glxCloseObjectIn:aGLXWindowId
"end object defnition - JEFF and I defined this with different names"
- ^ self glxCloseobjIn: aGLXWindowId
+%{ /* NOCONTEXT */
+ SETWIN(aGLXWindowId)
+ closeobj();
+ RETURN (true);
+%}
+.
+ ^ false
!
glxCloseobjIn: aGLXWindowId
%{ /* NOCONTEXT */
-#ifdef GLX
SETWIN(aGLXWindowId)
closeobj();
RETURN (true);
-#endif
%}
.
^ false
@@ -3567,9 +3605,11 @@
another name conflict"
%{ /* NOCONTEXT */
- SETWIN(aGLXWindowId)
- makeobj(_objectVal(id));
- RETURN (true);
+ if (_isSmallInteger(id)) {
+ SETWIN(aGLXWindowId)
+ makeobj(_objectVal(id));
+ RETURN (true);
+ }
%}
.
^ false
@@ -3579,9 +3619,11 @@
"start object definition"
%{ /* NOCONTEXT */
- SETWIN(aGLXWindowId)
- makeobj(_objectVal(obj));
- RETURN (true);
+ if (_isSmallInteger(obj)) {
+ SETWIN(aGLXWindowId)
+ makeobj(_objectVal(obj));
+ RETURN (true);
+ }
%}
.
^ false