| @@ -59,7 +59,7 @@ String String::Printf(char const *format, va_list ap) | |||||
| /* vsnprintf() tells us how many character we need, and we need to | /* vsnprintf() tells us how many character we need, and we need to | ||||
| * add one for the terminating null byte. */ | * add one for the terminating null byte. */ | ||||
| size_t needed = vsnprintf(NULL, 0, format, ap2) + 1; | |||||
| size_t needed = vsnprintf(nullptr, 0, format, ap2) + 1; | |||||
| ((Super &)ret).Reserve(needed); | ((Super &)ret).Reserve(needed); | ||||
| ret.m_count = needed; | ret.m_count = needed; | ||||
| @@ -45,6 +45,18 @@ | |||||
| # define FP_USE(x) (void)(x) | # define FP_USE(x) (void)(x) | ||||
| #endif | #endif | ||||
| /* Ensure we have nullptr */ | |||||
| #if defined nullptr | |||||
| /* do nothing */ | |||||
| #elif defined __GNUC__ | |||||
| # define nullptr __null | |||||
| #else | |||||
| # include <cstddef> | |||||
| # define nullptr NULL | |||||
| #endif | |||||
| /* Ensure isnan() is present even on systems that don't define it, or | /* Ensure isnan() is present even on systems that don't define it, or | ||||
| * when -ffast-math is being used. */ | * when -ffast-math is being used. */ | ||||
| #include <cmath> | #include <cmath> | ||||
| @@ -44,12 +44,12 @@ DebugFps::DebugFps(int x, int y) | |||||
| #if 0 | #if 0 | ||||
| for (int i = 0; i < 5; i ++) | for (int i = 0; i < 5; i ++) | ||||
| { | { | ||||
| data->lines[i] = new Text(NULL, "data/font/ascii.png"); | |||||
| data->lines[i] = new Text(nullptr, "data/font/ascii.png"); | |||||
| data->lines[i]->SetPos(ivec3(x, y + (i ? 8 : 0) + 16 * i, 0)); | data->lines[i]->SetPos(ivec3(x, y + (i ? 8 : 0) + 16 * i, 0)); | ||||
| Ticker::Ref(data->lines[i]); | Ticker::Ref(data->lines[i]); | ||||
| } | } | ||||
| #else | #else | ||||
| data->lines[0] = new Text(NULL, "data/font/ascii.png"); | |||||
| data->lines[0] = new Text(nullptr, "data/font/ascii.png"); | |||||
| data->lines[0]->SetPos(ivec3(x, y, 100)); | data->lines[0]->SetPos(ivec3(x, y, 100)); | ||||
| Ticker::Ref(data->lines[0]); | Ticker::Ref(data->lines[0]); | ||||
| #endif | #endif | ||||
| @@ -56,7 +56,7 @@ DebugRecord::DebugRecord(char const *path, float fps) | |||||
| data->size = ivec2(0); | data->size = ivec2(0); | ||||
| data->fps = (int)(fps + 0.5f); | data->fps = (int)(fps + 0.5f); | ||||
| #if defined USE_PIPI | #if defined USE_PIPI | ||||
| data->sequence = NULL; | |||||
| data->sequence = nullptr; | |||||
| #endif | #endif | ||||
| m_drawgroup = DRAWGROUP_CAPTURE; | m_drawgroup = DRAWGROUP_CAPTURE; | ||||
| @@ -106,10 +106,10 @@ int Dict::MakeSlot(char const *name) | |||||
| if (slotid == data->m_entities.Count()) | if (slotid == data->m_entities.Count()) | ||||
| { | { | ||||
| empty = data->m_entities.Count(); | empty = data->m_entities.Count(); | ||||
| data->m_entities.Push(NULL); | |||||
| data->m_entities.Push(nullptr); | |||||
| } | } | ||||
| data->m_entities[empty] = NULL; | |||||
| data->m_entities[empty] = nullptr; | |||||
| slotid = empty; | slotid = empty; | ||||
| data->nentities++; | data->nentities++; | ||||
| } | } | ||||
| @@ -125,7 +125,7 @@ void Dict::RemoveSlot(int slotid) | |||||
| { | { | ||||
| if (Ticker::Unref(data->m_entities[slotid]) == 0) | if (Ticker::Unref(data->m_entities[slotid]) == 0) | ||||
| { | { | ||||
| data->m_entities[slotid] = NULL; | |||||
| data->m_entities[slotid] = nullptr; | |||||
| data->nentities--; | data->nentities--; | ||||
| } | } | ||||
| } | } | ||||
| @@ -110,14 +110,14 @@ at { return token::T_TRIANGLE; } | |||||
| ato { return token::T_TORUS; } | ato { return token::T_TORUS; } | ||||
| #[0-9a-fA-F]{3} { | #[0-9a-fA-F]{3} { | ||||
| uint32_t tmp = std::strtol(yytext + 1, NULL, 16); | |||||
| uint32_t tmp = std::strtol(yytext + 1, nullptr, 16); | |||||
| yylval->u32val = 0x11000000u * (tmp >> 8) | yylval->u32val = 0x11000000u * (tmp >> 8) | ||||
| | 0x00110000u * ((tmp >> 4) & 0xf) | | 0x00110000u * ((tmp >> 4) & 0xf) | ||||
| | 0x00001100u * (tmp & 0xf) | | 0x00001100u * (tmp & 0xf) | ||||
| | 0x000000ffu; | | 0x000000ffu; | ||||
| return token::COLOR; } | return token::COLOR; } | ||||
| #[0-9a-fA-F]{4} { | #[0-9a-fA-F]{4} { | ||||
| uint32_t tmp = std::strtol(yytext + 1, NULL, 16); | |||||
| uint32_t tmp = std::strtol(yytext + 1, nullptr, 16); | |||||
| yylval->u32val = 0x11000000u * (tmp >> 12) | yylval->u32val = 0x11000000u * (tmp >> 12) | ||||
| | 0x00110000u * ((tmp >> 8) & 0xf) | | 0x00110000u * ((tmp >> 8) & 0xf) | ||||
| | 0x00001100u * ((tmp >> 4) & 0xf) | | 0x00001100u * ((tmp >> 4) & 0xf) | ||||
| @@ -125,10 +125,10 @@ ato { return token::T_TORUS; } | |||||
| return token::COLOR; } | return token::COLOR; } | ||||
| #[0-9a-fA-F]{6} { | #[0-9a-fA-F]{6} { | ||||
| yylval->u32val = 0xffu | yylval->u32val = 0xffu | ||||
| | 0x100u * (uint32_t)std::strtol(yytext + 1, NULL, 16); | |||||
| | 0x100u * (uint32_t)std::strtol(yytext + 1, nullptr, 16); | |||||
| return token::COLOR; } | return token::COLOR; } | ||||
| #[0-9a-fA-F]{8} { | #[0-9a-fA-F]{8} { | ||||
| yylval->u32val = (uint32_t)std::strtol(yytext + 1, NULL, 16); | |||||
| yylval->u32val = (uint32_t)std::strtol(yytext + 1, nullptr, 16); | |||||
| return token::COLOR; } | return token::COLOR; } | ||||
| [-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)? { | [-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)? { | ||||
| yylval->fval = std::atof(yytext); return token::NUMBER; } | yylval->fval = std::atof(yytext); return token::NUMBER; } | ||||
| @@ -85,7 +85,7 @@ ShaderUniform const *GpuShaderData::GetUniform(const lol::String &uniform) | |||||
| for (int i = 0; i < m_shader_uniform.Count(); ++i) | for (int i = 0; i < m_shader_uniform.Count(); ++i) | ||||
| if (m_shader_uniform[i].m1 == uniform) | if (m_shader_uniform[i].m1 == uniform) | ||||
| return &m_shader_uniform[i].m2; | return &m_shader_uniform[i].m2; | ||||
| return NULL; | |||||
| return nullptr; | |||||
| } | } | ||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
| @@ -94,7 +94,7 @@ ShaderAttrib const *GpuShaderData::GetAttribute(const lol::String &attribute) | |||||
| for (int i = 0; i < m_shader_attrib.Count(); ++i) | for (int i = 0; i < m_shader_attrib.Count(); ++i) | ||||
| if (m_shader_attrib[i].m1 == attribute) | if (m_shader_attrib[i].m1 == attribute) | ||||
| return &m_shader_attrib[i].m2; | return &m_shader_attrib[i].m2; | ||||
| return NULL; | |||||
| return nullptr; | |||||
| } | } | ||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
| @@ -181,7 +181,7 @@ GpuEasyMeshData::GpuEasyMeshData() | |||||
| { | { | ||||
| m_vertexcount = 0; | m_vertexcount = 0; | ||||
| m_indexcount = 0; | m_indexcount = 0; | ||||
| m_ibo = NULL; | |||||
| m_ibo = nullptr; | |||||
| } | } | ||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
| @@ -220,7 +220,7 @@ void GpuEasyMeshData::AddGpuData(GpuShaderData* gpudata, EasyMesh* src_mesh) | |||||
| { | { | ||||
| m_gpudatas.Reserve(DebugRenderMode::Max); | m_gpudatas.Reserve(DebugRenderMode::Max); | ||||
| for (int i = 0; i < DebugRenderMode::Max; i++) | for (int i = 0; i < DebugRenderMode::Max; i++) | ||||
| m_gpudatas << NULL; | |||||
| m_gpudatas << nullptr; | |||||
| } | } | ||||
| m_gpudatas[gpudata->m_render_mode] = gpudata; | m_gpudatas[gpudata->m_render_mode] = gpudata; | ||||
| } | } | ||||
| @@ -232,9 +232,9 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vdecl_flags, EasyMesh* src_mesh) | |||||
| if (m_vdatas[i].m1 == vdecl_flags) | if (m_vdatas[i].m1 == vdecl_flags) | ||||
| return; | return; | ||||
| VertexDeclaration* new_vdecl = NULL; | |||||
| VertexBuffer* new_vbo = NULL; | |||||
| void *vbo_data = NULL; | |||||
| VertexDeclaration* new_vdecl = nullptr; | |||||
| VertexBuffer* new_vbo = nullptr; | |||||
| void *vbo_data = nullptr; | |||||
| int vbo_bytes = 0; | int vbo_bytes = 0; | ||||
| #define COPY_VBO \ | #define COPY_VBO \ | ||||
| @@ -364,7 +364,7 @@ void GpuEasyMeshData::RenderMeshData(mat4 const &model) | |||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
| EasyMesh::EasyMesh() | EasyMesh::EasyMesh() | ||||
| : m_build_data(NULL) | |||||
| : m_build_data(nullptr) | |||||
| { | { | ||||
| m_cursors.Push(0, 0); | m_cursors.Push(0, 0); | ||||
| } | } | ||||
| @@ -391,7 +391,7 @@ void EasyMesh::CloseBrace() | |||||
| void EasyMesh::MeshConvert(GpuShaderData* new_gpu_sdata) | void EasyMesh::MeshConvert(GpuShaderData* new_gpu_sdata) | ||||
| { | { | ||||
| delete(m_build_data); | delete(m_build_data); | ||||
| m_build_data = NULL; | |||||
| m_build_data = nullptr; | |||||
| if (new_gpu_sdata) | if (new_gpu_sdata) | ||||
| { | { | ||||
| @@ -2250,7 +2250,7 @@ void EasyMesh::Chamfer(float f) | |||||
| } | } | ||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
| void EasyMesh::SplitTriangles(int pass) { SplitTriangles(pass, NULL); } | |||||
| void EasyMesh::SplitTriangles(int pass) { SplitTriangles(pass, nullptr); } | |||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
| void EasyMesh::SplitTriangles(int pass, VertexDictionnary *vert_dict) | void EasyMesh::SplitTriangles(int pass, VertexDictionnary *vert_dict) | ||||
| @@ -487,10 +487,10 @@ class VertexDictionnary | |||||
| public: | public: | ||||
| int FindVertexMaster(const int search_idx); | int FindVertexMaster(const int search_idx); | ||||
| bool FindMatchingVertices(const int search_idx, Array<int> &matching_ids); | bool FindMatchingVertices(const int search_idx, Array<int> &matching_ids); | ||||
| bool FindConnectedVertices(const int search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_vert, Array<int> const *ignored_tri = NULL); | |||||
| bool FindConnectedTriangles(const int search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_tri, Array<int> const *ignored_tri = NULL); | |||||
| bool FindConnectedTriangles(const ivec2 &search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_tri, Array<int> const *ignored_tri = NULL); | |||||
| bool FindConnectedTriangles(const ivec3 &search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_tri, Array<int> const *ignored_tri = NULL); | |||||
| bool FindConnectedVertices(const int search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_vert, Array<int> const *ignored_tri = nullptr); | |||||
| bool FindConnectedTriangles(const int search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_tri, Array<int> const *ignored_tri = nullptr); | |||||
| bool FindConnectedTriangles(const ivec2 &search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_tri, Array<int> const *ignored_tri = nullptr); | |||||
| bool FindConnectedTriangles(const ivec3 &search_idx, const Array<uint16_t> &tri_list, const int tri0, Array<int> &connected_tri, Array<int> const *ignored_tri = nullptr); | |||||
| void AddVertex(int vert_id, vec3 vert_coord); | void AddVertex(int vert_id, vec3 vert_coord); | ||||
| bool GetMasterList(Array<int> &ret_master_list) { ret_master_list = master_list; return ret_master_list.Count() > 0; } | bool GetMasterList(Array<int> &ret_master_list) { ret_master_list = master_list; return ret_master_list.Count() > 0; } | ||||
| void Clear() { vertex_list.Empty(); } | void Clear() { vertex_list.Empty(); } | ||||
| @@ -524,7 +524,7 @@ public: | |||||
| bool Compile(char const *command); | bool Compile(char const *command); | ||||
| void MeshConvert(GpuShaderData* new_gpu_sdata); | void MeshConvert(GpuShaderData* new_gpu_sdata); | ||||
| void MeshConvert(Shader* ProvidedShader = NULL); | |||||
| void MeshConvert(Shader* ProvidedShader = nullptr); | |||||
| void Render(mat4 const &model); | void Render(mat4 const &model); | ||||
| private: | private: | ||||
| @@ -78,8 +78,8 @@ EglApp::EglApp(char const *title, ivec2 res, float fps) : | |||||
| data->egl_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); | data->egl_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); | ||||
| # else | # else | ||||
| data->dpy = XOpenDisplay(NULL); | |||||
| if (data->dpy == NULL) | |||||
| data->dpy = XOpenDisplay(nullptr); | |||||
| if (data->dpy == nullptr) | |||||
| { | { | ||||
| Log::Error("cannot connect to X server\n"); | Log::Error("cannot connect to X server\n"); | ||||
| exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
| @@ -115,7 +115,7 @@ EglApp::EglApp(char const *title, ivec2 res, float fps) : | |||||
| exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
| } | } | ||||
| if (!eglInitialize(data->egl_dpy, NULL, NULL)) | |||||
| if (!eglInitialize(data->egl_dpy, nullptr, nullptr)) | |||||
| { | { | ||||
| Log::Error("cannot initialize EGL\n"); | Log::Error("cannot initialize EGL\n"); | ||||
| exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
| @@ -187,11 +187,11 @@ EglApp::EglApp(char const *title, ivec2 res, float fps) : | |||||
| vc_dispmanx_update_submit_sync(dispman_update); | vc_dispmanx_update_submit_sync(dispman_update); | ||||
| data->egl_surf = eglCreateWindowSurface(data->egl_dpy, ecfg, | data->egl_surf = eglCreateWindowSurface(data->egl_dpy, ecfg, | ||||
| &data->nativewindow, NULL); | |||||
| &data->nativewindow, nullptr); | |||||
| # else | # else | ||||
| data->egl_surf = eglCreateWindowSurface(data->egl_dpy, ecfg, | data->egl_surf = eglCreateWindowSurface(data->egl_dpy, ecfg, | ||||
| (EGLNativeWindowType)data->win, | (EGLNativeWindowType)data->win, | ||||
| NULL); | |||||
| nullptr); | |||||
| # endif | # endif | ||||
| if (data->egl_surf == EGL_NO_SURFACE) | if (data->egl_surf == EGL_NO_SURFACE) | ||||
| { | { | ||||
| @@ -1,8 +1,8 @@ | |||||
| /* A Bison parser, made by GNU Bison 2.4.2. */ | |||||
| /* A Bison parser, made by GNU Bison 2.5. */ | |||||
| /* Skeleton interface for Bison LALR(1) parsers in C++ | /* Skeleton interface for Bison LALR(1) parsers in C++ | ||||
| Copyright (C) 2002-2010 Free Software Foundation, Inc. | |||||
| Copyright (C) 2002-2011 Free Software Foundation, Inc. | |||||
| This program is free software: you can redistribute it and/or modify | This program is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU General Public License as published by | it under the terms of the GNU General Public License as published by | ||||
| @@ -40,20 +40,6 @@ | |||||
| #include <string> | #include <string> | ||||
| #include <iostream> | #include <iostream> | ||||
| #include "stack.hh" | #include "stack.hh" | ||||
| namespace lol { | |||||
| /* Line 34 of lalr1.cc */ | |||||
| #line 49 "generated/easymesh-parser.h" | |||||
| class position; | |||||
| class location; | |||||
| } // lol | |||||
| /* Line 34 of lalr1.cc */ | |||||
| #line 56 "generated/easymesh-parser.h" | |||||
| #include "location.hh" | #include "location.hh" | ||||
| /* Enabling traces. */ | /* Enabling traces. */ | ||||
| @@ -74,30 +60,11 @@ namespace lol { | |||||
| # define YYTOKEN_TABLE 0 | # define YYTOKEN_TABLE 0 | ||||
| #endif | #endif | ||||
| /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. | |||||
| If N is 0, then set CURRENT to the empty location which ends | |||||
| the previous symbol: RHS[0] (always defined). */ | |||||
| #ifndef YYLLOC_DEFAULT | |||||
| # define YYLLOC_DEFAULT(Current, Rhs, N) \ | |||||
| do { \ | |||||
| if (N) \ | |||||
| { \ | |||||
| (Current).begin = (Rhs)[1].begin; \ | |||||
| (Current).end = (Rhs)[N].end; \ | |||||
| } \ | |||||
| else \ | |||||
| { \ | |||||
| (Current).begin = (Current).end = (Rhs)[0].end; \ | |||||
| } \ | |||||
| } while (false) | |||||
| #endif | |||||
| namespace lol { | namespace lol { | ||||
| /* Line 34 of lalr1.cc */ | |||||
| #line 101 "generated/easymesh-parser.h" | |||||
| /* Line 35 of lalr1.cc */ | |||||
| #line 68 "generated/easymesh-parser.h" | |||||
| /// A Bison parser. | /// A Bison parser. | ||||
| class EasyMeshParser | class EasyMeshParser | ||||
| @@ -108,7 +75,7 @@ namespace lol { | |||||
| union semantic_type | union semantic_type | ||||
| { | { | ||||
| /* Line 34 of lalr1.cc */ | |||||
| /* Line 35 of lalr1.cc */ | |||||
| #line 36 "easymesh/easymesh-parser.y" | #line 36 "easymesh/easymesh-parser.y" | ||||
| float fval; | float fval; | ||||
| @@ -118,8 +85,8 @@ namespace lol { | |||||
| /* Line 34 of lalr1.cc */ | |||||
| #line 123 "generated/easymesh-parser.h" | |||||
| /* Line 35 of lalr1.cc */ | |||||
| #line 90 "generated/easymesh-parser.h" | |||||
| }; | }; | ||||
| #else | #else | ||||
| typedef YYSTYPE semantic_type; | typedef YYSTYPE semantic_type; | ||||
| @@ -265,6 +232,14 @@ namespace lol { | |||||
| /// The location stack. | /// The location stack. | ||||
| location_stack_type yylocation_stack_; | location_stack_type yylocation_stack_; | ||||
| /// Whether the given \c yypact_ value indicates a defaulted state. | |||||
| /// \param yyvalue the value to check | |||||
| static bool yy_pact_value_is_default_ (int yyvalue); | |||||
| /// Whether the given \c yytable_ value indicates a syntax error. | |||||
| /// \param yyvalue the value to check | |||||
| static bool yy_table_value_is_error_ (int yyvalue); | |||||
| /// Internal symbol numbers. | /// Internal symbol numbers. | ||||
| typedef unsigned char token_number_type; | typedef unsigned char token_number_type; | ||||
| /* Tables. */ | /* Tables. */ | ||||
| @@ -272,7 +247,7 @@ namespace lol { | |||||
| static const signed char yypact_[]; | static const signed char yypact_[]; | ||||
| static const signed char yypact_ninf_; | static const signed char yypact_ninf_; | ||||
| /// For a state, default rule to reduce. | |||||
| /// For a state, default reduction number. | |||||
| /// Unless\a yytable_ specifies something else to do. | /// Unless\a yytable_ specifies something else to do. | ||||
| /// Zero means the default is an error. | /// Zero means the default is an error. | ||||
| static const unsigned char yydefact_[]; | static const unsigned char yydefact_[]; | ||||
| @@ -303,10 +278,8 @@ namespace lol { | |||||
| static const char* const yytname_[]; | static const char* const yytname_[]; | ||||
| #endif | #endif | ||||
| #if YYERROR_VERBOSE | |||||
| /// Convert the symbol name \a n to a form suitable for a diagnostic. | /// Convert the symbol name \a n to a form suitable for a diagnostic. | ||||
| virtual std::string yytnamerr_ (const char *n); | |||||
| #endif | |||||
| static std::string yytnamerr_ (const char *n); | |||||
| #if YYDEBUG | #if YYDEBUG | ||||
| /// A type to store symbol numbers and -1. | /// A type to store symbol numbers and -1. | ||||
| @@ -364,8 +337,8 @@ namespace lol { | |||||
| } // lol | } // lol | ||||
| /* Line 34 of lalr1.cc */ | |||||
| #line 369 "generated/easymesh-parser.h" | |||||
| /* Line 35 of lalr1.cc */ | |||||
| #line 342 "generated/easymesh-parser.h" | |||||
| @@ -1,8 +1,8 @@ | |||||
| /* A Bison parser, made by GNU Bison 2.4.2. */ | |||||
| /* A Bison parser, made by GNU Bison 2.5. */ | |||||
| /* Locations for Bison parsers in C++ | /* Locations for Bison parsers in C++ | ||||
| Copyright (C) 2002-2007, 2009-2010 Free Software Foundation, Inc. | |||||
| Copyright (C) 2002-2007, 2009-2011 Free Software Foundation, Inc. | |||||
| This program is free software: you can redistribute it and/or modify | This program is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU General Public License as published by | it under the terms of the GNU General Public License as published by | ||||
| @@ -1,8 +1,8 @@ | |||||
| /* A Bison parser, made by GNU Bison 2.4.2. */ | |||||
| /* A Bison parser, made by GNU Bison 2.5. */ | |||||
| /* Skeleton implementation for Bison LALR(1) parsers in C++ | /* Skeleton implementation for Bison LALR(1) parsers in C++ | ||||
| Copyright (C) 2002-2010 Free Software Foundation, Inc. | |||||
| Copyright (C) 2002-2011 Free Software Foundation, Inc. | |||||
| This program is free software: you can redistribute it and/or modify | This program is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU General Public License as published by | it under the terms of the GNU General Public License as published by | ||||
| @@ -35,7 +35,7 @@ | |||||
| /* First part of user declarations. */ | /* First part of user declarations. */ | ||||
| /* Line 310 of lalr1.cc */ | |||||
| /* Line 293 of lalr1.cc */ | |||||
| #line 1 "gpu/lolfx-parser.y" | #line 1 "gpu/lolfx-parser.y" | ||||
| // | // | ||||
| @@ -58,7 +58,7 @@ | |||||
| /* Line 310 of lalr1.cc */ | |||||
| /* Line 293 of lalr1.cc */ | |||||
| #line 63 "generated/lolfx-parser.cpp" | #line 63 "generated/lolfx-parser.cpp" | ||||
| @@ -66,7 +66,7 @@ | |||||
| /* User implementation prologue. */ | /* User implementation prologue. */ | ||||
| /* Line 316 of lalr1.cc */ | |||||
| /* Line 299 of lalr1.cc */ | |||||
| #line 241 "gpu/lolfx-parser.y" | #line 241 "gpu/lolfx-parser.y" | ||||
| #include "gpu/lolfx-compiler.h" | #include "gpu/lolfx-compiler.h" | ||||
| @@ -75,7 +75,7 @@ | |||||
| #define yylex mc.m_lexer->lex | #define yylex mc.m_lexer->lex | ||||
| /* Line 316 of lalr1.cc */ | |||||
| /* Line 299 of lalr1.cc */ | |||||
| #line 80 "generated/lolfx-parser.cpp" | #line 80 "generated/lolfx-parser.cpp" | ||||
| #ifndef YY_ | #ifndef YY_ | ||||
| @@ -90,6 +90,26 @@ | |||||
| # endif | # endif | ||||
| #endif | #endif | ||||
| /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. | |||||
| If N is 0, then set CURRENT to the empty location which ends | |||||
| the previous symbol: RHS[0] (always defined). */ | |||||
| #define YYRHSLOC(Rhs, K) ((Rhs)[K]) | |||||
| #ifndef YYLLOC_DEFAULT | |||||
| # define YYLLOC_DEFAULT(Current, Rhs, N) \ | |||||
| do \ | |||||
| if (N) \ | |||||
| { \ | |||||
| (Current).begin = YYRHSLOC (Rhs, 1).begin; \ | |||||
| (Current).end = YYRHSLOC (Rhs, N).end; \ | |||||
| } \ | |||||
| else \ | |||||
| { \ | |||||
| (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \ | |||||
| } \ | |||||
| while (false) | |||||
| #endif | |||||
| /* Suppress unused-variable warnings by "using" E. */ | /* Suppress unused-variable warnings by "using" E. */ | ||||
| #define YYUSE(e) ((void) (e)) | #define YYUSE(e) ((void) (e)) | ||||
| @@ -141,9 +161,8 @@ do { \ | |||||
| namespace lol { | namespace lol { | ||||
| /* Line 379 of lalr1.cc */ | |||||
| #line 146 "generated/lolfx-parser.cpp" | |||||
| #if YYERROR_VERBOSE | |||||
| /* Line 382 of lalr1.cc */ | |||||
| #line 166 "generated/lolfx-parser.cpp" | |||||
| /* Return YYSTR after stripping away unnecessary quotes and | /* Return YYSTR after stripping away unnecessary quotes and | ||||
| backslashes, so that it's suitable for yyerror. The heuristic is | backslashes, so that it's suitable for yyerror. The heuristic is | ||||
| @@ -182,7 +201,6 @@ namespace lol { | |||||
| return yystr; | return yystr; | ||||
| } | } | ||||
| #endif | |||||
| /// Build a parser object. | /// Build a parser object. | ||||
| LolFxParser::LolFxParser (class LolFxCompiler& mc_yyarg) | LolFxParser::LolFxParser (class LolFxCompiler& mc_yyarg) | ||||
| @@ -283,6 +301,18 @@ namespace lol { | |||||
| } | } | ||||
| #endif | #endif | ||||
| inline bool | |||||
| LolFxParser::yy_pact_value_is_default_ (int yyvalue) | |||||
| { | |||||
| return yyvalue == yypact_ninf_; | |||||
| } | |||||
| inline bool | |||||
| LolFxParser::yy_table_value_is_error_ (int yyvalue) | |||||
| { | |||||
| return yyvalue == yytable_ninf_; | |||||
| } | |||||
| int | int | ||||
| LolFxParser::parse () | LolFxParser::parse () | ||||
| { | { | ||||
| @@ -304,7 +334,7 @@ namespace lol { | |||||
| /// Location of the lookahead. | /// Location of the lookahead. | ||||
| location_type yylloc; | location_type yylloc; | ||||
| /// The locations where the error started and ended. | /// The locations where the error started and ended. | ||||
| location_type yyerror_range[2]; | |||||
| location_type yyerror_range[3]; | |||||
| /// $$. | /// $$. | ||||
| semantic_type yyval; | semantic_type yyval; | ||||
| @@ -342,7 +372,7 @@ namespace lol { | |||||
| /* Try to take a decision without lookahead. */ | /* Try to take a decision without lookahead. */ | ||||
| yyn = yypact_[yystate]; | yyn = yypact_[yystate]; | ||||
| if (yyn == yypact_ninf_) | |||||
| if (yy_pact_value_is_default_ (yyn)) | |||||
| goto yydefault; | goto yydefault; | ||||
| /* Read a lookahead token. */ | /* Read a lookahead token. */ | ||||
| @@ -375,8 +405,8 @@ namespace lol { | |||||
| yyn = yytable_[yyn]; | yyn = yytable_[yyn]; | ||||
| if (yyn <= 0) | if (yyn <= 0) | ||||
| { | { | ||||
| if (yyn == 0 || yyn == yytable_ninf_) | |||||
| goto yyerrlab; | |||||
| if (yy_table_value_is_error_ (yyn)) | |||||
| goto yyerrlab; | |||||
| yyn = -yyn; | yyn = -yyn; | ||||
| goto yyreduce; | goto yyreduce; | ||||
| } | } | ||||
| @@ -432,46 +462,57 @@ namespace lol { | |||||
| { | { | ||||
| case 202: | case 202: | ||||
| /* Line 677 of lalr1.cc */ | |||||
| /* Line 690 of lalr1.cc */ | |||||
| #line 728 "gpu/lolfx-parser.y" | #line 728 "gpu/lolfx-parser.y" | ||||
| { std::cout << "New tech " << std::endl; } | { std::cout << "New tech " << std::endl; } | ||||
| break; | break; | ||||
| case 203: | case 203: | ||||
| /* Line 677 of lalr1.cc */ | |||||
| /* Line 690 of lalr1.cc */ | |||||
| #line 736 "gpu/lolfx-parser.y" | #line 736 "gpu/lolfx-parser.y" | ||||
| { std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; } | { std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; } | ||||
| break; | break; | ||||
| case 204: | case 204: | ||||
| /* Line 677 of lalr1.cc */ | |||||
| /* Line 690 of lalr1.cc */ | |||||
| #line 737 "gpu/lolfx-parser.y" | #line 737 "gpu/lolfx-parser.y" | ||||
| { std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; } | { std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; } | ||||
| break; | break; | ||||
| case 207: | case 207: | ||||
| /* Line 677 of lalr1.cc */ | |||||
| /* Line 690 of lalr1.cc */ | |||||
| #line 750 "gpu/lolfx-parser.y" | #line 750 "gpu/lolfx-parser.y" | ||||
| { std::cout << "New pass " << std::endl; } | { std::cout << "New pass " << std::endl; } | ||||
| break; | break; | ||||
| case 226: | case 226: | ||||
| /* Line 677 of lalr1.cc */ | |||||
| /* Line 690 of lalr1.cc */ | |||||
| #line 786 "gpu/lolfx-parser.y" | #line 786 "gpu/lolfx-parser.y" | ||||
| { std::cout << "new shader" << std::endl; } | { std::cout << "new shader" << std::endl; } | ||||
| break; | break; | ||||
| /* Line 677 of lalr1.cc */ | |||||
| #line 472 "generated/lolfx-parser.cpp" | |||||
| /* Line 690 of lalr1.cc */ | |||||
| #line 502 "generated/lolfx-parser.cpp" | |||||
| default: | default: | ||||
| break; | break; | ||||
| } | } | ||||
| /* User semantic actions sometimes alter yychar, and that requires | |||||
| that yytoken be updated with the new translation. We take the | |||||
| approach of translating immediately before every use of yytoken. | |||||
| One alternative is translating here after every semantic action, | |||||
| but that translation would be missed if the semantic action | |||||
| invokes YYABORT, YYACCEPT, or YYERROR immediately after altering | |||||
| yychar. In the case of YYABORT or YYACCEPT, an incorrect | |||||
| destructor might then be invoked immediately. In the case of | |||||
| YYERROR, subsequent parser actions might lead to an incorrect | |||||
| destructor call or verbose syntax error message before the | |||||
| lookahead is translated. */ | |||||
| YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc); | YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc); | ||||
| yypop_ (yylen); | yypop_ (yylen); | ||||
| @@ -495,14 +536,20 @@ namespace lol { | |||||
| | yyerrlab -- here on detecting error | | | yyerrlab -- here on detecting error | | ||||
| `------------------------------------*/ | `------------------------------------*/ | ||||
| yyerrlab: | yyerrlab: | ||||
| /* Make sure we have latest lookahead translation. See comments at | |||||
| user semantic actions for why this is necessary. */ | |||||
| yytoken = yytranslate_ (yychar); | |||||
| /* If not already recovering from an error, report this error. */ | /* If not already recovering from an error, report this error. */ | ||||
| if (!yyerrstatus_) | if (!yyerrstatus_) | ||||
| { | { | ||||
| ++yynerrs_; | ++yynerrs_; | ||||
| if (yychar == yyempty_) | |||||
| yytoken = yyempty_; | |||||
| error (yylloc, yysyntax_error_ (yystate, yytoken)); | error (yylloc, yysyntax_error_ (yystate, yytoken)); | ||||
| } | } | ||||
| yyerror_range[0] = yylloc; | |||||
| yyerror_range[1] = yylloc; | |||||
| if (yyerrstatus_ == 3) | if (yyerrstatus_ == 3) | ||||
| { | { | ||||
| /* If just tried and failed to reuse lookahead token after an | /* If just tried and failed to reuse lookahead token after an | ||||
| @@ -537,7 +584,7 @@ namespace lol { | |||||
| if (false) | if (false) | ||||
| goto yyerrorlab; | goto yyerrorlab; | ||||
| yyerror_range[0] = yylocation_stack_[yylen - 1]; | |||||
| yyerror_range[1] = yylocation_stack_[yylen - 1]; | |||||
| /* Do not reclaim the symbols of the rule which action triggered | /* Do not reclaim the symbols of the rule which action triggered | ||||
| this YYERROR. */ | this YYERROR. */ | ||||
| yypop_ (yylen); | yypop_ (yylen); | ||||
| @@ -554,7 +601,7 @@ namespace lol { | |||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| yyn = yypact_[yystate]; | yyn = yypact_[yystate]; | ||||
| if (yyn != yypact_ninf_) | |||||
| if (!yy_pact_value_is_default_ (yyn)) | |||||
| { | { | ||||
| yyn += yyterror_; | yyn += yyterror_; | ||||
| if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) | if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) | ||||
| @@ -569,7 +616,7 @@ namespace lol { | |||||
| if (yystate_stack_.height () == 1) | if (yystate_stack_.height () == 1) | ||||
| YYABORT; | YYABORT; | ||||
| yyerror_range[0] = yylocation_stack_[0]; | |||||
| yyerror_range[1] = yylocation_stack_[0]; | |||||
| yydestruct_ ("Error: popping", | yydestruct_ ("Error: popping", | ||||
| yystos_[yystate], | yystos_[yystate], | ||||
| &yysemantic_stack_[0], &yylocation_stack_[0]); | &yysemantic_stack_[0], &yylocation_stack_[0]); | ||||
| @@ -578,10 +625,10 @@ namespace lol { | |||||
| YY_STACK_PRINT (); | YY_STACK_PRINT (); | ||||
| } | } | ||||
| yyerror_range[1] = yylloc; | |||||
| yyerror_range[2] = yylloc; | |||||
| // Using YYLLOC is tempting, but would change the location of | // Using YYLLOC is tempting, but would change the location of | ||||
| // the lookahead. YYLOC is available though. | // the lookahead. YYLOC is available though. | ||||
| YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); | |||||
| YYLLOC_DEFAULT (yyloc, yyerror_range, 2); | |||||
| yysemantic_stack_.push (yylval); | yysemantic_stack_.push (yylval); | ||||
| yylocation_stack_.push (yyloc); | yylocation_stack_.push (yyloc); | ||||
| @@ -604,7 +651,13 @@ namespace lol { | |||||
| yyreturn: | yyreturn: | ||||
| if (yychar != yyempty_) | if (yychar != yyempty_) | ||||
| yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); | |||||
| { | |||||
| /* Make sure we have latest lookahead translation. See comments | |||||
| at user semantic actions for why this is necessary. */ | |||||
| yytoken = yytranslate_ (yychar); | |||||
| yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, | |||||
| &yylloc); | |||||
| } | |||||
| /* Do not reclaim the symbols of the rule which action triggered | /* Do not reclaim the symbols of the rule which action triggered | ||||
| this YYABORT or YYACCEPT. */ | this YYABORT or YYACCEPT. */ | ||||
| @@ -623,51 +676,97 @@ namespace lol { | |||||
| // Generate an error message. | // Generate an error message. | ||||
| std::string | std::string | ||||
| LolFxParser::yysyntax_error_ (int yystate, int tok) | |||||
| LolFxParser::yysyntax_error_ (int yystate, int yytoken) | |||||
| { | { | ||||
| std::string res; | |||||
| YYUSE (yystate); | |||||
| #if YYERROR_VERBOSE | |||||
| int yyn = yypact_[yystate]; | |||||
| if (yypact_ninf_ < yyn && yyn <= yylast_) | |||||
| std::string yyres; | |||||
| // Number of reported tokens (one for the "unexpected", one per | |||||
| // "expected"). | |||||
| size_t yycount = 0; | |||||
| // Its maximum. | |||||
| enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; | |||||
| // Arguments of yyformat. | |||||
| char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | |||||
| /* There are many possibilities here to consider: | |||||
| - If this state is a consistent state with a default action, then | |||||
| the only way this function was invoked is if the default action | |||||
| is an error action. In that case, don't check for expected | |||||
| tokens because there are none. | |||||
| - The only way there can be no lookahead present (in yytoken) is | |||||
| if this state is a consistent state with a default action. | |||||
| Thus, detecting the absence of a lookahead is sufficient to | |||||
| determine that there is no unexpected or expected token to | |||||
| report. In that case, just report a simple "syntax error". | |||||
| - Don't assume there isn't a lookahead just because this state is | |||||
| a consistent state with a default action. There might have | |||||
| been a previous inconsistent state, consistent state with a | |||||
| non-default action, or user semantic action that manipulated | |||||
| yychar. | |||||
| - Of course, the expected token list depends on states to have | |||||
| correct lookahead information, and it depends on the parser not | |||||
| to perform extra reductions after fetching a lookahead from the | |||||
| scanner and before detecting a syntax error. Thus, state | |||||
| merging (from LALR or IELR) and default reductions corrupt the | |||||
| expected token list. However, the list is correct for | |||||
| canonical LR with one exception: it will still contain any | |||||
| token that will not be accepted due to an error action in a | |||||
| later state. | |||||
| */ | |||||
| if (yytoken != yyempty_) | |||||
| { | { | ||||
| /* Start YYX at -YYN if negative to avoid negative indexes in | |||||
| YYCHECK. */ | |||||
| int yyxbegin = yyn < 0 ? -yyn : 0; | |||||
| /* Stay within bounds of both yycheck and yytname. */ | |||||
| int yychecklim = yylast_ - yyn + 1; | |||||
| int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; | |||||
| int count = 0; | |||||
| for (int x = yyxbegin; x < yyxend; ++x) | |||||
| if (yycheck_[x + yyn] == x && x != yyterror_) | |||||
| ++count; | |||||
| // FIXME: This method of building the message is not compatible | |||||
| // with internationalization. It should work like yacc.c does it. | |||||
| // That is, first build a string that looks like this: | |||||
| // "syntax error, unexpected %s or %s or %s" | |||||
| // Then, invoke YY_ on this string. | |||||
| // Finally, use the string as a format to output | |||||
| // yytname_[tok], etc. | |||||
| // Until this gets fixed, this message appears in English only. | |||||
| res = "syntax error, unexpected "; | |||||
| res += yytnamerr_ (yytname_[tok]); | |||||
| if (count < 5) | |||||
| { | |||||
| count = 0; | |||||
| for (int x = yyxbegin; x < yyxend; ++x) | |||||
| if (yycheck_[x + yyn] == x && x != yyterror_) | |||||
| { | |||||
| res += (!count++) ? ", expecting " : " or "; | |||||
| res += yytnamerr_ (yytname_[x]); | |||||
| } | |||||
| } | |||||
| yyarg[yycount++] = yytname_[yytoken]; | |||||
| int yyn = yypact_[yystate]; | |||||
| if (!yy_pact_value_is_default_ (yyn)) | |||||
| { | |||||
| /* Start YYX at -YYN if negative to avoid negative indexes in | |||||
| YYCHECK. In other words, skip the first -YYN actions for | |||||
| this state because they are default actions. */ | |||||
| int yyxbegin = yyn < 0 ? -yyn : 0; | |||||
| /* Stay within bounds of both yycheck and yytname. */ | |||||
| int yychecklim = yylast_ - yyn + 1; | |||||
| int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; | |||||
| for (int yyx = yyxbegin; yyx < yyxend; ++yyx) | |||||
| if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_ | |||||
| && !yy_table_value_is_error_ (yytable_[yyx + yyn])) | |||||
| { | |||||
| if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) | |||||
| { | |||||
| yycount = 1; | |||||
| break; | |||||
| } | |||||
| else | |||||
| yyarg[yycount++] = yytname_[yyx]; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| else | |||||
| #endif | |||||
| res = YY_("syntax error"); | |||||
| return res; | |||||
| char const* yyformat = 0; | |||||
| switch (yycount) | |||||
| { | |||||
| #define YYCASE_(N, S) \ | |||||
| case N: \ | |||||
| yyformat = S; \ | |||||
| break | |||||
| YYCASE_(0, YY_("syntax error")); | |||||
| YYCASE_(1, YY_("syntax error, unexpected %s")); | |||||
| YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); | |||||
| YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); | |||||
| YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); | |||||
| YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); | |||||
| #undef YYCASE_ | |||||
| } | |||||
| // Argument number. | |||||
| size_t yyi = 0; | |||||
| for (char const* yyp = yyformat; *yyp; ++yyp) | |||||
| if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount) | |||||
| { | |||||
| yyres += yytnamerr_ (yyarg[yyi++]); | |||||
| ++yyp; | |||||
| } | |||||
| else | |||||
| yyres += *yyp; | |||||
| return yyres; | |||||
| } | } | ||||
| @@ -746,9 +845,9 @@ namespace lol { | |||||
| -68, -559, -559, -559, -559 | -68, -559, -559, -559, -559 | ||||
| }; | }; | ||||
| /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE | |||||
| doesn't specify something else to do. Zero means the default is an | |||||
| error. */ | |||||
| /* YYDEFACT[S] -- default reduction number in state S. Performed when | |||||
| YYTABLE doesn't specify something else to do. Zero means the | |||||
| default is an error. */ | |||||
| const unsigned short int | const unsigned short int | ||||
| LolFxParser::yydefact_[] = | LolFxParser::yydefact_[] = | ||||
| { | { | ||||
| @@ -855,7 +954,7 @@ namespace lol { | |||||
| /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | ||||
| positive, shift that token. If negative, reduce the rule which | positive, shift that token. If negative, reduce the rule which | ||||
| number is the opposite. If zero, do what YYDEFACT says. */ | |||||
| number is the opposite. If YYTABLE_NINF_, syntax error. */ | |||||
| const short int LolFxParser::yytable_ninf_ = -323; | const short int LolFxParser::yytable_ninf_ = -323; | ||||
| const short int | const short int | ||||
| LolFxParser::yytable_[] = | LolFxParser::yytable_[] = | ||||
| @@ -3791,11 +3890,11 @@ namespace lol { | |||||
| } // lol | } // lol | ||||
| /* Line 1053 of lalr1.cc */ | |||||
| #line 3796 "generated/lolfx-parser.cpp" | |||||
| /* Line 1136 of lalr1.cc */ | |||||
| #line 3895 "generated/lolfx-parser.cpp" | |||||
| /* Line 1055 of lalr1.cc */ | |||||
| /* Line 1138 of lalr1.cc */ | |||||
| #line 1298 "gpu/lolfx-parser.y" | #line 1298 "gpu/lolfx-parser.y" | ||||
| @@ -1,8 +1,8 @@ | |||||
| /* A Bison parser, made by GNU Bison 2.4.2. */ | |||||
| /* A Bison parser, made by GNU Bison 2.5. */ | |||||
| /* Skeleton interface for Bison LALR(1) parsers in C++ | /* Skeleton interface for Bison LALR(1) parsers in C++ | ||||
| Copyright (C) 2002-2010 Free Software Foundation, Inc. | |||||
| Copyright (C) 2002-2011 Free Software Foundation, Inc. | |||||
| This program is free software: you can redistribute it and/or modify | This program is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU General Public License as published by | it under the terms of the GNU General Public License as published by | ||||
| @@ -40,20 +40,6 @@ | |||||
| #include <string> | #include <string> | ||||
| #include <iostream> | #include <iostream> | ||||
| #include "stack.hh" | #include "stack.hh" | ||||
| namespace lol { | |||||
| /* Line 34 of lalr1.cc */ | |||||
| #line 49 "generated/lolfx-parser.h" | |||||
| class position; | |||||
| class location; | |||||
| } // lol | |||||
| /* Line 34 of lalr1.cc */ | |||||
| #line 56 "generated/lolfx-parser.h" | |||||
| #include "location.hh" | #include "location.hh" | ||||
| /* Enabling traces. */ | /* Enabling traces. */ | ||||
| @@ -74,30 +60,11 @@ namespace lol { | |||||
| # define YYTOKEN_TABLE 0 | # define YYTOKEN_TABLE 0 | ||||
| #endif | #endif | ||||
| /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. | |||||
| If N is 0, then set CURRENT to the empty location which ends | |||||
| the previous symbol: RHS[0] (always defined). */ | |||||
| #ifndef YYLLOC_DEFAULT | |||||
| # define YYLLOC_DEFAULT(Current, Rhs, N) \ | |||||
| do { \ | |||||
| if (N) \ | |||||
| { \ | |||||
| (Current).begin = (Rhs)[1].begin; \ | |||||
| (Current).end = (Rhs)[N].end; \ | |||||
| } \ | |||||
| else \ | |||||
| { \ | |||||
| (Current).begin = (Current).end = (Rhs)[0].end; \ | |||||
| } \ | |||||
| } while (false) | |||||
| #endif | |||||
| namespace lol { | namespace lol { | ||||
| /* Line 34 of lalr1.cc */ | |||||
| #line 101 "generated/lolfx-parser.h" | |||||
| /* Line 35 of lalr1.cc */ | |||||
| #line 68 "generated/lolfx-parser.h" | |||||
| /// A Bison parser. | /// A Bison parser. | ||||
| class LolFxParser | class LolFxParser | ||||
| @@ -108,7 +75,7 @@ namespace lol { | |||||
| union semantic_type | union semantic_type | ||||
| { | { | ||||
| /* Line 34 of lalr1.cc */ | |||||
| /* Line 35 of lalr1.cc */ | |||||
| #line 34 "gpu/lolfx-parser.y" | #line 34 "gpu/lolfx-parser.y" | ||||
| int ival; | int ival; | ||||
| @@ -118,8 +85,8 @@ namespace lol { | |||||
| /* Line 34 of lalr1.cc */ | |||||
| #line 123 "generated/lolfx-parser.h" | |||||
| /* Line 35 of lalr1.cc */ | |||||
| #line 90 "generated/lolfx-parser.h" | |||||
| }; | }; | ||||
| #else | #else | ||||
| typedef YYSTYPE semantic_type; | typedef YYSTYPE semantic_type; | ||||
| @@ -640,6 +607,14 @@ namespace lol { | |||||
| /// The location stack. | /// The location stack. | ||||
| location_stack_type yylocation_stack_; | location_stack_type yylocation_stack_; | ||||
| /// Whether the given \c yypact_ value indicates a defaulted state. | |||||
| /// \param yyvalue the value to check | |||||
| static bool yy_pact_value_is_default_ (int yyvalue); | |||||
| /// Whether the given \c yytable_ value indicates a syntax error. | |||||
| /// \param yyvalue the value to check | |||||
| static bool yy_table_value_is_error_ (int yyvalue); | |||||
| /// Internal symbol numbers. | /// Internal symbol numbers. | ||||
| typedef unsigned short int token_number_type; | typedef unsigned short int token_number_type; | ||||
| /* Tables. */ | /* Tables. */ | ||||
| @@ -647,7 +622,7 @@ namespace lol { | |||||
| static const short int yypact_[]; | static const short int yypact_[]; | ||||
| static const short int yypact_ninf_; | static const short int yypact_ninf_; | ||||
| /// For a state, default rule to reduce. | |||||
| /// For a state, default reduction number. | |||||
| /// Unless\a yytable_ specifies something else to do. | /// Unless\a yytable_ specifies something else to do. | ||||
| /// Zero means the default is an error. | /// Zero means the default is an error. | ||||
| static const unsigned short int yydefact_[]; | static const unsigned short int yydefact_[]; | ||||
| @@ -678,10 +653,8 @@ namespace lol { | |||||
| static const char* const yytname_[]; | static const char* const yytname_[]; | ||||
| #endif | #endif | ||||
| #if YYERROR_VERBOSE | |||||
| /// Convert the symbol name \a n to a form suitable for a diagnostic. | /// Convert the symbol name \a n to a form suitable for a diagnostic. | ||||
| virtual std::string yytnamerr_ (const char *n); | |||||
| #endif | |||||
| static std::string yytnamerr_ (const char *n); | |||||
| #if YYDEBUG | #if YYDEBUG | ||||
| /// A type to store symbol numbers and -1. | /// A type to store symbol numbers and -1. | ||||
| @@ -739,8 +712,8 @@ namespace lol { | |||||
| } // lol | } // lol | ||||
| /* Line 34 of lalr1.cc */ | |||||
| #line 744 "generated/lolfx-parser.h" | |||||
| /* Line 35 of lalr1.cc */ | |||||
| #line 717 "generated/lolfx-parser.h" | |||||
| @@ -1,8 +1,8 @@ | |||||
| /* A Bison parser, made by GNU Bison 2.4.2. */ | |||||
| /* A Bison parser, made by GNU Bison 2.5. */ | |||||
| /* Positions for Bison parsers in C++ | /* Positions for Bison parsers in C++ | ||||
| Copyright (C) 2002-2007, 2009-2010 Free Software Foundation, Inc. | |||||
| Copyright (C) 2002-2007, 2009-2011 Free Software Foundation, Inc. | |||||
| This program is free software: you can redistribute it and/or modify | This program is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU General Public License as published by | it under the terms of the GNU General Public License as published by | ||||
| @@ -1,8 +1,8 @@ | |||||
| /* A Bison parser, made by GNU Bison 2.4.2. */ | |||||
| /* A Bison parser, made by GNU Bison 2.5. */ | |||||
| /* Stack handling for Bison parsers in C++ | /* Stack handling for Bison parsers in C++ | ||||
| Copyright (C) 2002-2010 Free Software Foundation, Inc. | |||||
| Copyright (C) 2002-2011 Free Software Foundation, Inc. | |||||
| This program is free software: you can redistribute it and/or modify | This program is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU General Public License as published by | it under the terms of the GNU General Public License as published by | ||||
| @@ -38,7 +38,7 @@ | |||||
| namespace lol { | namespace lol { | ||||
| /* Line 1066 of lalr1.cc */ | |||||
| /* Line 1149 of lalr1.cc */ | |||||
| #line 43 "generated/stack.hh" | #line 43 "generated/stack.hh" | ||||
| template <class T, class S = std::deque<T> > | template <class T, class S = std::deque<T> > | ||||
| class stack | class stack | ||||
| @@ -128,7 +128,7 @@ namespace lol { | |||||
| } // lol | } // lol | ||||
| /* Line 1152 of lalr1.cc */ | |||||
| /* Line 1235 of lalr1.cc */ | |||||
| #line 133 "generated/stack.hh" | #line 133 "generated/stack.hh" | ||||
| #endif // not BISON_STACK_HH[]dnl | #endif // not BISON_STACK_HH[]dnl | ||||
| @@ -67,19 +67,19 @@ FrameBuffer::FrameBuffer(ivec2 size) | |||||
| if (FAILED(g_d3ddevice->CreateTexture(size.x, size.y, 1, | if (FAILED(g_d3ddevice->CreateTexture(size.x, size.y, 1, | ||||
| D3DUSAGE_RENDERTARGET, | D3DUSAGE_RENDERTARGET, | ||||
| D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, | D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, | ||||
| &m_data->m_texture, NULL))) | |||||
| &m_data->m_texture, nullptr))) | |||||
| Abort(); | Abort(); | ||||
| if (FAILED(m_data->m_texture->GetSurfaceLevel(0, &m_data->m_surface))) | if (FAILED(m_data->m_texture->GetSurfaceLevel(0, &m_data->m_surface))) | ||||
| Abort(); | Abort(); | ||||
| #elif defined _XBOX | #elif defined _XBOX | ||||
| if (FAILED(g_d3ddevice->CreateTexture(size.x, size.y, 1, 0, | if (FAILED(g_d3ddevice->CreateTexture(size.x, size.y, 1, 0, | ||||
| D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, | D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, | ||||
| &m_data->m_texture, NULL))) | |||||
| &m_data->m_texture, nullptr))) | |||||
| Abort(); | Abort(); | ||||
| if (FAILED(g_d3ddevice->CreateRenderTarget(size.x, size.y, | if (FAILED(g_d3ddevice->CreateRenderTarget(size.x, size.y, | ||||
| D3DFMT_A8R8G8B8, | D3DFMT_A8R8G8B8, | ||||
| D3DMULTISAMPLE_NONE, 0, 0, | D3DMULTISAMPLE_NONE, 0, 0, | ||||
| &m_data->m_surface, NULL))) | |||||
| &m_data->m_surface, nullptr))) | |||||
| Abort(); | Abort(); | ||||
| #else | #else | ||||
| # if GL_VERSION_1_1 | # if GL_VERSION_1_1 | ||||
| @@ -114,7 +114,7 @@ FrameBuffer::FrameBuffer(ivec2 size) | |||||
| glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLenum)filtering); | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLenum)filtering); | ||||
| glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLenum)filtering); | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLenum)filtering); | ||||
| glTexImage2D(GL_TEXTURE_2D, 0, internal_format, size.x, size.y, 0, | glTexImage2D(GL_TEXTURE_2D, 0, internal_format, size.x, size.y, 0, | ||||
| format, GL_UNSIGNED_BYTE, NULL); | |||||
| format, GL_UNSIGNED_BYTE, nullptr); | |||||
| # if GL_VERSION_1_1 || GL_ES_VERSION_2_0 | # if GL_VERSION_1_1 || GL_ES_VERSION_2_0 | ||||
| glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | ||||
| @@ -200,9 +200,9 @@ void FrameBuffer::Unbind() | |||||
| Abort(); | Abort(); | ||||
| m_data->m_back_surface->Release(); | m_data->m_back_surface->Release(); | ||||
| #elif defined _XBOX | #elif defined _XBOX | ||||
| if (FAILED(g_d3ddevice->Resolve(D3DRESOLVE_RENDERTARGET0, NULL, | |||||
| m_data->m_texture, NULL, 0, 0, NULL, | |||||
| 0, 0, NULL))) | |||||
| if (FAILED(g_d3ddevice->Resolve(D3DRESOLVE_RENDERTARGET0, nullptr, | |||||
| m_data->m_texture, nullptr, 0, 0, nullptr, | |||||
| 0, 0, nullptr))) | |||||
| Abort(); | Abort(); | ||||
| if (FAILED(g_d3ddevice->SetRenderTarget(0, m_data->m_back_surface))) | if (FAILED(g_d3ddevice->SetRenderTarget(0, m_data->m_back_surface))) | ||||
| Abort(); | Abort(); | ||||
| @@ -67,7 +67,7 @@ IndexBuffer::IndexBuffer(size_t size) | |||||
| #if defined USE_D3D9 || defined _XBOX | #if defined USE_D3D9 || defined _XBOX | ||||
| if (FAILED(g_d3ddevice->CreateIndexBuffer(size, D3DUSAGE_WRITEONLY, | if (FAILED(g_d3ddevice->CreateIndexBuffer(size, D3DUSAGE_WRITEONLY, | ||||
| D3DFMT_INDEX16, D3DPOOL_MANAGED, | D3DFMT_INDEX16, D3DPOOL_MANAGED, | ||||
| &m_data->m_ibo, NULL))) | |||||
| &m_data->m_ibo, nullptr))) | |||||
| Abort(); | Abort(); | ||||
| #else | #else | ||||
| glGenBuffers(1, &m_data->m_ibo); | glGenBuffers(1, &m_data->m_ibo); | ||||
| @@ -93,7 +93,7 @@ IndexBuffer::~IndexBuffer() | |||||
| void *IndexBuffer::Lock(size_t offset, size_t size) | void *IndexBuffer::Lock(size_t offset, size_t size) | ||||
| { | { | ||||
| if (!m_data->m_size) | if (!m_data->m_size) | ||||
| return NULL; | |||||
| return nullptr; | |||||
| #if defined USE_D3D9 || defined _XBOX | #if defined USE_D3D9 || defined _XBOX | ||||
| void *ret; | void *ret; | ||||
| @@ -142,7 +142,7 @@ void IndexBuffer::Unbind() | |||||
| return; | return; | ||||
| #if defined USE_D3D9 || defined _XBOX | #if defined USE_D3D9 || defined _XBOX | ||||
| if (FAILED(g_d3ddevice->SetIndices(NULL))) | |||||
| if (FAILED(g_d3ddevice->SetIndices(nullptr))) | |||||
| Abort(); | Abort(); | ||||
| #else | #else | ||||
| glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); | ||||
| @@ -91,10 +91,10 @@ Shader *Shader::Create(char const *lolfx) | |||||
| /* Parse the crap */ | /* Parse the crap */ | ||||
| Array<char const *, char const *> sections; | Array<char const *, char const *> sections; | ||||
| char *key = NULL; | |||||
| char *key = nullptr; | |||||
| for (char *parser = src; *parser; ) | for (char *parser = src; *parser; ) | ||||
| { | { | ||||
| if (key == NULL && (parser[0] == '\n' || parser[0] == '\r') | |||||
| if (key == nullptr && (parser[0] == '\n' || parser[0] == '\r') | |||||
| && parser[1] == '[') | && parser[1] == '[') | ||||
| { | { | ||||
| *parser = '\0'; | *parser = '\0'; | ||||
| @@ -109,7 +109,7 @@ Shader *Shader::Create(char const *lolfx) | |||||
| { | { | ||||
| sections.Push(key, parser); | sections.Push(key, parser); | ||||
| parser++; | parser++; | ||||
| key = NULL; | |||||
| key = nullptr; | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -117,7 +117,7 @@ Shader *Shader::Create(char const *lolfx) | |||||
| } | } | ||||
| } | } | ||||
| char const *vert = NULL, *frag = NULL; | |||||
| char const *vert = nullptr, *frag = nullptr; | |||||
| for (int i = 0; i < sections.Count(); i++) | for (int i = 0; i < sections.Count(); i++) | ||||
| { | { | ||||
| #if !defined __CELLOS_LV2__ && !defined _XBOX && !defined USE_D3D9 | #if !defined __CELLOS_LV2__ && !defined _XBOX && !defined USE_D3D9 | ||||
| @@ -177,7 +177,7 @@ Shader::Shader(char const *vert, char const *frag) | |||||
| #if defined _XBOX | #if defined _XBOX | ||||
| { "_XBOX", "1" }, | { "_XBOX", "1" }, | ||||
| #endif | #endif | ||||
| { NULL, NULL } | |||||
| { nullptr, nullptr } | |||||
| }; | }; | ||||
| #elif !defined __CELLOS_LV2__ | #elif !defined __CELLOS_LV2__ | ||||
| char buf[4096], errbuf[4096]; | char buf[4096], errbuf[4096]; | ||||
| @@ -193,7 +193,7 @@ Shader::Shader(char const *vert, char const *frag) | |||||
| /* Compile vertex shader */ | /* Compile vertex shader */ | ||||
| data->vert_crc = ShaderData::hash(vert); | data->vert_crc = ShaderData::hash(vert); | ||||
| #if defined USE_D3D9 || defined _XBOX | #if defined USE_D3D9 || defined _XBOX | ||||
| hr = D3DXCompileShader(vert, (UINT)strlen(vert), macros, NULL, "main", | |||||
| hr = D3DXCompileShader(vert, (UINT)strlen(vert), macros, nullptr, "main", | |||||
| "vs_3_0", 0, &shader_code, &error_msg, | "vs_3_0", 0, &shader_code, &error_msg, | ||||
| &data->vert_table); | &data->vert_table); | ||||
| if (FAILED(hr)) | if (FAILED(hr)) | ||||
| @@ -206,9 +206,9 @@ Shader::Shader(char const *vert, char const *frag) | |||||
| &data->vert_shader); | &data->vert_shader); | ||||
| shader_code->Release(); | shader_code->Release(); | ||||
| #elif !defined __CELLOS_LV2__ | #elif !defined __CELLOS_LV2__ | ||||
| ShaderData::Patch(buf, vert, NULL); | |||||
| ShaderData::Patch(buf, vert, nullptr); | |||||
| data->vert_id = glCreateShader(GL_VERTEX_SHADER); | data->vert_id = glCreateShader(GL_VERTEX_SHADER); | ||||
| glShaderSource(data->vert_id, 1, &shader, NULL); | |||||
| glShaderSource(data->vert_id, 1, &shader, nullptr); | |||||
| glCompileShader(data->vert_id); | glCompileShader(data->vert_id); | ||||
| glGetShaderInfoLog(data->vert_id, sizeof(errbuf), &len, errbuf); | glGetShaderInfoLog(data->vert_id, sizeof(errbuf), &len, errbuf); | ||||
| @@ -226,8 +226,8 @@ Shader::Shader(char const *vert, char const *frag) | |||||
| #else | #else | ||||
| data->vert_id = cgCreateProgram(cgCreateContext(), CG_SOURCE, vert, | data->vert_id = cgCreateProgram(cgCreateContext(), CG_SOURCE, vert, | ||||
| cgGLGetLatestProfile(CG_GL_VERTEX), | cgGLGetLatestProfile(CG_GL_VERTEX), | ||||
| NULL, NULL); | |||||
| if (data->vert_id == NULL) | |||||
| nullptr, nullptr); | |||||
| if (data->vert_id == nullptr) | |||||
| { | { | ||||
| Log::Error("failed to compile vertex shader"); | Log::Error("failed to compile vertex shader"); | ||||
| Log::Error("shader source:\n%s\n", vert); | Log::Error("shader source:\n%s\n", vert); | ||||
| @@ -237,7 +237,7 @@ Shader::Shader(char const *vert, char const *frag) | |||||
| /* Compile fragment shader */ | /* Compile fragment shader */ | ||||
| data->frag_crc = ShaderData::hash(frag); | data->frag_crc = ShaderData::hash(frag); | ||||
| #if defined USE_D3D9 || defined _XBOX | #if defined USE_D3D9 || defined _XBOX | ||||
| hr = D3DXCompileShader(frag, (UINT)strlen(frag), macros, NULL, "main", | |||||
| hr = D3DXCompileShader(frag, (UINT)strlen(frag), macros, nullptr, "main", | |||||
| "ps_3_0", 0, &shader_code, &error_msg, | "ps_3_0", 0, &shader_code, &error_msg, | ||||
| &data->frag_table); | &data->frag_table); | ||||
| if (FAILED(hr)) | if (FAILED(hr)) | ||||
| @@ -250,9 +250,9 @@ Shader::Shader(char const *vert, char const *frag) | |||||
| &data->frag_shader); | &data->frag_shader); | ||||
| shader_code->Release(); | shader_code->Release(); | ||||
| #elif !defined __CELLOS_LV2__ | #elif !defined __CELLOS_LV2__ | ||||
| ShaderData::Patch(buf, NULL, frag); | |||||
| ShaderData::Patch(buf, nullptr, frag); | |||||
| data->frag_id = glCreateShader(GL_FRAGMENT_SHADER); | data->frag_id = glCreateShader(GL_FRAGMENT_SHADER); | ||||
| glShaderSource(data->frag_id, 1, &shader, NULL); | |||||
| glShaderSource(data->frag_id, 1, &shader, nullptr); | |||||
| glCompileShader(data->frag_id); | glCompileShader(data->frag_id); | ||||
| glGetShaderInfoLog(data->frag_id, sizeof(errbuf), &len, errbuf); | glGetShaderInfoLog(data->frag_id, sizeof(errbuf), &len, errbuf); | ||||
| @@ -270,8 +270,8 @@ Shader::Shader(char const *vert, char const *frag) | |||||
| #else | #else | ||||
| data->frag_id = cgCreateProgram(cgCreateContext(), CG_SOURCE, frag, | data->frag_id = cgCreateProgram(cgCreateContext(), CG_SOURCE, frag, | ||||
| cgGLGetLatestProfile(CG_GL_FRAGMENT), | cgGLGetLatestProfile(CG_GL_FRAGMENT), | ||||
| NULL, NULL); | |||||
| if (data->frag_id == NULL) | |||||
| nullptr, nullptr); | |||||
| if (data->frag_id == nullptr) | |||||
| { | { | ||||
| Log::Error("failed to compile fragment shader"); | Log::Error("failed to compile fragment shader"); | ||||
| Log::Error("shader source:\n%s\n", frag); | Log::Error("shader source:\n%s\n", frag); | ||||
| @@ -286,7 +286,7 @@ Shader::Shader(char const *vert, char const *frag) | |||||
| { | { | ||||
| D3DXCONSTANT_DESC cdesc; | D3DXCONSTANT_DESC cdesc; | ||||
| UINT count = 1; | UINT count = 1; | ||||
| D3DXHANDLE h = data->frag_table->GetConstant(NULL, i); | |||||
| D3DXHANDLE h = data->frag_table->GetConstant(nullptr, i); | |||||
| data->frag_table->GetConstantDesc(h, &cdesc, &count); | data->frag_table->GetConstantDesc(h, &cdesc, &count); | ||||
| } | } | ||||
| data->vert_table->GetDesc(&desc); | data->vert_table->GetDesc(&desc); | ||||
| @@ -294,7 +294,7 @@ Shader::Shader(char const *vert, char const *frag) | |||||
| { | { | ||||
| D3DXCONSTANT_DESC cdesc; | D3DXCONSTANT_DESC cdesc; | ||||
| UINT count = 1; | UINT count = 1; | ||||
| D3DXHANDLE h = data->vert_table->GetConstant(NULL, i); | |||||
| D3DXHANDLE h = data->vert_table->GetConstant(nullptr, i); | |||||
| data->frag_table->GetConstantDesc(h, &cdesc, &count); | data->frag_table->GetConstantDesc(h, &cdesc, &count); | ||||
| } | } | ||||
| #elif !defined __CELLOS_LV2__ | #elif !defined __CELLOS_LV2__ | ||||
| @@ -351,7 +351,7 @@ ShaderUniform Shader::GetUniformLocation(char const *uni) const | |||||
| UINT count; | UINT count; | ||||
| count = 0; | count = 0; | ||||
| hr = data->frag_table->GetConstantByName(NULL, tmpname); | |||||
| hr = data->frag_table->GetConstantByName(nullptr, tmpname); | |||||
| if (hr) | if (hr) | ||||
| data->frag_table->GetConstantDesc(hr, &cdesc, &count); | data->frag_table->GetConstantDesc(hr, &cdesc, &count); | ||||
| if (count) | if (count) | ||||
| @@ -361,7 +361,7 @@ ShaderUniform Shader::GetUniformLocation(char const *uni) const | |||||
| } | } | ||||
| count = 0; | count = 0; | ||||
| hr = data->vert_table->GetConstantByName(NULL, tmpname); | |||||
| hr = data->vert_table->GetConstantByName(nullptr, tmpname); | |||||
| if (hr) | if (hr) | ||||
| data->vert_table->GetConstantDesc(hr, &cdesc, &count); | data->vert_table->GetConstantDesc(hr, &cdesc, &count); | ||||
| if (count) | if (count) | ||||
| @@ -675,8 +675,8 @@ void Shader::Unbind() const | |||||
| { | { | ||||
| #if defined USE_D3D9 || defined _XBOX | #if defined USE_D3D9 || defined _XBOX | ||||
| HRESULT hr; | HRESULT hr; | ||||
| hr = g_d3ddevice->SetVertexShader(NULL); | |||||
| hr = g_d3ddevice->SetPixelShader(NULL); | |||||
| hr = g_d3ddevice->SetVertexShader(nullptr); | |||||
| hr = g_d3ddevice->SetPixelShader(nullptr); | |||||
| #elif !defined __CELLOS_LV2__ | #elif !defined __CELLOS_LV2__ | ||||
| /* FIXME: untested */ | /* FIXME: untested */ | ||||
| glUseProgram(0); | glUseProgram(0); | ||||
| @@ -728,7 +728,7 @@ int ShaderData::GetVersion() | |||||
| char const *test130 = | char const *test130 = | ||||
| "#version 130\n" | "#version 130\n" | ||||
| "void main() { gl_Position = vec4(0.0, 0.0, 0.0, 0.0); }"; | "void main() { gl_Position = vec4(0.0, 0.0, 0.0, 0.0); }"; | ||||
| glShaderSource(id, 1, &test130, NULL); | |||||
| glShaderSource(id, 1, &test130, nullptr); | |||||
| glCompileShader(id); | glCompileShader(id); | ||||
| glGetShaderInfoLog(id, sizeof(buf), &len, buf); | glGetShaderInfoLog(id, sizeof(buf), &len, buf); | ||||
| if (len <= 0) | if (len <= 0) | ||||
| @@ -740,7 +740,7 @@ int ShaderData::GetVersion() | |||||
| char const *test120 = | char const *test120 = | ||||
| "#version 120\n" | "#version 120\n" | ||||
| "void main() { gl_Position = vec4(0.0, 0.0, 0.0, 0.0); }"; | "void main() { gl_Position = vec4(0.0, 0.0, 0.0, 0.0); }"; | ||||
| glShaderSource(id, 1, &test120, NULL); | |||||
| glShaderSource(id, 1, &test120, nullptr); | |||||
| glCompileShader(id); | glCompileShader(id); | ||||
| glGetShaderInfoLog(id, sizeof(buf), &len, buf); | glGetShaderInfoLog(id, sizeof(buf), &len, buf); | ||||
| if (len <= 0) | if (len <= 0) | ||||
| @@ -835,7 +835,7 @@ void ShaderData::Patch(char *dst, char const *vert, char const *frag) | |||||
| "vec2 in_MultiTexCoord7 = gl_MultiTexCoord7.xy;", | "vec2 in_MultiTexCoord7 = gl_MultiTexCoord7.xy;", | ||||
| #endif | #endif | ||||
| NULL | |||||
| nullptr | |||||
| }; | }; | ||||
| for (char const * const *rep = main_replaces; rep[0]; rep += 2) | for (char const * const *rep = main_replaces; rep[0]; rep += 2) | ||||
| @@ -865,7 +865,7 @@ void ShaderData::Patch(char *dst, char const *vert, char const *frag) | |||||
| "out vec3", "varying vec3", | "out vec3", "varying vec3", | ||||
| "out vec4", "varying vec4", | "out vec4", "varying vec4", | ||||
| "out mat4", "varying mat4", | "out mat4", "varying mat4", | ||||
| NULL | |||||
| nullptr | |||||
| }; | }; | ||||
| for (char const * const *rep = fast_replaces; rep[0]; rep += 2) | for (char const * const *rep = fast_replaces; rep[0]; rep += 2) | ||||
| @@ -115,7 +115,7 @@ Texture::Texture(ivec2 size, PixelFormat format) | |||||
| g_d3ddevice->CreateTexture(m_data->m_size.x, m_data->m_size.y, 1, | g_d3ddevice->CreateTexture(m_data->m_size.x, m_data->m_size.y, 1, | ||||
| d3d_usage, d3d_format, | d3d_usage, d3d_format, | ||||
| D3DPOOL_DEFAULT, &m_data->m_texture, NULL); | |||||
| D3DPOOL_DEFAULT, &m_data->m_texture, nullptr); | |||||
| m_data->m_bytes_per_elem = GET_CLAMPED(d3d_formats, format).bytes; | m_data->m_bytes_per_elem = GET_CLAMPED(d3d_formats, format).bytes; | ||||
| #else | #else | ||||
| static struct | static struct | ||||
| @@ -196,9 +196,9 @@ void Texture::SetData(void *data) | |||||
| #if defined _XBOX || defined USE_D3D9 | #if defined _XBOX || defined USE_D3D9 | ||||
| D3DLOCKED_RECT rect; | D3DLOCKED_RECT rect; | ||||
| # if defined USE_D3D9 | # if defined USE_D3D9 | ||||
| m_data->m_texture->LockRect(0, &rect, NULL, D3DLOCK_DISCARD); | |||||
| m_data->m_texture->LockRect(0, &rect, nullptr, D3DLOCK_DISCARD); | |||||
| # else | # else | ||||
| m_data->m_texture->LockRect(0, &rect, NULL, 0); | |||||
| m_data->m_texture->LockRect(0, &rect, nullptr, 0); | |||||
| # endif | # endif | ||||
| memcpy(rect.pBits, data, rect.Pitch * m_data->m_size.y); | memcpy(rect.pBits, data, rect.Pitch * m_data->m_size.y); | ||||
| @@ -216,7 +216,7 @@ void Texture::SetSubData(ivec2 origin, ivec2 size, void *data) | |||||
| { | { | ||||
| #if defined _XBOX || defined USE_D3D9 | #if defined _XBOX || defined USE_D3D9 | ||||
| D3DLOCKED_RECT rect; | D3DLOCKED_RECT rect; | ||||
| m_data->m_texture->LockRect(0, &rect, NULL, 0); | |||||
| m_data->m_texture->LockRect(0, &rect, nullptr, 0); | |||||
| int stride = size.x * m_data->m_bytes_per_elem; | int stride = size.x * m_data->m_bytes_per_elem; | ||||
| for (int j = 0; j < size.y; j++) | for (int j = 0; j < size.y; j++) | ||||
| @@ -612,8 +612,8 @@ VertexBuffer::VertexBuffer(size_t size) | |||||
| if (!size) | if (!size) | ||||
| return; | return; | ||||
| #if defined USE_D3D9 || defined _XBOX | #if defined USE_D3D9 || defined _XBOX | ||||
| if (FAILED(g_d3ddevice->CreateVertexBuffer(size, D3DUSAGE_WRITEONLY, NULL, | |||||
| D3DPOOL_MANAGED, &m_data->m_vbo, NULL))) | |||||
| if (FAILED(g_d3ddevice->CreateVertexBuffer(size, D3DUSAGE_WRITEONLY, nullptr, | |||||
| D3DPOOL_MANAGED, &m_data->m_vbo, nullptr))) | |||||
| Abort(); | Abort(); | ||||
| #else | #else | ||||
| glGenBuffers(1, &m_data->m_vbo); | glGenBuffers(1, &m_data->m_vbo); | ||||
| @@ -639,7 +639,7 @@ VertexBuffer::~VertexBuffer() | |||||
| void *VertexBuffer::Lock(size_t offset, size_t size) | void *VertexBuffer::Lock(size_t offset, size_t size) | ||||
| { | { | ||||
| if (!m_data->m_size) | if (!m_data->m_size) | ||||
| return NULL; | |||||
| return nullptr; | |||||
| #if defined USE_D3D9 || defined _XBOX | #if defined USE_D3D9 || defined _XBOX | ||||
| void *ret; | void *ret; | ||||
| if (FAILED(m_data->m_vbo->Lock(offset, size, (void **)&ret, 0))) | if (FAILED(m_data->m_vbo->Lock(offset, size, (void **)&ret, 0))) | ||||
| @@ -48,7 +48,7 @@ Gradient::Gradient(vec3 aa, vec3 bb) | |||||
| m_bbox[0] = aa; | m_bbox[0] = aa; | ||||
| m_bbox[1] = bb; | m_bbox[1] = bb; | ||||
| data->shader = NULL; | |||||
| data->shader = nullptr; | |||||
| } | } | ||||
| void Gradient::TickGame(float seconds) | void Gradient::TickGame(float seconds) | ||||
| @@ -55,7 +55,7 @@ bool AndroidImageData::Open(char const *path) | |||||
| #if !LOL_RELEASE | #if !LOL_RELEASE | ||||
| Log::Error("JVM environment not found, trying to attach thread\n"); | Log::Error("JVM environment not found, trying to attach thread\n"); | ||||
| #endif | #endif | ||||
| res = g_vm->AttachCurrentThread(&env, NULL); | |||||
| res = g_vm->AttachCurrentThread(&env, nullptr); | |||||
| } | } | ||||
| if (res < 0) | if (res < 0) | ||||
| { | { | ||||
| @@ -53,7 +53,7 @@ bool GdiPlusImageData::Open(char const *path) | |||||
| Gdiplus::Status status; | Gdiplus::Status status; | ||||
| ULONG_PTR token; | ULONG_PTR token; | ||||
| Gdiplus::GdiplusStartupInput input; | Gdiplus::GdiplusStartupInput input; | ||||
| status = Gdiplus::GdiplusStartup(&token, &input, NULL); | |||||
| status = Gdiplus::GdiplusStartup(&token, &input, nullptr); | |||||
| if (status != Gdiplus::Ok) | if (status != Gdiplus::Ok) | ||||
| { | { | ||||
| #if !LOL_RELEASE | #if !LOL_RELEASE | ||||
| @@ -63,11 +63,11 @@ bool GdiPlusImageData::Open(char const *path) | |||||
| } | } | ||||
| Array<String> pathlist = System::GetPathList(path); | Array<String> pathlist = System::GetPathList(path); | ||||
| m_bitmap = NULL; | |||||
| m_bitmap = nullptr; | |||||
| for (int i = 0; i < pathlist.Count(); ++i) | for (int i = 0; i < pathlist.Count(); ++i) | ||||
| { | { | ||||
| size_t len; | size_t len; | ||||
| len = mbstowcs(NULL, pathlist[i].C(), 0); | |||||
| len = mbstowcs(nullptr, pathlist[i].C(), 0); | |||||
| wchar_t *wpath = new wchar_t[len + 1]; | wchar_t *wpath = new wchar_t[len + 1]; | ||||
| if (mbstowcs(wpath, pathlist[i].C(), len + 1) == (size_t)-1) | if (mbstowcs(wpath, pathlist[i].C(), len + 1) == (size_t)-1) | ||||
| { | { | ||||
| @@ -92,7 +92,7 @@ bool GdiPlusImageData::Open(char const *path) | |||||
| status, pathlist[i].C()); | status, pathlist[i].C()); | ||||
| #endif | #endif | ||||
| delete m_bitmap; | delete m_bitmap; | ||||
| m_bitmap = NULL; | |||||
| m_bitmap = nullptr; | |||||
| } | } | ||||
| } | } | ||||
| @@ -77,9 +77,9 @@ bool Ps3ImageData::Open(char const *path) | |||||
| in_param.ppuThreadPriority = 1000; | in_param.ppuThreadPriority = 1000; | ||||
| in_param.spuThreadPriority = 200; | in_param.spuThreadPriority = 200; | ||||
| in_param.cbCtrlMallocFunc = Ps3ImageData::Malloc; | in_param.cbCtrlMallocFunc = Ps3ImageData::Malloc; | ||||
| in_param.cbCtrlMallocArg = NULL; | |||||
| in_param.cbCtrlMallocArg = nullptr; | |||||
| in_param.cbCtrlFreeFunc = Ps3ImageData::Free; | in_param.cbCtrlFreeFunc = Ps3ImageData::Free; | ||||
| in_param.cbCtrlFreeArg = NULL; | |||||
| in_param.cbCtrlFreeArg = nullptr; | |||||
| CellPngDecThreadOutParam out_param; | CellPngDecThreadOutParam out_param; | ||||
| err = cellPngDecCreate(&hmain, &in_param, &out_param); | err = cellPngDecCreate(&hmain, &in_param, &out_param); | ||||
| if (err != CELL_OK) | if (err != CELL_OK) | ||||
| @@ -95,7 +95,7 @@ bool Ps3ImageData::Open(char const *path) | |||||
| dec_src.srcSelect = CELL_PNGDEC_FILE; | dec_src.srcSelect = CELL_PNGDEC_FILE; | ||||
| dec_src.fileOffset = 0; | dec_src.fileOffset = 0; | ||||
| dec_src.fileSize = 0; | dec_src.fileSize = 0; | ||||
| dec_src.streamPtr = NULL; | |||||
| dec_src.streamPtr = nullptr; | |||||
| dec_src.streamSize = 0; | dec_src.streamSize = 0; | ||||
| dec_src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_ENABLE; | dec_src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_ENABLE; | ||||
| CellPngDecSubHandle hsub; | CellPngDecSubHandle hsub; | ||||
| @@ -129,7 +129,7 @@ bool Ps3ImageData::Open(char const *path) | |||||
| } | } | ||||
| CellPngDecInParam in_dec_param; | CellPngDecInParam in_dec_param; | ||||
| in_dec_param.commandPtr = NULL; | |||||
| in_dec_param.commandPtr = nullptr; | |||||
| in_dec_param.outputMode = CELL_PNGDEC_TOP_TO_BOTTOM; | in_dec_param.outputMode = CELL_PNGDEC_TOP_TO_BOTTOM; | ||||
| in_dec_param.outputColorSpace = CELL_PNGDEC_RGBA; | in_dec_param.outputColorSpace = CELL_PNGDEC_RGBA; | ||||
| in_dec_param.outputBitDepth = 8; | in_dec_param.outputBitDepth = 8; | ||||
| @@ -78,7 +78,7 @@ bool SdlImageData::Open(char const *path) | |||||
| if (m_img->format->BytesPerPixel != 4) | if (m_img->format->BytesPerPixel != 4) | ||||
| { | { | ||||
| SDL_Surface *tmp = Create32BppSurface(size); | SDL_Surface *tmp = Create32BppSurface(size); | ||||
| SDL_BlitSurface(m_img, NULL, tmp, NULL); | |||||
| SDL_BlitSurface(m_img, nullptr, tmp, nullptr); | |||||
| SDL_FreeSurface(m_img); | SDL_FreeSurface(m_img); | ||||
| m_img = tmp; | m_img = tmp; | ||||
| } | } | ||||
| @@ -39,8 +39,8 @@ public: | |||||
| private: | private: | ||||
| static ImageData *Load(char const *path) | static ImageData *Load(char const *path) | ||||
| { | { | ||||
| ImageLoader *parser = Helper(NULL); | |||||
| ImageData *ret = NULL; | |||||
| ImageLoader *parser = Helper(nullptr); | |||||
| ImageData *ret = nullptr; | |||||
| while (parser && !ret) | while (parser && !ret) | ||||
| { | { | ||||
| @@ -53,7 +53,7 @@ private: | |||||
| static ImageLoader *Helper(ImageLoader *set) | static ImageLoader *Helper(ImageLoader *set) | ||||
| { | { | ||||
| static ImageLoader *loaders = NULL; | |||||
| static ImageLoader *loaders = nullptr; | |||||
| if (!set) | if (!set) | ||||
| return loaders; | return loaders; | ||||
| @@ -64,7 +64,7 @@ private: | |||||
| set->next = *parser; | set->next = *parser; | ||||
| *parser = set; | *parser = set; | ||||
| return NULL; | |||||
| return nullptr; | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -106,7 +106,7 @@ protected: | |||||
| if (!ret->Open(path)) \ | if (!ret->Open(path)) \ | ||||
| { \ | { \ | ||||
| delete ret; \ | delete ret; \ | ||||
| return NULL; \ | |||||
| return nullptr; \ | |||||
| } \ | } \ | ||||
| return ret; \ | return ret; \ | ||||
| } \ | } \ | ||||
| @@ -31,7 +31,7 @@ namespace lol | |||||
| * Input implementation class | * Input implementation class | ||||
| */ | */ | ||||
| InputTracker* Input::m_input_tracker = NULL; | |||||
| InputTracker* Input::m_input_tracker = nullptr; | |||||
| static class InputData | static class InputData | ||||
| { | { | ||||
| @@ -116,9 +116,9 @@ void InputTracker::UpdateActionStatus(float seconds) | |||||
| { | { | ||||
| #if defined USE_SDL | #if defined USE_SDL | ||||
| # if SDL_VERSION_ATLEAST(1,3,0) | # if SDL_VERSION_ATLEAST(1,3,0) | ||||
| Uint8 *keystate = SDL_GetKeyboardState(NULL); | |||||
| Uint8 *keystate = SDL_GetKeyboardState(nullptr); | |||||
| # else | # else | ||||
| Uint8 *keystate = SDL_GetKeyState(NULL); | |||||
| Uint8 *keystate = SDL_GetKeyState(nullptr); | |||||
| # endif | # endif | ||||
| //SOOOoooo ugly. | //SOOOoooo ugly. | ||||
| for (int i = 0; i < Key::Last; ++i) | for (int i = 0; i < Key::Last; ++i) | ||||
| @@ -270,9 +270,9 @@ vec2 Input::GetAxis(int axis) | |||||
| #if defined USE_SDL | #if defined USE_SDL | ||||
| /* Simulate a joystick using the keyboard. This SDL call is free. */ | /* Simulate a joystick using the keyboard. This SDL call is free. */ | ||||
| # if SDL_VERSION_ATLEAST(1,3,0) | # if SDL_VERSION_ATLEAST(1,3,0) | ||||
| Uint8 *keystate = SDL_GetKeyboardState(NULL); | |||||
| Uint8 *keystate = SDL_GetKeyboardState(nullptr); | |||||
| # else | # else | ||||
| Uint8 *keystate = SDL_GetKeyState(NULL); | |||||
| Uint8 *keystate = SDL_GetKeyState(nullptr); | |||||
| # endif | # endif | ||||
| int left = keystate[SDLK_d] - (keystate[SDLK_a] | keystate[SDLK_q]); | int left = keystate[SDLK_d] - (keystate[SDLK_a] | keystate[SDLK_q]); | ||||
| int up = (keystate[SDLK_w] | keystate[SDLK_z]) - keystate[SDLK_s] ; | int up = (keystate[SDLK_w] | keystate[SDLK_z]) - keystate[SDLK_s] ; | ||||
| @@ -303,9 +303,9 @@ int Input::GetButtonState(int button) | |||||
| { | { | ||||
| #if defined USE_SDL | #if defined USE_SDL | ||||
| # if SDL_VERSION_ATLEAST(1,3,0) | # if SDL_VERSION_ATLEAST(1,3,0) | ||||
| Uint8 *keystate = SDL_GetKeyboardState(NULL); | |||||
| Uint8 *keystate = SDL_GetKeyboardState(nullptr); | |||||
| # else | # else | ||||
| Uint8 *keystate = SDL_GetKeyState(NULL); | |||||
| Uint8 *keystate = SDL_GetKeyState(nullptr); | |||||
| # endif | # endif | ||||
| return keystate[button]; | return keystate[button]; | ||||
| #else | #else | ||||
| @@ -401,7 +401,7 @@ void Input::SetMousePos(ivec2 coord) | |||||
| { | { | ||||
| data->mouse = coord; | data->mouse = coord; | ||||
| WorldEntity *top = NULL; | |||||
| WorldEntity *top = nullptr; | |||||
| /* Find the top “widget” amongst all entities that match the | /* Find the top “widget” amongst all entities that match the | ||||
| * mouse coordinates */ | * mouse coordinates */ | ||||
| @@ -486,7 +486,7 @@ Stick *Input::TrackStick(int desired) | |||||
| { | { | ||||
| /* FIXME: add the possibility to choose amongst sticks */ | /* FIXME: add the possibility to choose amongst sticks */ | ||||
| if (desired >= data->m_sticks.Count()) | if (desired >= data->m_sticks.Count()) | ||||
| return NULL; | |||||
| return nullptr; | |||||
| Ticker::Ref(data->m_sticks[desired]); | Ticker::Ref(data->m_sticks[desired]); | ||||
| return data->m_sticks[desired]; | return data->m_sticks[desired]; | ||||
| } | } | ||||
| @@ -19,7 +19,7 @@ namespace lol | |||||
| static inline void Abort() | static inline void Abort() | ||||
| { | { | ||||
| #if defined __CELLOS_LV2__ | #if defined __CELLOS_LV2__ | ||||
| *(uint32_t *)NULL = 0xdead; | |||||
| *(uint32_t *)nullptr = 0xdead; | |||||
| #else | #else | ||||
| std::abort(); | std::abort(); | ||||
| #endif | #endif | ||||
| @@ -120,7 +120,7 @@ protected: | |||||
| template<typename T> inline void AddStream(int n, VertexUsage usage) | template<typename T> inline void AddStream(int n, VertexUsage usage) | ||||
| { | { | ||||
| m_streams[n].stream_type = GetType((T *)NULL); | |||||
| m_streams[n].stream_type = GetType((T *)nullptr); | |||||
| m_streams[n].usage = usage; | m_streams[n].usage = usage; | ||||
| m_streams[n].size = sizeof(T); | m_streams[n].size = sizeof(T); | ||||
| } | } | ||||
| @@ -74,7 +74,7 @@ public: | |||||
| inline void Run(T a, T b, RealFunc *func, int decimals) | inline void Run(T a, T b, RealFunc *func, int decimals) | ||||
| { | { | ||||
| Run(a, b, func, NULL, decimals); | |||||
| Run(a, b, func, nullptr, decimals); | |||||
| } | } | ||||
| T EvalCheby(T const &x) | T EvalCheby(T const &x) | ||||
| @@ -56,7 +56,7 @@ LevelMap::LevelMap(char const *path) | |||||
| char tmp[BUFSIZ]; | char tmp[BUFSIZ]; | ||||
| int gids[LevelMapData::MAX_TILESETS]; | int gids[LevelMapData::MAX_TILESETS]; | ||||
| uint32_t *tiles = NULL; | |||||
| uint32_t *tiles = nullptr; | |||||
| int level = 0, orientation = 0, ntiles = 0; | int level = 0, orientation = 0, ntiles = 0; | ||||
| FILE *fp = fopen(path, "r"); | FILE *fp = fopen(path, "r"); | ||||
| @@ -118,7 +118,7 @@ LevelMap::LevelMap(char const *path) | |||||
| Layer *l = new Layer(data->width, data->height, | Layer *l = new Layer(data->width, data->height, | ||||
| level, orientation, tiles); | level, orientation, tiles); | ||||
| data->m_layers.Push(l); | data->m_layers.Push(l); | ||||
| tiles = NULL; | |||||
| tiles = nullptr; | |||||
| //Log::Debug("new layer %ix%i\n", data->width, data->height); | //Log::Debug("new layer %ix%i\n", data->width, data->height); | ||||
| } | } | ||||
| } | } | ||||
| @@ -69,15 +69,15 @@ void AndroidApp::Tick() | |||||
| void *AndroidApp::MainRun(void *data) | void *AndroidApp::MainRun(void *data) | ||||
| { | { | ||||
| int argc = 1; | int argc = 1; | ||||
| char *argv[] = { "", NULL }; | |||||
| char *env[] = { NULL }; | |||||
| char *argv[] = { "", nullptr }; | |||||
| char *env[] = { nullptr }; | |||||
| /* Call the user's main() function. One of these will work. */ | /* Call the user's main() function. One of these will work. */ | ||||
| lol_android_main(); | lol_android_main(); | ||||
| lol_android_main(argc, argv); | lol_android_main(argc, argv); | ||||
| lol_android_main(argc, argv, env); | lol_android_main(argc, argv, env); | ||||
| return NULL; | |||||
| return nullptr; | |||||
| } | } | ||||
| AndroidApp::~AndroidApp() | AndroidApp::~AndroidApp() | ||||
| @@ -107,7 +107,7 @@ Java_org_zoy_LolEngine_LolRenderer_nativeInit(JNIEnv* env) | |||||
| { | { | ||||
| /* Initialise app thread and wait for it to be ready, ie. set | /* Initialise app thread and wait for it to be ready, ie. set | ||||
| * the FPS value at least. */ | * the FPS value at least. */ | ||||
| g_main_thread = new Thread(lol::AndroidApp::MainRun, NULL);; | |||||
| g_main_thread = new Thread(lol::AndroidApp::MainRun, nullptr); | |||||
| g_main_queue.Pop(); | g_main_queue.Pop(); | ||||
| /* Launch our ticker */ | /* Launch our ticker */ | ||||
| @@ -91,13 +91,13 @@ bool NaClInstance::Init(uint32_t argc, | |||||
| { | { | ||||
| /* Ensure only one NaClInstance does Init() at the same time. */ | /* Ensure only one NaClInstance does Init() at the same time. */ | ||||
| main_mutex.Lock(); | main_mutex.Lock(); | ||||
| char *env[] = { NULL }; | |||||
| char *env[] = { nullptr }; | |||||
| Args arglist(argc, const_cast<char **>(argv), const_cast<char **>(env)); | Args arglist(argc, const_cast<char **>(argv), const_cast<char **>(env)); | ||||
| main_queue.Push(&arglist); | main_queue.Push(&arglist); | ||||
| m_main_thread = new Thread(MainRun, NULL); | |||||
| m_main_thread = new Thread(MainRun, nullptr); | |||||
| /* Push so that only MainSignal() can unblock us */ | /* Push so that only MainSignal() can unblock us */ | ||||
| main_queue.Push(NULL); | |||||
| main_queue.Push(NULL); | |||||
| main_queue.Push(nullptr); | |||||
| main_queue.Push(nullptr); | |||||
| main_mutex.Unlock(); | main_mutex.Unlock(); | ||||
| // My timer callback | // My timer callback | ||||
| @@ -120,7 +120,7 @@ void * NaClInstance::MainRun(void *data) | |||||
| lol_nacl_main(arglist->m_argc, arglist->m_argv); | lol_nacl_main(arglist->m_argc, arglist->m_argv); | ||||
| lol_nacl_main(arglist->m_argc, arglist->m_argv, arglist->m_env); | lol_nacl_main(arglist->m_argc, arglist->m_argv, arglist->m_env); | ||||
| return NULL; | |||||
| return nullptr; | |||||
| } | } | ||||
| void NaClInstance::MainSignal() | void NaClInstance::MainSignal() | ||||
| @@ -145,7 +145,7 @@ void NaClInstance::DidChangeView(const pp::Rect& position, const pp::Rect& clip) | |||||
| m_size = ivec2(position.size().width(), position.size().height()); | m_size = ivec2(position.size().width(), position.size().height()); | ||||
| if (m_opengl_ctx == NULL) | |||||
| if (m_opengl_ctx == nullptr) | |||||
| m_opengl_ctx.reset(new OpenGLContext(this)); | m_opengl_ctx.reset(new OpenGLContext(this)); | ||||
| m_opengl_ctx->InvalidateContext(this); | m_opengl_ctx->InvalidateContext(this); | ||||
| m_opengl_ctx->ResizeContext(position.size()); | m_opengl_ctx->ResizeContext(position.size()); | ||||
| @@ -177,7 +177,7 @@ bool NaClInstance::HandleInputEvent(const pp::InputEvent& event) | |||||
| void NaClInstance::DrawSelf() | void NaClInstance::DrawSelf() | ||||
| { | { | ||||
| if (m_opengl_ctx == NULL) | |||||
| if (m_opengl_ctx == nullptr) | |||||
| return; | return; | ||||
| m_opengl_ctx->MakeContextCurrent(this); | m_opengl_ctx->MakeContextCurrent(this); | ||||
| @@ -38,8 +38,10 @@ OpenGLContext::~OpenGLContext() { | |||||
| glSetCurrentContextPPAPI(0); | glSetCurrentContextPPAPI(0); | ||||
| } | } | ||||
| bool OpenGLContext::MakeContextCurrent(pp::Instance* instance) { | |||||
| if (instance == NULL) { | |||||
| bool OpenGLContext::MakeContextCurrent(pp::Instance* instance) | |||||
| { | |||||
| if (instance == nullptr) | |||||
| { | |||||
| glSetCurrentContextPPAPI(0); | glSetCurrentContextPPAPI(0); | ||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -63,7 +63,7 @@ Ps3App::Ps3App(char const *title, ivec2 res, float fps) : | |||||
| cellSysmoduleLoadModule(CELL_SYSMODULE_USBD); | cellSysmoduleLoadModule(CELL_SYSMODULE_USBD); | ||||
| cellSysmoduleLoadModule(CELL_SYSMODULE_IO); | cellSysmoduleLoadModule(CELL_SYSMODULE_IO); | ||||
| cellSysutilRegisterCallback(0, Ps3AppData::SysCallBack, NULL); | |||||
| cellSysutilRegisterCallback(0, Ps3AppData::SysCallBack, nullptr); | |||||
| PSGLinitOptions psglio; | PSGLinitOptions psglio; | ||||
| psglio.enable = PSGL_INIT_MAX_SPUS | psglio.enable = PSGL_INIT_MAX_SPUS | ||||
| @@ -136,7 +136,7 @@ public: | |||||
| virtual ~ThreadBase() | virtual ~ThreadBase() | ||||
| { | { | ||||
| sys_ppu_thread_join(m_thread, NULL); | |||||
| sys_ppu_thread_join(m_thread, nullptr); | |||||
| } | } | ||||
| private: | private: | ||||
| @@ -33,7 +33,7 @@ | |||||
| #endif | #endif | ||||
| #if defined USE_SDL && defined USE_D3D9 | #if defined USE_SDL && defined USE_D3D9 | ||||
| HWND g_hwnd = NULL; | |||||
| HWND g_hwnd = nullptr; | |||||
| extern IDirect3DDevice9 *g_d3ddevice; | extern IDirect3DDevice9 *g_d3ddevice; | ||||
| #endif | #endif | ||||
| @@ -87,7 +87,7 @@ SdlApp::SdlApp(char const *title, ivec2 res, float fps) : | |||||
| exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
| } | } | ||||
| SDL_WM_SetCaption(title, NULL); | |||||
| SDL_WM_SetCaption(title, nullptr); | |||||
| /* Initialise everything */ | /* Initialise everything */ | ||||
| Ticker::Setup(fps); | Ticker::Setup(fps); | ||||
| @@ -126,7 +126,7 @@ void SdlApp::Tick() | |||||
| hr = g_d3ddevice->EndScene(); | hr = g_d3ddevice->EndScene(); | ||||
| if (FAILED(hr)) | if (FAILED(hr)) | ||||
| Abort(); | Abort(); | ||||
| hr = g_d3ddevice->Present(NULL, NULL, NULL, NULL); | |||||
| hr = g_d3ddevice->Present(nullptr, nullptr, nullptr, nullptr); | |||||
| if (FAILED(hr)) | if (FAILED(hr)) | ||||
| Abort(); | Abort(); | ||||
| # else | # else | ||||
| @@ -196,7 +196,7 @@ void SdlInputData::Tick(float seconds) | |||||
| /* Send the whole keyboard state to the input system */ | /* Send the whole keyboard state to the input system */ | ||||
| #if 0 | #if 0 | ||||
| Uint8 *keystate = SDL_GetKeyState(NULL); | |||||
| Uint8 *keystate = SDL_GetKeyState(nullptr); | |||||
| for (int i = 0; i < 256; i++) | for (int i = 0; i < 256; i++) | ||||
| if (keystate[i]) | if (keystate[i]) | ||||
| Input::KeyPressed(i, seconds); | Input::KeyPressed(i, seconds); | ||||
| @@ -67,7 +67,7 @@ void XboxApp::Tick() | |||||
| Ticker::TickDraw(); | Ticker::TickDraw(); | ||||
| #if defined _XBOX | #if defined _XBOX | ||||
| g_d3ddevice->Present(NULL, NULL, NULL, NULL); | |||||
| g_d3ddevice->Present(nullptr, nullptr, nullptr, nullptr); | |||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -75,7 +75,7 @@ private: | |||||
| static Scene *scene; | static Scene *scene; | ||||
| }; | }; | ||||
| Scene *SceneData::scene = NULL; | |||||
| Scene *SceneData::scene = nullptr; | |||||
| /* | /* | ||||
| * Public Scene class | * Public Scene class | ||||
| @@ -56,7 +56,7 @@ class FileData | |||||
| #elif HAVE_STDIO_H | #elif HAVE_STDIO_H | ||||
| if (m_fd) | if (m_fd) | ||||
| fclose(m_fd); | fclose(m_fd); | ||||
| m_fd = NULL; | |||||
| m_fd = nullptr; | |||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -49,11 +49,11 @@ void Init(int argc, char *argv[], | |||||
| */ | */ | ||||
| #if defined HAVE_GETCWD | #if defined HAVE_GETCWD | ||||
| char *cwd = getcwd(NULL, 0); | |||||
| char *cwd = getcwd(nullptr, 0); | |||||
| #elif defined HAVE__GETCWD || (defined _WIN32 && !defined _XBOX) | #elif defined HAVE__GETCWD || (defined _WIN32 && !defined _XBOX) | ||||
| char *cwd = _getcwd(NULL, 0); | |||||
| char *cwd = _getcwd(nullptr, 0); | |||||
| #else | #else | ||||
| char *cwd = NULL; | |||||
| char *cwd = nullptr; | |||||
| #endif | #endif | ||||
| String binarydir = String(cwd ? cwd : ".") + SEPARATOR; | String binarydir = String(cwd ? cwd : ".") + SEPARATOR; | ||||
| free(cwd); | free(cwd); | ||||
| @@ -39,7 +39,7 @@ public: | |||||
| MutexBase() | MutexBase() | ||||
| { | { | ||||
| #if defined HAVE_PTHREAD_H | #if defined HAVE_PTHREAD_H | ||||
| pthread_mutex_init(&m_mutex, NULL); | |||||
| pthread_mutex_init(&m_mutex, nullptr); | |||||
| #elif defined _WIN32 | #elif defined _WIN32 | ||||
| InitializeCriticalSection(&m_mutex); | InitializeCriticalSection(&m_mutex); | ||||
| #endif | #endif | ||||
| @@ -88,12 +88,12 @@ public: | |||||
| m_start = m_count = 0; | m_start = m_count = 0; | ||||
| #if defined HAVE_PTHREAD_H | #if defined HAVE_PTHREAD_H | ||||
| m_poppers = m_pushers = 0; | m_poppers = m_pushers = 0; | ||||
| pthread_mutex_init(&m_mutex, NULL); | |||||
| pthread_cond_init(&m_empty_cond, NULL); | |||||
| pthread_cond_init(&m_full_cond, NULL); | |||||
| pthread_mutex_init(&m_mutex, nullptr); | |||||
| pthread_cond_init(&m_empty_cond, nullptr); | |||||
| pthread_cond_init(&m_full_cond, nullptr); | |||||
| #elif defined _WIN32 | #elif defined _WIN32 | ||||
| m_empty_sem = CreateSemaphore(NULL, CAPACITY, CAPACITY, NULL); | |||||
| m_full_sem = CreateSemaphore(NULL, 0, CAPACITY, NULL); | |||||
| m_empty_sem = CreateSemaphore(nullptr, CAPACITY, CAPACITY, nullptr); | |||||
| m_full_sem = CreateSemaphore(nullptr, 0, CAPACITY, nullptr); | |||||
| InitializeCriticalSection(&m_mutex); | InitializeCriticalSection(&m_mutex); | ||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -136,7 +136,7 @@ public: | |||||
| pthread_mutex_unlock(&m_mutex); | pthread_mutex_unlock(&m_mutex); | ||||
| #elif defined _WIN32 | #elif defined _WIN32 | ||||
| LeaveCriticalSection(&m_mutex); | LeaveCriticalSection(&m_mutex); | ||||
| ReleaseSemaphore(m_full_sem, 1, NULL); | |||||
| ReleaseSemaphore(m_full_sem, 1, nullptr); | |||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -168,7 +168,7 @@ public: | |||||
| pthread_mutex_unlock(&m_mutex); | pthread_mutex_unlock(&m_mutex); | ||||
| #else | #else | ||||
| LeaveCriticalSection(&m_mutex); | LeaveCriticalSection(&m_mutex); | ||||
| ReleaseSemaphore(m_empty_sem, 1, NULL); | |||||
| ReleaseSemaphore(m_empty_sem, 1, nullptr); | |||||
| #endif | #endif | ||||
| return ret; | return ret; | ||||
| @@ -200,7 +200,7 @@ public: | |||||
| pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); | pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); | ||||
| pthread_create(&m_thread, &attr, fn, data); | pthread_create(&m_thread, &attr, fn, data); | ||||
| #elif defined _WIN32 | #elif defined _WIN32 | ||||
| m_thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)fn, | |||||
| m_thread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)fn, | |||||
| data, 0, &m_tid); | data, 0, &m_tid); | ||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -208,7 +208,7 @@ public: | |||||
| virtual ~ThreadBase() | virtual ~ThreadBase() | ||||
| { | { | ||||
| #if defined HAVE_PTHREAD_H | #if defined HAVE_PTHREAD_H | ||||
| pthread_join(m_thread, NULL); | |||||
| pthread_join(m_thread, nullptr); | |||||
| #elif defined _WIN32 | #elif defined _WIN32 | ||||
| WaitForSingleObject(m_thread, INFINITE); | WaitForSingleObject(m_thread, INFINITE); | ||||
| #endif | #endif | ||||
| @@ -59,7 +59,7 @@ private: | |||||
| float GetSeconds(bool reset) | float GetSeconds(bool reset) | ||||
| { | { | ||||
| struct timeval tv, tv0 = m_tv; | struct timeval tv, tv0 = m_tv; | ||||
| gettimeofday(&tv, NULL); | |||||
| gettimeofday(&tv, nullptr); | |||||
| if (reset) | if (reset) | ||||
| m_tv = tv; | m_tv = tv; | ||||
| return 1e-6f * (tv.tv_usec - tv0.tv_usec) + (tv.tv_sec - tv0.tv_sec); | return 1e-6f * (tv.tv_usec - tv0.tv_usec) + (tv.tv_sec - tv0.tv_sec); | ||||
| @@ -45,7 +45,7 @@ Text::Text(char const *text, char const *font) | |||||
| : data(new TextData()) | : data(new TextData()) | ||||
| { | { | ||||
| data->font = Forge::Register(font); | data->font = Forge::Register(font); | ||||
| data->text = text ? strdup(text) : NULL; | |||||
| data->text = text ? strdup(text) : nullptr; | |||||
| data->length = text ? strlen(text) : 0; | data->length = text ? strlen(text) : 0; | ||||
| data->pos = vec3(0, 0, 0); | data->pos = vec3(0, 0, 0); | ||||
| @@ -56,7 +56,7 @@ void Text::SetText(char const *text) | |||||
| { | { | ||||
| if (data->text) | if (data->text) | ||||
| free(data->text); | free(data->text); | ||||
| data->text = text ? strdup(text) : NULL; | |||||
| data->text = text ? strdup(text) : nullptr; | |||||
| data->length = text ? strlen(text) : 0; | data->length = text ? strlen(text) : 0; | ||||
| } | } | ||||
| @@ -39,7 +39,7 @@ public: | |||||
| quit(0), quitframe(0), quitdelay(20), panic(0) | quit(0), quitframe(0), quitdelay(20), panic(0) | ||||
| { | { | ||||
| for (int i = 0; i < Entity::ALLGROUP_END; i++) | for (int i = 0; i < Entity::ALLGROUP_END; i++) | ||||
| list[i] = NULL; | |||||
| list[i] = nullptr; | |||||
| } | } | ||||
| ~TickerData() | ~TickerData() | ||||
| @@ -114,7 +114,7 @@ void Ticker::Register(Entity *entity) | |||||
| void Ticker::Ref(Entity *entity) | void Ticker::Ref(Entity *entity) | ||||
| { | { | ||||
| ASSERT(entity, "dereferencing NULL entity\n"); | |||||
| ASSERT(entity, "dereferencing nullptr entity\n"); | |||||
| ASSERT(!entity->m_destroy, | ASSERT(!entity->m_destroy, | ||||
| "referencing entity scheduled for destruction %s\n", | "referencing entity scheduled for destruction %s\n", | ||||
| entity->GetName()); | entity->GetName()); | ||||
| @@ -124,7 +124,7 @@ void Ticker::Ref(Entity *entity) | |||||
| /* Get the entity out of the m_autorelease list. This is usually | /* Get the entity out of the m_autorelease list. This is usually | ||||
| * very fast since the first entry in autolist is the last | * very fast since the first entry in autolist is the last | ||||
| * registered entity. */ | * registered entity. */ | ||||
| for (Entity *e = data->autolist, *prev = NULL; e; | |||||
| for (Entity *e = data->autolist, *prev = nullptr; e; | |||||
| prev = e, e = e->m_autonext) | prev = e, e = e->m_autonext) | ||||
| { | { | ||||
| if (e == entity) | if (e == entity) | ||||
| @@ -141,7 +141,7 @@ void Ticker::Ref(Entity *entity) | |||||
| int Ticker::Unref(Entity *entity) | int Ticker::Unref(Entity *entity) | ||||
| { | { | ||||
| ASSERT(entity, "dereferencing NULL entity\n"); | |||||
| ASSERT(entity, "dereferencing null entity\n"); | |||||
| ASSERT(entity->m_ref > 0, "dereferencing unreferenced entity %s\n", | ASSERT(entity->m_ref > 0, "dereferencing unreferenced entity %s\n", | ||||
| entity->GetName()) | entity->GetName()) | ||||
| ASSERT(!entity->m_autorelease, "dereferencing autoreleased entity %s\n", | ASSERT(!entity->m_autorelease, "dereferencing autoreleased entity %s\n", | ||||
| @@ -247,7 +247,7 @@ void *TickerData::GameThreadMain(void * /* p */) | |||||
| * before inserting awaiting objects, because only objects already | * before inserting awaiting objects, because only objects already | ||||
| * inthe tick lists can be marked for destruction. */ | * inthe tick lists can be marked for destruction. */ | ||||
| for (int i = 0; i < Entity::ALLGROUP_END; i++) | for (int i = 0; i < Entity::ALLGROUP_END; i++) | ||||
| for (Entity *e = data->list[i], *prev = NULL; e; ) | |||||
| for (Entity *e = data->list[i], *prev = nullptr; e; ) | |||||
| { | { | ||||
| if (e->m_destroy && i < Entity::GAMEGROUP_END) | if (e->m_destroy && i < Entity::GAMEGROUP_END) | ||||
| { | { | ||||
| @@ -321,7 +321,7 @@ void *TickerData::GameThreadMain(void * /* p */) | |||||
| Log::Info("ticker game thread terminated\n"); | Log::Info("ticker game thread terminated\n"); | ||||
| #endif | #endif | ||||
| return NULL; | |||||
| return nullptr; | |||||
| } | } | ||||
| void *TickerData::DrawThreadMain(void * /* p */) | void *TickerData::DrawThreadMain(void * /* p */) | ||||
| @@ -335,7 +335,7 @@ void *TickerData::DrawThreadMain(void * /* p */) | |||||
| data->gametick.Push(1); | data->gametick.Push(1); | ||||
| } | } | ||||
| return NULL; | |||||
| return nullptr; | |||||
| } | } | ||||
| void *TickerData::DiskThreadMain(void * /* p */) | void *TickerData::DiskThreadMain(void * /* p */) | ||||
| @@ -343,7 +343,7 @@ void *TickerData::DiskThreadMain(void * /* p */) | |||||
| /* FIXME: temporary hack to avoid crashes on the PS3 */ | /* FIXME: temporary hack to avoid crashes on the PS3 */ | ||||
| data->disktick.Pop(); | data->disktick.Pop(); | ||||
| return NULL; | |||||
| return nullptr; | |||||
| } | } | ||||
| void Ticker::SetState(Entity * /* entity */, uint32_t /* state */) | void Ticker::SetState(Entity * /* entity */, uint32_t /* state */) | ||||
| @@ -361,10 +361,10 @@ void Ticker::Setup(float fps) | |||||
| { | { | ||||
| data->fps = fps; | data->fps = fps; | ||||
| data->gamethread = new Thread(TickerData::GameThreadMain, NULL); | |||||
| data->gamethread = new Thread(TickerData::GameThreadMain, nullptr); | |||||
| data->gametick.Push(1); | data->gametick.Push(1); | ||||
| data->diskthread = new Thread(TickerData::DiskThreadMain, NULL); | |||||
| data->diskthread = new Thread(TickerData::DiskThreadMain, nullptr); | |||||
| } | } | ||||
| void Ticker::TickDraw() | void Ticker::TickDraw() | ||||
| @@ -70,7 +70,7 @@ TileSet::TileSet(char const *path, ivec2 size, ivec2 count) | |||||
| data->path = data->name + 10; | data->path = data->name + 10; | ||||
| sprintf(data->name, "<tileset> %s", path); | sprintf(data->name, "<tileset> %s", path); | ||||
| data->tiles = NULL; | |||||
| data->tiles = nullptr; | |||||
| data->m_texture = 0; | data->m_texture = 0; | ||||
| data->img = new Image(path); | data->img = new Image(path); | ||||
| data->isize = data->img->GetSize(); | data->isize = data->img->GetSize(); | ||||
| @@ -153,7 +153,7 @@ void TileSet::TickDraw(float seconds) | |||||
| if (pixels != data->img->GetData()) | if (pixels != data->img->GetData()) | ||||
| free(pixels); | free(pixels); | ||||
| delete data->img; | delete data->img; | ||||
| data->img = NULL; | |||||
| data->img = nullptr; | |||||
| } | } | ||||
| } | } | ||||
| @@ -307,7 +307,7 @@ void Video::Clear(ClearMask m) | |||||
| mask |= D3DCLEAR_ZBUFFER; | mask |= D3DCLEAR_ZBUFFER; | ||||
| if (m & ClearMask::Stencil) | if (m & ClearMask::Stencil) | ||||
| mask |= D3DCLEAR_STENCIL; | mask |= D3DCLEAR_STENCIL; | ||||
| if (FAILED(VideoData::d3d_dev->Clear(0, NULL, mask, | |||||
| if (FAILED(VideoData::d3d_dev->Clear(0, nullptr, mask, | |||||
| VideoData::clear_color, | VideoData::clear_color, | ||||
| VideoData::clear_depth, 0))) | VideoData::clear_depth, 0))) | ||||
| Abort(); | Abort(); | ||||
| @@ -39,6 +39,11 @@ au Syntax cpp | |||||
| \ int2 int3 int4 int2x2 int3x3 int4x4 | \ int2 int3 int4 int2x2 int3x3 int4x4 | ||||
| \ float2 float3 float4 float2x2 float3x3 float4x4 | \ float2 float3 float4 float2x2 float3x3 float4x4 | ||||
| " Ensure we know about nullptr | |||||
| au Syntax cpp | |||||
| \ syn keyword cConstant | |||||
| \ nullptr | |||||
| """ | """ | ||||
| """ LolFx language handler | """ LolFx language handler | ||||