Skip to content

Imported older objc code - #21

Open
djthorpe wants to merge 1 commit into
mainfrom
djt/0909/objc
Open

Imported older objc code#21
djthorpe wants to merge 1 commit into
mainfrom
djt/0909/objc

Conversation

@djthorpe

@djthorpe djthorpe commented Sep 9, 2026

Copy link
Copy Markdown
Member

Added the older code, for reference

Copilot AI lite review requested due to automatic review settings September 9, 2026 16:28
@djthorpe djthorpe self-assigned this Sep 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It introduces a large runtime/framework surface area with identified build/link breakages and incomplete synchronization semantics that can affect correctness and stability.

Pull request overview

This PR imports an older Objective-C runtime / framework implementation and adds a large set of Objective-C runtime tests, primarily as reference material.

Changes:

  • Adds a GCC-style Objective-C runtime implementation (src/objc/runtime-gcc) plus public runtime headers under include/runtime/objc/gcc.
  • Adds early Foundation / Application / Network framework code under src/objc/* and corresponding public headers under include/objc/*.
  • Adds many Objective-C runtime test executables and CMake scaffolding under test/objc.
File summaries
File Description
test/objc/CMakeLists.txt Adds ObjC test suite entrypoint.
test/objc/objc/runtime-objc.cmake Adds ObjC runtime test subdirs + Pico combined runner.
test/objc/objc/runtime-objc.h Declares ObjC runtime test entrypoints.
test/objc/objc/runtime-objc.m Pico combined test runner main.
test/objc/objc/runtime_01/CMakeLists.txt Builds runtime_01 test target.
test/objc/objc/runtime_01/main.c runtime_01 test main wrapper.
test/objc/objc/runtime_01/test.m runtime_01 test implementation.
test/objc/objc/runtime_02/CMakeLists.txt Builds runtime_02 test target.
test/objc/objc/runtime_02/main.c runtime_02 test main wrapper.
test/objc/objc/runtime_02/test.m runtime_02 test implementation.
test/objc/objc/runtime_02/TestClass.h runtime_02 helper class header.
test/objc/objc/runtime_02/TestClass.m runtime_02 helper class impl.
test/objc/objc/runtime_03/CMakeLists.txt Builds runtime_03 test target.
test/objc/objc/runtime_03/main.c runtime_03 test main wrapper.
test/objc/objc/runtime_03/test.m runtime_03 test implementation.
test/objc/objc/runtime_04/CMakeLists.txt Builds runtime_04 test target.
test/objc/objc/runtime_04/main.c runtime_04 test main wrapper.
test/objc/objc/runtime_04/Test.m runtime_04 test implementation.
test/objc/objc/runtime_04/Test04.h runtime_04 helper class header.
test/objc/objc/runtime_04/Test04.m runtime_04 helper class impl.
test/objc/objc/runtime_05/CMakeLists.txt Builds runtime_05 test target.
test/objc/objc/runtime_05/main.c runtime_05 test main wrapper.
test/objc/objc/runtime_05/test.m runtime_05 test implementation.
test/objc/objc/runtime_05/Test1.h runtime_05 helper class header.
test/objc/objc/runtime_05/Test1.m runtime_05 helper class impl.
test/objc/objc/runtime_05/Test2.h runtime_05 helper class header.
test/objc/objc/runtime_05/Test2.m runtime_05 helper class impl.
test/objc/objc/runtime_06/CMakeLists.txt Builds runtime_06 test target.
test/objc/objc/runtime_06/main.m runtime_06 test main / TestMain wrapper.
test/objc/objc/runtime_06/Test.h runtime_06 helper class header.
test/objc/objc/runtime_06/Test.m runtime_06 helper class impl.
test/objc/objc/runtime_06/Test+Description.h runtime_06 category header.
test/objc/objc/runtime_06/Test+Description.m runtime_06 category impl.
test/objc/objc/runtime_08/CMakeLists.txt Builds runtime_08 test target.
test/objc/objc/runtime_08/main.m runtime_08 test implementation.
test/objc/objc/runtime_09/CMakeLists.txt Builds runtime_09 test target.
test/objc/objc/runtime_09/main.m runtime_09 test implementation.
test/objc/objc/runtime_10/CMakeLists.txt Builds runtime_10 test target.
test/objc/objc/runtime_10/main.m runtime_10 test implementation.
test/objc/objc/runtime_11/CMakeLists.txt Builds runtime_11 test target.
test/objc/objc/runtime_11/main.m runtime_11 test implementation.
test/objc/objc/runtime_12/CMakeLists.txt Builds runtime_12 test target.
test/objc/objc/runtime_12/main.m runtime_12 test implementation.
test/objc/objc/runtime_13/CMakeLists.txt Builds runtime_13 test target.
test/objc/objc/runtime_13/main.m runtime_13 test implementation.
test/objc/objc/runtime_14/CMakeLists.txt Builds runtime_14 test target.
test/objc/objc/runtime_14/main.m runtime_14 test implementation.
test/objc/objc/runtime_15/CMakeLists.txt Builds runtime_15 test target.
test/objc/objc/runtime_15/main.m runtime_15 test implementation.
test/objc/objc/runtime_16/CMakeLists.txt Builds runtime_16 test target.
test/objc/objc/runtime_16/main.m runtime_16 test implementation.
test/objc/objc/runtime_17/CMakeLists.txt Builds runtime_17 test target.
test/objc/objc/runtime_17/main.m runtime_17 test implementation.
test/objc/objc/runtime_18/CMakeLists.txt Builds runtime_18 test target.
test/objc/objc/runtime_18/main.m runtime_18 test implementation.
test/objc/objc/runtime_19/CMakeLists.txt Builds runtime_19 test target.
test/objc/objc/runtime_19/main.m runtime_19 test implementation.
test/objc/objc/runtime_20/CMakeLists.txt Builds runtime_20 test target.
test/objc/objc/runtime_20/main.m runtime_20 test implementation.
test/objc/objc/runtime_21/CMakeLists.txt Builds runtime_21 test target.
test/objc/objc/runtime_21/main.m runtime_21 test implementation.
test/objc/objc/runtime_22/CMakeLists.txt Builds runtime_22 test target.
test/objc/objc/runtime_22/main.m runtime_22 test implementation.
test/objc/objc/runtime_23/CMakeLists.txt Builds runtime_23 test target.
test/objc/objc/runtime_23/main.m runtime_23 test implementation.
test/objc/objc/runtime_24/CMakeLists.txt Builds runtime_24 test target.
test/objc/objc/runtime_24/main.m runtime_24 test implementation.
test/objc/objc/runtime_25/CMakeLists.txt Builds runtime_25 test target.
test/objc/objc/runtime_25/main.m runtime_25 test implementation.
test/objc/objc/runtime_26/CMakeLists.txt Builds runtime_26 test target.
test/objc/objc/runtime_26/main.m runtime_26 test implementation.
test/objc/objc/runtime_27/CMakeLists.txt Builds runtime_27 test target.
test/objc/objc/runtime_27/main.m runtime_27 test implementation.
test/objc/objc/runtime_28/CMakeLists.txt Builds runtime_28 test target.
test/objc/objc/runtime_28/main.m runtime_28 test implementation.
test/objc/objc/runtime_29/CMakeLists.txt Builds runtime_29 test target.
test/objc/objc/runtime_29/main.m runtime_29 test implementation.
test/objc/objc/runtime_30/CMakeLists.txt Builds runtime_30 test target.
test/objc/objc/runtime_30/main.m runtime_30 test implementation.
test/objc/objc/runtime_31/CMakeLists.txt Builds runtime_31 test target.
test/objc/objc/runtime_31/main.m runtime_31 test implementation.
test/objc/objc/runtime_32/CMakeLists.txt Builds runtime_32 test target.
test/objc/objc/runtime_32/main.m runtime_32 test implementation.
test/objc/objc/runtime_33/CMakeLists.txt Builds runtime_33 test target.
test/objc/objc/runtime_33/main.m runtime_33 test implementation.
test/objc/objc/runtime_34/CMakeLists.txt Builds runtime_34 test target.
test/objc/objc/runtime_34/main.m runtime_34 test implementation.
test/objc/objc/runtime_35/CMakeLists.txt Builds runtime_35 test target.
test/objc/objc/runtime_35/main.m runtime_35 test implementation.
test/objc/objc/runtime_36/CMakeLists.txt Builds runtime_36 test target.
test/objc/objc/runtime_36/main.m runtime_36 test implementation.
test/objc/objc/runtime_37/CMakeLists.txt Builds runtime_37 test target.
test/objc/objc/runtime_37/main.m runtime_37 test implementation.
test/objc/NXFoundation/NXFoundation.cmake Adds NXFoundation test subdirs.
test/objc/NXFoundation/NXFoundation_01/CMakeLists.txt Builds NXFoundation_01 test target.
test/objc/NXFoundation/NXFoundation_01/main.m NXFoundation_01 test implementation.
test/objc/NXFoundation/NXFoundation_02/CMakeLists.txt Builds NXFoundation_02 test target.
test/objc/NXFoundation/NXFoundation_02/main.m NXFoundation_02 test implementation.
test/objc/NXFoundation/NXFoundation_03/CMakeLists.txt Builds NXFoundation_03 test target.
test/objc/NXFoundation/NXFoundation_03/main.m NXFoundation_03 test implementation.
test/objc/NXFoundation/NXFoundation_04/CMakeLists.txt Builds NXFoundation_04 test target.
test/objc/NXFoundation/NXFoundation_04/main.m NXFoundation_04 test implementation.
test/objc/NXFoundation/NXFoundation_05/CMakeLists.txt Builds NXFoundation_05 test target.
test/objc/NXFoundation/NXFoundation_05/main.m NXFoundation_05 test implementation.
test/objc/NXFoundation/NXFoundation_06/CMakeLists.txt Builds NXFoundation_06 test target.
test/objc/NXFoundation/NXFoundation_06/main.m NXFoundation_06 test implementation.
test/objc/NXFoundation/NXFoundation_07/CMakeLists.txt Builds NXFoundation_07 test target.
test/objc/NXFoundation/NXFoundation_07/main.m NXFoundation_07 test implementation.
test/objc/NXFoundation/NXFoundation_08/CMakeLists.txt Builds NXFoundation_08 test target.
test/objc/NXFoundation/NXFoundation_08/main.m NXFoundation_08 test implementation.
test/objc/NXFoundation/NXFoundation_09/CMakeLists.txt Builds NXFoundation_09 test target.
test/objc/NXFoundation/NXFoundation_10/CMakeLists.txt Builds NXFoundation_10 test target.
test/objc/NXFoundation/NXFoundation_11/CMakeLists.txt Builds NXFoundation_11 test target.
test/objc/NXFoundation/NXFoundation_11/main.m NXFoundation_11 test implementation.
test/objc/NXFoundation/NXFoundation_12/CMakeLists.txt Builds NXFoundation_12 test target.
test/objc/NXFoundation/NXFoundation_12/main.m NXFoundation_12 test implementation.
test/objc/NXFoundation/NXFoundation_13/CMakeLists.txt Builds NXFoundation_13 test target.
test/objc/NXFoundation/NXFoundation_14/CMakeLists.txt Builds NXFoundation_14 test target.
test/objc/NXFoundation/NXFoundation_15/CMakeLists.txt Builds NXFoundation_15 test target.
test/objc/NXFoundation/NXFoundation_16/CMakeLists.txt Builds NXFoundation_16 test target.
test/objc/NXFoundation/NXFoundation_17/CMakeLists.txt Builds NXFoundation_17 test target.
test/objc/NXFoundation/NXFoundation_18/CMakeLists.txt Builds NXFoundation_18 test target.
test/objc/NXFoundation/NXFoundation_19/CMakeLists.txt Builds NXFoundation_19 test target.
test/objc/NXFoundation/NXFoundation_20/CMakeLists.txt Builds NXFoundation_20 test target.
test/objc/NXFoundation/NXFoundation_21/CMakeLists.txt Builds NXFoundation_21 test target.
test/objc/NXFoundation/NXFoundation_22/CMakeLists.txt Builds NXFoundation_22 test target.
test/objc/NXFoundation/NXFoundation_23/CMakeLists.txt Builds NXFoundation_23 test target.
test/objc/NXFoundation/NXFoundation_24/CMakeLists.txt Builds NXFoundation_24 test target.
src/objc/runtime-gcc/CMakeLists.txt Defines objc-gcc runtime library build.
src/objc/runtime-gcc/category.c Category registration/loading implementation.
src/objc/runtime-gcc/category.h Category subsystem interface.
src/objc/runtime-gcc/class.h Class subsystem interface.
src/objc/runtime-gcc/dtable.c Dispatch-table implementation.
src/objc/runtime-gcc/dtable.h Dispatch-table interface.
src/objc/runtime-gcc/hash.h Selector hash-table interface.
src/objc/runtime-gcc/init.m Forces runtime class linking.
src/objc/runtime-gcc/module.c ObjC module registration/exec.
src/objc/runtime-gcc/mutex.c ObjC synchronization stubs.
src/objc/runtime-gcc/NXConstantString.m NXConstantString class runtime impl.
src/objc/runtime-gcc/Object.m Root Object class runtime impl.
src/objc/runtime-gcc/Protocol.m Protocol class runtime impl.
src/objc/runtime-gcc/protocol.h Protocol subsystem interface.
src/objc/runtime-gcc/statics.c Static instances registration/loading.
src/objc/runtime-gcc/statics.h Static instances interface.
src/objc/Foundation/CMakeLists.txt Defines Foundation library build.
src/objc/Foundation/NXArch.m Architecture introspection helpers.
src/objc/Foundation/NXAutoreleasePool.m Autorelease pool implementation.
src/objc/Foundation/NXLog.m Foundation logging function.
src/objc/Foundation/NXMap+hash.h Hash-table API header.
src/objc/Foundation/NXNotFound.m NXNotFound constant definition.
src/objc/Foundation/NXNull.m NXNull singleton implementation.
src/objc/Foundation/NXNumberUnsignedInt16.m Unsigned 16-bit NXNumber impl.
src/objc/Foundation/NXNumberUnsignedInt32.m Unsigned 32-bit NXNumber impl.
src/objc/Foundation/NXNumberZero.m Zero singleton number impl.
src/objc/Foundation/NXString+format.h NXString formatting hook declaration.
src/objc/Foundation/NXString+unicode.h ASCII unicode helpers.
src/objc/Foundation/NXThread.m Thread utility implementation.
src/objc/Foundation/NXTimeInterval.m Time interval constants/utilities.
src/objc/Foundation/NXZone+malloc.h Zone malloc shim declarations.
src/objc/Foundation/NXZone+malloc.m Zone malloc shim + objc_malloc/free.
src/objc/Network/CMakeLists.txt Defines Network library build.
src/objc/Network/NXNetworkTime.m NTP-backed network time manager.
src/objc/Network/NXWireless+Private.h Private NXWireless category header.
src/objc/Network/NXWirelessNetwork+Private.h Private NXWirelessNetwork category header.
src/objc/Application/CMakeLists.txt Defines Application library build.
src/objc/Application/Application+Private.h Private Application category header.
src/objc/Application/GPIO+Private.h Private GPIO category header.
src/objc/Application/NXTimer+Private.h Private NXTimer category header.
include/runtime/objc/gcc/assert.h ObjC runtime assertion macro header.
include/runtime/objc/gcc/malloc.h ObjC runtime alloc/free API.
include/runtime/objc/gcc/mutex.h ObjC runtime sync API header.
include/runtime/objc/gcc/NXConstantString+Protocol.h Constant string protocol header.
include/runtime/objc/gcc/NXConstantString.h NXConstantString runtime header.
include/runtime/objc/gcc/objc.h ObjC runtime umbrella header.
include/runtime/objc/gcc/Object+Protocol.h Root object protocol header.
include/runtime/objc/gcc/Protocol.h Protocol class header.
include/objc/Foundation/Collection+Protocol.h Collection protocol header.
include/objc/Foundation/Foundation.h Foundation umbrella header.
include/objc/Foundation/JSON+Protocol.h JSON protocol header.
include/objc/Foundation/NXArch.h Architecture API header.
include/objc/Foundation/NXAutoreleasePool.h Autorelease pool API header.
include/objc/Foundation/NXComparisonResult.h Comparison result enum header.
include/objc/Foundation/NXLog.h Logging API header.
include/objc/Foundation/NXNotFound.h NXNotFound API header.
include/objc/Foundation/NXNull.h NXNull API header.
include/objc/Foundation/NXObject.h NXObject API header.
include/objc/Foundation/NXPoint.h NXPoint type header.
include/objc/Foundation/NXThread.h NXThread API header.
include/objc/Foundation/NXTimeInterval.h NXTimeInterval API header.
include/objc/Foundation/NXZone.h NXZone API header.
include/objc/Foundation/Object+Description.h Object description category header.
include/objc/Foundation/Retain+Protocol.h Retain/release protocol header.
include/objc/Network/MQTTDelegate+Protocol.h MQTT delegate protocol header.
include/objc/Network/Network.h Network umbrella header.
include/objc/Network/NetworkTimeDelegate+Protocol.h Network time delegate header.
include/objc/Network/NXNetworkTime.h NXNetworkTime API header.
include/objc/Network/NXWirelessError.h NXWirelessError enum header.
include/objc/Network/NXWirelessNetwork.h NXWirelessNetwork API header.
include/objc/Network/WirelessDelegate+Protocol.h Wireless delegate protocol header.
include/objc/Application/Application.h Application umbrella header.
include/objc/Application/ApplicationDelegate+Protocol.h App delegate protocol header.
include/objc/Application/GPIODelegate+Protocol.h GPIO delegate protocol header.
include/objc/Application/GPIOTypes.h GPIO type definitions header.
include/objc/Application/InputManager+Protocols.h Input manager protocol header.
include/objc/Application/NXApplication.h NXApplication API header.
include/objc/Application/NXApplication+Types.h NXApplication type definitions.
include/objc/Application/NXApplicationMain.h NXApplicationMain API header.
include/objc/Application/NXInputManager.h NXInputManager API header.
include/objc/Application/NXTimer.h NXTimer API header.
include/objc/Application/TimerDelegate+Protocol.h Timer delegate protocol header.
include/objc/Application/LED.h LED API header.
Review details
  • Files reviewed: 175/276 changed files
  • Comments generated: 8
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +25 to +49
va_list args;
va_start(args, format);
const char *cFormat = [format cStr];
// First attempt: format directly into the static buffer. The returned len
// is the total required length (untruncated). If it fits, we already have
// the full string and can print once.
size_t len = sys_vsprintf_ex(buf, NXLOG_BUFFER_SIZE, cFormat, args,
_nxstring_format_handler);
if (len < NXLOG_BUFFER_SIZE) {
sys_puts(buf);
} else {
// Truncated: reformat using a heap buffer. Copy the va_list first.
va_list args_copy;
va_copy(args_copy, args);
char *buf = (char *)sys_malloc(len + 1);
if (buf) {
sys_vsprintf_ex(buf, len + 1, cFormat, args_copy,
_nxstring_format_handler);
sys_puts(buf);
sys_free(buf);
} else {
// OOM: print the truncated static buffer
sys_puts(buf);
}
va_end(args_copy);
Comment on lines +9 to +15
+ (id)alloc {
id obj = (id)objc_malloc(class_getInstanceSize(self));
if (obj) {
sys_memset(obj, 0, class_getInstanceSize(self));
object_setClass(obj, self);
}
return obj;
Comment on lines +8 to +12
int objc_sync_enter(id obj) {
// TODO: Implement actual synchronization
// For now, return success (no-op)
return 0;
}
Comment on lines +1 to +4
#pragma once
#include <objc/objc.h>
#include "Test2.h"

Comment on lines +12 to +16
if(CMAKE_SYSTEM_NAME STREQUAL "Pico")
pico_add_extra_outputs(${NAME})
pico_enable_stdio_usb(${NAME} 1)
pico_enable_stdio_uart(${NAME} 0)
endif()
Comment on lines +14 to +18
if(CMAKE_SYSTEM_NAME STREQUAL "Pico")
pico_add_extra_outputs(${NAME})
pico_enable_stdio_usb(${NAME} 1)
pico_enable_stdio_uart(${NAME} 0)
endif()
Comment on lines +12 to +16
if(CMAKE_SYSTEM_NAME STREQUAL "Pico")
pico_add_extra_outputs(${NAME})
pico_enable_stdio_usb(${NAME} 1)
pico_enable_stdio_uart(${NAME} 0)
endif()
Comment on lines +4 to +6
* @details This file provides an `assert` macro that can be used for debugging
* purposes. The assertion is only active when the `DEBUG` preprocessor macro is
* defined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants