From aaaac00aa511f1b7449b2c52fbbed5ddc66a5d7c Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 26 Aug 2012 20:11:32 +0200 Subject: [PATCH] Comment fixes. --- src/init.c | 61 +++++++++++++++++++++++++++----------------------- src/internal.h | 14 +++++------- 2 files changed, 38 insertions(+), 37 deletions(-) diff --git a/src/init.c b/src/init.c index 28f3a52f..7e9fe4e7 100644 --- a/src/init.c +++ b/src/init.c @@ -36,40 +36,43 @@ #include +//------------------------------------------------------------------------ +// Flag indicating whether GLFW has been successfully initialized +//------------------------------------------------------------------------ +GLboolean _glfwInitialized = GL_FALSE; + + +//------------------------------------------------------------------------ +// All shared and API-specific global data protected by _glfwInitialized +// This should only be touched after a call to glfwInit that has not been +// followed by a call to glfwTerminate +//------------------------------------------------------------------------ +_GLFWlibrary _glfwLibrary; + + +//------------------------------------------------------------------------ +// The current GLFW error code +// This is outside of _glfwLibrary so it can be initialized and usable +// before glfwInit is called, which lets that function report errors +// TODO: Make this thread-local +//------------------------------------------------------------------------ +static int _glfwError = GLFW_NO_ERROR; + + +//------------------------------------------------------------------------ +// The current error callback +// This is outside of _glfwLibrary so it can be initialized and usable +// before glfwInit is called, which lets that function report errors +//------------------------------------------------------------------------ +static GLFWerrorfun _glfwErrorCallback = NULL; + + ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// -//======================================================================== -// Platform independent global state shared between compilation units -//======================================================================== - -// Flag indicating whether GLFW has been initialized -GLboolean _glfwInitialized = GL_FALSE; - -// All global data protected by _glfwInitialized -// This data should only be touched after a call to glfwInit that has -// not been followed by a call to glfwTerminate -_GLFWlibrary _glfwLibrary; - - -//======================================================================== -// Platform independent global error state -// These are not in _glfwLibrary because they need to be initialized and -// usable before glfwInit so it can report errors to the user -//======================================================================== - -// The current error code -// TODO: Make thread-local -static int _glfwError = GLFW_NO_ERROR; - -// The current error callback -static GLFWerrorfun _glfwErrorCallback = NULL; - - //======================================================================== // Sets the current error value -// This function may be called without GLFW having been initialized //======================================================================== void _glfwSetError(int error, const char* format, ...) @@ -160,6 +163,7 @@ GLFWAPI void glfwTerminate(void) //======================================================================== // Get GLFW version +// This function may be called without GLFW having been initialized //======================================================================== GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev) @@ -177,6 +181,7 @@ GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev) //======================================================================== // Get the GLFW version string +// This function may be called without GLFW having been initialized //======================================================================== GLFWAPI const char* glfwGetVersionString(void) diff --git a/src/internal.h b/src/internal.h index d286c5cb..9129b50c 100644 --- a/src/internal.h +++ b/src/internal.h @@ -233,15 +233,11 @@ struct _GLFWlibrary }; -//======================================================================== -// Platform independent global state shared between compilation units -// These are exported from init.c -//======================================================================== - -// Flag indicating if GLFW has been initialized +//------------------------------------------------------------------------ +// Global state shared between compilation units of GLFW +// These are exported from and documented in init.c +//------------------------------------------------------------------------ extern GLboolean _glfwInitialized; - -// All global data protected by _glfwInitialized extern _GLFWlibrary _glfwLibrary; @@ -312,7 +308,7 @@ void _glfwPlatformCopyContext(_GLFWwindow* src, _GLFWwindow* dst, unsigned long int _glfwCompareVideoModes(const GLFWvidmode* first, const GLFWvidmode* second); void _glfwSplitBPP(int bpp, int* red, int* green, int* blue); -// Error handling (error.c) +// Error handling (init.c) void _glfwSetError(int error, const char* format, ...); // Window management (window.c)