Skip to content

Commit cdfc19d

Browse files
committed
24.8.28
[Engine] * Finish logging LUA API static vars. * Resolve compiler warnings. * Miscellaneous clean ups.
1 parent 3f4b7e5 commit cdfc19d

File tree

6 files changed

+46
-28
lines changed

6 files changed

+46
-28
lines changed

src/crypt.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static const string CryptBin2HexL(const uint8_t*const ucStr,
205205
static const string CryptBin2HexL(const MemConst &mcSrc)
206206
{ return CryptBin2HexL(mcSrc.MemPtr<uint8_t>(), mcSrc.MemSize()); }
207207
/* ------------------------------------------------------------------------- */
208-
void CryptAddEntropyPtr(const void*const vpPtr, const size_t stSize)
208+
static void CryptAddEntropyPtr(const void*const vpPtr, const size_t stSize)
209209
{ RAND_add(vpPtr, UtilIntOrMax<int>(stSize), static_cast<double>(stSize)); }
210210
/* ------------------------------------------------------------------------- */
211211
template<typename IntType>void CryptAddEntropyInt(const IntType itValue)

src/fontglph.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ template<class StrokerFuncType>
286286
GetMaxTexSizeFromBounds(ipData.DimGetWidth<GLuint>(),
287287
ipData.DimGetHeight<GLuint>(), uiWidth, uiHeight, 2);
288288
const GLuint uiMaximum = cOgl->MaxTexSize();
289-
// Makle sure the size is supported by graphics. !FIXME. Make a new
289+
// Make sure the size is supported by graphics. !FIXME. Make a new
290290
// OpenGL surface in a sub-texture slot here but this may require a bit
291291
// of work.
292292
if(uiSize > uiMaximum)
@@ -334,14 +334,14 @@ template<class StrokerFuncType>
334334
mDst.MemWrite(stDestPos, cpSrc, stSrcScanSize);
335335
// Calculate clear position and set white transparent pixels
336336
const size_t stClearPos = stDestPos + stSrcScanSize;
337-
mDst.MemFillEx<uint64_t>(stClearPos, uqClear, stDestExtra);
337+
mDst.MemFillEx(stClearPos, uqClear, stDestExtra);
338338
} // Calculate size of a scan line in the new surface
339339
const size_t stDestScanSize = stBinWidth * BY_GRAYALPHA;
340340
// Clear extra pixels on the bottom
341341
for(size_t stY = DimGetHeight(); stY < stBinHeight; ++stY)
342342
{ // Calculate source and destination position and copy the scan line
343343
const size_t stClearPos = (stBinWidth * stY) * BY_GRAYALPHA;
344-
mDst.MemFillEx<uint64_t>(stClearPos, uqClear, stDestScanSize);
344+
mDst.MemFillEx(stClearPos, uqClear, stDestScanSize);
345345
} // This is the new image and the old one will be destroyed
346346
const size_t stOldAlloc = isRef.MemSize();
347347
isRef.MemSwap(mDst);

