Rename hk=>smo

This commit is contained in:
2025-07-22 06:48:04 -04:00
parent 79f3e84ff8
commit d0aa8e2306
26 changed files with 119 additions and 119 deletions
+15 -15
View File
@@ -184,7 +184,7 @@ public:
}
};
AttachedDevice(const hk::device::SenseDeviceSpec &spec,
AttachedDevice(const smo::device::SenseDeviceSpec &spec,
std::shared_ptr<XcbConnection> conn)
: deviceSpec(spec)
// This std::move is moving ownership from a shared_ptr to a shared_ptr
@@ -229,14 +229,14 @@ public:
}
}
hk::device::SenseDeviceSpec deviceSpec;
smo::device::SenseDeviceSpec deviceSpec;
WindowSelector windowSelector;
std::shared_ptr<XcbConnection> connection;
std::string actualWindowName;
public:
static int getRequiredParamAsInt(
const hk::device::SenseDeviceSpec& spec,
const smo::device::SenseDeviceSpec& spec,
const std::string& paramName)
{
auto it = std::find_if(
@@ -263,7 +263,7 @@ public:
}
static void parseWindowSelector(
const hk::device::SenseDeviceSpec& spec,
const smo::device::SenseDeviceSpec& spec,
WindowSelector& windowSelector)
{
// Default match type
@@ -428,12 +428,12 @@ static xcb_window_t findByName(
} // namespace xcb_window_search
static hk::sense_api::sal_mlo_initializeIndFn xcbXorg_initializeInd;
static hk::sense_api::sal_mlo_finalizeIndFn xcbXorg_finalizeInd;
static hk::sense_api::sal_mlo_attachDeviceReqFn xcbXorg_attachDeviceReq;
static hk::sense_api::sal_mlo_detachDeviceReqFn xcbXorg_detachDeviceReq;
static smo::sense_api::sal_mlo_initializeIndFn xcbXorg_initializeInd;
static smo::sense_api::sal_mlo_finalizeIndFn xcbXorg_finalizeInd;
static smo::sense_api::sal_mlo_attachDeviceReqFn xcbXorg_attachDeviceReq;
static smo::sense_api::sal_mlo_detachDeviceReqFn xcbXorg_detachDeviceReq;
static hk::sense_api::SenseApiDesc xcbXorgApiDesc =
static smo::sense_api::SenseApiDesc xcbXorgApiDesc =
{
.name = "xcb",
.exportedImplexorApis = { { "video-implexor" } },
@@ -445,7 +445,7 @@ static hk::sense_api::SenseApiDesc xcbXorgApiDesc =
}
};
/* Below here are the exported functions that Harikoff will use both to load
/* Below here are the exported functions that Salmanoff will use both to load
* and use this library.
******************************************************************************/
@@ -459,10 +459,10 @@ static hk::sense_api::SenseApiDesc xcbXorgApiDesc =
*
* @return A reference to the SenseApiDesc structure describing the API.
*/
extern HK_UNMANGLED hk::sense_api::HK_GET_SENSE_API_DESC_FN_TYPEDEF
HK_GET_SENSE_API_DESC_FN_NAME;
extern SMO_UNMANGLED smo::sense_api::SMO_GET_SENSE_API_DESC_FN_TYPEDEF
SMO_GET_SENSE_API_DESC_FN_NAME;
const hk::sense_api::SenseApiDesc &HK_GET_SENSE_API_DESC_FN_NAME(void)
const smo::sense_api::SenseApiDesc &SMO_GET_SENSE_API_DESC_FN_NAME(void)
{
return xcbXorgApiDesc;
}
@@ -478,7 +478,7 @@ int xcbXorg_finalizeInd(void)
return 0;
}
int xcbXorg_attachDeviceReq(const hk::device::SenseDeviceSpec &desc)
int xcbXorg_attachDeviceReq(const smo::device::SenseDeviceSpec &desc)
{
// Ensure connection exists before creating device. Create conn'tion if not.
XcbConnection::XConnectionIdentifier id{
@@ -505,7 +505,7 @@ int xcbXorg_attachDeviceReq(const hk::device::SenseDeviceSpec &desc)
return 0;
}
int xcbXorg_detachDeviceReq(const hk::device::SenseDeviceSpec &spec)
int xcbXorg_detachDeviceReq(const smo::device::SenseDeviceSpec &spec)
{
auto it = std::find_if(attachedDevices.begin(), attachedDevices.end(),
[&spec](const AttachedDevice &device) {
+7 -7
View File
@@ -1,11 +1,11 @@
#ifndef HK_PREPROCESSOR_H
#define HK_PREPROCESSOR_H
#ifndef SMO_PREPROCESSOR_H
#define SMO_PREPROCESSOR_H
#define HK_Q(x) #x
#define HK_QUOTE(x) HK_Q(x)
#define SMO_Q(x) #x
#define SMO_QUOTE(x) SMO_Q(x)
#define HK_CONCAT(a, b) a ## b
#define SMO_CONCAT(a, b) a ## b
#define HK_UNMANGLED "C"
#define SMO_UNMANGLED "C"
#endif // HK_PREPROCESSOR_H
#endif // SMO_PREPROCESSOR_H
+17 -17
View File
@@ -5,7 +5,7 @@
#include <stdbool.h>
#include <user/senseDeviceSpec.h>
namespace hk {
namespace smo {
namespace sense_api {
typedef int (sal_mlo_initializeIndFn)(void);
@@ -15,15 +15,15 @@ typedef int (sal_mlo_detachDeviceReqFn)(const device::SenseDeviceSpec &desc);
struct Sal_Mgmt_LibOps
{
/* When Harikoff loads a sense API lib, it calls this function to initialize
/* When Salmanoff loads a sense API lib, it calls this function to initialize
* the lib. When this returns, the lib should be ready to attach devices.
*/
sal_mlo_initializeIndFn *initializeInd;
/* Harikoff calls this to finalize the lib and free its internal
/* Salmanoff calls this to finalize the lib and free its internal
* resources. When this returns, the lib should be ready to be unloaded.
*/
sal_mlo_finalizeIndFn *finalizeInd;
/* Harikoff calls this to attach a device to the lib. When it returns, the
/* Salmanoff calls this to attach a device to the lib. When it returns, the
* device should be attached and ready to be implexed.
*/
sal_mlo_attachDeviceReqFn *attachDeviceReq;
@@ -42,7 +42,7 @@ struct Sal_Mgmt_LibOps
}
};
/* Exported by all sense API Libraries to tell Harikoff what API the lib uses
/* Exported by all sense API Libraries to tell Salmanoff what API the lib uses
* to connect to providers; and also to state which implexor APIs it exports.
*/
class SenseApiDesc
@@ -92,23 +92,23 @@ public:
};
#define HK_GET_SENSE_API_DESC_FN_NAME getSenseApiDesc
#define HK_GET_SENSE_API_DESC_FN_NAME_STR \
HK_QUOTE(HK_GET_SENSE_API_DESC_FN_NAME)
#define HK_GET_SENSE_API_DESC_FN_TYPEDEF \
HK_CONCAT(HK_GET_SENSE_API_DESC_FN_NAME, Fn)
#define SMO_GET_SENSE_API_DESC_FN_NAME getSenseApiDesc
#define SMO_GET_SENSE_API_DESC_FN_NAME_STR \
SMO_QUOTE(SMO_GET_SENSE_API_DESC_FN_NAME)
#define SMO_GET_SENSE_API_DESC_FN_TYPEDEF \
SMO_CONCAT(SMO_GET_SENSE_API_DESC_FN_NAME, Fn)
/* Every Sense API library must define a global instance of this
* function. Harikoff will search for it and invoke it via dlsym().
* function. Salmanoff will search for it and invoke it via dlsym().
*
* The function must return a SenseApiDesc struct that Hk will tell
* Hk what implexors can be used with it & what APIs it exports.
* The SenseApiDesc struct also gives Hk pointers to API functions
* to invoke for communication between Hk and the library.
* The function must return a SenseApiDesc struct that Smo will tell
* Smo what implexors can be used with it & what APIs it exports.
* The SenseApiDesc struct also gives Smo pointers to API functions
* to invoke for communication between Smo and the library.
*/
typedef const SenseApiDesc &(HK_GET_SENSE_API_DESC_FN_TYPEDEF)(void);
typedef const SenseApiDesc &(SMO_GET_SENSE_API_DESC_FN_TYPEDEF)(void);
} // namespace sense_api
} // namespace hk
} // namespace smo
#endif // __USER_SENSE_API_LIB_H__
+2 -2
View File
@@ -6,7 +6,7 @@
#include <iostream>
#include <sstream>
namespace hk {
namespace smo {
namespace device {
class SenseDeviceSpec
@@ -72,6 +72,6 @@ class ExtrospectorDeviceSpec : public SenseDeviceSpec
};
} // namespace device
} // namespace hk
} // namespace smo
#endif // SENSORDEVICESPEC_H
+13 -13
View File
@@ -11,11 +11,11 @@
#include <senseApis/senseApiManager.h>
#include "componentThread.h"
namespace hk {
namespace smo {
static int initializeHarikoff(int argc, char **argv, char **envp);
static int initializeSalmanoff(int argc, char **argv, char **envp);
} // namespace hk
} // namespace smo
int main(int argc, char **argv, char **envp)
{
@@ -25,12 +25,12 @@ int main(int argc, char **argv, char **envp)
boost::asio::io_service::work work(mrntLoop);
// Validate thread IDs
hk::ComponentThread::validateThreadIds();
smo::ComponentThread::validateThreadIds();
// Post initializeHarikoff to mrntLoop
// Post initializeSalmanoff to mrntLoop
mrntLoop.post([&]()
{
int ret = hk::initializeHarikoff(argc, argv, envp);
int ret = smo::initializeSalmanoff(argc, argv, envp);
if (ret != 0)
{
std::cerr << "Initialization failed with code: "
@@ -57,15 +57,15 @@ int main(int argc, char **argv, char **envp)
return 0;
}
namespace hk {
namespace smo {
static int initializeHarikoff(int argc, char **argv, char **envp)
static int initializeSalmanoff(int argc, char **argv, char **envp)
{
std::cout << __func__ << ": Entering" << std::endl;
using namespace hk;
using namespace smo;
OptionParser &options = OptionParser::getOptions();
hk::Mind mind;
smo::Mind mind;
std::cout << PACKAGE_NAME << " " << PACKAGE_VERSION << std::endl;
@@ -100,12 +100,12 @@ std::cerr << "Done attachAllSenseDevicesFromSpecs" << std::endl;
/* Start the threads */
for (const auto& [id, componentThread]
: hk::ComponentThread::componentThreads) {
hk::ComponentThread::signalThread(id);
: smo::ComponentThread::componentThreads) {
smo::ComponentThread::signalThread(id);
}
std::cout << __func__ << ": Exiting" << std::endl;
return 0;
}
} // namespace hk
} // namespace smo
+5 -5
View File
@@ -1,10 +1,10 @@
#include <iostream>
#include <componentThread.h>
namespace hk {
namespace smo {
namespace director {
/* The director is the seat of volition in Harikoff. It receives sensor
/* The director is the seat of volition in Salmanoff. It receives sensor
* events from the body and world, and uses them to direct its implexors
* to implex new menties. It then loads the menties into canvas for simulation
* and correlation with intrins, in order to form new attrimotions and
@@ -13,14 +13,14 @@ namespace director {
ComponentThread director;
}
namespace simulator {
/* The canvas is the simulation engine in Harikoff. It receives menties and
/* The canvas is the simulation engine in Salmanoff. It receives menties and
* simulates them in accordance with the instructions from director. It then
* re-renders them into perception for director to get feedback.
*/
ComponentThread canvas;
}
namespace subconscious {
/* The subconscious is the seat of memory in Harikoff. It receives menties
/* The subconscious is the seat of memory in Salmanoff. It receives menties
* from director and stores them in memory for later recall.
*/
ComponentThread subconscious;
@@ -95,4 +95,4 @@ void ComponentThread::validateThreadIds(void)
}
}
} // namespace hk
} // namespace smo
+2 -2
View File
@@ -8,7 +8,7 @@
#include <opts.h>
#include <deviceManager/deviceManager.h>
namespace hk {
namespace smo {
namespace device {
std::vector<std::shared_ptr<InteroceptorDeviceSpec>>
@@ -34,4 +34,4 @@ const std::string DeviceManager::stringifyDeviceSpecs(void)
}
} // namespace device
} // namespace hk
} // namespace smo
+2 -2
View File
@@ -10,7 +10,7 @@
#include "deviceSpecp.hh"
#include "deviceSpecl.hh"
namespace hk {
namespace smo {
namespace device {
std::string DeviceManager::readDeviceFile(const std::string& filename)
@@ -68,4 +68,4 @@ void DeviceManager::parseAllDeviceSpecs(void)
}
} // namespace device
} // namespace hk
} // namespace smo
+12 -12
View File
@@ -46,9 +46,9 @@ void yyerror(const char *message)
%union {
char* str;
char chr;
hk::device::SenseDeviceSpec* sensorSpec;
hk::device::InteroceptorDeviceSpec* interoceptorSpec;
hk::device::ExtrospectorDeviceSpec* extrospectorSpec;
smo::device::SenseDeviceSpec* sensorSpec;
smo::device::InteroceptorDeviceSpec* interoceptorSpec;
smo::device::ExtrospectorDeviceSpec* extrospectorSpec;
std::vector<std::pair<std::string,std::string>>* paramVector;
std::pair<std::string,std::string>* param;
}
@@ -83,12 +83,12 @@ sensor_spec:
interoceptor_spec:
KEYWORD_SPECTYPE_INTEROSPECTOR PIPE spec_body {
auto spec = std::make_shared<hk::device::InteroceptorDeviceSpec>(
*static_cast<hk::device::InteroceptorDeviceSpec *>($3));
auto spec = std::make_shared<smo::device::InteroceptorDeviceSpec>(
*static_cast<smo::device::InteroceptorDeviceSpec *>($3));
spec->sensorType = $1;
hk::device::DeviceManager::interoceptorDeviceSpecs.push_back(spec);
hk::device::DeviceManager::senseDeviceSpecs.push_back(spec);
smo::device::DeviceManager::interoceptorDeviceSpecs.push_back(spec);
smo::device::DeviceManager::senseDeviceSpecs.push_back(spec);
delete $3;
}
@@ -96,12 +96,12 @@ interoceptor_spec:
extrospector_spec:
KEYWORD_SPECTYPE_EXTROSPECTOR PIPE spec_body {
auto spec = std::make_shared<hk::device::ExtrospectorDeviceSpec>(
*static_cast<hk::device::ExtrospectorDeviceSpec *>($3));
auto spec = std::make_shared<smo::device::ExtrospectorDeviceSpec>(
*static_cast<smo::device::ExtrospectorDeviceSpec *>($3));
spec->sensorType = $1;
hk::device::DeviceManager::extrospectorDeviceSpecs.push_back(spec);
hk::device::DeviceManager::senseDeviceSpecs.push_back(spec);
smo::device::DeviceManager::extrospectorDeviceSpecs.push_back(spec);
smo::device::DeviceManager::senseDeviceSpecs.push_back(spec);
delete $3;
}
@@ -109,7 +109,7 @@ extrospector_spec:
spec_body:
STRING PIPE STRING LPAREN opt_params RPAREN PIPE STRING LPAREN opt_params RPAREN PIPE STRING {
$$ = new hk::device::SenseDeviceSpec();
$$ = new smo::device::SenseDeviceSpec();
$$->sensorType = '\0';
$$->implexor = std::string($1);
$$->api = std::string($3);
+2 -2
View File
@@ -7,7 +7,7 @@
#include <boost/asio.hpp>
#include <stdexcept>
namespace hk {
namespace smo {
class ComponentThread
{
@@ -64,6 +64,6 @@ namespace subconscious {
extern ComponentThread subconscious;
}
} // namespace hk
} // namespace smo
#endif // COMPONENT_THREAD_H
@@ -9,7 +9,7 @@
#include <iostream>
#include <user/senseDeviceSpec.h>
namespace hk {
namespace smo {
namespace device {
class DeviceManager
@@ -43,6 +43,6 @@ public:
};
} // namespace device
} // namespace hk
} // namespace smo
#endif // DEVICEMANAGER_H
+2 -2
View File
@@ -5,7 +5,7 @@
#include <cstdint>
#include <mentalEntity.h>
namespace hk {
namespace smo {
namespace director {
/**
@@ -74,6 +74,6 @@ public:
};
} // namespace director
} // namespace hk
} // namespace smo
#endif // DIRECTOR_COMMANDLIST_H
+2 -2
View File
@@ -4,7 +4,7 @@
#include <config.h>
#include <goal.h>
namespace hk {
namespace smo {
namespace director {
class Director {
@@ -16,6 +16,6 @@ public:
};
} // namespace director
} // namespace hk
} // namespace smo
#endif // DIRECTOR_H
+2 -2
View File
@@ -3,7 +3,7 @@
#include <simulator/scene.h>
namespace hk {
namespace smo {
class Goal
: public simulator::Scene {
@@ -12,6 +12,6 @@ public:
~Goal() = default;
};
} // namespace hk
} // namespace smo
#endif
+2 -2
View File
@@ -1,7 +1,7 @@
#ifndef IMPLIX_H
#define IMPLIX_H
namespace hk {
namespace smo {
namespace implix {
class Implix
@@ -12,6 +12,6 @@ public:
};
} // namespace implix
} // namespace hk
} // namespace smo
#endif // IMPLIX_H
+2 -2
View File
@@ -1,7 +1,7 @@
#ifndef _MENTAL_ENTITY_H
#define _MENTAL_ENTITY_H
namespace hk {
namespace smo {
class MentalEntity
{
@@ -9,6 +9,6 @@ public:
using Id = uint32_t;
};
} // namespace hk
} // namespace smo
#endif
+2 -2
View File
@@ -7,7 +7,7 @@
#include <director/director.h>
#include <simulator/simulator.h>
namespace hk {
namespace smo {
class Mind
{
@@ -23,6 +23,6 @@ public:
simulator::Simulator canvas;
};
} // namespace hk
} // namespace smo
#endif
+9 -9
View File
@@ -8,7 +8,7 @@
#include <functional>
#include <user/senseApiDesc.h>
namespace hk {
namespace smo {
namespace sense_api {
class SenseApiLib
@@ -28,10 +28,10 @@ private:
public:
SenseApiLib(
const std::string& path, void *_dlopen_handle,
HK_GET_SENSE_API_DESC_FN_TYPEDEF *descFn)
SMO_GET_SENSE_API_DESC_FN_TYPEDEF *descFn)
: libraryPath(path),
dlopen_handle(_dlopen_handle, DlCloser()),
HK_GET_SENSE_API_DESC_FN_NAME(descFn)
SMO_GET_SENSE_API_DESC_FN_NAME(descFn)
{}
void setSenseApiDesc(const SenseApiDesc &desc)
@@ -57,16 +57,16 @@ public:
/**
* @brief Every sense API lib is required to provide a function that returns
* a SenseApiDesc struct. This struct states which API the lib uses to
* connect Harikoff to the sense provider it supports.
* connect Salmanoff to the sense provider it supports.
*
* This getter function should be visible to dlsym() so that Harikoff can
* This getter function should be visible to dlsym() so that Salmanoff can
* find it in the lib after loading it, and call it.
*/
std::function<HK_GET_SENSE_API_DESC_FN_TYPEDEF>
HK_GET_SENSE_API_DESC_FN_NAME;
std::function<SMO_GET_SENSE_API_DESC_FN_TYPEDEF>
SMO_GET_SENSE_API_DESC_FN_NAME;
/**
* @brief Harikoff will call the `HK_GET_SENSE_API_DESC_FN_NAME` getter
* @brief Salmanoff will call the `SMO_GET_SENSE_API_DESC_FN_NAME` getter
* function and use the data it provides in order to fill out this
* descriptor.
*/
@@ -80,6 +80,6 @@ public:
};
} // namespace sense_api
} // namespace hk
} // namespace smo
#endif // SENSE_API_PROVIDER_DESC_H
+2 -2
View File
@@ -10,7 +10,7 @@
#include <senseApis/senseApiLib.h>
#include <user/senseDeviceSpec.h>
namespace hk {
namespace smo {
namespace sense_api {
class SenseApiManager
@@ -55,6 +55,6 @@ private:
};
} // namespace sense_api
} // namespace hk
} // namespace smo
#endif // SENSE_API_MANAGER_H
+2 -2
View File
@@ -4,7 +4,7 @@
#include <cstdint>
#include <sensors/sensor.h>
namespace hk {
namespace smo {
namespace sensors {
class Extrospector
@@ -18,6 +18,6 @@ public:
};
} // namespace sensors
} // namespace hk
} // namespace smo
#endif // _EXTROSPECTOR_H
+2 -2
View File
@@ -4,7 +4,7 @@
#include <cstdint>
#include <sensors/sensor.h>
namespace hk {
namespace smo {
namespace sensors {
class Interoceptor
@@ -104,6 +104,6 @@ public:
};
} // namespace sensors
} // namespace hk
} // namespace smo
#endif // _INTEROCEPTOR_H
+2 -2
View File
@@ -3,7 +3,7 @@
#include <cstdint>
namespace hk {
namespace smo {
namespace sensors {
class Sensor
@@ -16,6 +16,6 @@ public:
};
} // namespace sensors
} // namespace hk
} // namespace smo
#endif // _SENSOR_H
+2 -2
View File
@@ -5,7 +5,7 @@
#include <cstdint>
#include <mentalEntity.h>
namespace hk {
namespace smo {
namespace simulator {
/**
@@ -74,6 +74,6 @@ public:
};
} // namespace simulator
} // namespace hk
} // namespace smo
#endif // SIMULATOR_COMMANDLIST_H
+2 -2
View File
@@ -6,7 +6,7 @@
#include <mentalEntity.h>
#include <simulator/commandList.h>
namespace hk {
namespace smo {
namespace simulator {
class Scene
@@ -34,7 +34,7 @@ private:
};
} // namespace simulator
} // namespace hk
} // namespace smo
#endif
+2 -2
View File
@@ -4,7 +4,7 @@
#include <config.h>
#include <simulator/scene.h>
namespace hk {
namespace smo {
namespace simulator {
class Simulator {
@@ -21,6 +21,6 @@ private:
};
} // namespace simulator
} // namespace hk
} // namespace smo
#endif // SIMULATOR_H
+5 -5
View File
@@ -10,7 +10,7 @@
namespace fs = std::filesystem;
namespace hk {
namespace smo {
namespace sense_api {
/**
@@ -92,13 +92,13 @@ SenseApiLib& SenseApiManager::loadSenseApiLib(const std::string& libraryPath)
}
// Initialize getSenseApiDescriptor
auto func = reinterpret_cast<HK_GET_SENSE_API_DESC_FN_TYPEDEF *>(
dlsym(dlopen_handle.get(), HK_GET_SENSE_API_DESC_FN_NAME_STR));
auto func = reinterpret_cast<SMO_GET_SENSE_API_DESC_FN_TYPEDEF *>(
dlsym(dlopen_handle.get(), SMO_GET_SENSE_API_DESC_FN_NAME_STR));
if (!func)
{
throw std::runtime_error(
std::string(__func__) + ": dlsym('"
HK_GET_SENSE_API_DESC_FN_NAME_STR "') failed for library '"
SMO_GET_SENSE_API_DESC_FN_NAME_STR "') failed for library '"
+ libraryPath + "'");
}
@@ -265,4 +265,4 @@ void SenseApiManager::detachAllSenseDevices(void)
}
} // namespace sense_api
} // namespace hk
} // namespace smo