some function renaming, etc (John Fay)
authorBrian Paul <brianp@vmware.com>
Mon, 13 Sep 2004 18:09:00 +0000 (18:09 +0000)
committerBrian Paul <brianp@vmware.com>
Mon, 13 Sep 2004 18:09:00 +0000 (18:09 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@514 7f0cb862-5218-0410-a997-914c9d46530a

src/freeglut_cursor.c
src/freeglut_gamemode.c
src/freeglut_geometry.c
src/freeglut_init.c
src/freeglut_internal.h
src/freeglut_joystick.c
src/freeglut_main.c
src/freeglut_structure.c
src/freeglut_teapot.c
src/freeglut_window.c

index ef89405..bf5d2eb 100644 (file)
@@ -49,7 +49,7 @@
 
 #if TARGET_HOST_UNIX_X11
 
-int fgGetCursorError( Cursor cursor )
+static int fghGetCursorError( Cursor cursor )
 {
     int ret = 0;
     char buf[ 256 ];
@@ -90,7 +90,7 @@ void FGAPIENTRY glutSetCursor( int cursorID )
     /*
      * Open issues:
      * (a) Partial error checking.  Is that a problem?
-     *     Is fgGetCursorError() correct?  Should we abort on errors?
+     *     Is fghGetCursorError() correct?  Should we abort on errors?
      *     Should there be a freeglut-wide X error handler?  Should
      *     we use the X error-handler mechanism?
      * (b) FULL_CROSSHAIR demotes to plain CROSSHAIR.  Old GLUT allows
@@ -171,7 +171,7 @@ void FGAPIENTRY glutSetCursor( int cursorID )
             return;
         }
 
-        error = fgGetCursorError( cursor );
+        error = fghGetCursorError( cursor );
 
         if( GLUT_CURSOR_INHERIT == cursorID )
             XUndefineCursor( fgDisplay.Display,
index 5f93431..db70942 100644 (file)
@@ -48,7 +48,7 @@
  * Remembers the current visual settings, so that
  * we can change them and restore later...
  */
-void fghRememberState( void )
+static void fghRememberState( void )
 {
 #if TARGET_HOST_UNIX_X11
 
@@ -127,7 +127,7 @@ void fghRememberState( void )
 /*
  * Restores the previously remembered visual settings
  */
-void fghRestoreState( void )
+static void fghRestoreState( void )
 {
 #if TARGET_HOST_UNIX_X11
 
@@ -207,7 +207,7 @@ void fghRestoreState( void )
 /*
  * Checks the display mode settings against user's preferences
  */
-GLboolean fghCheckDisplayMode( int width, int height, int depth, int refresh )
+static GLboolean fghCheckDisplayMode( int width, int height, int depth, int refresh )
 {
     /* The desired values should be stored in fgState structure... */
     return ( width == fgState.GameModeSize.X ) &&
@@ -219,7 +219,7 @@ GLboolean fghCheckDisplayMode( int width, int height, int depth, int refresh )
 /*
  * Changes the current display mode to match user's settings
  */
-GLboolean fghChangeDisplayMode( GLboolean haveToTest )
+static GLboolean fghChangeDisplayMode( GLboolean haveToTest )
 {
 #if TARGET_HOST_UNIX_X11
 
index 3f1d24e..3e4fd3c 100644 (file)
@@ -121,7 +121,7 @@ void FGAPIENTRY glutSolidCube( GLdouble dSize )
  *    The sign of n can be flipped to get the reverse loop
  */
 
-static void circleTable(double **sint,double **cost,const int n)
+static void fghCircleTable(double **sint,double **cost,const int n)
 {
     int i;
 
@@ -144,7 +144,7 @@ static void circleTable(double **sint,double **cost,const int n)
     {
         free(*sint);
         free(*cost);
-        fgError("Failed to allocate memory in circleTable");
+        fgError("Failed to allocate memory in fghCircleTable");
     }
 
     /* Compute cos and sin around the circle */
@@ -177,8 +177,8 @@ void FGAPIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks)
 
     double *sint1,*cost1;
     double *sint2,*cost2;
-    circleTable(&sint1,&cost1,-slices);
-    circleTable(&sint2,&cost2,stacks*2);
+    fghCircleTable(&sint1,&cost1,-slices);
+    fghCircleTable(&sint2,&cost2,stacks*2);
 
     /* The top stack is covered with a triangle fan */
 
@@ -262,8 +262,8 @@ void FGAPIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks)
 
     double *sint1,*cost1;
     double *sint2,*cost2;
-    circleTable(&sint1,&cost1,-slices  );
-    circleTable(&sint2,&cost2, stacks*2);
+    fghCircleTable(&sint1,&cost1,-slices  );
+    fghCircleTable(&sint2,&cost2, stacks*2);
 
     /* Draw a line loop for each stack */
 
@@ -336,7 +336,7 @@ void FGAPIENTRY glutSolidCone( GLdouble base, GLdouble height, GLint slices, GLi
     /* Pre-computed circle */
 
     double *sint,*cost;
-    circleTable(&sint,&cost,-slices);
+    fghCircleTable(&sint,&cost,-slices);
 
     /* Cover the circular base with a triangle fan... */
 
@@ -420,7 +420,7 @@ void FGAPIENTRY glutWireCone( GLdouble base, GLdouble height, GLint slices, GLin
     /* Pre-computed circle */
 
     double *sint,*cost;
-    circleTable(&sint,&cost,-slices);
+    fghCircleTable(&sint,&cost,-slices);
 
     /* Draw the stacks... */
 
@@ -477,7 +477,7 @@ void FGAPIENTRY glutSolidCylinder(GLdouble radius, GLdouble height, GLint slices
     /* Pre-computed circle */
 
     double *sint,*cost;
-    circleTable(&sint,&cost,-slices);
+    fghCircleTable(&sint,&cost,-slices);
 
     /* Cover the base and top */
 
@@ -538,7 +538,7 @@ void FGAPIENTRY glutWireCylinder(GLdouble radius, GLdouble height, GLint slices,
     /* Pre-computed circle */
 
     double *sint,*cost;
-    circleTable(&sint,&cost,-slices);
+    fghCircleTable(&sint,&cost,-slices);
 
     /* Draw the stacks... */
 
index 57df74e..0853d35 100644 (file)
@@ -95,7 +95,7 @@ SFG_State fgState = { { -1, -1, GL_FALSE },  /* Position */
 /*
  * A call to this function should initialize all the display stuff...
  */
-void fgInitialize( const char* displayName )
+static void fghInitialize( const char* displayName )
 {
 #if TARGET_HOST_UNIX_X11
     fgDisplay.Display = XOpenDisplay( displayName );
@@ -616,7 +616,7 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
      * in the program arguments, we will use the DISPLAY environment
      * variable for opening the X display (see code above):
      */
-    fgInitialize( displayName );
+    fghInitialize( displayName );
 
     /*
      * Geometry parsing deffered until here because we may need the screen
index 1603df7..adfcb1b 100644 (file)
@@ -655,11 +655,9 @@ extern SFG_State fgState;
 #define  freeglut_assert_menu   assert( fgStructure.Menu != NULL );
 
 /*
- * The initialize and deinitialize functions get called on glutInit()
- * and glutMainLoop() end respectively. They should create/clean up
+ * The deinitialize function gets called on glutMainLoop() end. It should clean up
  * everything inside of the freeglut
  */
-void fgInitialize( const char* displayName );
 void fgDeinitialize( void );
 
 /*
index 43e4495..1115076 100644 (file)
@@ -437,14 +437,14 @@ io_object_t ioDevices[K_NUM_DEVICES];
 static void fghJoystickFindDevices ( SFG_Joystick* joy, mach_port_t );
 static CFDictionaryRef fghJoystickGetCFProperties ( SFG_Joystick* joy, io_object_t );
 
-void fghJoystickEnumerateElements ( SFG_Joystick* joy, CFTypeRef element );
+static void fghJoystickEnumerateElements ( SFG_Joystick* joy, CFTypeRef element );
 /* callback for CFArrayApply */
 static void fghJoystickElementEnumerator ( SFG_Joystick* joy, void *element, void* vjs );
-void fghJoystickParseElement ( SFG_Joystick* joy, CFDictionaryRef element );
+static void fghJoystickParseElement ( SFG_Joystick* joy, CFDictionaryRef element );
 
-void fghJoystickAddAxisElement ( SFG_Joystick* joy, CFDictionaryRef axis );
-void fghJoystickAddButtonElement ( SFG_Joystick* joy, CFDictionaryRef button );
-void fghJoystickAddHatElement ( SFG_Joystick* joy, CFDictionaryRef hat );
+static void fghJoystickAddAxisElement ( SFG_Joystick* joy, CFDictionaryRef axis );
+static void fghJoystickAddButtonElement ( SFG_Joystick* joy, CFDictionaryRef button );
+static void fghJoystickAddHatElement ( SFG_Joystick* joy, CFDictionaryRef hat );
 #endif
 
 
index 5ad233c..529e9e1 100644 (file)
@@ -413,44 +413,44 @@ void fgWarning( const char *fmt, ... )
  * and all other "joystick timer" code can be yanked.
  *
  */
-static void fgCheckJoystickCallback( SFG_Window* w, SFG_Enumerator* e)
+static void fghCheckJoystickCallback( SFG_Window* w, SFG_Enumerator* e)
 {
     if( FETCH_WCB( *w, Joystick ) )
     {
         e->found = GL_TRUE;
         e->data = w;
     }
-    fgEnumSubWindows( w, fgCheckJoystickCallback, e );
+    fgEnumSubWindows( w, fghCheckJoystickCallback, e );
 }
-static int fgHaveJoystick( void )
+static int fghHaveJoystick( void )
 {
     SFG_Enumerator enumerator;
     enumerator.found = GL_FALSE;
     enumerator.data = NULL;
-    fgEnumWindows( fgCheckJoystickCallback, &enumerator );
+    fgEnumWindows( fghCheckJoystickCallback, &enumerator );
     return !!enumerator.data;
 }
-static void fgHavePendingRedisplaysCallback( SFG_Window* w, SFG_Enumerator* e)
+static void fghHavePendingRedisplaysCallback( SFG_Window* w, SFG_Enumerator* e)
 {
     if( w->State.Redisplay )
     {
         e->found = GL_TRUE;
         e->data = w;
     }
-    fgEnumSubWindows( w, fgHavePendingRedisplaysCallback, e );
+    fgEnumSubWindows( w, fghHavePendingRedisplaysCallback, e );
 }
-static int fgHavePendingRedisplays (void)
+static int fghHavePendingRedisplays (void)
 {
     SFG_Enumerator enumerator;
     enumerator.found = GL_FALSE;
     enumerator.data = NULL;
-    fgEnumWindows( fgHavePendingRedisplaysCallback, &enumerator );
+    fgEnumWindows( fghHavePendingRedisplaysCallback, &enumerator );
     return !!enumerator.data;
 }
 /*
  * Returns the number of GLUT ticks (milliseconds) till the next timer event.
  */
-static long fgNextTimer( void )
+static long fghNextTimer( void )
 {
     long ret = INT_MAX;
     SFG_Timer *timer = fgState.Timers.First;
@@ -466,16 +466,16 @@ static long fgNextTimer( void )
  * Does the magic required to relinquish the CPU until something interesting
  * happens.
  */
-static void fgSleepForEvents( void )
+static void fghSleepForEvents( void )
 {
     long msec;
 
-    if( fgState.IdleCallback || fgHavePendingRedisplays( ) )
+    if( fgState.IdleCallback || fghHavePendingRedisplays( ) )
         return;
 
-    msec = fgNextTimer( );
-    if( fgHaveJoystick( ) )     /* XXX Use GLUT timers for joysticks... */
-        msec = MIN( msec, 10 ); /* XXX Dumb; forces granularity to .01sec */
+    msec = fghNextTimer( );
+    if( fghHaveJoystick( ) )     /* XXX Use GLUT timers for joysticks... */
+        msec = MIN( msec, 10 );  /* XXX Dumb; forces granularity to .01sec */
 
 #if TARGET_HOST_UNIX_X11
     /*
@@ -513,7 +513,7 @@ static void fgSleepForEvents( void )
 /*
  * Returns GLUT modifier mask for an XEvent.
  */
-int fgGetXModifiers( XEvent *event )
+static int fghGetXModifiers( XEvent *event )
 {
     int ret = 0;
 
@@ -871,7 +871,7 @@ void FGAPIENTRY glutMainLoopEvent( void )
                 ! FETCH_WCB( *window, MouseWheel ) )
                 break;
 
-            fgState.Modifiers = fgGetXModifiers( &event );
+            fgState.Modifiers = fghGetXModifiers( &event );
 
             /*
              * Finally execute the mouse or mouse wheel callback
@@ -995,7 +995,7 @@ void FGAPIENTRY glutMainLoopEvent( void )
                     if( keyboard_cb )
                     {
                         fgSetWindow( window );
-                        fgState.Modifiers = fgGetXModifiers( &event );
+                        fgState.Modifiers = fghGetXModifiers( &event );
                         keyboard_cb( asciiCode[ 0 ],
                                      event.xkey.x, event.xkey.y
                         );
@@ -1049,7 +1049,7 @@ void FGAPIENTRY glutMainLoopEvent( void )
                     if( special_cb && (special != -1) )
                     {
                         fgSetWindow( window );
-                        fgState.Modifiers = fgGetXModifiers( &event );
+                        fgState.Modifiers = fghGetXModifiers( &event );
                         special_cb( special, event.xkey.x, event.xkey.y );
                         fgState.Modifiers = 0xffffffff;
                     }
@@ -1160,7 +1160,7 @@ void FGAPIENTRY glutMainLoop( void )
             if( fgState.IdleCallback )
                 fgState.IdleCallback( );
 
-            fgSleepForEvents( );
+            fghSleepForEvents( );
         }
     }
 
@@ -1189,7 +1189,7 @@ void FGAPIENTRY glutLeaveMainLoop( void )
 /*
  * Determine a GLUT modifer mask based on MS-WINDOWS system info.
  */
-int fgGetWin32Modifiers (void)
+static int fghGetWin32Modifiers (void)
 {
     return
         ( ( ( GetKeyState( VK_LSHIFT   ) < 0 ) ||
@@ -1415,7 +1415,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
             break;
         }
 
-        fgState.Modifiers = fgGetWin32Modifiers( );
+        fgState.Modifiers = fghGetWin32Modifiers( );
 
         if( ( wParam & MK_LBUTTON ) ||
             ( wParam & MK_MBUTTON ) ||
@@ -1567,7 +1567,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
             break;
 
         fgSetWindow( window );
-        fgState.Modifiers = fgGetWin32Modifiers( );
+        fgState.Modifiers = fghGetWin32Modifiers( );
 
         INVOKE_WCB(
             *window, Mouse,
@@ -1612,7 +1612,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
             break;
 
         fgSetWindow( window );
-        fgState.Modifiers = fgGetWin32Modifiers( );
+        fgState.Modifiers = fghGetWin32Modifiers( );
 
         while( ticks-- )
             if( FETCH_WCB( *window, MouseWheel ) )
@@ -1659,7 +1659,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
          * Remember the current modifiers state. This is done here in order
          * to make sure the VK_DELETE keyboard callback is executed properly.
          */
-        fgState.Modifiers = fgGetWin32Modifiers( );
+        fgState.Modifiers = fghGetWin32Modifiers( );
 
         GetCursorPos( &mouse_pos );
         ScreenToClient( window->Window.Handle, &mouse_pos );
@@ -1747,7 +1747,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
          * Remember the current modifiers state. This is done here in order
          * to make sure the VK_DELETE keyboard callback is executed properly.
          */
-        fgState.Modifiers = fgGetWin32Modifiers( );
+        fgState.Modifiers = fghGetWin32Modifiers( );
 
         GetCursorPos( &mouse_pos );
         ScreenToClient( window->Window.Handle, &mouse_pos );
@@ -1828,7 +1828,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
       if( (fgState.KeyRepeat==GLUT_KEY_REPEAT_OFF || window->State.IgnoreKeyRepeat==GL_TRUE) && (HIWORD(lParam) & KF_REPEAT) )
             break;
 
-        fgState.Modifiers = fgGetWin32Modifiers( );
+        fgState.Modifiers = fghGetWin32Modifiers( );
         INVOKE_WCB( *window, Keyboard,
                     ( (char)wParam,
                       window->State.MouseX, window->State.MouseY )
index 9656836..6e1f542 100644 (file)
@@ -53,7 +53,7 @@ SFG_Structure fgStructure = { { NULL, NULL },  /* The list of windows       */
 
 /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
 
-void fgClearCallBacks( SFG_Window *window )
+static void fghClearCallBacks( SFG_Window *window )
 {
     if( window )
     {
@@ -77,7 +77,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
     SFG_Window *window = (SFG_Window *)calloc( sizeof(SFG_Window), 1 );
     int fakeArgc = 0;
 
-    fgClearCallBacks( window );
+    fghClearCallBacks( window );
 
     /*
      * If the freeglut internals haven't been initialized yet,
@@ -187,7 +187,7 @@ void fgAddToWindowDestroyList( SFG_Window* window )
      */
     {
         FGCBDestroy destroy = FETCH_WCB( *window, Destroy );
-        fgClearCallBacks( window );
+        fghClearCallBacks( window );
         SET_WCB( *window, Destroy, destroy );
     }
 }
@@ -239,7 +239,7 @@ void fgDestroyWindow( SFG_Window* window )
         if( window->Menu[ menu_index ] )
             window->Menu[ menu_index ]->ParentWindow = NULL;
 
-    fgClearCallBacks( window );
+    fghClearCallBacks( window );
     fgCloseWindow( window );
     free( window );
     if( fgStructure.Window == window )
index 3a5d3f6..0956642 100644 (file)
@@ -84,7 +84,7 @@
 /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */
 
 
-static void teapot( GLint grid, GLdouble scale, GLenum type )
+static void fghTeapot( GLint grid, GLdouble scale, GLenum type )
 {
 #if TARGET_HOST_WINCE
                int i, numV=sizeof(strip_vertices)/4, numI=sizeof(strip_normals)/4;
@@ -183,7 +183,7 @@ static void teapot( GLint grid, GLdouble scale, GLenum type )
 void FGAPIENTRY glutWireTeapot( GLdouble size )
 {
     /* We will use the general teapot rendering code */
-    teapot( 10, size, GL_LINE );
+    fghTeapot( 10, size, GL_LINE );
 }
 
 /*
@@ -192,7 +192,7 @@ void FGAPIENTRY glutWireTeapot( GLdouble size )
 void FGAPIENTRY glutSolidTeapot( GLdouble size )
 {
     /* We will use the general teapot rendering code */
-    teapot( 7, size, GL_FILL );
+    fghTeapot( 7, size, GL_FILL );
 }
 
 /*** END OF FILE ***/
index 5a570b7..c0714aa 100644 (file)
@@ -36,7 +36,7 @@
 #include <aygshell.h>
 #pragma comment( lib, "Aygshell.lib" )
 
-wchar_t* wstr_from_str(const char* str)
+static wchar_t* fghWstrFromStr(const char* str)
 {
     int i,len=strlen(str);
     wchar_t* wstr = (wchar_t*)malloc(2*len+2);
@@ -558,7 +558,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
 
 #if TARGET_HOST_WINCE
     {
-        wchar_t* wstr = wstr_from_str(title);
+        wchar_t* wstr = fghWstrFromStr(title);
 
         window->Window.Handle = CreateWindow(
             _T("FREEGLUT"),
@@ -849,7 +849,7 @@ void FGAPIENTRY glutSetWindowTitle( const char* title )
 
 #elif TARGET_HOST_WINCE
         {
-            wchar_t* wstr = wstr_from_str(title);
+            wchar_t* wstr = fghWstrFromStr(title);
 
             SetWindowText( fgStructure.Window->Window.Handle, wstr );
 
@@ -892,7 +892,7 @@ void FGAPIENTRY glutSetIconTitle( const char* title )
 
 #elif TARGET_HOST_WINCE
         {
-            wchar_t* wstr = wstr_from_str(title);
+            wchar_t* wstr = fghWstrFromStr(title);
 
             SetWindowText( fgStructure.Window->Window.Handle, wstr );