src/lldisplay.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ LLFUNC(SetInterval, 1, cTimer->TimerSetInterval(AgUInt64LG{lS, 1,
226226
// ? for widescreen window sizes.
227227
/* ------------------------------------------------------------------------- */
228228
LLFUNC(SetMatrix, 0,
229-
const AgNumberL aWidth{lS, 1, 1.0f},
230-
aHeight{lS, 2, 1.0f};
229+
const AgNumberL<GLfloat> aWidth{lS, 1, 1.0f},
230+
aHeight{lS, 2, 1.0f};
231231
cFboCore->AutoMatrix(aWidth, aHeight, false))
232232
/* ========================================================================= */
233233
// $ Display.SetPos

src/lua.hpp

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,11 @@ static class Lua final :
214214
iMembers = 0, // Number of static functions used
215215
iMethods = 0, // Number of class methods used
216216
iTables = 0, // Number of tables used
217-
iTotalStatics = 0, // Number of static vars registered
217+
iStatics = 0, // Number of static vars registered
218218
iTotalMembers = 0, // Number of static functions in total
219219
iTotalMethods = 0, // Number of class methods in total
220-
iTotalTables = 0; // Number of tables in total
220+
iTotalTables = 0, // Number of tables in total
221+
iTotalStatics = 0; // Number of static vars in total
221222
// Init core libraries
222223
for(const LuaLibStatic &llRef : llsaAPI)
223224
{ // Increment total statistics
@@ -226,8 +227,20 @@ static class Lua final :
226227
iTotalTables += llRef.iLLKICount;
227228
++iTotal;
228229
// Ignore if this API is not allowed in the current operation mode
229-
if(!cSystem->IsCoreFlagsHave(llRef.cfcRequired)) continue;
230-
// Increment used statistics
230+
if(!cSystem->IsCoreFlagsHave(llRef.cfcRequired))
231+
{ // If we have consts list?
232+
if(llRef.lkiList)
233+
{ // Number of static vars registered in this namespace
234+
int iStaticsNS = 0;
235+
// Walk through the table
236+
for(const LuaTable *ltPtr = llRef.lkiList; ltPtr->cpName; ++ltPtr)
237+
// Add to total static variables registered for this namespace
238+
iStaticsNS += ltPtr->iCount;
239+
// Add to total static variables registered
240+
iTotalStatics += iStaticsNS;
241+
} // Next namespace
242+
continue;
243+
} // Increment used statistics
231244
iMembers += llRef.iLLCount;
232245
iMethods += llRef.iLLMFCount;
233246
iTables += llRef.iLLKICount;
@@ -236,8 +249,8 @@ static class Lua final :
236249
LuaUtilPushTable(GetState(), 0,
237250
llRef.iLLCount + llRef.iLLMFCount + llRef.iLLKICount);
238251
luaL_setfuncs(GetState(), llRef.libList, 0);
239-
// Number of static vars registered
240-
int iStatics = 0;
252+
// Number of static vars registered in this namespace
253+
int iStaticsNS = 0;
241254
// If we have consts list?
242255
if(llRef.lkiList)
243256
{ // Walk through the table
@@ -256,16 +269,17 @@ static class Lua final :
256269
} // Set field name and finalise const table
257270
lua_setfield(GetState(), -2, ltRef.cpName);
258271
// Add to total static variables registered for this namespace
259-
iStatics += ltRef.iCount;
272+
iStaticsNS += ltRef.iCount;
260273
} // Add to total static variables registered
261-
iTotalStatics += iStatics;
274+
iStatics += iStaticsNS;
275+
iTotalStatics += iStaticsNS;
262276
} // If we have don't have member functions?
263277
if(!llRef.libmfList)
264278
{ // Set this current list to global
265279
lua_setglobal(GetState(), llRef.strvName.data());
266280
// Log progress
267281
cLog->LogDebugExSafe("- $ ($ members, $ tables, $ statics).",
268-
llRef.strvName, llRef.iLLCount, llRef.iLLKICount, iStatics);
282+
llRef.strvName, llRef.iLLCount, llRef.iLLKICount, iStaticsNS);
269283
// Continue
270284
continue;
271285
} // Load members into this namespace too for possible aliasing.
@@ -276,7 +290,7 @@ static class Lua final :
276290
// all threads of the same lua state share a single registry so this is
277291
// very safe. Start by creating a new metadata table for 4 entries.
278292
LuaUtilPushTable(GetState(), 0, 4);
279-
// Push the name of the metatable
293+
// Push the name of the meta table
280294
LuaUtilPushStrView(GetState(), llRef.strvName);
281295
lua_setfield(GetState(), -2, "__name");
282296
// Set methods so var:func() works
@@ -298,7 +312,7 @@ static class Lua final :
298312
// Log progress
299313
cLog->LogDebugExSafe(
300314
"- $ ($ members, $ tables, $ statics and $ methods).",
301-
llRef.strvName, llRef.iLLCount, llRef.iLLKICount, iStatics,
315+
llRef.strvName, llRef.iLLCount, llRef.iLLKICount, iStaticsNS,
302316
llRef.iLLMFCount);
303317
// For some reason, I cannot specify a __gc member for the garbage
304318
// collector in this metadata part above because LUA seems to remove
@@ -307,17 +321,20 @@ static class Lua final :
307321
} // Count libraries and report them
308322
cLog->LogDebugExSafe(
309323
"Lua registered $ of $ global namespaces...\n"
310-
"- $ of $ const tables are registered with $ statics.\n"
324+
"- $ of $ const tables are registered.\n"
325+
"- $ of $ static variables are registered.\n"
311326
"- $ of $ member functions are registered.\n"
312327
"- $ of $ method functions are registered.\n"
313328
"- $ of $ functions are registered in total.\n"
314-
"- $ variables are registered in total.",
329+
"- $ of $ variables are registered in total.",
315330
iCount, iTotal,
316-
iTables, iTotalTables, iTotalStatics,
331+
iTables, iTotalTables,
332+
iStatics, iTotalStatics,
317333
iMembers, iTotalMembers,
318334
iMethods, iTotalMethods,
319335
iMembers+iMethods, iTotalMembers+iTotalMethods,
320-
iMembers+iMethods+iTables+iTotalStatics);
336+
iMembers+iMethods+iTables+iStatics,
337+
iTotalMembers+iTotalMethods+iTotalTables+iTotalStatics);
321338
} // Init enviornment variables?
322339
if(FlagIsSet(LF_CORE))
323340
{ // Log progress

src/luautil.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,8 +553,9 @@ template<typename IntType>
553553
}
554554
/* -- Try to get and check a valid number not < or >= ---------------------- */
555555
template<typename IntType>
556-
static IntType LuaUtilGetNumLGE(lua_State*const lS, const int iIndex,
557-
const IntType itMin, const IntType itMax)
556+
static IntType LuaUtilGetNumLGE[[maybe_unused]]
557+
(lua_State*const lS, const int iIndex,
558+
const IntType itMin, const IntType itMax)
558559
{ // Throw if value not a number and return if it is in the valid range
559560
const IntType itVal = LuaUtilGetNum<IntType>(lS, iIndex);
560561
if(itVal >= itMin && itVal < itMax) return itVal;

src/msengine.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
#define VER_AUTHOR "MS-Design" // Author of engine
1313
#define VER_MAJOR 24 // Version major (year)
1414
#define VER_MINOR 8 // Version minor (month)
15-
#define VER_BUILD 17 // Version build (day)
16-
#define VER_REV 23 // Version rev (build#)
17-
#define VER_STR_NQ 24,8,17,23 // Version as literal
18-
#define VER_STR "24.8.17.23" // Version as string
19-
#define VER_DATE "Sat Aug 17 23:02:32 2024 +0100" // Compilation date
15+
#define VER_BUILD 18 // Version build (day)
16+
#define VER_REV 8 // Version rev (build#)
17+
#define VER_STR_NQ 24,8,18,8 // Version as literal
18+
#define VER_STR "24.8.18.8" // Version as string
19+
#define VER_DATE "Sun Aug 18 19:33:27 2024 +0100" // Compilation date
2020
/* == EoF =========================================================== EoF == */

0 commit comments

Comments
 (0)