├── .clang-format ├── .github └── workflows │ ├── Build Documentation Preview.yml │ ├── Build Thunder on Linux.yml │ ├── Build Thunder on MacOS.yml │ ├── Build Thunder on Windows.yml │ ├── Deploy Documentation Preview.yml │ ├── Docs build template.yml │ ├── Documentation Required Checks.yml │ ├── Documentation.yml │ ├── Linux build template.yml │ ├── MacOS build template.yml │ ├── Test Thunder.yml │ └── main-mend.yml ├── .gitignore ├── .vscode ├── README.md ├── c_cpp_properties.json ├── launch.json ├── settings.json └── tasks.json ├── CMakeLists.txt ├── CONTRIBUTING.md ├── COPYING ├── LICENSE ├── NOTICE ├── README.md ├── ReleaseNotes ├── ReleaseNotesThunder_R3.pdf ├── ThunderReleaseNotes_R4.4.md ├── ThunderReleaseNotes_R4_Thunder.pdf ├── ThunderReleaseNotes_R5.0.md ├── ThunderReleaseNotes_R5.1.md └── ThunderReleaseNotes_R5.2.md ├── Source ├── .clang-format ├── CMakeLists.txt ├── Thunder.sln ├── Thunder │ ├── CMakeLists.txt │ ├── Config.h │ ├── ConfigBuildroot.json │ ├── Controller.cpp │ ├── Controller.h │ ├── ControllerPlugin.json │ ├── ExampleConfigAll.json │ ├── ExampleConfigLinux.json │ ├── ExampleConfigWindows.json │ ├── GenericConfig.cmake │ ├── IRemoteInstantiation.h │ ├── Module.h │ ├── PluginHost.cpp │ ├── PluginServer.cpp │ ├── PluginServer.h │ ├── PostMortem.cpp │ ├── PostMortem.h │ ├── Probe.cpp │ ├── Probe.h │ ├── SystemInfo.cpp │ ├── SystemInfo.h │ ├── Thunder.conf.in │ ├── WarningReportingCategories.cpp │ ├── WarningReportingCategories.h │ ├── bridge.vcxproj │ ├── bridge.vcxproj.filters │ ├── doc │ │ └── ControllerPlugin.md │ ├── params.config │ └── scripts │ │ ├── CMakeLists.txt │ │ ├── environment │ │ ├── CMakeLists.txt │ │ ├── _base.env.in │ │ ├── coredump.sysconf.in │ │ ├── environment.in │ │ └── poweroff-displays.sysconf.in │ │ ├── set-subsystem-group-udev.rules.in │ │ ├── thunder.env.in │ │ ├── thunder.in │ │ └── thunder.service.in ├── ThunderPlugin │ ├── CMakeLists.txt │ ├── Module.h │ ├── Process.cpp │ ├── comprocess.vcxproj │ └── comprocess.vcxproj.filters ├── com │ ├── Administrator.cpp │ ├── Administrator.h │ ├── CMakeLists.txt │ ├── Communicator.cpp │ ├── Communicator.h │ ├── ConnectorType.cpp │ ├── ConnectorType.h │ ├── ICOM.h │ ├── IIteratorType.h │ ├── IStringIterator.h │ ├── IUnknown.cpp │ ├── IUnknown.h │ ├── IValueIterator.h │ ├── Ids.h │ ├── IteratorType.h │ ├── Messages.h │ ├── Module.cpp │ ├── Module.h │ ├── ProxyStubs.h │ ├── com.h │ ├── com.vcxproj │ └── com.vcxproj.filters ├── core │ ├── ASN1.h │ ├── AccessControl.h │ ├── AssertionControl.cpp │ ├── AssertionControl.h │ ├── CMakeLists.txt │ ├── CallsignTLS.cpp │ ├── CallsignTLS.h │ ├── Config.h │ ├── CoreDefault.props │ ├── CoreWarningReporting.props │ ├── CyclicBuffer.cpp │ ├── CyclicBuffer.h │ ├── DataBuffer.h │ ├── DataElement.cpp │ ├── DataElement.h │ ├── DataElementFile.cpp │ ├── DataElementFile.h │ ├── DoorBell.cpp │ ├── DoorBell.h │ ├── Enumerate.h │ ├── Factory.h │ ├── FileObserver.h │ ├── FileSystem.cpp │ ├── FileSystem.h │ ├── Frame.h │ ├── IAction.h │ ├── IAssertionControl.h │ ├── IIterator.h │ ├── IObserver.h │ ├── IPCChannel.h │ ├── IPCConnector.h │ ├── IPCMessage.h │ ├── IPFrame.h │ ├── ISO639.cpp │ ├── ISO639.h │ ├── IWarningReportingControl.h │ ├── JSON.cpp │ ├── JSON.h │ ├── JSONRPC.cpp │ ├── JSONRPC.h │ ├── KeyValue.h │ ├── Library.cpp │ ├── Library.h │ ├── Link.h │ ├── LockableContainer.h │ ├── MACAddress.h │ ├── Measurement.h │ ├── Media.h │ ├── MessageException.h │ ├── MessageStore.cpp │ ├── MessageStore.h │ ├── Messaging.cpp │ ├── Messaging.h │ ├── Module.cpp │ ├── Module.h │ ├── Netlink.cpp │ ├── Netlink.h │ ├── NetworkInfo.cpp │ ├── NetworkInfo.h │ ├── NodeId.cpp │ ├── NodeId.h │ ├── Number.cpp │ ├── Number.h │ ├── Optional.h │ ├── Parser.cpp │ ├── Parser.h │ ├── Portability.cpp │ ├── Portability.h │ ├── Process.h │ ├── ProcessInfo.cpp │ ├── ProcessInfo.h │ ├── Proxy.h │ ├── Queue.h │ ├── Range.h │ ├── ReadWriteLock.h │ ├── Rectangle.h │ ├── RequestResponse.h │ ├── ResourceMonitor.cpp │ ├── ResourceMonitor.h │ ├── SerialPort.cpp │ ├── SerialPort.h │ ├── Serialization.cpp │ ├── Serialization.h │ ├── Services.cpp │ ├── Services.h │ ├── SharedBuffer.cpp │ ├── SharedBuffer.h │ ├── Singleton.cpp │ ├── Singleton.h │ ├── SocketPort.cpp │ ├── SocketPort.h │ ├── SocketServer.h │ ├── StateTrigger.h │ ├── StopWatch.h │ ├── Stream.h │ ├── StreamJSON.h │ ├── StreamText.h │ ├── StreamTypeLengthValue.h │ ├── Sync.cpp │ ├── Sync.h │ ├── Synchronize.h │ ├── SynchronousChannel.h │ ├── SystemInfo.cpp │ ├── SystemInfo.h │ ├── TextFragment.h │ ├── TextReader.cpp │ ├── TextReader.h │ ├── TextStreamRedirectType.h │ ├── Thread.cpp │ ├── Thread.h │ ├── ThreadPool.h │ ├── Time.cpp │ ├── Time.h │ ├── Timer.h │ ├── TokenizedStringList.h │ ├── Trace.cpp │ ├── Trace.h │ ├── TriState.h │ ├── TypeTraits.h │ ├── ValueRecorder.h │ ├── Version.h.in │ ├── WarningReportingCategories.cpp │ ├── WarningReportingCategories.h │ ├── WarningReportingControl.cpp │ ├── WarningReportingControl.h │ ├── WorkerPool.cpp │ ├── WorkerPool.h │ ├── XGetopt.cpp │ ├── XGetopt.h │ ├── core.h │ ├── core.vcxproj │ ├── core.vcxproj.filters │ └── dllmain.cpp ├── cryptalgo │ ├── AES.cpp │ ├── AES.h │ ├── AESImplementation.cpp │ ├── AESImplementation.h │ ├── CMakeLists.txt │ ├── HMAC.h │ ├── Hash.cpp │ ├── Hash.h │ ├── HashStream.h │ ├── Module.cpp │ ├── Module.h │ ├── Random.cpp │ ├── Random.h │ ├── SecureSocketPort.cpp │ ├── SecureSocketPort.h │ ├── cryptalgo.h │ ├── cryptalgo.vcxproj │ └── cryptalgo.vcxproj.filters ├── extensions │ ├── CMakeLists.txt │ ├── bluetooth │ │ ├── BluetoothUtils.cpp │ │ ├── BluetoothUtils.h │ │ ├── CMakeLists.txt │ │ ├── Debug.h │ │ ├── Definitions.cpp │ │ ├── HCISocket.cpp │ │ ├── HCISocket.h │ │ ├── IDriver.h │ │ ├── Module.cpp │ │ ├── Module.h │ │ ├── UUID.cpp │ │ ├── UUID.h │ │ ├── audio │ │ │ ├── AVDTPProfile.cpp │ │ │ ├── AVDTPProfile.h │ │ │ ├── AVDTPSocket.cpp │ │ │ ├── AVDTPSocket.h │ │ │ ├── CMakeLists.txt │ │ │ ├── DataRecord.h │ │ │ ├── IAudioCodec.h │ │ │ ├── IAudioContentProtection.h │ │ │ ├── Module.cpp │ │ │ ├── Module.h │ │ │ ├── RTPSocket.h │ │ │ ├── SDPProfile.cpp │ │ │ ├── SDPProfile.h │ │ │ ├── SDPSocket.cpp │ │ │ ├── SDPSocket.h │ │ │ ├── bluetooth_audio.h │ │ │ ├── cmake │ │ │ │ └── FindSBC.cmake │ │ │ └── codecs │ │ │ │ ├── SBC.cpp │ │ │ │ └── SBC.h │ │ ├── bluetooth.h │ │ ├── drivers │ │ │ ├── BCM43XX.cpp │ │ │ ├── Basic.cpp │ │ │ └── SerialDriver.h │ │ └── gatt │ │ │ ├── CMakeLists.txt │ │ │ ├── GATTProfile.cpp │ │ │ ├── GATTProfile.h │ │ │ ├── GATTSocket.cpp │ │ │ ├── GATTSocket.h │ │ │ ├── Module.cpp │ │ │ ├── Module.h │ │ │ └── bluetooth_gatt.h │ ├── broadcast │ │ ├── CMakeLists.txt │ │ ├── Definitions.cpp │ │ ├── Definitions.h │ │ ├── Descriptors.h │ │ ├── EIT.h │ │ ├── Implementation │ │ │ └── V4L │ │ │ │ └── Tuner.cpp │ │ ├── MPEGDescriptor.h │ │ ├── MPEGSection.h │ │ ├── MPEGTable.h │ │ ├── Module.cpp │ │ ├── Module.h │ │ ├── NIT.h │ │ ├── Networks.h │ │ ├── ProgramTable.cpp │ │ ├── ProgramTable.h │ │ ├── SDT.h │ │ ├── Schedule.h │ │ ├── Services.h │ │ ├── TDT.h │ │ ├── TimeDate.h │ │ ├── TunerAdministrator.cpp │ │ ├── TunerAdministrator.h │ │ ├── broadcast.h │ │ ├── cmake │ │ │ ├── FindNEXUS.cmake │ │ │ └── FindNXCLIENT.cmake │ │ └── test │ │ │ ├── BroadcastTester.cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── Module.cpp │ │ │ └── Module.h │ ├── hibernate │ │ ├── CMakeLists.txt │ │ ├── checkpointlib │ │ │ └── CheckpointLib.c │ │ ├── checkpointserver │ │ │ └── CheckpointServer.c │ │ ├── common │ │ │ └── Log.h │ │ └── hibernate.h │ ├── localtracer │ │ ├── CMakeLists.txt │ │ ├── example │ │ │ ├── CMakeLists.txt │ │ │ └── main.cpp │ │ └── include │ │ │ └── localtracer │ │ │ └── localtracer.h │ ├── privilegedrequest │ │ ├── CMakeLists.txt │ │ ├── example │ │ │ ├── CMakeLists.txt │ │ │ └── main.cpp │ │ └── include │ │ │ └── privilegedrequest │ │ │ └── PrivilegedRequest.h │ ├── processcontainers │ │ ├── CMakeLists.txt │ │ ├── ContainerAdministrator.cpp │ │ ├── ContainerAdministrator.h │ │ ├── ContainerProducer.h │ │ ├── IProcessContainers.h │ │ ├── Messaging.h │ │ ├── Module.cpp │ │ ├── Module.h │ │ ├── common │ │ │ ├── BaseContainerIterator.h │ │ │ ├── BaseRefCount.h │ │ │ └── CGroupContainerInfo.h │ │ ├── implementations │ │ │ ├── AWCImplementation │ │ │ │ ├── AWC.cpp │ │ │ │ ├── AWC.h │ │ │ │ ├── AWCContainerAdministrator.cpp │ │ │ │ ├── AWCContainerAdministrator.h │ │ │ │ ├── AWCContainerBase.cpp │ │ │ │ ├── AWCContainerBase.h │ │ │ │ ├── AWCImplementation.cpp │ │ │ │ ├── AWCImplementation.h │ │ │ │ ├── AWCProxyContainer.cpp │ │ │ │ ├── AWCProxyContainer.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── dbus │ │ │ │ │ ├── Client.cpp │ │ │ │ │ ├── Client.h │ │ │ │ │ └── api.xml │ │ │ ├── CRunImplementation │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── CRunImplementation.cpp │ │ │ │ └── CRunImplementation.h │ │ │ ├── DobbyImplementation │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── DobbyImplementation.cpp │ │ │ │ └── DobbyImplementation.h │ │ │ ├── LXCImplementation │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── LXCImplementation.cpp │ │ │ │ └── LXCImplementation.h │ │ │ └── RunCImplementation │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── RunCImplementation.cpp │ │ │ │ └── RunCImplementation.h │ │ └── processcontainers.h │ └── warningreporting │ │ ├── CMakeLists.txt │ │ ├── IWarningReportingMedia.h │ │ ├── Module.cpp │ │ ├── Module.h │ │ ├── WarningReportingUnit.cpp │ │ ├── WarningReportingUnit.h │ │ ├── warningreporting.h │ │ ├── warningreporting.vcxproj │ │ └── warningreporting.vcxproj.filters ├── messaging │ ├── AssertionUnit.cpp │ ├── AssertionUnit.h │ ├── CMakeLists.txt │ ├── ConsoleStreamRedirect.cpp │ ├── ConsoleStreamRedirect.h │ ├── Control.h │ ├── DirectOutput.cpp │ ├── DirectOutput.h │ ├── Logging.cpp │ ├── Logging.h │ ├── LoggingCategories.h │ ├── MessageClient.cpp │ ├── MessageClient.h │ ├── MessageDispatcher.h │ ├── MessageUnit.cpp │ ├── MessageUnit.h │ ├── Module.cpp │ ├── Module.h │ ├── OperationalCategories.cpp │ ├── OperationalCategories.h │ ├── TraceCategories.cpp │ ├── TraceCategories.h │ ├── TraceControl.h │ ├── TraceFactory.h │ ├── messaging.h │ ├── messaging.vcxproj │ └── messaging.vcxproj.filters ├── plugins │ ├── CMakeLists.txt │ ├── Channel.cpp │ ├── Channel.h │ ├── Config.h │ ├── Configuration.h │ ├── IController.h │ ├── IDispatcher.h │ ├── IPlugin.h │ ├── IShell.h │ ├── IStateControl.h │ ├── IStateController.h │ ├── ISubSystem.h │ ├── IVirtualInput.h │ ├── JSONRPC.cpp │ ├── JSONRPC.h │ ├── Metadata.cpp │ ├── Metadata.h │ ├── Module.cpp │ ├── Module.h │ ├── Request.h │ ├── Service.cpp │ ├── Service.h │ ├── Shell.cpp │ ├── StateControl.cpp │ ├── StateControl.h │ ├── SubSystem.cpp │ ├── SubSystem.h │ ├── System.cpp │ ├── System.h │ ├── Types.h │ ├── VirtualInput.cpp │ ├── VirtualInput.h │ ├── definitions.h │ ├── plugins.h │ ├── plugins.vcxproj │ ├── plugins.vcxproj.filters │ ├── proxystubs.vcxproj │ └── proxystubs.vcxproj.filters └── websocket │ ├── CMakeLists.txt │ ├── JSONRPCLink.cpp │ ├── JSONRPCLink.h │ ├── JSONWebToken.cpp │ ├── JSONWebToken.h │ ├── Module.cpp │ ├── Module.h │ ├── URL.cpp │ ├── URL.h │ ├── WebLink.h │ ├── WebRequest.h │ ├── WebResponse.h │ ├── WebSerializer.cpp │ ├── WebSerializer.h │ ├── WebSocketLink.cpp │ ├── WebSocketLink.h │ ├── WebTransfer.h │ ├── WebTransform.h │ ├── websocket.h │ ├── websocket.vcxproj │ ├── websocket.vcxproj.filters │ └── windows │ └── include │ ├── zconf.h │ └── zlib.h ├── Tests ├── CMakeLists.txt ├── comrpctester │ ├── CMakeLists.txt │ ├── comprc-test-config.json │ └── main.cpp ├── cyclic-buffer │ ├── CMakeLists.txt │ ├── main.cpp │ └── process.h ├── file-unlink │ ├── CMakeLists.txt │ ├── file-client.cpp │ └── file-master.cpp ├── httpsclient │ ├── CMakeLists.txt │ ├── Module.cpp │ ├── Module.h │ └── main.cpp ├── jsongenerator │ └── IJsonGeneratorCorpus.h ├── loader │ ├── CMakeLists.txt │ └── main.cpp ├── message-buffer │ ├── CMakeLists.txt │ ├── Module.cpp │ ├── Module.h │ └── main.cpp ├── redirect │ ├── CMakeLists.txt │ └── main.cpp ├── unit │ ├── CMakeLists.txt │ ├── IPTestAdministrator.cpp │ ├── IPTestAdministrator.h │ ├── Module.h │ ├── core │ │ ├── CMakeLists.txt │ │ ├── test_cyclicbuffer.cpp │ │ ├── test_cyclicbuffer_dataexchange.cpp │ │ ├── test_databuffer.cpp │ │ ├── test_dataelement.cpp │ │ ├── test_dataelementfile.cpp │ │ ├── test_doorbell.cpp │ │ ├── test_enumerate.cpp │ │ ├── test_event.cpp │ │ ├── test_filesystem.cpp │ │ ├── test_frametype.cpp │ │ ├── test_hash.cpp │ │ ├── test_hex2strserialization.cpp │ │ ├── test_ipc.cpp │ │ ├── test_ipcclient.cpp │ │ ├── test_iso639.cpp │ │ ├── test_iterator.cpp │ │ ├── test_jsonparser.cpp │ │ ├── test_keyvalue.cpp │ │ ├── test_library.cpp │ │ ├── test_library_helloworld.cpp │ │ ├── test_lockablecontainer.cpp │ │ ├── test_measurementtype.cpp │ │ ├── test_memberavailability.cpp │ │ ├── test_messageException.cpp │ │ ├── test_message_dispatcher.cpp │ │ ├── test_message_unit.cpp │ │ ├── test_networkinfo.cpp │ │ ├── test_nodeid.cpp │ │ ├── test_numbertype.cpp │ │ ├── test_optional.cpp │ │ ├── test_parser.cpp │ │ ├── test_portability.cpp │ │ ├── test_processinfo.cpp │ │ ├── test_queue.cpp │ │ ├── test_rangetype.cpp │ │ ├── test_readwritelock.cpp │ │ ├── test_rectangle.cpp │ │ ├── test_rpc.cpp │ │ ├── test_semaphore.cpp │ │ ├── test_sharedbuffer.cpp │ │ ├── test_singleton.cpp │ │ ├── test_socketstreamjson.cpp │ │ ├── test_socketstreamtext.cpp │ │ ├── test_statetrigger.cpp │ │ ├── test_stopwatch.cpp │ │ ├── test_synchronize.cpp │ │ ├── test_synchronous.cpp │ │ ├── test_systeminfo.cpp │ │ ├── test_textfragment.cpp │ │ ├── test_textreader.cpp │ │ ├── test_thread.cpp │ │ ├── test_threadpool.cpp │ │ ├── test_time.cpp │ │ ├── test_timer.cpp │ │ ├── test_tristate.cpp │ │ ├── test_valuerecorder.cpp │ │ ├── test_weblinkjson.cpp │ │ ├── test_weblinktext.cpp │ │ ├── test_websocketjson.cpp │ │ ├── test_websockettext.cpp │ │ ├── test_workerpool.cpp │ │ └── test_xgetopt.cpp │ └── tests │ │ ├── CMakeLists.txt │ │ └── test_iptestmanager.cpp ├── unraveller │ ├── CMakeLists.txt │ └── main.cpp └── workerpool-test │ ├── CMakeLists.txt │ ├── Module.cpp │ ├── Module.h │ └── WorkerPoolTest.cpp ├── cmake ├── common │ ├── CmakeHelperFunctions.cmake │ ├── CodeCoverage.cmake │ ├── CompileSettings.cmake │ ├── CompileSettingsDebug.cmake │ ├── CreateLink.cmake │ ├── CreatePackage.cmake │ ├── GetBluez5Headers.cmake │ ├── GetExternalCode.cmake │ ├── HeaderOnlyInstall.cmake │ ├── InstallEnvironmentFragments.cmake │ ├── InstallLink.cmake │ └── install_symlink.cmake.in ├── config.cmake ├── config │ ├── collections │ │ ├── list_pop_back.cmake │ │ ├── list_pop_front.cmake │ │ ├── list_push_back.cmake │ │ └── list_push_front.cmake │ ├── core │ │ ├── eval.cmake │ │ ├── require.cmake │ │ └── return │ │ │ ├── ans.cmake │ │ │ ├── ans_append.cmake │ │ │ ├── ans_extract.cmake │ │ │ ├── clr.cmake │ │ │ ├── return.cmake │ │ │ ├── return_ans.cmake │ │ │ ├── return_math.cmake │ │ │ ├── return_ref.cmake │ │ │ ├── return_refs.cmake │ │ │ ├── return_reset.cmake │ │ │ ├── return_truth.cmake │ │ │ ├── set_ans.cmake │ │ │ └── set_ans_ref.cmake │ ├── events │ │ ├── event.cmake │ │ ├── event_addhandler.cmake │ │ ├── event_cancel.cmake │ │ ├── event_clear.cmake │ │ ├── event_emit.cmake │ │ ├── event_get.cmake │ │ ├── event_handler.cmake │ │ ├── event_handler_call.cmake │ │ ├── event_handlers.cmake │ │ ├── event_new.cmake │ │ ├── event_removehandler.cmake │ │ ├── events.cmake │ │ ├── events_track.cmake │ │ └── is_event.cmake │ ├── filesystem │ │ ├── file │ │ │ └── fwrite.cmake │ │ ├── fwrite_temp.cmake │ │ ├── navigation │ │ │ └── pwd.cmake │ │ └── path │ │ │ ├── path.cmake │ │ │ ├── path_qualify.cmake │ │ │ ├── path_qualify_from.cmake │ │ │ └── path_vary.cmake │ ├── formats │ │ └── json │ │ │ ├── README.md │ │ │ ├── README.md.in │ │ │ ├── json.cmake │ │ │ ├── json2.cmake │ │ │ ├── json2_definition.cmake │ │ │ ├── json3.cmake │ │ │ ├── json4.cmake │ │ │ ├── json_deserialize.cmake │ │ │ ├── json_escape.cmake │ │ │ ├── json_extract_string_value.cmake │ │ │ ├── json_format_tokens.cmake │ │ │ ├── json_indented.cmake │ │ │ ├── json_print.cmake │ │ │ ├── json_read.cmake │ │ │ ├── json_string_to_cmake.cmake │ │ │ ├── json_tokenize.cmake │ │ │ └── json_write.cmake │ ├── function │ │ └── function_import_table.cmake │ ├── map │ │ ├── README.md │ │ ├── README.md.in │ │ ├── core │ │ │ ├── is_map.cmake │ │ │ ├── map_append.cmake │ │ │ ├── map_append_string.cmake │ │ │ ├── map_append_unique.cmake │ │ │ ├── map_delete.cmake │ │ │ ├── map_duplicate.cmake │ │ │ ├── map_get.cmake │ │ │ ├── map_get_special.cmake │ │ │ ├── map_has.cmake │ │ │ ├── map_keys.cmake │ │ │ ├── map_new.cmake │ │ │ ├── map_remove.cmake │ │ │ ├── map_remove_item.cmake │ │ │ ├── map_set.cmake │ │ │ ├── map_set_hidden.cmake │ │ │ ├── map_set_special.cmake │ │ │ └── map_tryget.cmake │ │ ├── dfs.cmake │ │ ├── dfs_callback.cmake │ │ ├── helpers │ │ │ ├── list_match.cmake │ │ │ ├── map_all_paths.cmake │ │ │ ├── map_at.cmake │ │ │ ├── map_capture.cmake │ │ │ ├── map_capture_new.cmake │ │ │ ├── map_clear.cmake │ │ │ ├── map_copy_shallow.cmake │ │ │ ├── map_count.cmake │ │ │ ├── map_defaults.cmake │ │ │ ├── map_ensure.cmake │ │ │ ├── map_extract.cmake │ │ │ ├── map_fill.cmake │ │ │ ├── map_flatten.cmake │ │ │ ├── map_from_keyvaluelist.cmake │ │ │ ├── map_get_default.cmake │ │ │ ├── map_get_map.cmake │ │ │ ├── map_has_all.cmake │ │ │ ├── map_has_any.cmake │ │ │ ├── map_invert.cmake │ │ │ ├── map_isempty.cmake │ │ │ ├── map_key_at.cmake │ │ │ ├── map_keys_append.cmake │ │ │ ├── map_keys_clear.cmake │ │ │ ├── map_keys_remove.cmake │ │ │ ├── map_keys_set.cmake │ │ │ ├── map_keys_sort.cmake │ │ │ ├── map_match.cmake │ │ │ ├── map_match_properties.cmake │ │ │ ├── map_matches.cmake │ │ │ ├── map_omit.cmake │ │ │ ├── map_omit_regex.cmake │ │ │ ├── map_overwrite.cmake │ │ │ ├── map_pairs.cmake │ │ │ ├── map_partial.cmake │ │ │ ├── map_path_get.cmake │ │ │ ├── map_path_set.cmake │ │ │ ├── map_peek_back.cmake │ │ │ ├── map_peek_front.cmake │ │ │ ├── map_pick.cmake │ │ │ ├── map_pick_regex.cmake │ │ │ ├── map_pop_back.cmake │ │ │ ├── map_pop_front.cmake │ │ │ ├── map_promote.cmake │ │ │ ├── map_property_length.cmake │ │ │ ├── map_push_back.cmake │ │ │ ├── map_push_front.cmake │ │ │ ├── map_rename.cmake │ │ │ ├── map_set_default.cmake │ │ │ ├── map_to_keyvaluelist.cmake │ │ │ ├── map_to_valuelist.cmake │ │ │ ├── map_unpack.cmake │ │ │ ├── map_values.cmake │ │ │ └── mm.cmake │ │ ├── iterator │ │ │ ├── README.md │ │ │ ├── README.md.in │ │ │ ├── map_iterator.cmake │ │ │ ├── map_iterator_break.cmake │ │ │ └── map_iterator_next.cmake │ │ ├── map_import_properties.cmake │ │ ├── map_matches_obj.cmake │ │ └── operations │ │ │ ├── map_clone.cmake │ │ │ ├── map_clone_deep.cmake │ │ │ ├── map_clone_shallow.cmake │ │ │ ├── map_equal.cmake │ │ │ ├── map_equal_obj.cmake │ │ │ ├── map_foreach.cmake │ │ │ ├── map_issubsetof.cmake │ │ │ ├── map_merge.cmake │ │ │ └── map_union.cmake │ ├── quickmap │ │ ├── README.md │ │ ├── README.md.in │ │ ├── end.cmake │ │ ├── key.cmake │ │ ├── kv.cmake │ │ ├── map.cmake │ │ ├── ref.cmake │ │ ├── val.cmake │ │ └── var.cmake │ ├── ref │ │ ├── README.md │ │ ├── README.md.in │ │ ├── address_append.cmake │ │ ├── address_append_string.cmake │ │ ├── address_delete.cmake │ │ ├── address_get.cmake │ │ ├── address_new.cmake │ │ ├── address_peek_back.cmake │ │ ├── address_peek_front.cmake │ │ ├── address_pop_back.cmake │ │ ├── address_pop_front.cmake │ │ ├── address_print.cmake │ │ ├── address_push_back.cmake │ │ ├── address_push_front.cmake │ │ ├── address_set.cmake │ │ ├── address_set_new.cmake │ │ ├── address_type_get.cmake │ │ ├── address_type_matches.cmake │ │ └── is_address.cmake │ ├── stack │ │ ├── stack_peek.cmake │ │ ├── stack_pop.cmake │ │ └── stack_push.cmake │ └── string │ │ ├── cmake_string_to_json.cmake │ │ ├── encoding │ │ └── string_decode_semicolon.cmake │ │ ├── string_codes.cmake │ │ ├── string_take_address.cmake │ │ └── string_take_regex.cmake ├── modules │ ├── FindBreakpad.cmake │ ├── FindDBus.cmake │ ├── FindDBusClient.cmake │ ├── FindExecInfo.cmake │ ├── FindGBM.cmake │ ├── FindLIBRT.cmake │ ├── FindLXC.cmake │ ├── FindLibCRUN.cmake │ ├── FindLibGio.cmake │ ├── FindLibGioUnix.cmake │ ├── FindLibGlib.cmake │ ├── FindLibGobject.cmake │ ├── FindMemcr.cmake │ ├── FindSlauncher.cmake │ └── FindSystemd.cmake ├── platform.cmake ├── project.cmake.in └── templates │ ├── default.pc.in │ └── defaultConfig.cmake.in ├── docs ├── assets │ ├── AsyncInterfaceExample.png │ ├── ExampleStaticDynamic1.png │ ├── ExampleStaticDynamic2.png │ ├── simple_execution_modes.drawio.svg │ ├── state_change.svg │ └── umlsources.txt ├── client │ ├── com-rpc.md │ ├── intro.md │ └── json-rpc.md ├── debugging │ ├── debug.md │ └── thundershark.md ├── docs.md ├── index.md ├── introduction │ ├── architecture │ │ ├── overview.md │ │ ├── plugin_modes.md │ │ └── rpc │ │ │ ├── comrpc.md │ │ │ └── jsonrpc.md │ ├── build_linux.md │ ├── build_windows.md │ ├── config.md │ ├── intro.md │ ├── repos.md │ └── usage.md ├── issuetemplate │ └── issuetemplate.md ├── plugin │ ├── composite.md │ ├── config.md │ ├── devtools │ │ ├── devtools.md │ │ └── pluginskeletongenerator.md │ ├── errors.md │ ├── execution-modes │ │ ├── containers │ │ │ ├── container.md │ │ │ ├── lxc.md │ │ │ └── runc.md │ │ ├── distrubuted.md │ │ ├── execution-modes.md │ │ ├── inprocess.md │ │ ├── introduction.md │ │ └── outofprocess.md │ ├── interfaces │ │ ├── docs.md │ │ ├── guidelines.md │ │ ├── interfaces.md │ │ └── tags.md │ ├── intro.md │ ├── lifecycle.md │ ├── messaging.md │ ├── private-comrpc.md │ ├── proxypool.md │ ├── subsystems.md │ └── versioning.md ├── references │ └── references.md ├── rfc │ └── websocket.md ├── stylesheets │ └── extra.css ├── utils │ ├── files │ │ ├── files.md │ │ └── observer.md │ ├── json.md │ ├── processes.md │ ├── singletons.md │ ├── sockets.md │ ├── strings.md │ ├── threading │ │ ├── mutex.md │ │ └── worker-pool.md │ ├── time.md │ ├── timers.md │ └── web.md └── walkthrough │ └── hello-world │ ├── client-comrpc.md │ ├── client-jsonrpc.md │ ├── guide.md │ └── setup.md └── mkdocs.yml /.github/workflows/Build Thunder on Linux.yml: -------------------------------------------------------------------------------- 1 | name: Build Thunder on Linux 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: ["master"] 7 | paths-ignore: 8 | - 'doc/**' 9 | - 'docs/**' 10 | - 'ReleaseNotes/**' 11 | pull_request: 12 | branches: ["master"] 13 | paths-ignore: 14 | - 'doc/**' 15 | - 'docs/**' 16 | - 'ReleaseNotes/**' 17 | 18 | jobs: 19 | Thunder: 20 | uses: rdkcentral/Thunder/.github/workflows/Linux build template.yml@master 21 | 22 | ThunderInterfaces: 23 | needs: Thunder 24 | uses: rdkcentral/ThunderInterfaces/.github/workflows/Linux build template.yml@master 25 | 26 | ThunderLibraries: 27 | needs: Thunder 28 | uses: WebPlatformForEmbedded/ThunderLibraries/.github/workflows/Linux build template.yml@main 29 | 30 | ThunderClientLibraries: 31 | needs: ThunderInterfaces 32 | uses: rdkcentral/ThunderClientLibraries/.github/workflows/Linux build template.yml@master 33 | 34 | ThunderNanoServices: 35 | needs: ThunderInterfaces 36 | uses: rdkcentral/ThunderNanoServices/.github/workflows/Linux build template.yml@master 37 | 38 | ThunderNanoServicesRDK: 39 | needs: ThunderInterfaces 40 | uses: WebPlatformForEmbedded/ThunderNanoServicesRDK/.github/workflows/Linux build template.yml@master 41 | -------------------------------------------------------------------------------- /.github/workflows/Build Thunder on MacOS.yml: -------------------------------------------------------------------------------- 1 | name: Build Thunder on MacOS 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: ["master"] 7 | paths-ignore: 8 | - 'doc/**' 9 | - 'docs/**' 10 | - 'ReleaseNotes/**' 11 | pull_request: 12 | branches: ["master"] 13 | paths-ignore: 14 | - 'doc/**' 15 | - 'docs/**' 16 | - 'ReleaseNotes/**' 17 | 18 | jobs: 19 | Thunder_MacOS: 20 | uses: rdkcentral/Thunder/.github/workflows/MacOS build template.yml@master 21 | 22 | ThunderInterfaces_MacOS: 23 | needs: Thunder_MacOS 24 | uses: rdkcentral/ThunderInterfaces/.github/workflows/MacOS build template.yml@master 25 | 26 | ThunderClientLibraries_MacOS: 27 | needs: ThunderInterfaces_MacOS 28 | uses: rdkcentral/ThunderClientLibraries/.github/workflows/MacOS build template.yml@master 29 | 30 | ThunderNanoServices_MacOS: 31 | needs: ThunderInterfaces_MacOS 32 | uses: rdkcentral/ThunderNanoServices/.github/workflows/MacOS build template.yml@master 33 | 34 | ThunderNanoServicesRDK_MacOS: 35 | needs: ThunderInterfaces_MacOS 36 | uses: WebPlatformForEmbedded/ThunderNanoServicesRDK/.github/workflows/MacOS build template.yml@master 37 | -------------------------------------------------------------------------------- /.github/workflows/Docs build template.yml: -------------------------------------------------------------------------------- 1 | name: Documentation Required Checks 2 | 3 | on: 4 | workflow_call: 5 | 6 | jobs: 7 | Thunder: 8 | runs-on: ubuntu-latest 9 | 10 | strategy: 11 | matrix: 12 | build_type: [Debug, Release, MinSizeRel] 13 | 14 | name: Build type - ${{matrix.build_type}} 15 | steps: 16 | - run: 'echo "Changes only to the documentation, so no build required" ' 17 | -------------------------------------------------------------------------------- /.github/workflows/Documentation Required Checks.yml: -------------------------------------------------------------------------------- 1 | name: Documentation Required Checks 2 | 3 | on: 4 | push: 5 | branches: ["master"] 6 | paths: 7 | - '!**' 8 | - 'doc/**' 9 | - 'docs/**' 10 | - 'ReleaseNotes/**' 11 | pull_request: 12 | branches: ["master"] 13 | paths: 14 | - '!**' 15 | - 'doc/**' 16 | - 'docs/**' 17 | - 'ReleaseNotes/**' 18 | 19 | jobs: 20 | Thunder: 21 | uses: rdkcentral/Thunder/.github/workflows/Docs build template.yml@master 22 | -------------------------------------------------------------------------------- /.github/workflows/Documentation.yml: -------------------------------------------------------------------------------- 1 | name: Build Thunder documentation 2 | 3 | on: 4 | # Allows you to run this workflow manually from the Actions tab 5 | workflow_dispatch: 6 | # Automatically publish on pushes to master 7 | push: 8 | branches: ["master"] 9 | 10 | jobs: 11 | deploy: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v4 15 | - uses: actions/setup-python@v5 16 | with: 17 | python-version: 3.x 18 | - run: pip install mkdocs-material 19 | - run: mkdocs build 20 | - name: Deploy 21 | uses: JamesIves/github-pages-deploy-action@v4 22 | with: 23 | folder: site 24 | clean-exclude: pr-preview/ 25 | -------------------------------------------------------------------------------- /.github/workflows/main-mend.yml: -------------------------------------------------------------------------------- 1 | name: Mend workflow 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-22.04 12 | steps: 13 | # It will checkout the latest code 14 | - uses: actions/checkout@v4 15 | - name: Run Whitesource/Mend scan 16 | run: | 17 | java -version 18 | curl -LJO https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar 19 | java -jar wss-unified-agent.jar -apiKey ${{ secrets.MEND_API_KEY }} -product Thunder -project thunder-github-action-test 20 | -------------------------------------------------------------------------------- /.vscode/README.md: -------------------------------------------------------------------------------- 1 | # Visual Studio Code integration 2 | 3 | These configurations are expected to be used with a generated workspace the by ***[ThunderKickStart](https://github.com/WebPlatformForEmbedded/ThunderKickStart)*** project. 4 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Linux", 5 | "includePath": [ 6 | "${workspaceFolder}/**", 7 | "${config:thunder.installPath}/usr/include/**" 8 | ], 9 | "defines": [], 10 | "compilerPath": "/usr/bin/gcc", 11 | "cStandard": "c11", 12 | "cppStandard": "gnu++14", 13 | "intelliSenseMode": "clang-x64", 14 | "configurationProvider": "ms-vscode.cmake-tools" 15 | } 16 | ], 17 | "version": 4 18 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cmake.configureSettings": { 3 | "EXTERN_EVENTS":"", 4 | "PORT":"55555", 5 | "BINDING":"127.0.0.1", 6 | "IDLE_TIME":"180", 7 | "BUILD_SHARED_LIBS" : "ON" 8 | } 9 | } -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing 2 | ============ 3 | If you would like to contribute code to this project you can do so through GitHub by forking the repository 4 | and sending a pull request. 5 | Before RDK accepts your code into the project you must sign the RDK Contributor License Agreement (CLA). 6 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | LICENSE -------------------------------------------------------------------------------- /ReleaseNotes/ReleaseNotesThunder_R3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/ReleaseNotes/ReleaseNotesThunder_R3.pdf -------------------------------------------------------------------------------- /ReleaseNotes/ThunderReleaseNotes_R4_Thunder.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/ReleaseNotes/ThunderReleaseNotes_R4_Thunder.pdf -------------------------------------------------------------------------------- /Source/Thunder/ConfigBuildroot.json: -------------------------------------------------------------------------------- 1 | { 2 | "port":9888, 3 | "binding":"0.0.0.0", 4 | "idletime":180, 5 | "persistentpath":"/tmp", 6 | "datapath":"/opt/thunder/Plugins/", 7 | "plugins": 8 | [ 9 | {"callsign":"Tracing","locator":"/opt/thunder/libtracecontrol.so", "classname":"TraceControl", "configuration":{"console":true,"remote":{"port":4444,"binding":"0.0.0.0"}}}, 10 | {"callsign":"FanControl", "locator":"/opt/thunder/libfancontrol.so", "classname":"FanControl", "configuration":{"deviceid":"/dev/ttyACM0"}}, 11 | {"callsign":"DelayedResponse", "locator":"/opt/thunder/libdelayedresponse.so", "classname":"DelayedResponse", "configuration":{"minimum":0,"maximum":30}} 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /Source/Thunder/ControllerPlugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "plugin.schema.json", 3 | "info": { 4 | "title": "Controller Plugin", 5 | "callsign": "Controller", 6 | "locator": "(built-in)", 7 | "status": "production", 8 | "version": "1.0", 9 | "acronyms": { 10 | "FQDN": "Fully-Qualified Domain Name", 11 | "SSDP": "Simple Service Discovery Protocol" 12 | } 13 | }, 14 | "interface": [ 15 | { "$cppref": "{cppinterfacedir}/IController.h" } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /Source/Thunder/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME Application 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #ifdef __CORE_WARNING_REPORTING__ 33 | #include 34 | #endif 35 | 36 | #ifndef TREE_REFERENCE 37 | #define TREE_REFERENCE engineering_build_for_debug_purpose_only 38 | #endif 39 | 40 | #undef EXTERNAL 41 | #define EXTERNAL 42 | -------------------------------------------------------------------------------- /Source/Thunder/params.config: -------------------------------------------------------------------------------- 1 | port 2 | binding 3 | version 4 | process 5 | ipv6 6 | idletime 7 | softkillcheckwaittime 8 | hardkillcheckwaittime 9 | persistentpath 10 | volatilepath 11 | datapath 12 | systempath 13 | proxystubpath 14 | postmortempath 15 | redirect 16 | ethernetcard 17 | communicator 18 | hibernate 19 | exitreasons 20 | messaging 21 | plugins 22 | -------------------------------------------------------------------------------- /Source/Thunder/scripts/environment/_base.env.in: -------------------------------------------------------------------------------- 1 | XDG_RUNTIME_DIR=@CMAKE_INSTALL_FULL_RUNSTATEDIR@ 2 | -------------------------------------------------------------------------------- /Source/Thunder/scripts/environment/coredump.sysconf.in: -------------------------------------------------------------------------------- 1 | # This script configures the system to handle core dumps for debugging purposes. 2 | # 3 | # - Enables appending the process ID to core dump filenames by setting `core_uses_pid` to 1. 4 | # - Allows core dumps for setuid programs by setting `suid_dumpable` to 2. 5 | # - Configures the core dump file naming pattern and location using `core_pattern`. 6 | # The pattern includes: 7 | # - `%e`: Executable filename 8 | # - `%p`: Process ID 9 | # - `%h`: Hostname 10 | # - `%t`: Timestamp 11 | # - Creates the directory for storing core dumps if it does not exist. 12 | # - Removes the limit on core dump file size by setting `ulimit -c` to unlimited. 13 | # 14 | 15 | echo 1 > /proc/sys/kernel/core_uses_pid 16 | echo 2 > /proc/sys/fs/suid_dumpable 17 | echo "@ROOT_PATH@/cores/core_%e_%p_%h_%t" > /proc/sys/kernel/core_pattern 18 | mkdir -p @ROOT_PATH@/cores 19 | ulimit -c unlimited 20 | -------------------------------------------------------------------------------- /Source/Thunder/scripts/environment/poweroff-displays.sysconf.in: -------------------------------------------------------------------------------- 1 | # This script is designed to power off framebuffer devices (fb0, fb1, etc.) 2 | # after a delay of 8 seconds. It performs the following steps: 3 | # 1. Waits for 8 seconds using the `sleep` command. 4 | # 2. Iterates over all framebuffer device "blank" files located in 5 | # /sys/class/graphics/fb*/blank. 6 | # 3. Writes the value `1` to each "blank" file, which signals the framebuffer 7 | # to turn off or enter a low-power state. 8 | # 4. Runs the entire operation in the background using the `&` operator. 9 | 10 | ( 11 | sleep 8 12 | for fb in /sys/class/graphics/fb*/blank; do 13 | echo 1 > "$fb" 14 | done 15 | ) & 16 | -------------------------------------------------------------------------------- /Source/Thunder/scripts/set-subsystem-group-udev.rules.in: -------------------------------------------------------------------------------- 1 | SUBSYSTEM == "@UDEV_RULE_SUBSYSTEM@", GROUP = "@UDEV_RULE_GROUP@", MODE = "0660" 2 | -------------------------------------------------------------------------------- /Source/Thunder/scripts/thunder.env.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | start() { 4 | [ -r @CMAKE_INSTALL_FULL_SYSCONFDIR@/Thunder/environment ] && . @CMAKE_INSTALL_FULL_SYSCONFDIR@/Thunder/environment 5 | 6 | echo -n "Starting Thunder: " 7 | start-stop-daemon -S -q -b -m -p @CMAKE_INSTALL_FULL_RUNSTATEDIR@/Thunder.pid --exec @CMAKE_INSTALL_FULL_BINDIR@/Thunder -- -b /dev/null 2>&1 8 | [ $? == 0 ] && echo "OK" || echo "FAIL" 9 | } 10 | stop() { 11 | echo -n "Stopping Thunder: " 12 | start-stop-daemon -K -q -p @CMAKE_INSTALL_FULL_RUNSTATEDIR@/Thunder.pid 13 | [ $? == 0 ] && echo "OK" || echo "FAIL" 14 | rm -rf @CMAKE_INSTALL_FULL_RUNSTATEDIR@/Thunder.pid 15 | } 16 | restart() { 17 | stop 18 | sleep 3 19 | start 20 | } 21 | 22 | case "$1" in 23 | start) 24 | start 25 | ;; 26 | stop) 27 | stop 28 | ;; 29 | restart|reload) 30 | restart 31 | ;; 32 | *) 33 | echo "Usage: $0 {start|stop|restart}" 34 | exit 1 35 | esac 36 | 37 | exit $? 38 | -------------------------------------------------------------------------------- /Source/Thunder/scripts/thunder.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | start() { 4 | # Core dumps 5 | # echo 1 > /proc/sys/kernel/core_uses_pid 6 | # echo 2 > /proc/sys/fs/suid_dumpable 7 | # echo "@ROOT_PATH@/cores/core-pid_%p--process%E" > /proc/sys/kernel/core_pattern 8 | # mkdir -p @ROOT_PATH@/cores 9 | # ulimit -c unlimited 10 | 11 | # needed for wayland/westeros/weston 12 | export XDG_RUNTIME_DIR=@CMAKE_INSTALL_FULL_RUNSTATEDIR@ 13 | 14 | echo -n "Starting Thunder: " 15 | start-stop-daemon -S -q -b -m -p @CMAKE_INSTALL_FULL_RUNSTATEDIR@/Thunder.pid --exec @CMAKE_INSTALL_FULL_BINDIR@/Thunder -- -b /dev/null 2>&1 16 | [ $? == 0 ] && echo "OK" || echo "FAIL" 17 | 18 | # sleep 8 19 | # echo 1 > /sys/class/graphics/fb0/blank 20 | } 21 | stop() { 22 | echo -n "Stopping Thunder: " 23 | start-stop-daemon -K -q -p @CMAKE_INSTALL_FULL_RUNSTATEDIR@/Thunder.pid 24 | [ $? == 0 ] && echo "OK" || echo "FAIL" 25 | rm -rf @CMAKE_INSTALL_FULL_RUNSTATEDIR@/Thunder.pid 26 | } 27 | restart() { 28 | stop 29 | sleep 3 30 | start 31 | } 32 | 33 | case "$1" in 34 | start) 35 | start 36 | ;; 37 | stop) 38 | stop 39 | ;; 40 | restart|reload) 41 | restart 42 | ;; 43 | *) 44 | echo "Usage: $0 {start|stop|restart}" 45 | exit 1 46 | esac 47 | 48 | exit $? 49 | -------------------------------------------------------------------------------- /Source/Thunder/scripts/thunder.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=thunder 3 | Wants=multi-user.target 4 | After=multi-user.target @EXTRA_DEPENDS@ 5 | 6 | [Service] 7 | PIDFile=@CMAKE_INSTALL_FULL_RUNSTATEDIR@/Thunder.pid 8 | EnvironmentFile=-@CMAKE_INSTALL_FULL_SYSCONFDIR@/Thunder/Thunder.env 9 | Environment="WAYLAND_DISPLAY=wayland-0" 10 | Environment="XDG_RUNTIME_DIR=@CMAKE_INSTALL_FULL_RUNSTATEDIR@" 11 | ExecStart=-@CMAKE_INSTALL_FULL_BINDIR@/Thunder -b 12 | ExecStop=/bin/kill $MAINPID 13 | 14 | [Install] 15 | WantedBy=multi-user.target 16 | -------------------------------------------------------------------------------- /Source/ThunderPlugin/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME Process 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | -------------------------------------------------------------------------------- /Source/ThunderPlugin/comprocess.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Source Files 28 | 29 | 30 | -------------------------------------------------------------------------------- /Source/com/IStringIterator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | // ---- Include system wide include files ---- 23 | 24 | // ---- Include local include files ---- 25 | #include "Module.h" 26 | #include "ICOM.h" 27 | 28 | namespace Thunder { 29 | namespace RPC { 30 | 31 | typedef IteratorType StringIterator; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Source/com/IValueIterator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | // ---- Include system wide include files ---- 23 | 24 | // ---- Include local include files ---- 25 | #include "Module.h" 26 | #include "ICOM.h" 27 | 28 | namespace Thunder { 29 | namespace RPC { 30 | 31 | typedef IteratorType ValueIterator; 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Source/com/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | #include "Module.h" 20 | 21 | #ifdef BUILD_SHARED_LIBS 22 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 23 | #else 24 | MODULE_NAME_ARCHIVE_DECLARATION 25 | #endif -------------------------------------------------------------------------------- /Source/com/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME COM 24 | #endif 25 | 26 | #include 27 | #include 28 | 29 | #ifdef WARNING_REPORTING_ENABLED 30 | #include 31 | #endif 32 | 33 | #if defined(__WINDOWS__) && defined(COM_EXPORTS) 34 | #undef EXTERNAL 35 | #define EXTERNAL EXTERNAL_EXPORT 36 | #endif 37 | -------------------------------------------------------------------------------- /Source/com/ProxyStubs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2023 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | // ProxyStubs library API 27 | 28 | #define PROXYSTUBS_OPTIONS_NAME "proxystubs_options" 29 | 30 | enum proxystubs_options_t { 31 | PROXYSTUBS_OPTIONS_SECURE = 1, // --secure 32 | PROXYSTUBS_OPTIONS_COHERENT = 2 // --coherent 33 | }; 34 | 35 | typedef proxystubs_options_t (*proxystubs_options_func_t)(void); 36 | 37 | #ifdef __cplusplus 38 | } // extern "C" 39 | #endif 40 | -------------------------------------------------------------------------------- /Source/core/CoreDefault.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | $(CoreDefines) 12 | 13 | 14 | -------------------------------------------------------------------------------- /Source/core/CoreWarningReporting.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | __CORE_WARNING_REPORTING__ 6 | 7 | 8 | 9 | 10 | 11 | $(CoreDefines) 12 | 13 | 14 | -------------------------------------------------------------------------------- /Source/core/IAssertionControl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "Module.h" 23 | #include "Messaging.h" 24 | 25 | namespace Thunder { 26 | namespace Assertion { 27 | 28 | struct EXTERNAL IAssertionUnit { 29 | virtual ~IAssertionUnit() = default; 30 | virtual void AssertionEvent(Core::Messaging::IStore::Assert& metadata, const Core::Messaging::TextMessage& message) = 0; 31 | }; 32 | 33 | } 34 | } -------------------------------------------------------------------------------- /Source/core/IObserver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #ifndef __IOBSERVER_H 21 | #define __IOBSERVER_H 22 | 23 | #include "Module.h" 24 | #include "Portability.h" 25 | 26 | namespace Thunder { 27 | namespace Core { 28 | template 29 | struct IObserverType { 30 | virtual ~IObserverType() = default; 31 | virtual void Handle(OBSERVING element); 32 | }; 33 | } 34 | } // namespace Core 35 | 36 | #endif // __IOBSERVER_H 37 | -------------------------------------------------------------------------------- /Source/core/JSONRPC.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "JSONRPC.h" 21 | 22 | namespace Thunder { 23 | 24 | namespace Core { 25 | 26 | namespace JSONRPC { 27 | 28 | /* static */ constexpr TCHAR Message::DefaultVersion[]; 29 | } 30 | } 31 | } // namespace Thunder::Core::JSONRPC 32 | -------------------------------------------------------------------------------- /Source/core/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | #include "Module.h" 20 | #include "SystemInfo.h" 21 | 22 | #ifdef BUILD_SHARED_LIBS 23 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 24 | #else 25 | MODULE_NAME_ARCHIVE_DECLARATION 26 | #endif -------------------------------------------------------------------------------- /Source/core/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME Core 24 | #endif 25 | 26 | #include "Portability.h" 27 | 28 | #if defined(__WINDOWS__) && defined(CORE_EXPORTS) 29 | #undef EXTERNAL 30 | #define EXTERNAL EXTERNAL_EXPORT 31 | #endif 32 | 33 | 34 | -------------------------------------------------------------------------------- /Source/core/Version.h.in: -------------------------------------------------------------------------------- 1 | /*** 2 | * DO NOT EDIT, THIS FILE IS GENERATED @ @BUILD_TIMESTAMP@ 3 | */ 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #define THUNDER_VERSION @VERSION_MAJOR@ 10 | 11 | namespace Thunder 12 | { 13 | namespace Versioning { 14 | static constexpr uint8_t Major = @VERSION_MAJOR@; 15 | static constexpr uint8_t Minor = @VERSION_MINOR@; 16 | static constexpr uint8_t Patch = @VERSION_PATCH@; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Source/cryptalgo/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "Module.h" 21 | 22 | #ifdef BUILD_SHARED_LIBS 23 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 24 | #else 25 | MODULE_NAME_ARCHIVE_DECLARATION 26 | #endif -------------------------------------------------------------------------------- /Source/cryptalgo/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME Crypto 24 | #endif 25 | 26 | #include 27 | 28 | #if defined(__WINDOWS__) 29 | #if defined(CRYPTALGO_EXPORTS) 30 | #undef EXTERNAL 31 | #define EXTERNAL EXTERNAL_EXPORT 32 | #else 33 | #pragma comment(lib, "cryptalgo.lib") 34 | #endif 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /Source/cryptalgo/cryptalgo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #error "Please define a MODULE_NAME that describes the binary/library you are building." 24 | #endif 25 | 26 | #include "AES.h" 27 | #include "HMAC.h" 28 | #include "Hash.h" 29 | #include "HashStream.h" 30 | #include "Random.h" 31 | 32 | #if defined(SECURESOCKETS_ENABLED) 33 | #include "SecureSocketPort.h" 34 | #endif 35 | 36 | #ifdef __WINDOWS__ 37 | #pragma comment(lib, "cryptalgo.lib") 38 | #endif 39 | 40 | WPEFRAMEWORK_NESTEDNAMESPACE_COMPATIBILIY(Crypto) 41 | -------------------------------------------------------------------------------- /Source/extensions/bluetooth/Debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | // #define BLUETOOTH_CMD_DUMP 23 | 24 | #if defined(BLUETOOTH_CMD_DUMP) 25 | #define CMD_DUMP(descr, buffer, length) \ 26 | do { fprintf(stderr, "%s [%i]: ", descr, length); for (int i = 0; i < length; i++) { printf("%02x:", buffer[i]); } printf("\n"); } while(0) 27 | #else 28 | #define CMD_DUMP(descr, buffer, length) 29 | #endif 30 | -------------------------------------------------------------------------------- /Source/extensions/bluetooth/IDriver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef EXTERNAL 23 | #ifdef _MSVC_LANG 24 | #ifdef BLUETOOTH_EXPORTS 25 | #define EXTERNAL __declspec(dllexport) 26 | #else 27 | #define EXTERNAL __declspec(dllimport) 28 | #endif 29 | #else 30 | #define EXTERNAL __attribute__ ((visibility ("default"))) 31 | #endif 32 | #endif 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | EXTERNAL const char* construct_bluetooth_driver(const char* config); 39 | EXTERNAL void destruct_bluetooth_driver(); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | -------------------------------------------------------------------------------- /Source/extensions/bluetooth/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "Module.h" 21 | 22 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 23 | -------------------------------------------------------------------------------- /Source/extensions/bluetooth/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME Bluetooth 24 | #endif 25 | 26 | #include 27 | #include 28 | 29 | #include "Debug.h" 30 | 31 | #if defined(__WINDOWS__) && defined(BLUETOOTH_EXPORTS) 32 | #undef EXTERNAL 33 | #define EXTERNAL EXTERNAL_EXPORT 34 | #endif 35 | -------------------------------------------------------------------------------- /Source/extensions/bluetooth/UUID.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "UUID.h" 21 | 22 | namespace Thunder { 23 | 24 | namespace Bluetooth { 25 | 26 | /* static */ const uint8_t UUID::BASE[] = { 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 27 | 28 | } // namespace Bluetooth 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Source/extensions/bluetooth/audio/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2023 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "Module.h" 21 | 22 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 23 | -------------------------------------------------------------------------------- /Source/extensions/bluetooth/audio/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2023 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME Bluetooth_Audio 24 | #endif 25 | 26 | #include 27 | #include 28 | 29 | #include "../Debug.h" 30 | #include "../UUID.h" 31 | 32 | #if defined(__WINDOWS__) && defined(BLUETOOTH_EXPORTS) 33 | #undef EXTERNAL 34 | #define EXTERNAL EXTERNAL_EXPORT 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /Source/extensions/bluetooth/audio/bluetooth_audio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2023 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #error "Please define a MODULE_NAME that describes the binary/library you are building." 24 | #endif 25 | 26 | #include 27 | #include "SDPSocket.h" 28 | #include "SDPProfile.h" 29 | #include "AVDTPSocket.h" 30 | #include "AVDTPProfile.h" 31 | #include "RTPSocket.h" 32 | #include "DataRecord.h" 33 | 34 | #include "IAudioCodec.h" 35 | #include "IAudioContentProtection.h" 36 | 37 | #ifdef __WINDOWS__ 38 | #pragma comment(lib, "bluetoothaudio.lib") 39 | #endif -------------------------------------------------------------------------------- /Source/extensions/bluetooth/audio/cmake/FindSBC.cmake: -------------------------------------------------------------------------------- 1 | # If not stated otherwise in this file or this component's LICENSE file the 2 | # following copyright and licenses apply: 3 | # 4 | # Copyright 2021 Metrological 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | # - Try to find sbc 19 | # Once done this will define 20 | # SBC_FOUND - System has libsbc 21 | # SBC_INCLUDE_DIRS - The libsbc include directories 22 | # SBC_LIBRARIES - The libraries needed to use libsbc 23 | 24 | find_package(PkgConfig) 25 | pkg_check_modules(SBC REQUIRED sbc IMPORTED_TARGET) 26 | 27 | include(FindPackageHandleStandardArgs) 28 | find_package_handle_standard_args(SBC DEFAULT_MSG SBC_LIBRARIES) 29 | 30 | mark_as_advanced(SBC_FOUND SBC_LIBRARIES) 31 | 32 | if(SBC_FOUND) 33 | add_library(SBC::SBC ALIAS PkgConfig::SBC) 34 | endif() -------------------------------------------------------------------------------- /Source/extensions/bluetooth/bluetooth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #error "Please define a MODULE_NAME that describes the binary/library you are building." 24 | #endif 25 | 26 | #include "IDriver.h" 27 | #include "HCISocket.h" 28 | #include "UUID.h" 29 | #include "Debug.h" 30 | 31 | #ifdef __WINDOWS__ 32 | #pragma comment(lib, "bluetooth.lib") 33 | #endif 34 | -------------------------------------------------------------------------------- /Source/extensions/bluetooth/drivers/Basic.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | const char* construct_bluetooth_driver(const char* /* config */) { 27 | return (nullptr); 28 | } 29 | 30 | void destruct_bluetooth_driver() { 31 | } 32 | 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /Source/extensions/bluetooth/gatt/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "Module.h" 21 | 22 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 23 | -------------------------------------------------------------------------------- /Source/extensions/bluetooth/gatt/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME Bluetooth_GATT 24 | #endif 25 | 26 | #include 27 | #include 28 | 29 | #include "../Debug.h" 30 | #include "../UUID.h" 31 | 32 | #if defined(__WINDOWS__) && defined(BLUETOOTH_EXPORTS) 33 | #undef EXTERNAL 34 | #define EXTERNAL EXTERNAL_EXPORT 35 | #endif 36 | -------------------------------------------------------------------------------- /Source/extensions/bluetooth/gatt/bluetooth_gatt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #error "Please define a MODULE_NAME that describes the binary/library you are building." 24 | #endif 25 | 26 | #include 27 | #include "GATTSocket.h" 28 | #include "GATTProfile.h" 29 | 30 | #ifdef __WINDOWS__ 31 | #pragma comment(lib, "bluetoothgatt.lib") 32 | #endif -------------------------------------------------------------------------------- /Source/extensions/broadcast/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "Module.h" 21 | 22 | #ifdef BUILD_SHARED_LIBS 23 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 24 | #else 25 | MODULE_NAME_ARCHIVE_DECLARATION 26 | #endif 27 | -------------------------------------------------------------------------------- /Source/extensions/broadcast/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME Broadcast 24 | #endif 25 | 26 | #include 27 | 28 | #if defined(__WINDOWS__) && defined(BROADCAST_EXPORTS) 29 | #undef EXTERNAL 30 | #define EXTERNAL EXTERNAL_EXPORT 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /Source/extensions/broadcast/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # If not stated otherwise in this file or this component's license file the 2 | # following copyright and licenses apply: 3 | # 4 | # Copyright 2020 Metrological 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | include_directories(${CMAKE_CURRENT_LIST_DIR}/../../broadcast) 19 | include_directories($) 20 | 21 | add_executable(BroadcastTester 22 | Module.cpp 23 | BroadcastTester.cpp) 24 | 25 | target_link_libraries(BroadcastTester 26 | PRIVATE 27 | CompileSettingsDebug::CompileSettingsDebug 28 | ${NAMESPACE}Core::${NAMESPACE}Core 29 | ${NAMESPACE}Broadcast::${NAMESPACE}Broadcast 30 | ) 31 | 32 | install(TARGETS BroadcastTester DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${NAMESPACE}_Test) 33 | -------------------------------------------------------------------------------- /Source/extensions/broadcast/test/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2021 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "Module.h" 21 | 22 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 23 | -------------------------------------------------------------------------------- /Source/extensions/broadcast/test/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2021 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME BroadcastTest 24 | #endif 25 | 26 | #include 27 | #include 28 | 29 | #if defined(__WINDOWS__) && defined(BROADCAST_EXPORTS) 30 | #undef EXTERNAL 31 | #define EXTERNAL EXTERNAL_EXPORT 32 | #endif 33 | -------------------------------------------------------------------------------- /Source/extensions/hibernate/common/Log.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #ifndef MODULE 6 | #define MODULE "Hibernate" 7 | #endif 8 | 9 | #define LOGINFO(fmt, ...) do { fprintf(stdout, MODULE " [%s:%d] " fmt "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__);fflush(stdout); } while (0) 10 | #define LOGERR(fmt, ...) do { fprintf(stderr, MODULE " [%s:%d] " fmt "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__);fflush(stderr); } while (0) -------------------------------------------------------------------------------- /Source/extensions/localtracer/example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(local_trace_test 2 | main.cpp 3 | ) 4 | 5 | target_compile_options(local_trace_test PRIVATE -Wno-psabi) 6 | 7 | target_link_libraries(local_trace_test PRIVATE 8 | CompileSettingsDebug::CompileSettingsDebug 9 | ${NAMESPACE}Core::${NAMESPACE}Core 10 | ${NAMESPACE}LocalTracer::${NAMESPACE}LocalTracer) 11 | 12 | if(EXAMPLE_LOCALTRACER) 13 | install(TARGETS local_trace_test DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${NAMESPACE}_Test) 14 | endif() 15 | -------------------------------------------------------------------------------- /Source/extensions/privilegedrequest/example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # If not stated otherwise in this file or this component's license file the 2 | # following copyright and licenses apply: 3 | # 4 | # Copyright 2022 Metrological 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | add_executable(fdpassing main.cpp) 19 | 20 | target_compile_options (fdpassing PRIVATE -Wno-psabi) 21 | 22 | target_link_libraries(fdpassing PRIVATE 23 | CompileSettingsDebug::CompileSettingsDebug 24 | ${NAMESPACE}Core::${NAMESPACE}Core 25 | ${NAMESPACE}PrivilegedRequest::${NAMESPACE}PrivilegedRequest 26 | ) 27 | 28 | if(EXAMPLE_PRIVILEGEDREQUEST) 29 | install(TARGETS fdpassing DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${NAMESPACE}_Test) 30 | endif() 31 | -------------------------------------------------------------------------------- /Source/extensions/processcontainers/Messaging.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "Module.h" 23 | 24 | namespace Thunder { 25 | namespace ProcessContainers { 26 | 27 | DEFINE_MESSAGING_CATEGORY(Core::Messaging::BaseCategoryType, ProcessContainerization) 28 | DEFINE_MESSAGING_CATEGORY(Core::Messaging::BaseCategoryType, Debug) 29 | 30 | } // ProcessContainers 31 | } 32 | -------------------------------------------------------------------------------- /Source/extensions/processcontainers/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "Module.h" 21 | 22 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 23 | -------------------------------------------------------------------------------- /Source/extensions/processcontainers/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME ProcessContainers 24 | #endif 25 | 26 | #include 27 | #include 28 | 29 | #if defined(__WINDOWS__) && defined(CONTAINERS_EXPORTS) 30 | #undef EXTERNAL 31 | #define EXTERNAL EXTERNAL_EXPORT 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /Source/extensions/processcontainers/implementations/AWCImplementation/AWCContainerBase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "processcontainers/ContainerAdministrator.h" 4 | 5 | namespace Thunder { 6 | namespace ProcessContainers { 7 | 8 | class AWCContainerBase: 9 | public IContainer 10 | { 11 | private: 12 | string id_; 13 | public: 14 | AWCContainerBase(std::string id): id_{std::move(id)} {} 15 | 16 | const string& Id() const override {return id_;} 17 | IMemoryInfo* Memory() const override; 18 | IProcessorInfo* ProcessorInfo() const override; 19 | INetworkInterfaceIterator* NetworkInterfaces() const override; 20 | }; 21 | 22 | } /* ProcessContainers */ 23 | } /* Thunder */ 24 | -------------------------------------------------------------------------------- /Source/extensions/processcontainers/implementations/AWCImplementation/dbus/api.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Source/extensions/processcontainers/processcontainers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2024 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #error "Please define a MODULE_NAME that describes the binary/library you are building." 24 | #endif 25 | 26 | #include "IProcessContainers.h" 27 | #include "ContainerAdministrator.h" 28 | 29 | WPEFRAMEWORK_NESTEDNAMESPACE_COMPATIBILIY(ProcessContainers) 30 | -------------------------------------------------------------------------------- /Source/extensions/warningreporting/IWarningReportingMedia.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "Module.h" 23 | 24 | namespace Thunder { 25 | namespace WarningReporting { 26 | struct EXTERNAL IWarningReportingMedia { 27 | virtual ~IWarningReportingMedia() = default; 28 | virtual void Output(const char fileName[], const uint32_t lineNumber, const char identifer[], const IWarningEvent* information) = 0; 29 | }; 30 | } 31 | } 32 | 33 | 34 | -------------------------------------------------------------------------------- /Source/extensions/warningreporting/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "Module.h" 21 | 22 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 23 | -------------------------------------------------------------------------------- /Source/extensions/warningreporting/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME WarningReporting 24 | #endif 25 | 26 | #include 27 | #include 28 | 29 | #if defined(__WINDOWS__) && defined(WARNINGREPORTING_EXPORTS) 30 | #undef EXTERNAL 31 | #define EXTERNAL EXTERNAL_EXPORT 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /Source/extensions/warningreporting/warningreporting.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #error "Please define a MODULE_NAME that describes the binary/library you are building." 24 | #endif 25 | 26 | #include "IWarningReportingMedia.h" 27 | #include "WarningReportingUnit.h" 28 | 29 | #ifdef __WINDOWS__ 30 | #pragma comment(lib, "warningreporting.lib") 31 | #endif 32 | 33 | WPEFRAMEWORK_NESTEDNAMESPACE_COMPATIBILIY(WarningReporting) 34 | -------------------------------------------------------------------------------- /Source/messaging/LoggingCategories.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2022 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "Module.h" 23 | 24 | namespace Thunder { 25 | 26 | namespace Logging { 27 | 28 | // ...but logging controls have to be visible outside of the Messaging lib 29 | DEFINE_LOGGING_CATEGORY(Startup) 30 | DEFINE_LOGGING_CATEGORY(Shutdown) 31 | DEFINE_LOGGING_CATEGORY(Notification) 32 | DEFINE_LOGGING_CATEGORY(Error) 33 | DEFINE_LOGGING_CATEGORY(ParsingError) 34 | DEFINE_LOGGING_CATEGORY(Fatal) 35 | DEFINE_LOGGING_CATEGORY(Crash) 36 | 37 | } // namespace Logging 38 | } 39 | -------------------------------------------------------------------------------- /Source/messaging/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2022 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "Module.h" 21 | 22 | #ifdef BUILD_SHARED_LIBS 23 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 24 | #else 25 | MODULE_NAME_ARCHIVE_DECLARATION 26 | #endif -------------------------------------------------------------------------------- /Source/messaging/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2022 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME Messaging 24 | #endif 25 | 26 | #include 27 | 28 | #if defined(__WINDOWS__) && defined(MESSAGING_EXPORTS) 29 | #undef EXTERNAL 30 | #define EXTERNAL EXTERNAL_EXPORT 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /Source/plugins/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "Module.h" 21 | #include "IController.h" 22 | 23 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 24 | -------------------------------------------------------------------------------- /Source/plugins/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME Plugins 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #ifdef __CORE_WARNING_REPORTING__ 33 | #include 34 | #endif 35 | 36 | #if defined(__WINDOWS__) && defined(PLUGINS_EXPORTS) 37 | #undef EXTERNAL 38 | #define EXTERNAL EXTERNAL_EXPORT 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /Source/plugins/StateControl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "Module.h" 23 | #include "IStateControl.h" 24 | 25 | namespace Thunder { 26 | 27 | ENUM_CONVERSION_HANDLER(PluginHost::IStateControl::command) 28 | ENUM_CONVERSION_HANDLER(PluginHost::IStateControl::state) 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Source/plugins/SubSystem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "Module.h" 21 | #include "ISubSystem.h" 22 | 23 | namespace Thunder { 24 | 25 | } // namespace Thunder 26 | -------------------------------------------------------------------------------- /Source/plugins/SubSystem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "Module.h" 23 | #include "ISubSystem.h" 24 | 25 | namespace Thunder { 26 | 27 | ENUM_CONVERSION_HANDLER(PluginHost::ISubSystem::subsystem) 28 | 29 | } 30 | -------------------------------------------------------------------------------- /Source/plugins/definitions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2023 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | // Generated files include this 23 | 24 | #include 25 | #include 26 | #include 27 | -------------------------------------------------------------------------------- /Source/websocket/JSONRPCLink.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "JSONRPCLink.h" 21 | 22 | namespace Thunder { 23 | 24 | ENUM_CONVERSION_BEGIN(Thunder::JSONRPC::JSONPluginState) 25 | 26 | { Thunder::JSONRPC::DEACTIVATED, _TXT("Deactivated") }, 27 | { Thunder::JSONRPC::ACTIVATED, _TXT("Activated") }, 28 | 29 | ENUM_CONVERSION_END(Thunder::JSONRPC::JSONPluginState) 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Source/websocket/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "Module.h" 21 | 22 | #ifdef BUILD_SHARED_LIBS 23 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 24 | #else 25 | MODULE_NAME_ARCHIVE_DECLARATION 26 | #endif -------------------------------------------------------------------------------- /Source/websocket/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME WebSocket 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #if defined(__WINDOWS__) && defined(WEBSOCKET_EXPORTS) 31 | #undef EXTERNAL 32 | #define EXTERNAL EXTERNAL_EXPORT 33 | #endif 34 | -------------------------------------------------------------------------------- /Source/websocket/WebTransform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #ifndef __WEBTRANSFORM_H 21 | #define __WEBTRANSFORM_H 22 | 23 | #include "Module.h" 24 | 25 | namespace Thunder { 26 | namespace Web { 27 | class NoTransform { 28 | public: 29 | NoTransform(const NoTransform&) = delete; 30 | NoTransform& operator=(const NoTransform&) = delete; 31 | 32 | public: 33 | inline NoTransform() 34 | { 35 | } 36 | inline ~NoTransform() 37 | { 38 | } 39 | }; 40 | } 41 | } 42 | 43 | #endif // __WEBTRANSFORM_H 44 | -------------------------------------------------------------------------------- /Tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | option(LOADER_TEST "Utility to load a plugin in isolation." OFF) 2 | option(HTTPSCLIENT_TEST "Example how to do https requests with Thunder." OFF) 3 | option(WORKERPOOL_TEST "WorkerPool stress test" OFF) 4 | option(FILE_UNLINK_TEST "File unlink test" OFF) 5 | option(REDIRECT_TEST "Test stream redirection" OFF) 6 | option(MESSAGEBUFFER_TEST "Test message buffer" OFF) 7 | option(UNRAVELLER "reveal thread details" OFF) 8 | 9 | if(BUILD_TESTS) 10 | add_subdirectory(unit) 11 | endif() 12 | 13 | if (FILE_UNLINK_TEST) 14 | add_subdirectory(file-unlink) 15 | endif() 16 | 17 | if(HTTPSCLIENT_TEST) 18 | add_subdirectory(httpsclient) 19 | endif() 20 | 21 | if(LOADER_TEST) 22 | add_subdirectory(loader) 23 | endif() 24 | 25 | if(REDIRECT_TEST) 26 | add_subdirectory(redirect) 27 | endif() 28 | 29 | if(WORKERPOOL_TEST) 30 | add_subdirectory(workerpool-test) 31 | endif() 32 | 33 | if(MESSAGEBUFFER_TEST) 34 | add_subdirectory(message-buffer) 35 | endif() 36 | 37 | if(CYCLICBUFFER_TEST) 38 | add_subdirectory(cyclic-buffer) 39 | endif() 40 | 41 | if(UNRAVELLER) 42 | add_subdirectory(unraveller) 43 | endif() -------------------------------------------------------------------------------- /Tests/comrpctester/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # If not stated otherwise in this file or this component's license file the 2 | # following copyright and licenses apply: 3 | # 4 | # Copyright 2023 Metrological 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | add_executable(comrpctester main.cpp) 19 | 20 | target_link_libraries(comrpctester 21 | PRIVATE 22 | ${NAMESPACE}Core::${NAMESPACE}Core 23 | ${NAMESPACE}COM::${NAMESPACE}COM 24 | ) 25 | 26 | set_target_properties(comrpctester PROPERTIES 27 | CXX_STANDARD 11 28 | CXX_STANDARD_REQUIRED YES 29 | ) 30 | 31 | install(TARGETS comrpctester DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${NAMESPACE}_Test) 32 | 33 | -------------------------------------------------------------------------------- /Tests/cyclic-buffer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # If not stated otherwise in this file or this component's license file the 2 | # following copyright and licenses apply: 3 | # 4 | # Copyright 2020 Metrological 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | add_executable(CyclicBuffer main.cpp) 19 | 20 | set_target_properties(CyclicBuffer PROPERTIES 21 | CXX_STANDARD 11 22 | CXX_STANDARD_REQUIRED YES 23 | ) 24 | 25 | target_link_libraries(CyclicBuffer 26 | PRIVATE 27 | ${NAMESPACE}Core 28 | ) 29 | 30 | install(TARGETS CyclicBuffer DESTINATION bin) 31 | 32 | -------------------------------------------------------------------------------- /Tests/file-unlink/file-client.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int main() { 9 | errno = 0; 10 | int fd = open ("test.txt", O_RDWR); 11 | printf("fd = %d, error = %s\n", fd, strerror(errno)); 12 | system("ls -l test.txt"); 13 | int key = 0; 14 | scanf("%d", &key); 15 | system("ls -l test.txt"); 16 | char buffer[50]; 17 | int size = read(fd, buffer, sizeof(buffer)); 18 | printf("size = %d buffer = %s\n", size, buffer); 19 | int status = close(fd); 20 | printf("fd = %d, error = %s\n", status, strerror(errno)); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /Tests/file-unlink/file-master.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int main() { 10 | int fd = open ("test.txt", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); 11 | printf("fd = %d, error = %s\n", fd, strerror(errno)); 12 | int key = 0; 13 | system("ls -l test.txt"); 14 | char buffer[] = "TestString"; 15 | write(fd, buffer, sizeof(buffer)); 16 | 17 | scanf("%d", &key); 18 | close(fd); 19 | int status = unlink("test.txt"); 20 | 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /Tests/httpsclient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #find_package(${NAMESPACE}Core REQUIRED) 2 | #find_package(${NAMESPACE}Cryptalgo REQUIRED) 3 | #find_package(${NAMESPACE}WebSocket REQUIRED) 4 | #find_package(${NAMESPACE}Tracing REQUIRED) 5 | 6 | add_executable(httpsclient_test 7 | Module.cpp 8 | main.cpp 9 | ) 10 | 11 | target_link_libraries(httpsclient_test 12 | PRIVATE 13 | ${NAMESPACE}Core 14 | ${NAMESPACE}Cryptalgo 15 | ${NAMESPACE}Tracing 16 | ${NAMESPACE}WebSocket 17 | ) 18 | 19 | install(TARGETS httpsclient_test DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${NAMESPACE}_Test) 20 | -------------------------------------------------------------------------------- /Tests/httpsclient/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2021 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "Module.h" 21 | 22 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 23 | -------------------------------------------------------------------------------- /Tests/httpsclient/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2021 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME HTTPSClientTest 24 | #endif 25 | 26 | #include 27 | 28 | #undef EXTERNAL 29 | #define EXTERNAL 30 | -------------------------------------------------------------------------------- /Tests/loader/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # If not stated otherwise in this file or this component's license file the 2 | # following copyright and licenses apply: 3 | # 4 | # Copyright 2020 Metrological 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | find_package(Threads) 19 | 20 | add_executable(WPELibraryTestLoader main.cpp) 21 | 22 | target_link_libraries(WPELibraryTestLoader 23 | PRIVATE 24 | Threads::Threads 25 | ${CMAKE_DL_LIBS} 26 | ${NAMESPACE}Core::${NAMESPACE}Core 27 | ) 28 | 29 | set_target_properties(WPELibraryTestLoader PROPERTIES 30 | CXX_STANDARD 11 31 | CXX_STANDARD_REQUIRED YES 32 | ) 33 | 34 | install(TARGETS WPELibraryTestLoader DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${NAMESPACE}_Test) 35 | 36 | -------------------------------------------------------------------------------- /Tests/message-buffer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # If not stated otherwise in this file or this component's license file the 2 | # following copyright and licenses apply: 3 | # 4 | # Copyright 2020 Metrological 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | add_executable(MessageBufferTest 19 | Module.cpp 20 | main.cpp) 21 | 22 | target_link_libraries(MessageBufferTest 23 | PRIVATE 24 | ${NAMESPACE}Core::${NAMESPACE}Core 25 | ${NAMESPACE}COM::${NAMESPACE}COM 26 | ${NAMESPACE}Messaging::${NAMESPACE}Messaging 27 | ) 28 | 29 | set_target_properties(MessageBufferTest PROPERTIES 30 | CXX_STANDARD 11 31 | CXX_STANDARD_REQUIRED YES 32 | ) 33 | 34 | install(TARGETS MessageBufferTest DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${NAMESPACE}_Test) 35 | -------------------------------------------------------------------------------- /Tests/message-buffer/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2021 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "Module.h" 21 | 22 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 23 | -------------------------------------------------------------------------------- /Tests/message-buffer/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2021 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME MessageBufferTest 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #undef EXTERNAL 31 | #define EXTERNAL 32 | -------------------------------------------------------------------------------- /Tests/redirect/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # If not stated otherwise in this file or this component's license file the 2 | # following copyright and licenses apply: 3 | # 4 | # Copyright 2020 Metrological 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | add_executable(redirect main.cpp) 19 | 20 | target_link_libraries(redirect 21 | PRIVATE 22 | ${NAMESPACE}Core::${NAMESPACE}Core 23 | ) 24 | 25 | set_target_properties(redirect PROPERTIES 26 | CXX_STANDARD 11 27 | CXX_STANDARD_REQUIRED YES 28 | ) 29 | 30 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") 31 | 32 | install(TARGETS redirect DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${NAMESPACE}_Test) 33 | 34 | -------------------------------------------------------------------------------- /Tests/unit/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME ThunderUnitTests 24 | #endif 25 | -------------------------------------------------------------------------------- /Tests/unit/core/test_library_helloworld.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2020 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include 21 | 22 | namespace Thunder { 23 | namespace Tests { 24 | namespace Core { 25 | 26 | extern "C" std::string HelloWorld(){ 27 | return "Hello World!"; 28 | } 29 | 30 | } // Core 31 | } // Tests 32 | } // Thunder 33 | -------------------------------------------------------------------------------- /Tests/unraveller/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # If not stated otherwise in this file or this component's license file the 2 | # following copyright and licenses apply: 3 | # 4 | # Copyright 2024 Metrological 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | add_executable(unraveller main.cpp) 19 | 20 | target_link_libraries(unraveller 21 | PRIVATE 22 | ${NAMESPACE}Core::${NAMESPACE}Core 23 | ${NAMESPACE}Cryptalgo::${NAMESPACE}Cryptalgo 24 | ) 25 | 26 | set_target_properties(unraveller PROPERTIES 27 | CXX_STANDARD 11 28 | CXX_STANDARD_REQUIRED YES 29 | ) 30 | 31 | install(TARGETS unraveller DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${NAMESPACE}_Test) 32 | -------------------------------------------------------------------------------- /Tests/workerpool-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_executable(WorkerPoolTest 3 | Module.cpp 4 | WorkerPoolTest.cpp 5 | ) 6 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread") 7 | 8 | target_link_libraries(WorkerPoolTest 9 | PRIVATE 10 | ${NAMESPACE}Core 11 | ) 12 | 13 | install(TARGETS WorkerPoolTest DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${NAMESPACE}_Test) 14 | -------------------------------------------------------------------------------- /Tests/workerpool-test/Module.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2021 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "Module.h" 21 | 22 | MODULE_NAME_DECLARATION(BUILD_REFERENCE) 23 | -------------------------------------------------------------------------------- /Tests/workerpool-test/Module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * If not stated otherwise in this file or this component's LICENSE file the 3 | * following copyright and licenses apply: 4 | * 5 | * Copyright 2021 Metrological 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #ifndef MODULE_NAME 23 | #define MODULE_NAME WorkerPoolTest 24 | #endif 25 | 26 | #include 27 | 28 | #undef EXTERNAL 29 | #define EXTERNAL 30 | -------------------------------------------------------------------------------- /cmake/common/CreateLink.cmake: -------------------------------------------------------------------------------- 1 | # Creates a symlink (if used in CMakeLists.txt in configuration phase) 2 | # 3 | # example: ${CMAKE_PROJECT_DIR}/include/link.h > ${CMAKE_BINARY_DIR}/target.h 4 | # 5 | # include(CreateLink) 6 | # CreateLink( 7 | # LINK "${CMAKE_PROJECT_DIR}/include/link.h" 8 | # TARGET "${CMAKE_BINARY_DIR}/target.h" 9 | #) 10 | # 11 | function(CreateLink) 12 | set(oneValueArgs TARGET LINK) 13 | 14 | cmake_parse_arguments(Argument "${optionsArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) 15 | 16 | message(VERBOSE "Creating symlink ${Argument_LINK} -> ${Argument_TARGET}") 17 | 18 | get_filename_component(LINK_DIR ${Argument_LINK} DIRECTORY) 19 | file(MAKE_DIRECTORY "${LINK_DIR}") 20 | 21 | if(${CMAKE_VERSION} VERSION_LESS "3.14.0") 22 | message(WARNING "Please consider to switch to CMake 3.14.0 or up to create symlinks") 23 | INSTALL(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${Argument_TARGET} ${Argument_LINK})") 24 | else() 25 | file(CREATE_LINK ${Argument_TARGET} ${Argument_LINK} SYMBOLIC) 26 | endif() 27 | endfunction(CreateLink) 28 | -------------------------------------------------------------------------------- /cmake/common/InstallLink.cmake: -------------------------------------------------------------------------------- 1 | # Creates a symlink in the installalation phase 2 | # 3 | # example: /usr/include/link.h > target.h 4 | # include(InstallLink) 5 | # InstallLink( 6 | # LINK "${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/include/link.h" 7 | # TARGET "target.h" 8 | #) 9 | # 10 | macro(InstallLink) 11 | set(oneValueArgs TARGET LINK) 12 | 13 | cmake_parse_arguments(Argument "${optionsArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) 14 | 15 | set(LINK "${Argument_LINK}") 16 | set(TARGET "${Argument_TARGET}") 17 | 18 | configure_file("install_symlink.cmake.in" "install_symlink.cmake" 19 | @ONLY) 20 | 21 | install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/install_symlink.cmake") 22 | endmacro(InstallLink) 23 | -------------------------------------------------------------------------------- /cmake/common/install_symlink.cmake.in: -------------------------------------------------------------------------------- 1 | set(CMAKE_MODULE_PATH @CMAKE_MODULE_PATH@) 2 | include(CreateLink) 3 | CreateLink(LINK @LINK@ TARGET @TARGET@) -------------------------------------------------------------------------------- /cmake/config/collections/list_pop_back.cmake: -------------------------------------------------------------------------------- 1 | # removes the last element from list and returns it 2 | function(list_pop_back __list_pop_back_lst) 3 | 4 | if("${${__list_pop_back_lst}}_" STREQUAL "_") 5 | return() 6 | endif() 7 | list(LENGTH "${__list_pop_back_lst}" len) 8 | math(EXPR len "${len} - 1") 9 | list(GET "${__list_pop_back_lst}" "${len}" res) 10 | list(REMOVE_AT "${__list_pop_back_lst}" ${len}) 11 | set("${__list_pop_back_lst}" ${${__list_pop_back_lst}} PARENT_SCOPE) 12 | return_ref(res) 13 | endfunction() 14 | 15 | 16 | 17 | # removes the last element from list and returns it 18 | ## faster version 19 | macro(list_pop_back __list_pop_back_lst) 20 | if("${${__list_pop_back_lst}}_" STREQUAL "_") 21 | set(__ans) 22 | else() 23 | list(LENGTH "${__list_pop_back_lst}" __list_pop_back_length) 24 | math(EXPR __list_pop_back_length "${__list_pop_back_length} - 1") 25 | list(GET "${__list_pop_back_lst}" "${__list_pop_back_length}" __ans) 26 | list(REMOVE_AT "${__list_pop_back_lst}" ${__list_pop_back_length}) 27 | endif() 28 | endmacro() -------------------------------------------------------------------------------- /cmake/config/collections/list_pop_front.cmake: -------------------------------------------------------------------------------- 1 | # removes the first value of the list and returns it 2 | function(list_pop_front __list_pop_front_lst) 3 | set(res) 4 | 5 | list(LENGTH "${__list_pop_front_lst}" len) 6 | if("${len}" EQUAL 0) 7 | return() 8 | endif() 9 | 10 | list(GET ${__list_pop_front_lst} 0 res) 11 | 12 | if(${len} EQUAL 1) 13 | set(${__list_pop_front_lst} ) 14 | else() 15 | list(REMOVE_AT "${__list_pop_front_lst}" 0) 16 | endif() 17 | #message("${__list_pop_front_lst} is ${${__list_pop_front_lst}}") 18 | # set(${result} ${res} PARENT_SCOPE) 19 | set(${__list_pop_front_lst} ${${__list_pop_front_lst}} PARENT_SCOPE) 20 | return_ref(res) 21 | endfunction() 22 | 23 | 24 | # removes the first value of the list and returns it 25 | ## faster version 26 | macro(list_pop_front __list_pop_front_lst) 27 | list(LENGTH "${__list_pop_front_lst}" __list_pop_front_length) 28 | if(NOT "${__list_pop_front_length}" EQUAL 0) 29 | list(GET ${__list_pop_front_lst} 0 __ans) 30 | 31 | if(${__list_pop_front_length} EQUAL 1) 32 | set(${__list_pop_front_lst}) 33 | else() 34 | list(REMOVE_AT "${__list_pop_front_lst}" 0) 35 | endif() 36 | else() 37 | set(__ans) 38 | endif() 39 | 40 | endmacro() -------------------------------------------------------------------------------- /cmake/config/collections/list_push_back.cmake: -------------------------------------------------------------------------------- 1 | # adds a value to the end of the list 2 | function(list_push_back __list_push_back_lst value) 3 | set(${__list_push_back_lst} ${${__list_push_back_lst}} ${value} PARENT_SCOPE) 4 | endfunction() -------------------------------------------------------------------------------- /cmake/config/collections/list_push_front.cmake: -------------------------------------------------------------------------------- 1 | # adds a value at the beginning of the list 2 | function(list_push_front __list_push_front_lst value) 3 | set(${__list_push_front_lst} ${value} ${${__list_push_front_lst}} PARENT_SCOPE) 4 | return(true) 5 | endfunction() -------------------------------------------------------------------------------- /cmake/config/core/eval.cmake: -------------------------------------------------------------------------------- 1 | # Evaluate expression (faster version) 2 | # Suggestion from the Wiki: http://cmake.org/Wiki/CMake/Language_Syntax 3 | # Unfortunately, no built-in stuff for this: http://public.kitware.com/Bug/view.php?id=4034 4 | # eval will not modify ans (the code evaluated may modify ans) 5 | # vars starting with __eval should not be used in code 6 | function(eval __eval_code) 7 | 8 | # one file per execution of cmake (if this file were in memory it would probably be faster...) 9 | fwrite_temp("" ".cmake") 10 | ans(__eval_temp_file) 11 | 12 | 13 | # speedup: statically write filename so eval boils down to 3 function calls 14 | file(WRITE "${__eval_temp_file}" " 15 | function(eval __eval_code) 16 | file(WRITE ${__eval_temp_file} \"\${__eval_code}\") 17 | include(${__eval_temp_file}) 18 | set(__ans \${__ans} PARENT_SCOPE) 19 | endfunction() 20 | ") 21 | include("${__eval_temp_file}") 22 | 23 | 24 | eval("${__eval_code}") 25 | return_ans() 26 | endfunction() 27 | 28 | 29 | -------------------------------------------------------------------------------- /cmake/config/core/require.cmake: -------------------------------------------------------------------------------- 1 | function(require file) 2 | file(GLOB_RECURSE res "${file}") 3 | 4 | if(NOT res) 5 | message(FATAL_ERROR "could not find required file for '${file}'") 6 | endif() 7 | 8 | foreach(file ${res}) 9 | include("${file}") 10 | endforeach() 11 | 12 | endfunction() 13 | -------------------------------------------------------------------------------- /cmake/config/core/return/ans.cmake: -------------------------------------------------------------------------------- 1 | # assigns the result return by a functi on to the specified variable 2 | # must be immediately called after funct ion call 3 | # if no argument is passed current __ans will be cleared (this should be called at beginning of ffunc) 4 | # the name ans stems from calculators ans and signifies the last answer 5 | function(ans __ans_result) 6 | set(${__ans_result} "${__ans}" PARENT_SCOPE) 7 | endfunction() 8 | -------------------------------------------------------------------------------- /cmake/config/core/return/ans_append.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## appends the last return value to the specified list 4 | macro(ans_append __lst) 5 | list(APPEND ${__lst} ${__ans}) 6 | endmacro() -------------------------------------------------------------------------------- /cmake/config/core/return/ans_extract.cmake: -------------------------------------------------------------------------------- 1 | ## extracts the the specified variables in order from last result 2 | ## returns the rest of the result which was unused 3 | ## ``` 4 | ## do_something() 5 | ## ans_extract(value1 value2) 6 | ## ans(rest) 7 | ## ``` 8 | macro(ans_extract) 9 | ans(__ans_extract_list) 10 | list_extract(__ans_extract_list ${ARGN}) 11 | endmacro() -------------------------------------------------------------------------------- /cmake/config/core/return/clr.cmake: -------------------------------------------------------------------------------- 1 | # used to clear the __ans variable. may also called inside a function with argument PARENT_SCOPE to clear 2 | # parent __ans variable 3 | macro(clr) 4 | set(__ans ${ARGN}) 5 | endmacro() -------------------------------------------------------------------------------- /cmake/config/core/return/return.cmake: -------------------------------------------------------------------------------- 1 | ## 2 | ## 3 | ## when not to use: if your data degrades when evaluated by a macro 4 | ## for example escapes are resolved 5 | macro(return) 6 | set(__ans "${ARGN}" PARENT_SCOPE) 7 | _return() 8 | endmacro() -------------------------------------------------------------------------------- /cmake/config/core/return/return_ans.cmake: -------------------------------------------------------------------------------- 1 | #returns the last returned value 2 | # this is a shorthand useful when returning the rsult of a previous function 3 | macro(return_ans) 4 | return_ref(__ans) 5 | endmacro() 6 | -------------------------------------------------------------------------------- /cmake/config/core/return/return_math.cmake: -------------------------------------------------------------------------------- 1 | 2 | macro(return_math expr) 3 | math(EXPR __return_math_res "${expr}") 4 | return(${__return_math_res}) 5 | endmacro() 6 | -------------------------------------------------------------------------------- /cmake/config/core/return/return_ref.cmake: -------------------------------------------------------------------------------- 1 | # returns the var called ${ref} 2 | # this inderection is needed when returning escaped string, else macro will evaluate the string 3 | macro(return_ref __return_ref_ref) 4 | set(__ans "${${__return_ref_ref}}" PARENT_SCOPE) 5 | _return() 6 | endmacro() 7 | 8 | -------------------------------------------------------------------------------- /cmake/config/core/return/return_refs.cmake: -------------------------------------------------------------------------------- 1 | 2 | ## returns the values of multiple refs 3 | macro(return_refs) 4 | set(__ans) 5 | foreach(arg ${ARGN}) 6 | list(APPEND __ans "${${arg}}") 7 | endforeach() 8 | set(__ans "${__ans}" PARENT_SCOPE) 9 | _return() 10 | endmacro() -------------------------------------------------------------------------------- /cmake/config/core/return/return_reset.cmake: -------------------------------------------------------------------------------- 1 | macro(return_reset) 2 | set(__ans PARENT_SCOPE) 3 | endmacro() -------------------------------------------------------------------------------- /cmake/config/core/return/return_truth.cmake: -------------------------------------------------------------------------------- 1 | macro(return_truth) 2 | if(${ARGN}) 3 | return(true) 4 | endif() 5 | return(false) 6 | endmacro() 7 | -------------------------------------------------------------------------------- /cmake/config/core/return/set_ans.cmake: -------------------------------------------------------------------------------- 1 | function(set_ans ) 2 | set(__set_ans_val ${ARGN}) 3 | return_ref(__set_ans_val) 4 | endfunction() -------------------------------------------------------------------------------- /cmake/config/core/return/set_ans_ref.cmake: -------------------------------------------------------------------------------- 1 | function(set_ans_ref __set_ans_ref_ref) 2 | return_ref("${__set_ans_ref_ref}") 3 | 4 | endfunction() -------------------------------------------------------------------------------- /cmake/config/events/event.cmake: -------------------------------------------------------------------------------- 1 | ## `():` 2 | ## 3 | ## tries to get the `` identified by `` 4 | ## if it does not exist a new `` is created by @markdown_see_function("event_new(...)") 5 | function(event ) 6 | set(event_id ${ARGN}) 7 | set(event) 8 | if(event_id) 9 | event_get("${event_id}") 10 | ans(event) 11 | endif() 12 | if(NOT event) 13 | event_new(${event_id}) 14 | ans(event) 15 | endif() 16 | return_ref(event) 17 | endfunction() 18 | -------------------------------------------------------------------------------- /cmake/config/events/event_addhandler.cmake: -------------------------------------------------------------------------------- 1 | ## `event_addhandler(<~event> <~callable>)->` 2 | ## 3 | ## adds an event handler to the specified event. returns an `` 4 | ## which can be used to remove the handler from the event. 5 | ## 6 | function(event_addhandler event handler) 7 | event("${event}") 8 | ans(event) 9 | 10 | event_handler("${handler}") 11 | ans(handler) 12 | 13 | ## then only append function 14 | map_append_unique("${event}" handlers "${handler}") 15 | 16 | return(${handler}) 17 | endfunction() 18 | 19 | -------------------------------------------------------------------------------- /cmake/config/events/event_cancel.cmake: -------------------------------------------------------------------------------- 1 | ## `()->` 2 | ## 3 | ## only usable inside event handlers. cancels the current event and returns 4 | ## after this handler. 5 | function(event_cancel) 6 | address_set(${__current_event_cancel} true) 7 | return() 8 | endfunction() -------------------------------------------------------------------------------- /cmake/config/events/event_clear.cmake: -------------------------------------------------------------------------------- 1 | ## `(<~event>)->` 2 | ## 3 | ## removes all handlers from the specified event 4 | function(event_clear event) 5 | event_get("${event}") 6 | ans(event) 7 | 8 | event_handlers("${event}") 9 | ans(handlers) 10 | 11 | foreach(handler ${handlers}) 12 | event_removehandler("${event}" "${handler}") 13 | endforeach() 14 | 15 | return() 16 | endfunction() 17 | 18 | -------------------------------------------------------------------------------- /cmake/config/events/event_get.cmake: -------------------------------------------------------------------------------- 1 | ## `(<~event>)->` 2 | ## 3 | ## returns the `` identified by `` 4 | ## if the event does not exist `` is returned. 5 | function(event_get event) 6 | events() 7 | ans(events) 8 | 9 | is_event("${event}") 10 | ans(is_event) 11 | 12 | if(is_event) 13 | return_ref(event) 14 | endif() 15 | 16 | map_tryget(${events} "${event}") 17 | return_ans() 18 | endfunction() 19 | -------------------------------------------------------------------------------- /cmake/config/events/event_handler.cmake: -------------------------------------------------------------------------------- 1 | ## `(<~callable>)->` 2 | ## 3 | ## creates an from the specified callable 4 | ## and returns it. a `event_handler` is also a callable 5 | function(event_handler callable) 6 | callable("${callable}") 7 | ans(event_handler) 8 | return_ref(event_handler) 9 | endfunction() 10 | -------------------------------------------------------------------------------- /cmake/config/events/event_handler_call.cmake: -------------------------------------------------------------------------------- 1 | ## `( )->` 2 | ## 3 | ## calls the specified event handler for the specified event. 4 | function(event_handler_call event event_handler) 5 | callable_call("${event_handler}" ${ARGN}) 6 | ans(res) 7 | return_ref(res) 8 | endfunction() 9 | -------------------------------------------------------------------------------- /cmake/config/events/event_handlers.cmake: -------------------------------------------------------------------------------- 1 | ## `()->` 2 | ## 3 | ## returns all handlers registered for the event 4 | function(event_handlers event) 5 | event_get("${event}") 6 | ans(event) 7 | 8 | if(NOT event) 9 | return() 10 | endif() 11 | 12 | map_tryget(${event} handlers) 13 | return_ans() 14 | 15 | endfunction() -------------------------------------------------------------------------------- /cmake/config/events/event_removehandler.cmake: -------------------------------------------------------------------------------- 1 | ## `()->` 2 | ## 3 | ## removes the specified handler from the event idenfied by event_id 4 | ## returns true if the handler was removed 5 | function(event_removehandler event handler) 6 | 7 | event("${event}") 8 | ans(event) 9 | 10 | if(NOT event) 11 | return(false) 12 | endif() 13 | 14 | 15 | event_handler("${handler}") 16 | ans(handler) 17 | 18 | 19 | map_remove_item("${event}" handlers "${handler}") 20 | ans(success) 21 | 22 | return_truth("${success}") 23 | 24 | endfunction() 25 | 26 | -------------------------------------------------------------------------------- /cmake/config/events/events.cmake: -------------------------------------------------------------------------------- 1 | ## `()-> ` 2 | ## 3 | ## returns the global events map it contains all registered events. 4 | function(events) 5 | 6 | function(events) 7 | map_get(global events) 8 | ans(events) 9 | return_ref(events) 10 | endfunction() 11 | 12 | map_new() 13 | ans(events) 14 | map_set(global events ${events}) 15 | events(${ARGN}) 16 | return_ans() 17 | endfunction() 18 | -------------------------------------------------------------------------------- /cmake/config/events/events_track.cmake: -------------------------------------------------------------------------------- 1 | ## `()->` 2 | ## 3 | ## sets up a function which listens only to the specified events 4 | ## 5 | function(events_track) 6 | function_new() 7 | ans(function_name) 8 | 9 | map_new() 10 | ans(map) 11 | 12 | eval(" 13 | function(${function_name}) 14 | map_new() 15 | ans(event_args) 16 | map_tryget(\${event} event_id) 17 | ans(event_id) 18 | map_set(\${event_args} id \${event_id}) 19 | map_set(\${event_args} args \${ARGN}) 20 | map_set(\${event_args} event \${event}) 21 | map_append(${map} \${event_id} \${event_args}) 22 | map_append(${map} event_ids \${event_id}) 23 | return(\${event_args}) 24 | endfunction() 25 | ") 26 | 27 | foreach(event ${ARGN}) 28 | event_addhandler(${event} ${function_name}) 29 | endforeach() 30 | 31 | return(${map}) 32 | endfunction() -------------------------------------------------------------------------------- /cmake/config/events/is_event.cmake: -------------------------------------------------------------------------------- 1 | ## `()->` 2 | ## 3 | ## returns true if the specified value is an event 4 | ## an event is a ref which is callable and has an event_id 5 | ## 6 | function(is_event event) 7 | is_address("${event}") 8 | ans(is_ref) 9 | if(NOT is_ref) 10 | return() 11 | endif() 12 | is_callable("${event}") 13 | ans(is_callable) 14 | if(NOT is_callable) 15 | return(false) 16 | endif() 17 | 18 | map_has(${event} event_id) 19 | ans(has_event_id) 20 | if(NOT has_event_id) 21 | return(false) 22 | endif() 23 | 24 | return(true) 25 | endfunction() -------------------------------------------------------------------------------- /cmake/config/filesystem/file/fwrite.cmake: -------------------------------------------------------------------------------- 1 | # writs argn to the speicified file creating it if it does not exist and 2 | # overwriting it if it does. 3 | function(fwrite path) 4 | path_qualify(path) 5 | file(WRITE "${path}" "${ARGN}") 6 | event_emit(on_fwrite "${path}") 7 | return_ref(path) 8 | endfunction() -------------------------------------------------------------------------------- /cmake/config/filesystem/fwrite_temp.cmake: -------------------------------------------------------------------------------- 1 | 2 | ## 3 | ## 4 | ## creates a temporary file containing the specified content 5 | ## returns the path for that file 6 | function(fwrite_temp content) 7 | set(ext ${ARGN}) 8 | 9 | if(NOT ext) 10 | set(ext ".txt") 11 | endif() 12 | 13 | #cmakepp_config(temp_dir) 14 | #ans(temp_dir) 15 | set(temp_dir "/tmp") 16 | 17 | path_vary("${temp_dir}/fwrite_temp${ext}") 18 | ans(temp_path) 19 | 20 | fwrite("${temp_path}" "${content}") 21 | 22 | return_ref(temp_path) 23 | 24 | endfunction() 25 | -------------------------------------------------------------------------------- /cmake/config/filesystem/navigation/pwd.cmake: -------------------------------------------------------------------------------- 1 | # returns the current working directory 2 | function(pwd) 3 | address_get(__global_cd_current_directory) 4 | return_ans() 5 | endfunction() 6 | -------------------------------------------------------------------------------- /cmake/config/filesystem/path/path.cmake: -------------------------------------------------------------------------------- 1 | ## `()->` 2 | ## 3 | ## returns the fully qualified path name for path 4 | ## if path is a fully qualified name it returns path 5 | ## else path is interpreted as the relative path 6 | function(path path) 7 | pwd() 8 | ans(pwd) 9 | path_qualify_from("${pwd}" "${path}") 10 | return_ans() 11 | endfunction() 12 | 13 | 14 | -------------------------------------------------------------------------------- /cmake/config/filesystem/path/path_qualify.cmake: -------------------------------------------------------------------------------- 1 | 2 | ## qualifies the specified variable as a path and sets it accordingly 3 | macro(path_qualify __path_ref) 4 | path("${${__path_ref}}") 5 | ans(${__path_ref}) 6 | endmacro() 7 | -------------------------------------------------------------------------------- /cmake/config/filesystem/path/path_qualify_from.cmake: -------------------------------------------------------------------------------- 1 | ## `(> <~path>) -> ` 2 | ## 3 | ## @todo realpath or abspath? 4 | ## qualfies a path using the specified base_dir 5 | ## 6 | ## if path is absolute (starts with / or under windows with :/) 7 | ## it is returned as is 8 | ## 9 | ## if path starts with a '~' (tilde) the path is 10 | ## qualfied by prepending the current home directory (on all OSs) 11 | ## 12 | ## is neither absolute nor starts with ~ 13 | ## the path is relative and it is qualified 14 | ## by prepending the specified 15 | function(path_qualify_from base_dir path) 16 | string(REPLACE \\ / path "${path}") 17 | get_filename_component(realpath "${path}" ABSOLUTE) 18 | 19 | ## windows absolute path 20 | if(WIN32 AND "_${path}" MATCHES "^_[a-zA-Z]:\\/") 21 | return_ref(realpath) 22 | endif() 23 | 24 | ## posix absolute path 25 | if("_${path}" MATCHES "^_\\/") 26 | return_ref(realpath) 27 | endif() 28 | 29 | 30 | ## home path 31 | if("_${path}" MATCHES "^_~\\/?(.*)") 32 | home_dir() 33 | ans(base_dir) 34 | set(path "${CMAKE_MATCH_1}") 35 | endif() 36 | 37 | set(path "${base_dir}/${path}") 38 | 39 | ## relative path 40 | get_filename_component(realpath "${path}" ABSOLUTE) 41 | 42 | return_ref(realpath) 43 | endfunction() -------------------------------------------------------------------------------- /cmake/config/filesystem/path/path_vary.cmake: -------------------------------------------------------------------------------- 1 | ## `()->` 2 | ## 3 | ## varies the specified path until it does not exist 4 | ## this is done by inserting a random string into the path and doing so until 5 | ## a path is vound whic does not exist 6 | function(path_vary path) 7 | path_qualify(path) 8 | get_filename_component(ext "${path}" EXT) 9 | get_filename_component(name "${path}" NAME_WE) 10 | get_filename_component(base "${path}" PATH) 11 | set(rnd) 12 | while(true) 13 | set(path "${base}/${name}${rnd}${ext}") 14 | 15 | if(NOT EXISTS "${path}") 16 | return("${path}") 17 | endif() 18 | 19 | 20 | ## alternatively count up 21 | string(RANDOM rnd) 22 | set(rnd "_${rnd}") 23 | 24 | endwhile() 25 | endfunction() -------------------------------------------------------------------------------- /cmake/config/formats/json/json2.cmake: -------------------------------------------------------------------------------- 1 | function(json2 input) 2 | 3 | json2_definition() 4 | ans(lang) 5 | language_initialize(${lang}) 6 | address_set(json2_language_definition "${lang}") 7 | function(json2 input) 8 | checksum_string("${input}") 9 | ans(ck) 10 | file_cache_return_hit("${ck}") 11 | address_get(json2_language_definition) 12 | ans(lang) 13 | map_new() 14 | ans(ctx) 15 | map_set(${ctx} input "${input}") 16 | map_set(${ctx} def "json") 17 | obj_setprototype(${ctx} "${lang}") 18 | 19 | #lang2(output json2 input "${input}" def "json") 20 | 21 | lang(output ${ctx}) 22 | ans(res) 23 | file_cache_update("${ck}" ${res}) 24 | return_ref(res) 25 | endfunction() 26 | json2("${input}") 27 | return_ans() 28 | endfunction() -------------------------------------------------------------------------------- /cmake/config/formats/json/json_deserialize.cmake: -------------------------------------------------------------------------------- 1 | ## `()->{}` 2 | ## 3 | ## deserializes the specified json code. In combination with json there are a few things 4 | ## that need mention: 5 | ## * semicolons. If you use semicolons in json then they will be deserialized as 6 | ## ASCII 31 (Unit Separator) which allows cmake to know the difference to the semicolons in a list 7 | ## if you want semicolons to appear in cmake then use a json array. You can always use `string_decode_semicolon()` 8 | ## to obtain the string as it was in json 9 | ## eg. `[1,2,3] => 1;2;3` `"1;2;3" => 1${semicolon_code}2${semicolon_code}3` 10 | ## 11 | function(json_deserialize json) 12 | json4("${json}") 13 | return_ans() 14 | endfunction() -------------------------------------------------------------------------------- /cmake/config/formats/json/json_escape.cmake: -------------------------------------------------------------------------------- 1 | # function to escape json 2 | function(json_escape value) 3 | string(REGEX REPLACE "\\\\" "\\\\\\\\" value "${value}") 4 | string(REGEX REPLACE "\\\"" "\\\\\"" value "${value}") 5 | string(REGEX REPLACE "\n" "\\\\n" value "${value}") 6 | string(REGEX REPLACE "\r" "\\\\r" value "${value}") 7 | string(REGEX REPLACE "\t" "\\\\t" value "${value}") 8 | string(REGEX REPLACE "\\$" "\\\\$" value "${value}") 9 | string(REGEX REPLACE ";" "\\\\\\\\;" value "${value}") 10 | return_ref(value) 11 | endfunction() -------------------------------------------------------------------------------- /cmake/config/formats/json/json_extract_string_value.cmake: -------------------------------------------------------------------------------- 1 | 2 | ## quickly extracts string properties values from a json string 3 | ## useful for large json files with unique property keys 4 | function(json_extract_string_value key data) 5 | regex_escaped_string("\"" "\"") 6 | ans(regex) 7 | 8 | set(key_value_regex "\"${key}\" *: ${regex}") 9 | string(REGEX MATCHALL "${key_value_regex}" matches "${data}") 10 | set(values) 11 | foreach(match ${matches}) 12 | string(REGEX REPLACE "${key_value_regex}" "\\1" match "${match}") 13 | list(APPEND values "${match}") 14 | endforeach() 15 | return_ref(values) 16 | endfunction() -------------------------------------------------------------------------------- /cmake/config/formats/json/json_print.cmake: -------------------------------------------------------------------------------- 1 | function(json_print) 2 | json_indented(${ARGN}) 3 | ans(res) 4 | _message("${res}") 5 | endfunction() -------------------------------------------------------------------------------- /cmake/config/formats/json/json_read.cmake: -------------------------------------------------------------------------------- 1 | # reads a json file from the specified location 2 | # the location may be relative (see explanantion of path() function) 3 | # returns a map or nothing if reading fails 4 | function(json_read file) 5 | path("${file}") 6 | ans(file) 7 | if(NOT EXISTS "${file}") 8 | return() 9 | endif() 10 | checksum_file("${file}") 11 | ans(cache_key) 12 | file_cache_return_hit("${cache_key}") 13 | 14 | file(READ "${file}" data) 15 | json_deserialize("${data}") 16 | ans(data) 17 | 18 | file_cache_update("${cache_key}" "${data}") 19 | 20 | return_ref(data) 21 | endfunction() -------------------------------------------------------------------------------- /cmake/config/formats/json/json_string_to_cmake.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(json_string_to_cmake str) 3 | # remove trailing and leading quotation marks 4 | if("${str}" MATCHES "\"(.*)\"") 5 | set(str "${CMAKE_MATCH_1}") 6 | ## escape semicolon 7 | string(REPLACE "\\\\;" ";" str "${CMAKE_MATCH_1}") 8 | endif() 9 | 10 | string(ASCII 8 char) 11 | string(REPLACE "\\b" "${char}" str "${str}") 12 | string(ASCII 12 char) 13 | string(REPLACE "\\f" "${char}" str "${str}") 14 | 15 | 16 | string(REPLACE "\\n" "\n" str "${str}") 17 | string(REPLACE "\\t" "\t" str "${str}") 18 | string(REPLACE "\\t" "\t" str "${str}") 19 | string(REPLACE "\\r" "\r" str "${str}") 20 | string(REPLACE "\\\"" "\"" str "${str}") 21 | 22 | string(REPLACE "\\\\" "\\" str "${str}") 23 | 24 | return_ref(str) 25 | 26 | endfunction() 27 | # converts the json-string & to a cmake string 28 | function(json_string_ref_to_cmake __json_string_ref_to_cmake_ref) 29 | json_string_to_cmake("${${__json_string_ref_to_cmake_ref}}") 30 | return_ans() 31 | 32 | endfunction() -------------------------------------------------------------------------------- /cmake/config/formats/json/json_tokenize.cmake: -------------------------------------------------------------------------------- 1 | function(json_tokenize result json) 2 | 3 | set(regex "(\\{|\\}|:|,|\\[|\\]|\"(\\\\.|[^\"])*\")") 4 | string(REGEX MATCHALL "${regex}" matches "${json}") 5 | 6 | 7 | # replace brackets with angular brackets because 8 | # normal brackes are not handled properly by cmake 9 | string(REPLACE ";[;" ";<;" matches "${matches}") 10 | string(REPLACE ";];" ";>;" matches "${matches}") 11 | string(REPLACE "[" "†" matches "${matches}") 12 | string(REPLACE "]" "‡" matches "${matches}") 13 | 14 | set(tokens) 15 | foreach(match ${matches}) 16 | string_char_at("${match}" 0) 17 | ans(char) 18 | if("${char}" STREQUAL "[") 19 | string_char_at("${match}" -2) 20 | ans(char) 21 | if(NOT "${char}" STREQUAL "]") 22 | message(FATAL_ERROR "json syntax error: no closing ']' instead: '${char}' ") 23 | endif() 24 | string(LENGTH "${match}" len) 25 | math(EXPR len "${len} - 2") 26 | string(SUBSTRING ${match} 1 ${len} array_values) 27 | set(tokens ${tokens} "<") 28 | foreach(submatch ${array_values}) 29 | set(tokens ${tokens} ${submatch} ) 30 | endforeach() 31 | set(tokens ${tokens} ">") 32 | else() 33 | set(tokens ${tokens} ${match}) 34 | endif() 35 | endforeach() 36 | 37 | set(${result} ${tokens} PARENT_SCOPE) 38 | endfunction() -------------------------------------------------------------------------------- /cmake/config/formats/json/json_write.cmake: -------------------------------------------------------------------------------- 1 | # write the specified object reference to the specified file 2 | ## todo rename to fwrite_json(path data) 3 | function(json_write file obj) 4 | path("${file}") 5 | ans(file) 6 | json_indented(${obj}) 7 | ans(data) 8 | file(WRITE "${file}" "${data}") 9 | return() 10 | endfunction() -------------------------------------------------------------------------------- /cmake/config/function/function_import_table.cmake: -------------------------------------------------------------------------------- 1 | # imports the specified map as a function table which is callable via 2 | # whis is a performance enhancement 3 | function(function_import_table map function_name) 4 | map_keys(${map} ) 5 | ans(keys) 6 | set("ifs" "if(false)\n") 7 | foreach(key ${keys}) 8 | map_get(${map} ${key}) 9 | ans(command_name) 10 | set(ifs "${ifs}elseif(\"${key}\" STREQUAL \"\${switch}\" )\n${command_name}(\"\${ARGN}\")\nreturn_ans()\n") 11 | endforeach() 12 | set(ifs "${ifs}endif()\n") 13 | set("evl" "function(${function_name} switch)\n${ifs}\nreturn()\nendfunction()") 14 | # message(${evl}) 15 | set_ans("") 16 | 17 | eval("${evl}") 18 | endfunction() 19 | 20 | -------------------------------------------------------------------------------- /cmake/config/map/README.md.in: -------------------------------------------------------------------------------- 1 | ## Maps - Structured Data in CMake 2 | 3 | <% 4 | assign(function_files = glob("**.cmake" --relative --recurse)) 5 | %> 6 | 7 | Maps are very versatile and are missing dearly from CMake in my opinion. Maps are references as is standard in many languages. They are signified by having properties which are adressed by keys and can take any value. 8 | 9 | Due to the "variable variable" system (ie names of variables are string which can be generated from other variables) it is very easy to implement the map system. Under the hood a value is mapped by calling `address_set(${map}.${key})`. 10 | 11 | 12 | 13 | ### Function List 14 | 15 | <%= markdown_template_function_list(${function_files}) %> 16 | 17 | ### Function Descriptions 18 | 19 | <%= markdown_template_function_descriptions(${function_files}) %> 20 | 21 | 22 | -------------------------------------------------------------------------------- /cmake/config/map/core/is_map.cmake: -------------------------------------------------------------------------------- 1 | ## `(...)->` 2 | ## 3 | ## returns true iff the specified value is a map 4 | ## note to self: cannot make this a macro because string will be evaluated 5 | function(is_map) 6 | get_property(is_map GLOBAL PROPERTY "${ARGN}.__keys__" SET) 7 | set(__ans "${is_map}" PARENT_SCOPE) 8 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/core/map_append.cmake: -------------------------------------------------------------------------------- 1 | # appends a value to the end of a map entry 2 | function(map_append map key) 3 | get_property(isset GLOBAL PROPERTY "${map}.${key}" SET) 4 | if(NOT isset) 5 | map_set(${map} ${key} ${ARGN}) 6 | return() 7 | endif() 8 | set_property(GLOBAL APPEND PROPERTY "${map}.${key}" ${ARGN}) 9 | endfunction() 10 | -------------------------------------------------------------------------------- /cmake/config/map/core/map_append_string.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_append_string map key str) 3 | get_property(isset GLOBAL PROPERTY "${map}.${key}" SET) 4 | if(NOT isset) 5 | map_set(${map} ${key} "${str}") 6 | return() 7 | endif() 8 | get_property(property_val GLOBAL PROPERTY "${map}.${key}" ) 9 | set_property(GLOBAL PROPERTY "${map}.${key}" "${property_val}${str}") 10 | endfunction() 11 | 12 | 13 | 14 | function(map_append_string map key str) 15 | get_property(isset GLOBAL PROPERTY "${map}.${key}" SET) 16 | if(NOT isset) 17 | map_set(${map} ${key} "${str}") 18 | else() 19 | set_property(GLOBAL APPEND_STRING PROPERTY "${map}.${key}" "${str}") 20 | endif() 21 | set(__ans PARENT_SCOPE) 22 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/core/map_append_unique.cmake: -------------------------------------------------------------------------------- 1 | 2 | ## map_append_unique 3 | ## 4 | ## appends values to the . and ensures 5 | ## that . stays unique 6 | function(map_append_unique map prop) 7 | map_tryget("${map}" "${prop}") 8 | ans(vals) 9 | list(APPEND vals ${ARGN}) 10 | list_remove_duplicates(vals) 11 | map_set("${map}" "${prop}" ${vals}) 12 | endfunction() 13 | -------------------------------------------------------------------------------- /cmake/config/map/core/map_delete.cmake: -------------------------------------------------------------------------------- 1 | function(map_delete this) 2 | map_keys("${this}") 3 | ans(keys) 4 | foreach(key ${keys}) 5 | map_remove("${this}" ${key}) 6 | endforeach() 7 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/core/map_duplicate.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_duplicate source) 3 | map_new() 4 | ans(duplicate) 5 | map_keys("${source}") 6 | ans(keys) 7 | foreach(key ${keys}) 8 | map_tryget("${source}" "${key}") 9 | ans(val) 10 | map_set_hidden("${duplicate}" "${key}" ${val}) 11 | endforeach() 12 | map_keys_set("${duplicate}" ${keys}) 13 | return_ref(duplicate) 14 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/core/map_get.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_get this key) 3 | set(property_ref "${this}.${key}") 4 | get_property(property_exists GLOBAL PROPERTY "${property_ref}" SET) 5 | if(NOT property_exists) 6 | message(FATAL_ERROR "map '${this}' does not have key '${key}'") 7 | endif() 8 | 9 | get_property(property_val GLOBAL PROPERTY "${property_ref}") 10 | return_ref(property_val) 11 | endfunction() 12 | # faster way of accessing map. however fails if key contains escape sequences, escaped vars or @..@ substitutions 13 | # if thats the case comment out this macro 14 | macro(map_get __map_get_map __map_get_key) 15 | set(__map_get_property_ref "${__map_get_map}.${__map_get_key}") 16 | get_property(__ans GLOBAL PROPERTY "${__map_get_property_ref}") 17 | if(NOT __ans) 18 | get_property(__map_get_property_exists GLOBAL PROPERTY "${__map_get_property_ref}" SET) 19 | if(NOT __map_get_property_exists) 20 | json_print("${__map_get_map}") 21 | message(FATAL_ERROR "map '${__map_get_map}' does not have key '${__map_get_key}'") 22 | endif() 23 | endif() 24 | endmacro() 25 | 26 | -------------------------------------------------------------------------------- /cmake/config/map/core/map_get_special.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_get_special map key) 3 | map_tryget("${map}" "__${key}__") 4 | return_ans() 5 | endfunction() 6 | 7 | ## faster 8 | macro(map_get_special map key) 9 | get_property(__ans GLOBAL PROPERTY "${map}.__${key}__") 10 | endmacro() 11 | 12 | ## correcter 13 | function(map_get_special map key) 14 | get_property(__ans GLOBAL PROPERTY "${map}.__${key}__") 15 | set(__ans "${__ans}" PARENT_SCOPE) 16 | endfunction() 17 | -------------------------------------------------------------------------------- /cmake/config/map/core/map_has.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | function(map_has this key ) 5 | get_property(res GLOBAL PROPERTY "${this}.${key}" SET) 6 | return(${res}) 7 | endfunction() 8 | 9 | # faster way of accessing map. however fails if key contains escape sequences, escaped vars or @..@ substitutions 10 | # if thats the case comment out this macro 11 | macro(map_has this key ) 12 | get_property(__ans GLOBAL PROPERTY "${this}.${key}" SET) 13 | endmacro() 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /cmake/config/map/core/map_keys.cmake: -------------------------------------------------------------------------------- 1 | # returns all keys for the specified map 2 | macro(map_keys this) 3 | get_property(__ans GLOBAL PROPERTY "${this}.__keys__") 4 | #return_ref(keys) 5 | endmacro() 6 | # returns all keys for the specified map 7 | #function(map_keys this) 8 | # get_property(keys GLOBAL PROPERTY "${this}") 9 | # return_ref(keys) 10 | #endfunction() 11 | -------------------------------------------------------------------------------- /cmake/config/map/core/map_new.cmake: -------------------------------------------------------------------------------- 1 | 2 | ## optimized version 3 | macro(map_new) 4 | address_new() 5 | set_property(GLOBAL PROPERTY "${__ans}.__keys__" "") ## set keys (duck typing for map is that it has property keys) 6 | endmacro() -------------------------------------------------------------------------------- /cmake/config/map/core/map_remove.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_remove map key) 3 | map_has("${map}" "${key}") 4 | ans(has_key) 5 | ## set value to "" without updating key 6 | map_set_hidden("${map}" "${key}") 7 | if(NOT has_key) 8 | return(false) 9 | endif() 10 | get_property(keys GLOBAL PROPERTY "${map}.__keys__") 11 | list(LENGTH keys len) 12 | if(NOT len) 13 | returN(false) 14 | endif() 15 | list(REMOVE_ITEM keys "${key}") 16 | set_property(GLOBAL PROPERTY "${map}.__keys__" "${keys}") 17 | return(true) 18 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/core/map_remove_item.cmake: -------------------------------------------------------------------------------- 1 | 2 | ## map_remove_item 3 | ## 4 | ## removes the specified items from . 5 | ## returns the number of items removed 6 | function(map_remove_item map prop) 7 | map_tryget("${map}" "${prop}") 8 | ans(vals) 9 | list_remove(vals ${ARGN}) 10 | ans(res) 11 | if(res) 12 | map_set_hidden("${map}" "${prop}" "${vals}") 13 | endif() 14 | return_ref(res) 15 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/core/map_set.cmake: -------------------------------------------------------------------------------- 1 | # set a value in the map 2 | function(map_set this key ) 3 | set(property_ref "${this}.${key}") 4 | get_property(has_key GLOBAL PROPERTY "${property_ref}" SET) 5 | if(NOT has_key) 6 | set_property(GLOBAL APPEND PROPERTY "${this}.__keys__" "${key}") 7 | endif() 8 | # set the properties value 9 | set_property(GLOBAL PROPERTY "${property_ref}" "${ARGN}") 10 | endfunction() 11 | -------------------------------------------------------------------------------- /cmake/config/map/core/map_set_hidden.cmake: -------------------------------------------------------------------------------- 1 | function(map_set_hidden map property) 2 | set_property(GLOBAL PROPERTY "${map}.${property}" ${ARGN}) 3 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/core/map_set_special.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_set_special map key) 3 | set_property(GLOBAL PROPERTY "${map}.__${key}__" "${ARGN}") 4 | #map_set_hidden("${map}" "__${key}__" "${ARGN}") 5 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/core/map_tryget.cmake: -------------------------------------------------------------------------------- 1 | # tries to get the value map[key] and returns NOTFOUND if 2 | # it is not found 3 | 4 | function(map_tryget map key) 5 | get_property(res GLOBAL PROPERTY "${map}.${key}") 6 | return_ref(res) 7 | endfunction() 8 | 9 | # faster way of accessing map. however fails if key contains escape sequences, escaped vars or @..@ substitutions 10 | # if thats the case comment out this macro 11 | macro(map_tryget map key) 12 | get_property(__ans GLOBAL PROPERTY "${map}.${key}") 13 | endmacro() -------------------------------------------------------------------------------- /cmake/config/map/dfs.cmake: -------------------------------------------------------------------------------- 1 | # iterates a the graph with root nodes in ${ARGN} 2 | # in depth first order 3 | # expand must consider cycles 4 | function(dfs expand) 5 | stack_new() 6 | ans(stack) 7 | curry3(() => stack_push("${stack}" /0)) 8 | ans(push) 9 | curry3(() => stack_pop("${stack}" )) 10 | ans(pop) 11 | graphsearch(EXPAND "${expand}" PUSH "${push}" POP "${pop}" ${ARGN}) 12 | endfunction() 13 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/list_match.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | # matches the object list 4 | function(list_match __list_match_lst ) 5 | map_matches("${ARGN}") 6 | ans(predicate) 7 | list_where("${__list_match_lst}" "${predicate}") 8 | return_ans() 9 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_all_paths.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # returns all possible paths for the map 5 | # (currently crashing on cycles cycles) 6 | # todo: implement 7 | function(map_all_paths) 8 | message(FATAL_ERROR "map_all_paths is not implemented yet") 9 | 10 | function(_map_all_paths event) 11 | if("${event}" STREQUAL "map_element_begin") 12 | address_get(${current_path}) 13 | ans(current_path) 14 | set(cu) 15 | endif() 16 | if("${event}" STREQUAL "value") 17 | address_new(${}) 18 | endif() 19 | endfunction() 20 | 21 | address_new() 22 | ans(current_path) 23 | address_new() 24 | ans(path_list) 25 | 26 | dfs_callback(_map_all_paths ${ARGN}) 27 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_at.cmake: -------------------------------------------------------------------------------- 1 | 2 | ## returns the value at idx 3 | function(map_at map idx) 4 | map_key_at(${map} "${idx}") 5 | ans(key) 6 | map_tryget(${map} "${key}") 7 | return_ans() 8 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_capture.cmake: -------------------------------------------------------------------------------- 1 | ## captures the listed variables in the map 2 | function(map_capture map ) 3 | set(__map_capture_args ${ARGN}) 4 | list_extract_flag(__map_capture_args --reassign) 5 | ans(__reassign) 6 | list_extract_flag(__map_capture_args --notnull) 7 | ans(__not_null) 8 | foreach(__map_capture_arg ${__map_capture_args}) 9 | 10 | if(__reassign AND "${__map_capture_arg}" MATCHES "(.+)[:=](.+)") 11 | set(__map_capture_arg_key ${CMAKE_MATCH_1}) 12 | set(__map_capture_arg ${CMAKE_MATCH_2}) 13 | else() 14 | set(__map_capture_arg_key "${__map_capture_arg}") 15 | endif() 16 | # print_vars(__map_capture_arg __map_capture_arg_key) 17 | if(NOT __not_null OR NOT "${${__map_capture_arg}}_" STREQUAL "_") 18 | map_set(${map} "${__map_capture_arg_key}" "${${__map_capture_arg}}") 19 | endif() 20 | endforeach() 21 | endfunction() 22 | 23 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_capture_new.cmake: -------------------------------------------------------------------------------- 1 | ## captures a new map from the given variables 2 | ## example 3 | ## set(a 1) 4 | ## set(b 2) 5 | ## set(c 3) 6 | ## map_capture_new(a b c) 7 | ## ans(res) 8 | ## json_print(${res}) 9 | ## --> 10 | ## { 11 | ## "a":1, 12 | ## "b":2, 13 | ## "c":3 14 | ## } 15 | function(map_capture_new) 16 | map_new() 17 | ans(__map_capture_new_map) 18 | map_capture(${__map_capture_new_map} ${ARGN}) 19 | return(${__map_capture_new_map}) 20 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_clear.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | # removes all properties from map 4 | function(map_clear map) 5 | map_keys("${map}") 6 | ans(keys) 7 | foreach(key ${keys}) 8 | map_remove("${map}" "${key}") 9 | endforeach() 10 | return() 11 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_copy_shallow.cmake: -------------------------------------------------------------------------------- 1 | # copies the values of the source map into the target map by assignment 2 | # (shallow copy) 3 | function(map_copy_shallow target source) 4 | map_keys("${source}") 5 | ans(keys) 6 | 7 | foreach(key ${keys}) 8 | map_tryget("${source}" "${key}") 9 | ans(val) 10 | map_set("${target}" "${key}" "${val}") 11 | endforeach() 12 | return() 13 | endfunction() 14 | 15 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_count.cmake: -------------------------------------------------------------------------------- 1 | ## `()->` 2 | ## 3 | ## returns the number of elements for the specified map 4 | macro(map_count map) 5 | map_keys("${map}") 6 | list(LENGTH __ans __ans) 7 | endmacro() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_defaults.cmake: -------------------------------------------------------------------------------- 1 | 2 | # sets all undefined properties of map to the default value 3 | function(map_defaults map defaults) 4 | obj("${defaults}") 5 | ans(defaults) 6 | if(NOT defaults) 7 | message(FATAL_ERROR "No defaults specified") 8 | endif() 9 | 10 | if(NOT map) 11 | map_new() 12 | ans(map) 13 | endif() 14 | 15 | map_keys("${map}") 16 | ans(keys) 17 | 18 | map_keys("${defaults}") 19 | ans(default_keys) 20 | 21 | 22 | if(default_keys AND keys) 23 | list(REMOVE_ITEM default_keys ${keys}) 24 | endif() 25 | foreach(key ${default_keys}) 26 | map_tryget("${defaults}" "${key}") 27 | ans(val) 28 | map_set("${map}" "${key}" "${val}") 29 | endforeach() 30 | return_ref(map) 31 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_ensure.cmake: -------------------------------------------------------------------------------- 1 | # ensures that the specified vars are a map 2 | # parsing structured data if necessary 3 | macro(map_ensure) 4 | foreach(__map_ensure_arg ${ARGN}) 5 | obj("${${__map_ensure_arg}}") 6 | ans("${__map_ensure_arg}") 7 | endforeach() 8 | endmacro() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_extract.cmake: -------------------------------------------------------------------------------- 1 | function(map_extract navigation_expressions) 2 | cmake_parse_arguments("" "REQUIRE" "" "" ${ARGN}) 3 | set(args ${_UNPARSED_ARGUMENTS}) 4 | foreach(navigation_expression ${navigation_expressions}) 5 | map_navigate(res "${navigation_expression}") 6 | list_pop_front( args) 7 | ans(current) 8 | if(_REQUIRE AND NOT res) 9 | message(FATAL_ERROR "map_extract failed: requires ${navigation_expression}") 10 | endif() 11 | 12 | if(current) 13 | set(${current} ${res} PARENT_SCOPE) 14 | else() 15 | if(NOT _REQUIRE) 16 | break() 17 | endif() 18 | endif() 19 | endforeach() 20 | foreach(arg ${args}) 21 | set(${arg} PARENT_SCOPE) 22 | endforeach() 23 | 24 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_fill.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## files non existing or null values of lhs with values of rhs 4 | function(map_fill lhs rhs) 5 | map_ensure(lhs rhs) 6 | map_iterator(${rhs}) 7 | ans(it) 8 | while(true) 9 | map_iterator_break(it) 10 | 11 | map_tryget(${lhs} "${it.key}") 12 | ans(lvalue) 13 | 14 | if("${lvalue}_" STREQUAL "_") 15 | map_set(${lhs} "${it.key}" "${it.value}") 16 | endif() 17 | endwhile() 18 | return_ref(lhs) 19 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_flatten.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_flatten) 3 | set(result) 4 | foreach(map ${ARGN}) 5 | map_values(${map}) 6 | ans_append(result) 7 | endforeach() 8 | return_ref(result) 9 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_from_keyvaluelist.cmake: -------------------------------------------------------------------------------- 1 | # adds the keyvalues list to the map (if not map specified created one) 2 | function(map_from_keyvaluelist map) 3 | if(NOT map) 4 | map_new() 5 | ans(map) 6 | endif() 7 | set(args ${ARGN}) 8 | while(true) 9 | list_pop_front(args) 10 | ans(key) 11 | list_pop_front(args) 12 | ans(val) 13 | if(NOT key) 14 | break() 15 | endif() 16 | map_set("${map}" "${key}" "${val}") 17 | endwhile() 18 | return_ref(map) 19 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_get_default.cmake: -------------------------------------------------------------------------------- 1 | ## `( )->` 2 | ## 3 | ## returns the value stored in map.key or 4 | ## sets the value at map.key to ARGN and returns 5 | ## the value 6 | function(map_get_default map key) 7 | map_has("${map}" "${key}") 8 | ans(has_key) 9 | if(NOT has_key) 10 | map_set("${map}" "${key}" "${ARGN}") 11 | endif() 12 | map_tryget("${map}" "${key}") 13 | return_ans() 14 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_get_map.cmake: -------------------------------------------------------------------------------- 1 | ## `( )->` 2 | ## 3 | ## returns a map for the specified key 4 | ## creating it if it does not exist 5 | ## 6 | function(map_get_map map key) 7 | map_tryget(${map} ${key}) 8 | ans(res) 9 | is_address("${res}") 10 | ans(ismap) 11 | if(NOT ismap) 12 | map_new() 13 | ans(res) 14 | map_set(${map} ${key} ${res}) 15 | endif() 16 | return_ref(res) 17 | endfunction() 18 | 19 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_has_all.cmake: -------------------------------------------------------------------------------- 1 | 2 | # returns true if map has all keys specified 3 | #as varargs 4 | function(map_has_all map) 5 | 6 | foreach(key ${ARGN}) 7 | map_has("${map}" "${key}") 8 | ans(has_key) 9 | if(NOT has_key) 10 | return(false) 11 | endif() 12 | endforeach() 13 | return(true) 14 | 15 | endfunction() 16 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_has_any.cmake: -------------------------------------------------------------------------------- 1 | 2 | # returns true if map has any of the keys 3 | # specified as varargs 4 | function(map_has_any map) 5 | foreach(key ${ARGN}) 6 | map_has("${map}" "${key}") 7 | ans(has_key) 8 | if(has_key) 9 | return(true) 10 | endif() 11 | endforeach() 12 | return(false) 13 | 14 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_invert.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | # returns a copy of map with key values inverted 4 | # only works correctly for bijective maps 5 | function(map_invert map) 6 | map_keys("${map}") 7 | ans(keys) 8 | map_new() 9 | ans(inverted_map) 10 | foreach(key ${keys}) 11 | map_tryget("${map}" "${key}") 12 | ans(val) 13 | map_set("${inverted_map}" "${val}" "${key}") 14 | endforeach() 15 | return_ref(inverted_map) 16 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_isempty.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_isempty map) 3 | map_keys(${map}) 4 | ans(keys) 5 | list(LENGTH keys len) 6 | if(len) 7 | return(false) 8 | else() 9 | return(true) 10 | endif() 11 | endfunction() 12 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_key_at.cmake: -------------------------------------------------------------------------------- 1 | ## returns the key at the specified position 2 | function(map_key_at map idx) 3 | map_keys(${map}) 4 | ans(keys) 5 | list_normalize_index(keys ${idx}) 6 | ans(idx) 7 | list_get(keys ${idx}) 8 | ans(key) 9 | return_ref(key) 10 | endfunction() 11 | 12 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_keys_append.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_keys_append map) 3 | set_property(GLOBAL APPEND PROPERTY "${map}" ${ARGN}) 4 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_keys_clear.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_keys_clear map) 3 | set_property(GLOBAL PROPERTY "${map}.__keys__") 4 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_keys_remove.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_keys_remove map) 3 | get_property(keys GLOBAL PROPERTY "${map}.__keys__" ) 4 | if(keys AND ARGN) 5 | list(REMOVE_ITEM keys ${ARGN}) 6 | set_property(GLOBAL PROPERTY "${map}.__keys__" ${keys}) 7 | endif() 8 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_keys_set.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_keys_set map) 3 | set_property(GLOBAL PROPERTY "${map}.__keys__" ${ARGN}) 4 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_keys_sort.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_keys_sort map) 3 | get_property(keys GLOBAL PROPERTY "${map}.__keys__") 4 | if(keys) 5 | list(SORT keys) 6 | set_property(GLOBAL PROPERTY "${map}.__keys__" ${keys}) 7 | endif() 8 | endfunction() 9 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_match_properties.cmake: -------------------------------------------------------------------------------- 1 | # returns true if map's properties match all properties of attrs 2 | function(map_match_properties map attrs) 3 | map_keys("${attrs}") 4 | ans(attr_keys) 5 | foreach(key ${attr_keys}) 6 | 7 | map_tryget("${map}" "${key}") 8 | ans(val) 9 | map_tryget("${attrs}" "${key}") 10 | ans(pred) 11 | # message("matching ${map}'s ${key} '${val}' with ${pred}") 12 | if(NOT "${val}" MATCHES "${pred}") 13 | return(false) 14 | endif() 15 | endforeach() 16 | return(true) 17 | endfunction() 18 | 19 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_matches.cmake: -------------------------------------------------------------------------------- 1 | 2 | # returns a function which returns true of all 3 | function(map_matches attrs) 4 | obj("${attrs}") 5 | ans(attrs) 6 | # curry(map_match_properties(/1 ${attrs})) 7 | curry3(map_match_properties(/0 ${attrs})) 8 | return_ans() 9 | endfunction() 10 | 11 | 12 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_omit.cmake: -------------------------------------------------------------------------------- 1 | # returns a copy of map without the specified keys (argn) 2 | function(map_omit map) 3 | map_keys("${map}") 4 | ans(keys) 5 | if(ARGN) 6 | list(REMOVE_ITEM keys ${ARGN}) 7 | endif() 8 | map_pick("${map}" ${keys}) 9 | return_ans() 10 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_omit_regex.cmake: -------------------------------------------------------------------------------- 1 | # returns a map with all properties except those matched by any of the specified regexes 2 | function(map_omit_regex map) 3 | set(regexes ${ARGN}) 4 | map_keys("${map}") 5 | ans(keys) 6 | 7 | foreach(regex ${regexes}) 8 | foreach(key ${keys}) 9 | if("${key}" MATCHES "${regex}") 10 | list_remove(keys "${key}") 11 | endif() 12 | endforeach() 13 | endforeach() 14 | 15 | 16 | map_pick("${map}" ${keys}) 17 | 18 | return_ans() 19 | 20 | 21 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_overwrite.cmake: -------------------------------------------------------------------------------- 1 | 2 | ## overwrites all values of lhs with rhs 3 | function(map_overwrite lhs rhs) 4 | obj("${lhs}") 5 | ans(lhs) 6 | obj("${rhs}") 7 | ans(rhs) 8 | 9 | map_iterator("${rhs}") 10 | ans(it) 11 | while(true) 12 | map_iterator_break(it) 13 | map_set("${lhs}" "${it.key}" "${it.value}") 14 | endwhile() 15 | return(${lhs}) 16 | endfunction() 17 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_pairs.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | # returns a list key;value;key;value;... 4 | # only works if key and value are not lists (ie do not contain ;) 5 | function(map_pairs map) 6 | map_keys("${map}") 7 | ans(keys) 8 | set(pairs) 9 | foreach(key ${keys}) 10 | map_tryget("${map}" "${key}") 11 | ans(val) 12 | list(APPEND pairs "${key}") 13 | list(APPEND pairs "${val}") 14 | endforeach() 15 | return_ref(pairs) 16 | endfunction() 17 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_partial.cmake: -------------------------------------------------------------------------------- 1 | function(test) 2 | new() 3 | ans(obj) 4 | obj_set(${obj} "test1" "val1") 5 | obj_set(${obj} "test2" "val2") 6 | obj_set(${obj} "test3" "val3") 7 | 8 | 9 | obj_pick("${obj}" test1 test3) 10 | ans(res) 11 | assert(DEREF {res.test1} STREQUAL "val1") 12 | assert(DEREF {res.test3} STREQUAL "val3") 13 | 14 | obj_pick("${obj}" test4) 15 | ans(res) 16 | assert(res) 17 | assert(DEREF "_{res.test4}" STREQUAL "_") 18 | 19 | 20 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_path_get.cmake: -------------------------------------------------------------------------------- 1 | # returns the value at the specified path (path is specified as path fragment list) 2 | # e.g. map = {a:{b:{c:{d:{e:3}}}}} 3 | # map_path_get(${map} a b c d e) 4 | # returns 3 5 | # this function is somewhat faster than map_navigate() 6 | function(map_path_get map) 7 | set(args ${ARGN}) 8 | set(current "${map}") 9 | foreach(arg ${args}) 10 | if(NOT current) 11 | return() 12 | endif() 13 | map_tryget("${current}" "${arg}") 14 | ans(current) 15 | endforeach() 16 | return_ref(current) 17 | endfunction() 18 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_path_set.cmake: -------------------------------------------------------------------------------- 1 | # todo implement 2 | 3 | function(map_path_set map path value) 4 | message(FATAL_ERROR "not implemented") 5 | if(NOT map) 6 | map_new() 7 | ans(map) 8 | endif() 9 | 10 | set(current "${map}") 11 | 12 | foreach(arg ${path}) 13 | map_tryget("${current}" "${arg}") 14 | ans(current) 15 | 16 | endforeach() 17 | 18 | endfunction() 19 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_peek_back.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_peek_back map prop) 3 | map_tryget("${map}" "${prop}") 4 | ans(lst) 5 | list_peek_back(lst) 6 | return_ans() 7 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_peek_front.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_peek_front map prop) 3 | map_tryget("${map}" "${prop}") 4 | ans(lst) 5 | list_peek_front(lst) 6 | return_ans() 7 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_pick.cmake: -------------------------------------------------------------------------------- 1 | 2 | # returns a copy of map returning only the whitelisted keys 3 | function(map_pick map) 4 | map_new() 5 | ans(res) 6 | foreach(key ${ARGN}) 7 | obj_get(${map} "${key}") 8 | ans(val) 9 | 10 | map_set("${res}" "${key}" "${val}") 11 | endforeach() 12 | return("${res}") 13 | endfunction() 14 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_pick_regex.cmake: -------------------------------------------------------------------------------- 1 | 2 | # returns a map containing all properties whose keys were matched by any of the specified regexes 3 | function(map_pick_regex map) 4 | set(regexes ${ARGN}) 5 | map_keys("${map}") 6 | ans(keys) 7 | set(pick_keys) 8 | foreach(regex ${regexex}) 9 | foreach(key ${keys}) 10 | if("${key}" MATCHES "${regex}") 11 | list(APPEND pick_keys "${key}") 12 | endforeach() 13 | endforeach() 14 | endforeach() 15 | list(REMOVE_DUPLICATES pick_keys) 16 | map_pick("${map}" ${pick_keys}) 17 | return_ans() 18 | endfunction() 19 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_pop_back.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | function(map_pop_back map prop) 4 | map_tryget("${map}" "${prop}") 5 | ans(lst) 6 | list_pop_back(lst) 7 | ans(res) 8 | map_set("${map}" "${prop}" ${lst}) 9 | return_ref(res) 10 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_pop_front.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | function(map_pop_front map prop) 4 | map_tryget("${map}" "${prop}") 5 | ans(lst) 6 | list_pop_front(lst) 7 | ans(res) 8 | map_set("${map}" "${prop}" ${lst}) 9 | return_ref(res) 10 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_promote.cmake: -------------------------------------------------------------------------------- 1 | 2 | macro(map_promote __map_promote_map) 3 | # garbled names help free from variable collisions 4 | map_keys(${__map_promote_map} ) 5 | ans(__map_promote_keys) 6 | foreach(__map_promote_key ${__map_promote_keys}) 7 | map_get(${__map_promote_map} ${__map_promote_key}) 8 | ans(__map_promote_value) 9 | set("${__map_promote_key}" "${__map_promote_value}" PARENT_SCOPE) 10 | endforeach() 11 | endmacro() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_property_length.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ## returns the length of the specified property 5 | function(map_property_length map prop) 6 | map_tryget("${map}" "${prop}") 7 | ans(val) 8 | list(LENGTH val len) 9 | return_ref(len) 10 | endfunction() 11 | 12 | 13 | macro(map_property_length map prop) 14 | get_property(__map_property_length_value GLOBAL PROPERTY "${map}.${prop}") 15 | list(LENGTH __map_property_length_value __ans) 16 | endmacro() 17 | 18 | 19 | macro(map_property_string_length map prop) 20 | get_property(__map_property_length_value GLOBAL PROPERTY "${map}.${prop}") 21 | string(LENGTH "${__map_property_length_value}" __ans) 22 | endmacro() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_push_back.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | function(map_push_back map prop) 4 | map_tryget("${map}" "${prop}") 5 | ans(lst) 6 | list_push_back(lst ${ARGN}) 7 | map_set("${map}" "${prop}" ${lst}) 8 | return_ref(lst) 9 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_push_front.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_push_front map prop) 3 | map_tryget("${map}" "${prop}") 4 | ans(lst) 5 | list_push_front(lst ${ARGN}) 6 | ans(res) 7 | map_set("${map}" "${prop}" ${lst}) 8 | return_ref(res) 9 | endfunction() 10 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_rename.cmake: -------------------------------------------------------------------------------- 1 | ## renames a key in the specified map 2 | function(map_rename map key_old key_new) 3 | map_get("${map}" "${key_old}") 4 | ans(value) 5 | map_remove("${map}" "${key_old}") 6 | map_set("${map}" "${key_new}" "${value}") 7 | endfunction() 8 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_set_default.cmake: -------------------------------------------------------------------------------- 1 | ## `()->` 2 | ## 3 | ## sets the value of the specified prop if it does not exist 4 | ## ie if map_has returns false for the specified property 5 | ## returns true iff value was set 6 | function(map_set_default map prop) 7 | map_has("${map}" "${prop}") 8 | if(__ans) 9 | return(false) 10 | endif() 11 | map_set("${map}" "${prop}" ${ARGN}) 12 | return(true) 13 | endfunction() 14 | -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_to_keyvaluelist.cmake: -------------------------------------------------------------------------------- 1 | # converts a map to a key value list 2 | function(map_to_keyvaluelist map) 3 | map_keys(${map}) 4 | ans(keys) 5 | set(kvl) 6 | foreach(key ${keys}) 7 | map_get("${map}" "${key}") 8 | ans(val) 9 | list(APPEND kvl "${key}" "${val}") 10 | endforeach() 11 | return_ref(kvl) 12 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_to_valuelist.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | function(map_to_valuelist map) 4 | set(keys ${ARGN}) 5 | list_extract_flag(keys --all) 6 | ans(all) 7 | if(all) 8 | map_keys(${map}) 9 | ans(keys) 10 | endif() 11 | set(result) 12 | 13 | foreach(key ${keys}) 14 | map_tryget(${map} "${key}") 15 | ans(value) 16 | list(APPEND result "${value}") 17 | endforeach() 18 | return_ref(result) 19 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_unpack.cmake: -------------------------------------------------------------------------------- 1 | 2 | ## unpacks the specified reference to a map 3 | ## let a map be stored in the var 'themap' 4 | ## let it have the key/values a/1 b/2 c/3 5 | ## map_unpack(themap) will create the variables 6 | ## ${themap.a} contains 1 7 | ## ${themap.b} contains 2 8 | ## ${themap.c} contains 3 9 | function(map_unpack __ref) 10 | map_iterator(${${__ref}}) 11 | ans(it) 12 | while(true) 13 | map_iterator_break(it) 14 | set("${__ref}.${it.key}" ${it.value} PARENT_SCOPE) 15 | endwhile() 16 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/helpers/map_values.cmake: -------------------------------------------------------------------------------- 1 | # returns all values of the map which are passed as ARNG 2 | function(map_values this) 3 | set(args ${ARGN}) 4 | if(NOT args) 5 | map_keys(${this}) 6 | ans(args) 7 | endif() 8 | set(res) 9 | foreach(arg ${args}) 10 | map_get(${this} ${arg}) 11 | ans(val) 12 | list(APPEND res ${val}) 13 | endforeach() 14 | return_ref(res) 15 | endfunction() 16 | 17 | 18 | # ## faster 19 | # macro(map_values map) 20 | # set(__ans ${ARGN}) 21 | # if(NOT __ans) 22 | # map_keys(${map}) 23 | # endif() 24 | # ## ____map_values_key does not conflict as it is the loop variable 25 | # foreach(____map_values_key ${__ans}) 26 | # map_tryget(${map} ${____map_values_key}) 27 | # list(APPEND __map_values_result ${__ans}) 28 | # endforeach() 29 | # set(__ans ${__map_values_result}) 30 | # endmacro() -------------------------------------------------------------------------------- /cmake/config/map/helpers/mm.cmake: -------------------------------------------------------------------------------- 1 | ## function which generates a map 2 | ## out of the passed args 3 | ## or just returns the arg if it is already valid 4 | function(mm) 5 | 6 | set(args ${ARGN}) 7 | # assignment 8 | list(LENGTH args len) 9 | if("${len}" GREATER 2) 10 | list(GET args 1 equal) 11 | list(GET args 0 target) 12 | if("${equal}" STREQUAL = AND "${target}" MATCHES "[a-zA-Z0-9_\\-]") 13 | list(REMOVE_AT args 0 ) 14 | list(REMOVE_AT args 0 ) 15 | mm(${args}) 16 | ans(res) 17 | set("${target}" "${res}" PARENT_SCOPE) 18 | return_ref(res) 19 | endif() 20 | endif() 21 | 22 | 23 | 24 | data(${ARGN}) 25 | return_ans() 26 | endfunction() 27 | 28 | -------------------------------------------------------------------------------- /cmake/config/map/iterator/map_iterator.cmake: -------------------------------------------------------------------------------- 1 | ## initializes a new mapiterator 2 | function(map_iterator map) 3 | map_keys("${map}") 4 | ans(keys) 5 | set(iterator "${map}" before_start ${keys}) 6 | return_ref(iterator) 7 | endfunction() 8 | 9 | -------------------------------------------------------------------------------- /cmake/config/map/iterator/map_iterator_break.cmake: -------------------------------------------------------------------------------- 1 | # use this macro inside of a while(true) loop it breaks when the iterator is over 2 | # e.g. this prints all key values in the map 3 | # while(true) 4 | # map_iterator_break(myiterator) 5 | # message("${myiterator.key} = ${myiterator.value}") 6 | # endwhile() 7 | macro(map_iterator_break it_ref) 8 | map_iterator_next(${it_ref}) 9 | if("${it_ref}.end") 10 | break() 11 | endif() 12 | endmacro() -------------------------------------------------------------------------------- /cmake/config/map/iterator/map_iterator_next.cmake: -------------------------------------------------------------------------------- 1 | ## this function moves the map iterator to the next position 2 | ## and returns true if it was possible 3 | ## e.g. 4 | ## map_iterator_next(myiterator) 5 | ## ans(ok) ## is true if iterator had a next element 6 | ## variables ${myiterator.key} and ${myiterator.value} are available 7 | macro(map_iterator_next it_ref) 8 | list(LENGTH "${it_ref}" __map_iterator_next_length) 9 | if("${__map_iterator_next_length}" GREATER 1) 10 | list(REMOVE_AT "${it_ref}" 1) 11 | if(NOT "${__map_iterator_next_length}" EQUAL 2) 12 | list(GET "${it_ref}" 1 "${it_ref}.key") 13 | list(GET "${it_ref}" 0 "__map_iterator_map") 14 | get_property("${it_ref}.value" GLOBAL PROPERTY "${__map_iterator_map}.${${it_ref}.key}") 15 | set(__ans true) 16 | else() 17 | set(__ans false) 18 | set("${it_ref}.end" true) 19 | endif() 20 | else() 21 | set("${it_ref}.end" true) 22 | set(__ans false) 23 | endif() 24 | endmacro() 25 | -------------------------------------------------------------------------------- /cmake/config/map/map_import_properties.cmake: -------------------------------------------------------------------------------- 1 | ## imports the specified properties into the current scope 2 | ## e.g map = {a:1,b:2,c:3} 3 | ## map_import_properties(${map} a c) 4 | ## -> ${a} == 1 ${b} == 2 5 | macro(map_import_properties __map) 6 | foreach(key ${ARGN}) 7 | map_tryget("${__map}" "${key}") 8 | ans("${key}") 9 | endforeach() 10 | endmacro() 11 | 12 | -------------------------------------------------------------------------------- /cmake/config/map/map_matches_obj.cmake: -------------------------------------------------------------------------------- 1 | ## returns true if actual has all properties (and recursive properties) 2 | ## that expected has 3 | function(map_match_obj actual expected) 4 | obj("${actual}") 5 | ans(actual) 6 | obj("${expected}") 7 | ans(expected) 8 | map_match("${actual}" "${expected}") 9 | return_ans() 10 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/operations/map_clone.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_clone original type) 3 | if("${type}" STREQUAL "DEEP") 4 | map_clone_deep("${original}") 5 | return_ans() 6 | elseif("${type}" STREQUAL "SHALLOW") 7 | map_clone_shallow("${original}") 8 | return_ans() 9 | else() 10 | message(FATAL_ERROR "unknown clone type: ${type}") 11 | endif() 12 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/operations/map_clone_deep.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_clone_deep original) 3 | map_clone_shallow("${original}") 4 | ans(result) 5 | 6 | is_map("${result}" ) 7 | ans(ismap) 8 | if(ismap) 9 | map_keys("${result}" ) 10 | ans(keys) 11 | foreach(key ${keys}) 12 | map_get(${result} ${key}) 13 | ans(value) 14 | map_clone_deep("${value}") 15 | ans(cloned_value) 16 | map_set(${result} ${key} ${cloned_value}) 17 | endforeach() 18 | endif() 19 | return_ref(result) 20 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/operations/map_clone_shallow.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(map_clone_shallow original) 3 | is_map("${original}" ) 4 | ans(ismap) 5 | if(ismap) 6 | map_new() 7 | ans(result) 8 | map_keys("${original}" ) 9 | ans(keys) 10 | foreach(key ${keys}) 11 | map_get("${original}" "${key}") 12 | ans(value) 13 | map_set("${result}" "${key}" "${value}") 14 | endforeach() 15 | return(${result}) 16 | endif() 17 | 18 | is_address("${original}") 19 | ans(isref) 20 | if(isref) 21 | address_get(${original}) 22 | ans(res) 23 | address_type_get(${original}) 24 | ans(type) 25 | address_new(${type}) 26 | ans(result) 27 | address_set(${result} ${res}) 28 | return(${result}) 29 | endif() 30 | 31 | # everythign else is a value type and can be returned 32 | return_ref(original) 33 | 34 | endfunction() 35 | 36 | -------------------------------------------------------------------------------- /cmake/config/map/operations/map_equal_obj.cmake: -------------------------------------------------------------------------------- 1 | ## compares two maps for value equality 2 | ## lhs and rhs may be objectish 3 | function(map_equal_obj lhs rhs) 4 | obj("${lhs}") 5 | ans(lhs) 6 | obj("${rhs}") 7 | ans(rhs) 8 | map_equal("${lhs}" "${rhs}") 9 | return_ans() 10 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/operations/map_foreach.cmake: -------------------------------------------------------------------------------- 1 | # executes action (key, value)->void 2 | # on every key value pair in map 3 | # exmpl: map = {id:'1',val:'3'} 4 | # map_foreach("${map}" "(k,v)-> message($k $v)") 5 | # prints 6 | # id;1 7 | # val;3 8 | function(map_foreach map action) 9 | map_keys("${map}") 10 | ans(keys) 11 | foreach(key ${keys}) 12 | map_tryget("${map}" "${key}") 13 | ans(val) 14 | call("${action}"("${key}" "${val}")) 15 | endforeach() 16 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/operations/map_issubsetof.cmake: -------------------------------------------------------------------------------- 1 | function(map_issubsetof result superset subset) 2 | map_keys(${subset} ) 3 | ans(keys) 4 | foreach(key ${keys}) 5 | map_tryget(${superset} ${key}) 6 | ans(superValue) 7 | map_tryget(${subset} ${key}) 8 | ans(subValue) 9 | 10 | is_map(${superValue} ) 11 | ans(issupermap) 12 | is_map(${subValue} ) 13 | ans(issubmap) 14 | if(issubmap AND issubmap) 15 | map_issubsetof(res ${superValue} ${subValue}) 16 | if(NOT res) 17 | return_value(false) 18 | endif() 19 | else() 20 | list_isvalid(${superValue} ) 21 | ans(islistsuper) 22 | list_isvalid(${subValue} ) 23 | ans(islistsub) 24 | if(islistsub AND islistsuper) 25 | address_get(${superValue}) 26 | ans(superValue) 27 | address_get(${subValue}) 28 | ans(subValue) 29 | endif() 30 | list_equal( "${superValue}" "${subValue}") 31 | ans(res) 32 | if(NOT res) 33 | return_value(false) 34 | endif() 35 | endif() 36 | endforeach() 37 | return_value(true) 38 | endfunction() -------------------------------------------------------------------------------- /cmake/config/map/operations/map_merge.cmake: -------------------------------------------------------------------------------- 1 | # creates a union from all all maps passed as ARGN and combines them in result 2 | # you can merge two maps by typing map_union(${map1} ${map1} ${map2}) 3 | # maps are merged in order ( the last one takes precedence) 4 | function(map_merge ) 5 | set(lst ${ARGN}) 6 | 7 | map_new() 8 | ans(res) 9 | 10 | foreach(map ${lst}) 11 | map_keys(${map} ) 12 | ans(keys) 13 | foreach(key ${keys}) 14 | map_tryget(${res} ${key}) 15 | ans(existing_val) 16 | map_tryget(${map} ${key}) 17 | ans(val) 18 | 19 | is_map("${existing_val}" ) 20 | ans(existing_ismap) 21 | is_map("${val}" ) 22 | ans(new_ismap) 23 | 24 | if(new_ismap AND existing_ismap) 25 | map_union(${existing_val} ${val}) 26 | ans(existing_val) 27 | else() 28 | 29 | map_set(${res} ${key} ${val}) 30 | endif() 31 | endforeach() 32 | endforeach() 33 | return(${res}) 34 | endfunction() 35 | 36 | -------------------------------------------------------------------------------- /cmake/config/map/operations/map_union.cmake: -------------------------------------------------------------------------------- 1 | # creates a union from all all maps passed as ARGN and combines them in the first 2 | # you can merge two maps by typing map_union(${map1} ${map1} ${map2}) 3 | # maps are merged in order ( the last one takes precedence) 4 | function(map_union) 5 | set(lst ${ARGN}) 6 | list_pop_front(lst) 7 | ans(res) 8 | if(NOT res) 9 | message(FATAL_ERROR "map_union: no maps passed") 10 | endif() 11 | # loop through the keys of every map 12 | foreach(map ${lst}) 13 | map_keys(${map} ) 14 | ans(keys) 15 | foreach(key ${keys}) 16 | map_tryget(${map} ${key}) 17 | ans(val) 18 | map_set(${res} ${key} ${val}) 19 | endforeach() 20 | endforeach() 21 | return(${res}) 22 | endfunction() 23 | 24 | -------------------------------------------------------------------------------- /cmake/config/quickmap/end.cmake: -------------------------------------------------------------------------------- 1 | function(end) 2 | # remove last key from key stack and last map from map stack 3 | # return the popped map 4 | stack_pop(:quick_map_key_stack) 5 | stack_pop(:quick_map_map_stack) 6 | return_ans() 7 | endfunction() 8 | 9 | 10 | 11 | ## end() -> 12 | ## 13 | ## ends the current key, ref or map and returns the value 14 | ## 15 | function(end) 16 | stack_pop(quickmap) 17 | ans(ref) 18 | 19 | if(NOT ref) 20 | message(FATAL_ERROR "end() not possible ") 21 | endif() 22 | 23 | string_take_address(ref) 24 | ans(current_ref) 25 | 26 | return_ref(current_ref) 27 | endfunction() 28 | -------------------------------------------------------------------------------- /cmake/config/quickmap/key.cmake: -------------------------------------------------------------------------------- 1 | function(key key) 2 | # check if there is a current map 3 | stack_peek(:quick_map_map_stack) 4 | ans(current_map) 5 | if(NOT current_map) 6 | message(FATAL_ERROR "cannot set key for non existing map be sure to call first map() before first key()") 7 | endif() 8 | # set current key 9 | stack_pop(:quick_map_key_stack) 10 | stack_push(:quick_map_key_stack "${key}") 11 | endfunction() 12 | 13 | 14 | ## key() -> 15 | ## 16 | ## starts a new property for a map - may only be called 17 | ## after key or map 18 | ## fails if current ref is not a map 19 | function(key key) 20 | stack_pop(quickmap) 21 | ans(current_key) 22 | 23 | string_take_address(current_key) 24 | ans(current_ref) 25 | 26 | #is_map("${current_ref}") 27 | is_address("${current_ref}") 28 | ans(ismap) 29 | if(NOT ismap) 30 | message(FATAL_ERROR "expected a map before key() call") 31 | endif() 32 | 33 | 34 | map_set("${current_ref}" "${key}" "") 35 | stack_push(quickmap "${current_ref}.${key}") 36 | return() 37 | endfunction() 38 | -------------------------------------------------------------------------------- /cmake/config/quickmap/kv.cmake: -------------------------------------------------------------------------------- 1 | function(kv key) 2 | key("${key}") 3 | val(${ARGN}) 4 | endfunction() 5 | 6 | -------------------------------------------------------------------------------- /cmake/config/quickmap/map.cmake: -------------------------------------------------------------------------------- 1 | function(map) 2 | set(key ${ARGN}) 3 | 4 | # get current map 5 | stack_peek(:quick_map_map_stack) 6 | ans(current_map) 7 | 8 | # get current key 9 | stack_peek(:quick_map_key_stack) 10 | ans(current_key) 11 | 12 | if(ARGN) 13 | set(current_key ${ARGV0}) 14 | endif() 15 | 16 | # create new current map 17 | map_new() 18 | ans(new_map) 19 | 20 | 21 | # add map to existing map 22 | if(current_map) 23 | key("${current_key}") 24 | val("${new_map}") 25 | endif() 26 | 27 | 28 | # push new map and new current key on stacks 29 | stack_push(:quick_map_map_stack ${new_map}) 30 | stack_push(:quick_map_key_stack "") 31 | 32 | return_ref(new_map) 33 | endfunction() 34 | 35 | 36 | 37 | ## map() ->
38 | ## 39 | ## begins a new map returning its address 40 | ## map needs to be ended via end() 41 | function(map) 42 | if(NOT ARGN STREQUAL "") 43 | key("${ARGN}") 44 | endif() 45 | map_new() 46 | ans(ref) 47 | val(${ref}) 48 | stack_push(quickmap ${ref}) 49 | return_ref(ref) 50 | endfunction() 51 | -------------------------------------------------------------------------------- /cmake/config/quickmap/ref.cmake: -------------------------------------------------------------------------------- 1 | 2 | ## ref() ->
3 | ## 4 | ## begins a new reference value and returns its address 5 | ## ref needs to be ended via end() call 6 | function(ref) 7 | if(NOT ARGN STREQUAL "") 8 | key("${ARGN}") 9 | endif() 10 | address_new() 11 | ans(ref) 12 | val(${ref}) 13 | stack_push(quickmap ${ref}) 14 | return_ref(ref) 15 | endfunction() 16 | -------------------------------------------------------------------------------- /cmake/config/quickmap/val.cmake: -------------------------------------------------------------------------------- 1 | function(val) 2 | # appends the values to the current_map[current_key] 3 | stack_peek(:quick_map_map_stack) 4 | ans(current_map) 5 | stack_peek(:quick_map_key_stack) 6 | ans(current_key) 7 | if(NOT current_map) 8 | set(res ${ARGN}) 9 | return_ref(res) 10 | endif() 11 | map_append("${current_map}" "${current_key}" "${ARGN}") 12 | endfunction() 13 | 14 | 15 | 16 | ## val() -> 17 | ## 18 | ## adds a val to current property or ref 19 | ## 20 | function(val) 21 | set(args ${ARGN}) 22 | stack_peek(quickmap) 23 | ans(current_ref) 24 | 25 | if(NOT current_ref) 26 | return() 27 | endif() 28 | ## todo check if map 29 | address_append("${current_ref}" ${args}) 30 | return_ref(args) 31 | endfunction() 32 | -------------------------------------------------------------------------------- /cmake/config/quickmap/var.cmake: -------------------------------------------------------------------------------- 1 | 2 | ## captures a list of variable as a key value pair 3 | function(var) 4 | foreach(var ${ARGN}) 5 | kv("${var}" "${${var}}") 6 | endforeach() 7 | endfunction() -------------------------------------------------------------------------------- /cmake/config/ref/address_append.cmake: -------------------------------------------------------------------------------- 1 | function(address_append ref) 2 | set_property( GLOBAL APPEND PROPERTY "${ref}" "${ARGN}") 3 | endfunction() -------------------------------------------------------------------------------- /cmake/config/ref/address_append_string.cmake: -------------------------------------------------------------------------------- 1 | function(address_append_string ref str) 2 | set_property(GLOBAL APPEND_STRING PROPERTY "${ref}" "${str}") 3 | endfunction() -------------------------------------------------------------------------------- /cmake/config/ref/address_delete.cmake: -------------------------------------------------------------------------------- 1 | function(address_delete ref) 2 | set_property(GLOBAL PROPERTY "${ref}") 3 | endfunction() 4 | -------------------------------------------------------------------------------- /cmake/config/ref/address_get.cmake: -------------------------------------------------------------------------------- 1 | function(address_get ref ) 2 | get_property(ref_value GLOBAL PROPERTY "${ref}") 3 | return_ref(ref_value) 4 | endfunction() 5 | 6 | # optimized version 7 | macro(address_get ref) 8 | get_property(__ans GLOBAL PROPERTY "${ref}") 9 | endmacro() -------------------------------------------------------------------------------- /cmake/config/ref/address_new.cmake: -------------------------------------------------------------------------------- 1 | function(address_new) 2 | address_set(":0" 0) 3 | function(address_new) 4 | address_get(":0" ) 5 | ans(index) 6 | math(EXPR index "${index} + 1") 7 | address_set(":0" "${index}") 8 | if(ARGN) 9 | # set(type "${ARGV0}") 10 | address_set(":${index}.__type__" "${ARGV0}") 11 | endif() 12 | return(":${index}") 13 | endfunction() 14 | 15 | address_new(${ARGN}) 16 | return_ans() 17 | endfunction() 18 | 19 | ## optimized version 20 | function(address_new) 21 | set_property(GLOBAL PROPERTY ":0" 0 ) 22 | function(address_new) 23 | get_property(index GLOBAL PROPERTY ":0") 24 | math(EXPR index "${index} + 1") 25 | set_property(GLOBAL PROPERTY ":0" ${index} ) 26 | if(ARGN) 27 | set_property(GLOBAL PROPERTY ":${index}.__type__" "${ARGV0}") 28 | endif() 29 | set(__ans ":${index}" PARENT_SCOPE) 30 | endfunction() 31 | 32 | address_new(${ARGN}) 33 | return_ans() 34 | endfunction() 35 | 36 | ## faster 37 | macro(address_new) 38 | set_property(GLOBAL PROPERTY ":0" 0) 39 | macro(address_new) 40 | get_property(__ans GLOBAL PROPERTY ":0") 41 | math(EXPR __ans "${__ans} + 1") 42 | set_property(GLOBAL PROPERTY ":0" "${__ans}") 43 | set_property(GLOBAL PROPERTY ":${__ans}") 44 | set(__ans ":${__ans}") 45 | endmacro() 46 | address_new(${ARGN}) 47 | endmacro() -------------------------------------------------------------------------------- /cmake/config/ref/address_peek_back.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(address_peek_back ref) 3 | address_get(${ref}) 4 | ans(value) 5 | list_peek_back(value ${ARGN}) 6 | ans(res) 7 | return_ref(res) 8 | endfunction() -------------------------------------------------------------------------------- /cmake/config/ref/address_peek_front.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(address_peek_front ref) 3 | address_get(${ref}) 4 | ans(value) 5 | list_peek_front(value ${ARGN}) 6 | ans(res) 7 | return_ref(res) 8 | endfunction() -------------------------------------------------------------------------------- /cmake/config/ref/address_pop_back.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(address_pop_back ref) 3 | address_get(${ref}) 4 | ans(value) 5 | list_pop_back(value) 6 | ans(res) 7 | address_set(${ref} ${value}) 8 | return_ref(res) 9 | endfunction() -------------------------------------------------------------------------------- /cmake/config/ref/address_pop_front.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(address_pop_front ref) 3 | address_get(${ref}) 4 | ans(value) 5 | list_pop_front(value) 6 | ans(res) 7 | address_set(${ref} ${value}) 8 | return_ref(res) 9 | endfunction() -------------------------------------------------------------------------------- /cmake/config/ref/address_print.cmake: -------------------------------------------------------------------------------- 1 | function(address_print ref) 2 | address_get("${ref}") 3 | _message("${ref}") 4 | endfunction() -------------------------------------------------------------------------------- /cmake/config/ref/address_push_back.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(address_push_back ref) 3 | address_get(${ref}) 4 | ans(value) 5 | list_push_back(value "${ARGN}") 6 | ans(res) 7 | address_set(${ref} ${value}) 8 | return_ref(res) 9 | endfunction() -------------------------------------------------------------------------------- /cmake/config/ref/address_push_front.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(address_push_front ref) 3 | get_property(value GLOBAL PROPERTY "${ref}") 4 | set_property( GLOBAL PROPERTY "${ref}" "${ARGN}" "${value}") 5 | endfunction() -------------------------------------------------------------------------------- /cmake/config/ref/address_set.cmake: -------------------------------------------------------------------------------- 1 | function(address_set ref) 2 | set_property(GLOBAL PROPERTY "${ref}" "${ARGN}") 3 | endfunction() 4 | -------------------------------------------------------------------------------- /cmake/config/ref/address_set_new.cmake: -------------------------------------------------------------------------------- 1 | function(address_set_new) 2 | address_new() 3 | ans(res) 4 | address_set(${res} "${ARGN}") 5 | return(${res}) 6 | endfunction() -------------------------------------------------------------------------------- /cmake/config/ref/address_type_get.cmake: -------------------------------------------------------------------------------- 1 | function(address_type_get ref) 2 | is_address(${ref}) 3 | ans(is_ref) 4 | if(NOT is_ref) 5 | return() 6 | endif() 7 | address_get("${ref}.__type__") 8 | ans(type) 9 | return_ref(type) 10 | endfunction() -------------------------------------------------------------------------------- /cmake/config/ref/address_type_matches.cmake: -------------------------------------------------------------------------------- 1 | function(address_type_matches ref expectedType) 2 | is_address(${ref}) 3 | ans(isref) 4 | 5 | if(NOT isref) 6 | return(false) 7 | endif() 8 | 9 | address_type_get(${ref}) 10 | ans(type) 11 | if(NOT "${type}" STREQUAL "${expectedType}" ) 12 | return(false) 13 | endif() 14 | return(true) 15 | endfunction() -------------------------------------------------------------------------------- /cmake/config/ref/is_address.cmake: -------------------------------------------------------------------------------- 1 | function(is_address ref) 2 | list(LENGTH ref len) 3 | if(NOT ${len} EQUAL 1) 4 | return(false) 5 | endif() 6 | string(REGEX MATCH "^:" res "${ref}" ) 7 | if(res) 8 | return(true) 9 | endif() 10 | return(false) 11 | endfunction() 12 | 13 | ## faster - does not work in all cases 14 | macro(is_address ref) 15 | if("_${ref}" MATCHES "^_:[^;]+$") 16 | set(__ans true) 17 | else() 18 | set(__ans false) 19 | endif() 20 | endmacro() 21 | 22 | 23 | ## correcter 24 | ## the version above cannot be used because 25 | ## is_address gets arbirtray data - and since macros evaluate 26 | ## arguments a invalid ref could be ssen as valid 27 | ## or especially \\ fails because it beomes \ and causes an error 28 | function(is_address ref) 29 | if("_${ref}" MATCHES "^_:[^;]+$") 30 | set(__ans true PARENT_SCOPE) 31 | else() 32 | set(__ans false PARENT_SCOPE) 33 | endif() 34 | endfunction() -------------------------------------------------------------------------------- /cmake/config/stack/stack_peek.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(stack_peek stack) 3 | map_tryget("${stack}" back) 4 | ans(back) 5 | map_tryget("${stack}" "${back}") 6 | return_ans() 7 | endfunction() -------------------------------------------------------------------------------- /cmake/config/stack/stack_pop.cmake: -------------------------------------------------------------------------------- 1 | 2 | function(stack_pop stack) 3 | map_tryget("${stack}" back) 4 | ans(current_index) 5 | if(NOT current_index) 6 | return() 7 | endif() 8 | map_tryget("${stack}" "${current_index}") 9 | ans(res) 10 | math(EXPR current_index "${current_index} - 1") 11 | map_set_hidden("${stack}" back "${current_index}") 12 | return_ref(res) 13 | endfunction() 14 | -------------------------------------------------------------------------------- /cmake/config/stack/stack_push.cmake: -------------------------------------------------------------------------------- 1 | function(stack_push stack) 2 | map_tryget("${stack}" back) 3 | ans(current_index) 4 | 5 | # increase stack pointer 6 | if(NOT current_index) 7 | set(current_index 0) 8 | endif() 9 | math(EXPR current_index "${current_index} + 1") 10 | map_set_hidden("${stack}" back "${current_index}") 11 | 12 | map_set_hidden("${stack}" "${current_index}" "${ARGN}") 13 | endfunction() 14 | -------------------------------------------------------------------------------- /cmake/config/string/cmake_string_to_json.cmake: -------------------------------------------------------------------------------- 1 | 2 | 3 | function(cmake_string_to_json str) 4 | string_decode_semicolon("${str}") 5 | ans(str) 6 | string(REPLACE "\\" "\\\\" str "${str}") 7 | string(REPLACE "\"" "\\\"" str "${str}") 8 | string(REPLACE "\n" "\\n" str "${str}") 9 | string(REPLACE "\t" "\\t" str "${str}") 10 | string(REPLACE "\t" "\\t" str "${str}") 11 | string(REPLACE "\r" "\\r" str "${str}") 12 | string(ASCII 8 bs) 13 | string(REPLACE "${bs}" "\\b" str "${str}") 14 | string(ASCII 12 ff) 15 | string(REPLACE "${ff}" "\\f" str "${str}") 16 | # This was changed so the semicolon was printed correctly in json files... 17 | # string(REPLACE ";" "\\\\;" str "${str}") 18 | set(str "\"${str}\"") 19 | return_ref(str) 20 | endfunction() 21 | -------------------------------------------------------------------------------- /cmake/config/string/encoding/string_decode_semicolon.cmake: -------------------------------------------------------------------------------- 1 | # decodes semicolons in a string 2 | function(string_decode_semicolon str) 3 | string(ASCII 31 semicolon_code) 4 | string(REPLACE "${semicolon_code}" ";" str "${str}") 5 | return_ref(str) 6 | endfunction() 7 | 8 | 9 | 10 | ## faster 11 | function(string_decode_semicolon str) 12 | string_codes() 13 | eval(" 14 | function(string_decode_semicolon str) 15 | string(REPLACE \"${semicolon_code}\" \";\" str \"\${str}\" ) 16 | set(__ans \"\${str}\" PARENT_SCOPE) 17 | endfunction() 18 | ") 19 | string_decode_semicolon("${str}") 20 | return_ans() 21 | endfunction() 22 | -------------------------------------------------------------------------------- /cmake/config/string/string_codes.cmake: -------------------------------------------------------------------------------- 1 | # special chars |||||||↔|†|‡ 2 | macro(string_codes) 3 | string(ASCII 14 "${ARGN}free_token1") 4 | string(ASCII 15 "${ARGN}free_token2") 5 | string(ASCII 1 "${ARGN}free_token3") 6 | string(ASCII 2 "${ARGN}free_token4") 7 | 8 | string(ASCII 29 "${ARGN}bracket_open_code") 9 | string(ASCII 28 "${ARGN}bracket_close_code") 10 | string(ASCII 30 "${ARGN}ref_token") 11 | string(ASCII 21 "${ARGN}free_token") 12 | string(ASCII 31 "${ARGN}semicolon_code") 13 | string(ASCII 24 "${ARGN}empty_code") 14 | string(ASCII 2 "${ARGN}paren_open_code") 15 | string(ASCII 3 "${ARGN}paren_close_code") 16 | set("${ARGN}identifier_token" "__") 17 | endmacro() 18 | 19 | function(string_codes_print) 20 | string_codes() 21 | print_vars(--plain "bracket_open_code") 22 | print_vars(--plain "bracket_close_code") 23 | print_vars(--plain "ref_token") 24 | print_vars(--plain "semicolon_code") 25 | print_vars(--plain "empty_code") 26 | print_vars(--plain "paren_open_code") 27 | print_vars(--plain "paren_close_code") 28 | print_vars(--plain "free_token") 29 | print_vars(--plain "free_token1") 30 | print_vars(--plain "free_token2") 31 | print_vars(--plain "free_token3") 32 | print_vars(--plain "free_token4") 33 | endfunction() 34 | -------------------------------------------------------------------------------- /cmake/config/string/string_take_address.cmake: -------------------------------------------------------------------------------- 1 | ## `(>)->> ` 2 | ## 3 | ## Removes an address (regex format: ":[1-9][0-9]*") from a string reference and returns the address in "res". 4 | ## The address is also removed from the input string reference (str_ref). 5 | ## 6 | ## **Examples** 7 | ## 8 | ## 9 | function(string_take_address str_ref) 10 | string_take_regex("${str_ref}" ":[1-9][0-9]*") 11 | ans(res) 12 | set(${str_ref} ${${str_ref}} PARENT_SCOPE) 13 | return_ref(res) 14 | endfunction() 15 | -------------------------------------------------------------------------------- /cmake/modules/FindExecInfo.cmake: -------------------------------------------------------------------------------- 1 | # If not stated otherwise in this file or this component's license file the 2 | # following copyright and licenses apply: 3 | # 4 | # Copyright 2020 Metrological 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | include(CheckSymbolExists) 19 | CHECK_SYMBOL_EXISTS(__GNU_LIBRARY__ "features.h" GNU_LIBRARY_FOUND) 20 | 21 | if(NOT GNU_LIBRARY_FOUND) 22 | find_library (LIBEXECINFO_LIBRARY NAMES execinfo) 23 | mark_as_advanced(LIBEXECINFO_LIBRARY) 24 | endif() 25 | -------------------------------------------------------------------------------- /cmake/platform.cmake: -------------------------------------------------------------------------------- 1 | # If not stated otherwise in this file or this component's license file the 2 | # following copyright and licenses apply: 3 | # 4 | # Copyright 2020 Metrological 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | if(UNIX AND NOT APPLE) 19 | set(LINUX TRUE) 20 | endif() 21 | if(WIN32 AND MSVC) 22 | set(WIN_MSVC TRUE) 23 | message(STATUS "Building on Windows with MSVC") 24 | elseif(MINGW) 25 | message(STATUS "Building on Windows with MinGW") 26 | elseif(LINUX) 27 | message(STATUS "Building on Linux") 28 | elseif(APPLE) 29 | message(STATUS "Building on OS X") 30 | else() 31 | message(STATUS "Unsupported platform " ${CMAKE_HOST_SYSTEM} "?") 32 | endif() 33 | -------------------------------------------------------------------------------- /cmake/templates/default.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/@TARGET_LIBRARY_DIR@ 4 | includedir=${prefix}/@TARGET_INCLUDE_DIR@ 5 | 6 | Name: @NAME@ 7 | Version: @VERSION@ 8 | Description: @DESCRIPTION@ 9 | 10 | Libs: -L${libdir} @LIBRARIES@ 11 | Cflags: -I${includedir} @INCLUDE_DIRS@ @COMPILE_OPTIONS@ @COMPILE_DEFINES@ -------------------------------------------------------------------------------- /cmake/templates/defaultConfig.cmake.in: -------------------------------------------------------------------------------- 1 | # If not stated otherwise in this file or this component's license file the 2 | # following copyright and licenses apply: 3 | # 4 | # Copyright 2020 Metrological 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | set(dependencies @dependencies@) 19 | 20 | # First load dependencies 21 | foreach(dependency ${dependencies}) 22 | find_package(${dependency} REQUIRED) 23 | endforeach() 24 | 25 | # import target exports 26 | get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 27 | include(${_DIR}/@_name@Targets.cmake) 28 | -------------------------------------------------------------------------------- /docs/assets/AsyncInterfaceExample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/assets/AsyncInterfaceExample.png -------------------------------------------------------------------------------- /docs/assets/ExampleStaticDynamic1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/assets/ExampleStaticDynamic1.png -------------------------------------------------------------------------------- /docs/assets/ExampleStaticDynamic2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/assets/ExampleStaticDynamic2.png -------------------------------------------------------------------------------- /docs/assets/umlsources.txt: -------------------------------------------------------------------------------- 1 | plantuml 2 | 3 | @startuml 4 | 5 | skin rose 6 | 7 | participant Plugin order 30 8 | 9 | Client1 -> Plugin: SetA(10) 10 | CLient2 -> Plugin: GetA() 11 | CLient2 -> Plugin: GetB() 12 | Client1 -> Plugin: SetB(20) 13 | 14 | 15 | @enduml 16 | 17 | 18 | @startuml 19 | 20 | skin rose 21 | 22 | participant Plugin order 30 23 | 24 | Client1 -> Plugin: SetA(10) 25 | Activate Plugin 26 | Plugin -> Client3: AChanged() 27 | Activate Client3 28 | Client2 -> Plugin: SetA(20) 29 | Client3 -> Plugin: GetA() 30 | Deactivate Client3 31 | Plugin --> Client1 32 | Deactivate Plugin 33 | 34 | @enduml 35 | 36 | @startuml 37 | 38 | skin rose 39 | 40 | participant Plugin order 30 41 | participant PinProvider order 40 42 | 43 | Client -> Plugin: GetPin(Callback) 44 | Plugin --> Client 45 | Plugin -> Plugin: GetPin 46 | Activate Plugin 47 | Plugin -> PinProvider: RetrievePin 48 | Activate PinProvider 49 | PinProvider --> Plugin: pin 50 | Deactivate PinProvider 51 | Plugin -> Client: Callback(pin) 52 | Deactivate Plugin 53 | 54 | 55 | @enduml 56 | -------------------------------------------------------------------------------- /docs/client/com-rpc.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/client/com-rpc.md -------------------------------------------------------------------------------- /docs/client/intro.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/client/intro.md -------------------------------------------------------------------------------- /docs/client/json-rpc.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/client/json-rpc.md -------------------------------------------------------------------------------- /docs/debugging/debug.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/debugging/debug.md -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | Thunder is an open-source plugin-based device abstraction layer, where business functionality can be implemented as plugins and applications can query and control those plugins. Using Thunder provides a consistent interface-driven development model for both plugins and client applications, with an RPC engine that is suited to both web-based and native apps. 2 | 3 | Designed from the ground up for embedded platforms and written in C++11, Thunder can be run on even the most low-power of devices (including ARM and MIPS-based platforms). 4 | 5 | This documentation covers the design and architecture of Thunder, the process of writing Thunder plugins and client apps and the various utility libraries included. 6 | 7 | [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) 8 | 9 | ![Linux Build](https://github.com/rdkcentral/Thunder/actions/workflows/Build%20Thunder%20on%20Linux.yml/badge.svg) ![Windows Build](https://github.com/rdkcentral/Thunder/actions/workflows/Build%20Thunder%20on%20Windows.yml/badge.svg) ![Unit Test](https://github.com/rdkcentral/Thunder/actions/workflows/Test%20Thunder.yml/badge.svg) 10 | 11 | -------------------------------------------------------------------------------- /docs/introduction/architecture/plugin_modes.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/introduction/architecture/plugin_modes.md -------------------------------------------------------------------------------- /docs/introduction/architecture/rpc/comrpc.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/introduction/architecture/rpc/comrpc.md -------------------------------------------------------------------------------- /docs/introduction/architecture/rpc/jsonrpc.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/introduction/architecture/rpc/jsonrpc.md -------------------------------------------------------------------------------- /docs/plugin/composite.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/plugin/composite.md -------------------------------------------------------------------------------- /docs/plugin/devtools/devtools.md: -------------------------------------------------------------------------------- 1 | ThunderTools do contain a number of tools that can support you in developing Plugins. 2 | 3 | To make usage of these tools easier there is also a main menu that can be used to see an overview of currently existing tools and also allows a tool to be started directly from this menu. 4 | 5 | To start the Thunder Developer Tools main menu: 6 | 7 | 1. Goto the folder you want the tool to be started in (e.g. some tools will create files in the folder they are started in) 8 | 2. From that folder call the ThunderDevTools.py from the ThunderTools/ThunderDevTools folder (e.g. ../ThunderDevTools/ThunderDevTools.py) -------------------------------------------------------------------------------- /docs/plugin/execution-modes/distrubuted.md: -------------------------------------------------------------------------------- 1 | # Distributed 2 | 3 | !!! danger 4 | Distributed mode is considered experimental 5 | 6 | Distributed mode takes the out-of-process mode one step further by allowing plugins to run on an entirely different device than the main Thunder process. This device could even be running a different CPU with a different architecture. A COM-RPC channel is established over a TCP socket between the two devices to allow communication. 7 | 8 | An example use case for this could be a dual-SoC platform or for communicating with peripheral devices such as cameras. 9 | 10 | Note the COM-RPC protocol is not designed for untrusted channels (e.g. public internet), so this should be used with caution. Enabling tamer-resistant stubs can increase security & robustness but this should still not be considered completely secure. 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/plugin/execution-modes/inprocess.md: -------------------------------------------------------------------------------- 1 | # In Process Plugins 2 | 3 | This is the simplest execution mode, and the default if a mode is not set. An in-process plugin is loaded into and executed inside the main WPEFraemwork process. 4 | 5 | **Advantages** 6 | 7 | * Simple - there is no additional overhead or complexity from running additional processes 8 | * Highest performance - no additional RPC hops are required to communicate with the plugin. All calls to the plugin from the Thunder process are just local virtual function calls. 9 | * If an in-process plugin needs to communicate with another in-process plugin, Thunder will resolve any COM-RPC interface calls to local function calls. This removes the need to serialise/deserialise any data or cross any IPC boundary and results in the fastest performance possible 10 | 11 | **Disadvantages** 12 | 13 | * Stability - if a plugin is unstable or buggy and causes a crash then it will bring down the entire Thunder process 14 | * Resource monitoring - since the plugin runs inside the Thunder process, it is much harder to accurately monitor the CPU/memory usage from that specific plugin 15 | * Security - the plugin runs with the same permissions and privileges as the main Thunder process -------------------------------------------------------------------------------- /docs/plugin/interfaces/docs.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/plugin/interfaces/docs.md -------------------------------------------------------------------------------- /docs/plugin/private-comrpc.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/plugin/private-comrpc.md -------------------------------------------------------------------------------- /docs/plugin/proxypool.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/plugin/proxypool.md -------------------------------------------------------------------------------- /docs/references/references.md: -------------------------------------------------------------------------------- 1 | You can find references to some other related information here. Please check below links: 2 | 3 | [WPE-API-Thunder](https://github.com/WebPlatformForEmbedded/Documentation/blob/master/Thunder/WPE-API-Thunder/WPE-API-Thunder.pdf) (Deprecated Early Thunder Documentation) 4 | -------------------------------------------------------------------------------- /docs/stylesheets/extra.css: -------------------------------------------------------------------------------- 1 | /* Make page wider that default so tables etc fit better */ 2 | .md-grid { 3 | max-width: 70rem; 4 | } 5 | 6 | /* Slightly smaller than default */ 7 | .md-typeset { 8 | font-size: .75rem; 9 | } -------------------------------------------------------------------------------- /docs/utils/threading/mutex.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/utils/threading/mutex.md -------------------------------------------------------------------------------- /docs/utils/timers.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/utils/timers.md -------------------------------------------------------------------------------- /docs/utils/web.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/utils/web.md -------------------------------------------------------------------------------- /docs/walkthrough/hello-world/client-comrpc.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/walkthrough/hello-world/client-comrpc.md -------------------------------------------------------------------------------- /docs/walkthrough/hello-world/client-jsonrpc.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/walkthrough/hello-world/client-jsonrpc.md -------------------------------------------------------------------------------- /docs/walkthrough/hello-world/guide.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/walkthrough/hello-world/guide.md -------------------------------------------------------------------------------- /docs/walkthrough/hello-world/setup.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdkcentral/Thunder/cbe2b251dcc471033c007497c97fddfa4c0f178a/docs/walkthrough/hello-world/setup.md --------------------------------------------------------------------------------