feat: extract primitive method definitions into separate primitives.c/h files
Move the PRIMITIVE macro and all primitive function implementations (num_abs, string_contains, string_count) from vm.c into new src/primitives.c and src/primitives.h files. Add registerPrimitives() function to centralize primitive registration, removing inline PRIMITIVE calls from newVM(). Also remove unused numGlobals field from VM struct and add primitives.c to Xcode project sources.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
29AB1F291816E49C004B501E /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 29AB1F201816E49C004B501E /* main.c */; };
|
||||
29AB1F2F1816FA66004B501E /* vm.c in Sources */ = {isa = PBXBuildFile; fileRef = 29AB1F2E1816FA66004B501E /* vm.c */; };
|
||||
29AB1F3218170104004B501E /* compiler.c in Sources */ = {isa = PBXBuildFile; fileRef = 29AB1F3018170104004B501E /* compiler.c */; };
|
||||
29FA7298181D91020089013C /* primitives.c in Sources */ = {isa = PBXBuildFile; fileRef = 29FA7297181D91020089013C /* primitives.c */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@@ -32,6 +33,8 @@
|
||||
29AB1F2E1816FA66004B501E /* vm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vm.c; path = src/vm.c; sourceTree = SOURCE_ROOT; };
|
||||
29AB1F3018170104004B501E /* compiler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = compiler.c; path = src/compiler.c; sourceTree = SOURCE_ROOT; };
|
||||
29AB1F3118170104004B501E /* compiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = compiler.h; path = src/compiler.h; sourceTree = SOURCE_ROOT; };
|
||||
29FA7296181D90F30089013C /* primitives.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = primitives.h; path = src/primitives.h; sourceTree = SOURCE_ROOT; };
|
||||
29FA7297181D91020089013C /* primitives.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = primitives.c; path = src/primitives.c; sourceTree = SOURCE_ROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -66,6 +69,8 @@
|
||||
children = (
|
||||
29AB1F3018170104004B501E /* compiler.c */,
|
||||
29AB1F3118170104004B501E /* compiler.h */,
|
||||
29FA7297181D91020089013C /* primitives.c */,
|
||||
29FA7296181D90F30089013C /* primitives.h */,
|
||||
29AB1F201816E49C004B501E /* main.c */,
|
||||
29AB1F2E1816FA66004B501E /* vm.c */,
|
||||
29AB1F2D1816FA5B004B501E /* vm.h */,
|
||||
@@ -127,6 +132,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
29AB1F291816E49C004B501E /* main.c in Sources */,
|
||||
29FA7298181D91020089013C /* primitives.c in Sources */,
|
||||
29AB1F3218170104004B501E /* compiler.c in Sources */,
|
||||
29AB1F2F1816FA66004B501E /* vm.c in Sources */,
|
||||
);
|
||||
@@ -240,6 +246,7 @@
|
||||
29AB1F111816E3AD004B501E /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user