Move Script* classes to Script namespace

- Rename ScriptEngine, ScriptContext, ScriptInterface, ScriptRequest to
  Script::Engine, Script::Context, Script::Interface, Script::Request
- Remove 'Script' prefix from filenames:
  ScriptContext.* → Context.*
  ScriptInterface.* → Interface.*
  ScriptRequest.* → Request.*
  ScriptEngine.* → Engine.*
  ScriptConversions.* → Conversions.*
  ScriptExceptions.* → Exceptions.*
  ScriptForward.* → ForwardDeclarations.*
  ScriptStats.* → Stats.*
- Update all includes, forward declarations, and friend classes
- Use namespace Script { ... } in .cpp definitions to avoid repetitive
  Script:: prefix (keeping global callbacks outside)
- Rename internal implementation structs:
  ScriptInterface_impl → Interface_impl
  ScriptFunction → Function
- Update copyright year to 2026 in all touched files
- Suppress pre-existing cppcheck warnings (uninitvar, nullPointer, unknown
  macro) by adding them to suppressions-list.txt (these are not caused
  by this refactor)

Fixes #7516
This commit is contained in:
vyordan
2026-06-02 15:06:50 -06:00
committed by phosit
parent 310c4bf028
commit ec8b420abc
220 changed files with 2224 additions and 2153 deletions
+13 -13
View File
@@ -30,9 +30,9 @@
#include "ps/CLogger.h"
#include "ps/CStr.h"
#include "scriptinterface/Object.h"
#include "scriptinterface/ScriptConversions.h"
#include "scriptinterface/ScriptInterface.h"
#include "scriptinterface/ScriptRequest.h"
#include "scriptinterface/Conversions.h"
#include "scriptinterface/Interface.h"
#include "scriptinterface/Request.h"
#include <fmt/format.h>
#include <js/CallArgs.h>
@@ -55,7 +55,7 @@ bool GetCRectField(JSContext* cx, unsigned argc, JS::Value* vp)
{
JS::CallArgs args{JS::CallArgsFromVp(argc, vp)};
JS::RootedObject obj{cx, &args.thisv().toObject()};
CGUISimpleSetting<CGUISize>* wrapper{JS::GetMaybePtrFromReservedSlot<CGUISimpleSetting<CGUISize>>(obj, ScriptInterface::JSObjectReservedSlots::PRIVATE)};
CGUISimpleSetting<CGUISize>* wrapper{JS::GetMaybePtrFromReservedSlot<CGUISimpleSetting<CGUISize>>(obj, Script::Interface::JSObjectReservedSlots::PRIVATE)};
args.rval().setDouble(wrapper->GetMutable().*RectMember.*Member);
return true;
@@ -66,7 +66,7 @@ bool SetCRectField(JSContext* cx, unsigned argc, JS::Value* vp)
{
JS::CallArgs args{JS::CallArgsFromVp(argc, vp)};
JS::RootedObject obj{cx, &args.thisv().toObject()};
CGUISimpleSetting<CGUISize>* wrapper{JS::GetMaybePtrFromReservedSlot<CGUISimpleSetting<CGUISize>>(obj, ScriptInterface::JSObjectReservedSlots::PRIVATE)};
CGUISimpleSetting<CGUISize>* wrapper{JS::GetMaybePtrFromReservedSlot<CGUISimpleSetting<CGUISize>>(obj, Script::Interface::JSObjectReservedSlots::PRIVATE)};
double val;
if (!JS::ToNumber(cx, args.get(0), &val))
@@ -96,7 +96,7 @@ bool toString(JSContext* cx, uint argc, JS::Value* vp)
{
JS::CallArgs args{JS::CallArgsFromVp(argc, vp)};
JS::RootedObject obj{cx, &args.thisv().toObject()};
CGUISimpleSetting<CGUISize>* wrapper{JS::GetMaybePtrFromReservedSlot<CGUISimpleSetting<CGUISize>>(obj, ScriptInterface::JSObjectReservedSlots::PRIVATE)};
CGUISimpleSetting<CGUISize>* wrapper{JS::GetMaybePtrFromReservedSlot<CGUISimpleSetting<CGUISize>>(obj, Script::Interface::JSObjectReservedSlots::PRIVATE)};
CStr buffer;
buffer += ToPercentString(wrapper->GetMutable().pixel.left, wrapper->GetMutable().percent.left) + " ";
@@ -104,7 +104,7 @@ bool toString(JSContext* cx, uint argc, JS::Value* vp)
buffer += ToPercentString(wrapper->GetMutable().pixel.right, wrapper->GetMutable().percent.right) + " ";
buffer += ToPercentString(wrapper->GetMutable().pixel.bottom, wrapper->GetMutable().percent.bottom);
ScriptRequest rq{cx};
Script::Request rq{cx};
Script::ToJSVal(rq, args.rval(), buffer);
return true;
}
@@ -137,19 +137,19 @@ JSPropertySpec JSI_props[] =
void JSI_CGUISize::RegisterScriptClass(ScriptInterface& scriptInterface)
void JSI_CGUISize::RegisterScriptClass(Script::Interface& scriptInterface)
{
scriptInterface.DefineCustomObjectType(&JSI_class, nullptr, 0, JSI_props, JSI_methods, nullptr, nullptr);
}
template class CGUISimpleSetting<CGUISize>;
template<>
void CGUISimpleSetting<CGUISize>::ToJSVal(const ScriptRequest& rq, JS::MutableHandleValue ret)
void CGUISimpleSetting<CGUISize>::ToJSVal(const Script::Request& rq, JS::MutableHandleValue ret)
{
const ScriptInterface& scriptInterface = rq.GetScriptInterface();
const Script::Interface& scriptInterface = rq.GetScriptInterface();
JS::RootedObject obj{rq.cx, scriptInterface.CreateCustomObject("CGUISize")};
JS::SetReservedSlot(obj, ScriptInterface::JSObjectReservedSlots::PRIVATE, JS::PrivateValue(this));
JS::SetReservedSlot(obj, Script::Interface::JSObjectReservedSlots::PRIVATE, JS::PrivateValue(this));
ret.setObject(*obj);
};
@@ -160,7 +160,7 @@ bool CGUISimpleSetting<CGUISize>::DoFromString(const CStrW& value)
};
template<>
bool CGUISimpleSetting<CGUISize>::DoFromJSVal(const ScriptRequest& rq, JS::HandleValue value)
bool CGUISimpleSetting<CGUISize>::DoFromJSVal(const Script::Request& rq, JS::HandleValue value)
{
if (value.isString())
{
@@ -189,7 +189,7 @@ bool CGUISimpleSetting<CGUISize>::DoFromJSVal(const ScriptRequest& rq, JS::Handl
JS::RootedObject obj{rq.cx, &value.toObject()};
if (JS_InstanceOf(rq.cx, obj, &JSI_class, nullptr))
{
CGUISimpleSetting<CGUISize>* wrapper = JS::GetMaybePtrFromReservedSlot<CGUISimpleSetting<CGUISize>>(obj, ScriptInterface::JSObjectReservedSlots::PRIVATE);
CGUISimpleSetting<CGUISize>* wrapper = JS::GetMaybePtrFromReservedSlot<CGUISimpleSetting<CGUISize>>(obj, Script::Interface::JSObjectReservedSlots::PRIVATE);
if (this != wrapper)
this->Set(wrapper->m_Setting, false);
return true;