Skip to content
Browse files

Remove deprecated OS/2 code

OS/2 is no longer supported by the Perl OpenGL
module.  This commit removes that dead code.
  • Loading branch information...
1 parent 09f86bb commit b304cfeae1ec7aa307fac5d626560e800f3f140c @devel-chm devel-chm committed Aug 7, 2011
Showing with 3 additions and 593 deletions.
  1. +0 −6 Makefile.PL
  2. +0 −3 OpenGL.xs
  3. +2 −2 gl_exclude.h
  4. +0 −309 gl_util.c
  5. +0 −99 glpm_const.h
  6. +1 −19 pogl_gl_top.xs
  7. +0 −155 pogl_glut.xs
View
6 Makefile.PL
@@ -465,12 +465,6 @@ else # Everyone else
{
#delete($found_libs->{GLX});
$DEFS .= " -DHAVE_GLX";
-
- # Handle OS2 - why?
- if ($^O eq 'os2')
- {
- $DEFS .= ' -DOS2_GL_DISABLE_MISSING_EXT -DAPIENTRY= -D__PM__';
- }
}
elsif (!$found_libs->{GLX} && $verbose)
{
View
3 OpenGL.xs
@@ -125,6 +125,3 @@ BOOT:
PGOPOGL_CALL_BOOT(boot_OpenGL__GL__VertMulti);
PGOPOGL_CALL_BOOT(boot_OpenGL__GLU);
PGOPOGL_CALL_BOOT(boot_OpenGL__GLUT);
-#ifdef __PM__
- InitSys();
-#endif /* defined __PM__ */
View
4 gl_exclude.h
@@ -1,6 +1,6 @@
// OpenGL Extension Exclusions - may be modified before building.
//
-// Generated for NVIDIA Corporation, GeForce 8600 GT/PCI/SSE2
-// OpenGL v3.2.0, using FreeGLUT v20600
+// Generated for NVIDIA Corporation, GeForce 8600 GT/PCI/SSE2/3DNOW!
+// OpenGL v3.3.0, using FreeGLUT v20600
//
// Exclusions omitted for distribution build.
View
309 gl_util.c
@@ -1176,312 +1176,3 @@ GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, int mo
}
-#ifdef __PM__
-
-/* A very primitive emulation level for X under PM... */
-
-# include "os2pm_X.h"
-
-int yScreen; /* Will update ASAP */
-
-void
-InitSys(void) {
- yScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
- EventAv = newAV();
-}
-
-Bool
-XQueryPointer(display, w, root_return, child_return, root_x_return,
- root_y_return, win_x_return, win_y_return, mask_return)
- Display* display;
- Window w;
- Window* root_return;
- Window* child_return;
- int* root_x_return;
- int* root_y_return;
- int* win_x_return;
- int* win_y_return;
- unsigned int* mask_return;
-{
- POINTL pos;
- unsigned int state = 0;
- static SWP clientsize;
-
-#ifdef XDEBUG
- printf("XQueryPointer\n");
-#endif
- WinQueryPointerPos(HWND_DESKTOP, &pos);
- *root_x_return = pos.x;
- /* Translate from PM to X coordinates */
- *root_y_return = yScreen - pos.y;
-
- WinMapWindowPoints (HWND_DESKTOP, w, &pos, 1);
- *win_x_return = pos.x;
- /* Translate from PM to X coordinates */
- WinQueryWindowPos(w,&clientsize);
- *win_y_return = clientsize.cy - pos.y;
-
- *root_return = HWND_DESKTOP;
- *child_return = w;
-
- if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)
- state |= Button1MaskOS2;
- /* Report mouse as with X */
- if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)
- state |= Button2MaskOS2;
- if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)
- state |= Button3MaskOS2;
- if (WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000)
- state |= ControlMask;
- if (WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000)
- state |= ShiftMask;
- if (WinGetKeyState(HWND_DESKTOP, VK_ALT) & 0x8000)
- state |= Mod4Mask;
- if (WinGetKeyState(HWND_DESKTOP, VK_CAPSLOCK) & 0x0001)
- state |= LockMask;
- if (WinGetKeyState(HWND_DESKTOP, VK_NUMLOCK) & 0x0001)
- state |= Mod1Mask;
- if (WinGetKeyState(HWND_DESKTOP, VK_SCRLLOCK) & 0x0001)
- state |= Mod3Mask;
- *mask_return = state;
-#ifdef XDEBUG
- printf("sx = %d, sy = %d, wx = %d, wx = %d, mask = %#x. \n",
- *root_x_return, *root_y_return, *win_x_return, *win_y_return, *mask_return);
-#endif
- return True;
-}
-
-void
-XNextEvent(Display *d, XEvent *event)
-{
- SV* sv = av_shift(EventAv);
- IV n_a;
-
- StructCopy((XEvent*)SvPV(sv, n_a),event, XEvent);
- SvREFCNT_dec(sv);
-}
-
-void
-XLookupString(XKeyEvent *xkey, char *buf, int sizeof_buf, KeySym *ks, int f)
-{
- if (xkey->keycode < 256)
- *ks = (KeySym)xkey->keycode;
- else if (xkey->keycode == 256 + VK_ESC)
- *ks = (KeySym)27;
- else if (xkey->keycode == 256 + VK_ENTER)
- *ks = (KeySym)'\n';
- else if (xkey->keycode == 256 + VK_SPACE)
- *ks = (KeySym)' ';
- else if (xkey->keycode == 256 + VK_TAB)
- *ks = (KeySym)'\t';
- else
- *ks = (KeySym)'\0';
-}
-
-
-static MRESULT EXPENTRY WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM
-mp2)
-{
- static float t = 0.0;
- static SWP clientsize;
- static USHORT mycode;
- static ULONG key;
-
- switch(msg) {
- case WM_SIZE:
- WinQueryWindowPos(hwnd,&clientsize);
- if (LastEventMask & StructureNotifyMask) {
- XEvent x;
- SV *ev;
-
- x.type = ConfigureNotify;
- x.xconfigure.width = clientsize.cx;
- x.xconfigure.height = clientsize.cy;
- av_push(EventAv, newSVpv((char*)&x,sizeof(XEvent)));
- } else {
- /* Upon a resize, query new window size and set OpenGL viewport */
- glViewport(0, 0, clientsize.cx, clientsize.cy);
- }
- return WinDefWindowProc(hwnd, msg, mp1, mp2);
- case WM_TIMER:
- /* Upon getting a timer message, the invalidate rectangle call */
- /* will cause a WM_PAINT message to be sent, enabling animation */
- WinInvalidateRect(hwnd, NULLHANDLE, 0);
- return WinDefWindowProc(hwnd, msg, mp1, mp2);
- case WM_PAINT:
- if (LastEventMask & ExposureMask) {
- XEvent x;
- SV *ev;
-
- x.type = Expose;
- av_push(EventAv, newSVpv((char*)&x,sizeof(XEvent)));
- }
- return WinDefWindowProc(hwnd, msg, mp1, mp2);
- case WM_CHAR:
- mycode = (USHORT)SHORT1FROMMP(mp1);
- if ((mycode & KC_CHAR) && !(mycode & KC_KEYUP))
- key = CHAR1FROMMP(mp2);
- else if ((mycode & KC_VIRTUALKEY) && !(mycode & KC_KEYUP))
- key = CHAR3FROMMP(mp2) + 256;
- else
- key = 0;
- if (key && (LastEventMask & KeyPressMask)) {
- XEvent x;
- SV *ev;
-
- x.type = KeyPress;
- x.xkey.keycode = key;
- av_push(EventAv, newSVpv((char*)&x,sizeof(XEvent)));
- }
- return WinDefWindowProc(hwnd, msg, mp1, mp2);
- default:
- return WinDefWindowProc(hwnd, msg, mp1, mp2);
- }
-}
-
-struct Tk_Window_t {long type; HWND w;};
-
-Window
-nativeWindowId(Display *d, Window id)
-{
- if (!WinIsWindow(*d,id)) /* Tk handle? */
- return ((struct Tk_Window_t*)id)->w;
- return id;
-}
-
-
-Window
-MyCreateWindow(Display *d, Window par, int x, int y, int w, int h)
-{
- HWND hwnd = 0, hwndTop;
- int err;
-
-/* fprintf(stderr, "Creating with parent=%#lx.\n", (long)par); */
- if (par != HWND_DESKTOP) {
- ULONG createflags = 0;
-
- par = nativeWindowId(d, par);
-/* fprintf(stderr, "Creating with parent=%#lx.\n", (long)par); */
- if (!WinRegisterClass( Perl_hab,
- (PSZ)"PerlGLkid",
- WindowProc,
- CS_MOVENOTIFY, /* Need at least this! */
- /* As documented CS_SIZEREDRAW is needed too... */
- /* But this would not improve the visual appearence... */
- 0))
- croak("Cannot register class");
- err = CheckWinError(
- hwnd = WinCreateWindow(
- par, /* Parent */
- (PSZ)"PerlGLkid", /* class name */
- NULL, /* window title */
- WS_VISIBLE, /* Window style */
- x,y,w,h,
- par, /* Owner */
- HWND_TOP, /* Position */
- FID_CLIENT, /* Standard id */
- 0, /* No class data */
- 0)); /* No presentation parameters */
- } else {
- ULONG createflags = FCF_TITLEBAR |
- FCF_SYSMENU |
- FCF_MINMAX |
- FCF_TASKLIST |
- FCF_SIZEBORDER;
-
- if (!WinRegisterClass( Perl_hab,
- (PSZ)"PerlGLtop",
- WindowProc,
- CS_SIZEREDRAW | CS_MOVENOTIFY, /* Need at least this! */
- 0))
- croak("Cannot register class");
- err = CheckWinError(
- hwndTop = WinCreateStdWindow(
- par, /* Parent */
- WS_VISIBLE, /* Frame style */
- &createflags, /* min FCF_MENU|FCF_MINMAX */
- (PSZ)"PerlGLtop", /* class name */
- "OpenGL Sample",/* window title */
- WS_VISIBLE, /* client style */
- 0, /* resource handle */
- 1, /* Resource ID */
- &hwnd));
- }
- if (err)
- croak("Cannot create window, $^E=%#x", WinGetLastError(*d));
- if (!hwnd)
- croak("Error creating window");
- /* you must set window size before you call pglMakeCurrent */
- if ((par == HWND_DESKTOP) &&
- !WinSetWindowPos( hwndTop,
- HWND_TOP,
- x,
- y,
- w, /* XXXX Add border! */
- h,
- SWP_ACTIVATE | SWP_SIZE | SWP_MOVE | SWP_SHOW))
- croak("Couldn't position window!\n");
- return hwnd;
-}
-
-void
-glpMoveResizeWindow(int x, int y, unsigned int width, unsigned int height, Window w, Display* display)
-{
- SWP parPos;
-
- w = nativeWindowId(display, w);
- WinQueryWindowPos(WinQueryWindow(w, QW_PARENT), &parPos);
- /* Translate Y coordinates to PM: relative to parent */
- WinSetWindowPos(w, HWND_TOP, x, parPos.cy - height - y,
- width, height, SWP_MOVE | SWP_SIZE);
-}
-
-void
-glpMoveWindow(int x, int y, Window w, Display* display)
-{
- SWP parPos;
- SWP myPos;
-
- w = nativeWindowId(display, w);
- WinQueryWindowPos(WinQueryWindow(w, QW_PARENT), &parPos);
- WinQueryWindowPos(w, &myPos);
- /* Translate Y coordinates to PM: relative to parent */
- WinSetWindowPos(w, HWND_TOP, x, parPos.cy - myPos.cy - y,
- 0, 0, SWP_MOVE);
-}
-
-void
-glpResizeWindow(unsigned int width, unsigned int height, Window w, Display* display)
-{
- SWP parPos;
- SWP myPos;
-
- w = nativeWindowId(display, w);
- WinQueryWindowPos(WinQueryWindow(w, QW_PARENT), &parPos);
- WinQueryWindowPos(w, &myPos);
- /* Translate Y coordinates to PM: relative to parent... */
- /* Need to move too to leave the upper left corner at the same place... */
- WinSetWindowPos(w, HWND_TOP, myPos.x, parPos.cy - myPos.cy - myPos.y,
- width, height, SWP_MOVE | SWP_SIZE);
-}
-
-void
-morphPM()
-{
- PPIB pib;
- PTIB tib;
-
- DosGetInfoBlocks(&tib, &pib);
- if (pib->pib_ultype != 3) /* 2 is VIO */
- pib->pib_ultype = 3; /* 3 is PM */
-}
-
-#undef glutCreateWindow
-int
-my_glutCreateWindow(name)
-{
- morphPM();
- return glutCreateWindow(name);
-}
-
-#endif
View
99 glpm_const.h
@@ -1,99 +0,0 @@
-#ifdef __PM__
- if (1) {
- i(GLX_USE_GL)
- i(GLX_BUFFER_SIZE)
- i(GLX_LEVEL)
- i(GLX_RGBA)
- i(GLX_DOUBLEBUFFER)
- i(GLX_STEREO)
- i(GLX_AUX_BUFFERS)
- i(GLX_RED_SIZE)
- i(GLX_GREEN_SIZE)
- i(GLX_BLUE_SIZE)
- i(GLX_ALPHA_SIZE)
- i(GLX_DEPTH_SIZE)
- i(GLX_STENCIL_SIZE)
- i(GLX_ACCUM_RED_SIZE)
- i(GLX_ACCUM_GREEN_SIZE)
- i(GLX_ACCUM_BLUE_SIZE)
- i(GLX_ACCUM_ALPHA_SIZE)
-
- i(NoEventMask)
- i(KeyPressMask)
- i(KeyReleaseMask)
- i(ButtonPressMask)
- i(ButtonReleaseMask)
- i(EnterWindowMask)
- i(LeaveWindowMask)
- i(PointerMotionMask)
- i(PointerMotionHintMask)
- i(Button1MotionMask)
- i(Button2MotionMask)
- i(Button3MotionMask)
- i(Button4MotionMask)
- i(Button5MotionMask)
- i(ButtonMotionMask)
- i(KeymapStateMask)
- i(ExposureMask)
- i(VisibilityChangeMask)
- i(StructureNotifyMask)
- i(ResizeRedirectMask)
- i(SubstructureNotifyMask)
- i(SubstructureRedirectMask)
- i(FocusChangeMask)
- i(PropertyChangeMask)
- i(ColormapChangeMask)
- i(OwnerGrabButtonMask)
- i(KeyPress)
- i(KeyRelease)
- i(ButtonPress)
- i(ButtonRelease)
- i(MotionNotify)
- i(EnterNotify)
- i(LeaveNotify)
- i(FocusIn)
- i(FocusOut)
- i(KeymapNotify)
- i(Expose)
- i(GraphicsExpose)
- i(NoExpose)
- i(VisibilityNotify)
- i(CreateNotify)
- i(DestroyNotify)
- i(UnmapNotify)
- i(MapNotify)
- i(MapRequest)
- i(ReparentNotify)
- i(ConfigureNotify)
- i(ConfigureRequest)
- i(GravityNotify)
- i(ResizeRequest)
- i(CirculateNotify)
- i(CirculateRequest)
- i(PropertyNotify)
- i(SelectionClear)
- i(SelectionRequest)
- i(SelectionNotify)
- i(ColormapNotify)
- i(ClientMessage)
- i(MappingNotify)
- i(LASTEvent)
- i(ShiftMask)
- i(LockMask)
- i(ControlMask)
- i(Mod1Mask)
- i(Mod2Mask)
- i(Mod3Mask)
- i(Mod4Mask)
- i(Mod5Mask)
- i(Button1MaskOS2)
- i(Button2MaskOS2)
- i(Button3MaskOS2)
- i(Button4Mask)
- i(Button5Mask)
- i(AnyModifier)
- }
- if (0) {
- }
- else
-#endif /* def HAVE_GLX */
View
20 pogl_gl_top.xs
@@ -58,17 +58,6 @@ static Bool WaitForNotify(Display *d, XEvent *e, char *arg) {
#endif /* defined HAVE_GLX */
-#ifdef __PM__
-
-# define HAVE_GLpc /* Perl interface */
-# define auxXWindow() (croak("Not implemented: auxXWindow"),0)
-
-HMQ hmq;
-AV *EventAv;
-unsigned long LastEventMask; /* !! Common for all the windows */
-Display myDisplay;
-
-#endif /* defined __PM__ */
static int debug = 0;
@@ -394,18 +383,11 @@ _have_glp()
# /* The following material is directly copied from Stan Melax's original OpenGL-0.4 */
-#ifdef __PM__
-
-#// morphPM();
-void
-morphPM()
-
-#endif
int
__had_dbuffer_hack()
-#ifdef HAVE_GLpc /* GLX or __PM__ */
+#ifdef HAVE_GLpc /* GLX */
#// $ID = glpcOpenWindow($x,$y,$w,$h,$pw,$steal,$event_mask,@attribs);
HV *
View
155 pogl_glut.xs
@@ -58,168 +58,13 @@ char *s;
#ifdef IN_POGL_GLUT_XS
-#ifndef __PM__
# define DO_perl_call_sv(handler, flag) perl_call_sv(handler, flag)
# define ENSURE_callback_thread
# define GLUT_PUSH_NEW_SV(sv) XPUSHs(sv_2mortal(newSVsv(sv)))
# define GLUT_PUSH_NEW_IV(i) XPUSHs(sv_2mortal(newSViv(i)))
# define GLUT_PUSH_NEW_U8(c) XPUSHs(sv_2mortal(newSViv((int)c)))
# define GLUT_EXTEND_STACK(sp,n)
# define GLUT_PUSHMARK(sp) PUSHMARK(sp)
-#else
-/* GLUT on OS/2 PM runs callbacks from a secondary thread. This thread
- is not instrumented to run EMX CRTL functions. Basically, no Perl
- function may be run from this thread.
- We create a ternary thread via CRTL _beginthread() call, and communicate
- the requests to this thread via inter-thread communication (ITC). */
-
-# define GLUT_PUSHMARK(sp)
-
-# include "sys/builtin.h"
-# include "sys/fmutex.h"
-
-# include "os2pm_X.h"
-
-# define DO_perl_call_sv(handler, flag) \
- STMT_START { PUSHs(handler); \
- PUTBACK; \
- extend_by = 0; \
- RUN_perl_call_sv(); \
- } STMT_END
-
-# define GLUT_START_PUSHING 7
-# define GLUT_PUSHING_IVP 17
-# define GLUT_PUSHING_U8 27
-# define GLUT_PUSHING_SV 37
-
-# define GLUT_EXTEND_STACK(p,n) \
- STMT_START { if (PL_stack_max - p < 2*(n)+4) { \
- extend_by = 2*(n)+4; \
- RUN_perl_call_sv(); \
- } \
- SPAGAIN; \
- PUSHs((SV*)GLUT_START_PUSHING); \
- } STMT_END
-
-# define GLUT_PUSH_NEW_SV(sv) (PUSHs(sv), PUSHs((SV*)GLUT_PUSHING_SV))
-# define GLUT_PUSH_NEW_IV(i) (PUSHs((SV*)&i), PUSHs((SV*)GLUT_PUSHING_IVP))
-# define GLUT_PUSH_NEW_U8(c) (PUSHs((SV*)(int)c), PUSHs((SV*)GLUT_PUSHING_U8))
-
-_fmutex run_mutex, result_mutex;
-static int worker_started;
-static int extend_by;
-
-void
-RUN_perl_call_sv(void)
-{
- char *s = NULL;
-
- if (_fmutex_release(&run_mutex))
- s = "Error unlocking the callback thread";
- /* result_mutex is requested on entry! Block until looper finishes. */
- else if (_fmutex_request(&result_mutex, _FMR_IGNINT))
- s = "Error requesting the callback thread";
- if (s)
- write(2, s, strlen(s));
- return;
-}
-
-/* Main event handler for callbacks */
-void
-callback_thread_looper(void *dummy)
-{
- while (1) {
- /* It is requested already! Wait until somebody requests a run */
- if (_fmutex_request(&run_mutex, _FMR_IGNINT)) {
- warn("Error unlocking in the callback thread");
- worker_started = 0;
- return;
- }
- if (extend_by) { /* Need to extend the stack */
- dSP;
-
- EXTEND(sp, extend_by);
- } else {
- dSP;
- SV* handler = POPs;
- STRLEN n_a;
- SV **last = sp, **f;
-
- /* The rest is put on stack in a "raw" pointer form */
- while (1) {
- switch ((IV)*sp) {
- case GLUT_START_PUSHING:
- goto start_found;
- break;
- case GLUT_PUSHING_IVP:
- case GLUT_PUSHING_SV:
- case GLUT_PUSHING_U8:
- break;
- default:
- croak("Panic: broken descriptor/down when ITC for Glut: %#lx", (unsigned long)*sp);
- break;
- }
- sp -= 2;
- }
- start_found:
- f = sp + 1;
- sp--;
- PUSHMARK(sp);
- while (f < last) {
- switch ((IV)f[1]) {
- case GLUT_PUSHING_IVP:
- PUSHs(sv_2mortal(newSViv(*(IV*)*f)));
- break;
- case GLUT_PUSHING_U8:
- PUSHs(sv_2mortal(newSViv((IV)*f)));
- break;
- case GLUT_PUSHING_SV:
- PUSHs(sv_2mortal(newSVsv(*f)));
- break;
- default:
- croak("Panic: broken descriptor/up when ITC for Glut: %#lx", (unsigned long)f[1]);
- break;
- }
- f += 2;
- }
- PUTBACK;
- perl_call_sv(handler, G_DISCARD|G_EVAL);
- if (SvTRUE(ERRSV))
- fprintf(stderr, "Error in a GLUT Callback: %s", SvPV(ERRSV, n_a));
- }
- if (_fmutex_release(&result_mutex)) {
- warn("Error in a callback thread");
- worker_started = 0;
- return;
- }
- }
-}
-
-# define ENSURE_callback_thread \
- if (!worker_started) \
- start_callback_thread()
-
-/* Spin a thread for a callback */
-void
-start_callback_thread()
-{
- unsigned long rc;
-
- if (worker_started)
- return;
- if ( CheckOSError(_fmutex_create(&run_mutex, 0))
- || CheckOSError(_fmutex_create(&result_mutex, 0))
- || CheckOSError(_fmutex_request(&run_mutex, _FMR_IGNINT))
- || CheckOSError(_fmutex_request(&result_mutex, _FMR_IGNINT)))
- croak("Error creating semaphores");
- worker_started = _beginthread(&callback_thread_looper, NULL,
- 8*1024*1024, NULL);
- if (worker_started == -1) {
- worker_started = 0;
- croak("Error creating callback thread");
- }
-}
-#endif /* __PM__ */
#endif /* End IN_POGL_GLUT_XS */

0 comments on commit b304cfe

Please sign in to comment.
Something went wrong with that request. Please try again.