From 9bae7e6910729447e9fa2531eee5881833ed3395 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 9 Oct 2024 18:08:01 -0400 Subject: [PATCH 1/3] Added default template files to Xcode project This facilitates global searches for strings that occur both in code and in the template. --- mogenerator.xcodeproj/project.pbxproj | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/mogenerator.xcodeproj/project.pbxproj b/mogenerator.xcodeproj/project.pbxproj index 116806d..5ef8129 100644 --- a/mogenerator.xcodeproj/project.pbxproj +++ b/mogenerator.xcodeproj/project.pbxproj @@ -71,6 +71,12 @@ /* Begin PBXFileReference section */ 08FB7796FE84155DC02AAC07 /* mogenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = mogenerator.m; sourceTree = ""; usesTabs = 0; }; 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 147D172B1B8E2F480052E67D /* human.h.motemplate */ = {isa = PBXFileReference; lastKnownFileType = text; name = human.h.motemplate; path = templates/human.h.motemplate; sourceTree = ""; }; + 147D172C1B8E2F480052E67D /* human.m.motemplate */ = {isa = PBXFileReference; lastKnownFileType = text; name = human.m.motemplate; path = templates/human.m.motemplate; sourceTree = ""; }; + 147D172D1B8E2F480052E67D /* human.swift.motemplate */ = {isa = PBXFileReference; lastKnownFileType = text; name = human.swift.motemplate; path = templates/human.swift.motemplate; sourceTree = ""; }; + 147D172E1B8E2F480052E67D /* machine.h.motemplate */ = {isa = PBXFileReference; lastKnownFileType = text; name = machine.h.motemplate; path = templates/machine.h.motemplate; sourceTree = ""; }; + 147D172F1B8E2F480052E67D /* machine.m.motemplate */ = {isa = PBXFileReference; lastKnownFileType = text; name = machine.m.motemplate; path = templates/machine.m.motemplate; sourceTree = ""; }; + 147D17301B8E2F480052E67D /* machine.swift.motemplate */ = {isa = PBXFileReference; lastKnownFileType = text; name = machine.swift.motemplate; path = templates/machine.swift.motemplate; sourceTree = ""; }; 32A70AAB03705E1F00C91783 /* mogenerator_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mogenerator_Prefix.pch; sourceTree = ""; }; 457C26C7139A1EF900BF00DD /* MKCDAGNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MKCDAGNode.h; sourceTree = ""; }; 457C26C8139A1EF900BF00DD /* MKCDAGNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MKCDAGNode.m; sourceTree = ""; }; @@ -208,6 +214,7 @@ isa = PBXGroup; children = ( 08FB7795FE84155DC02AAC07 /* Source */, + 147D172A1B8E2F170052E67D /* Templates */, EE5ED86417332DED0013CCD1 /* momcom */, 79D2BF510ACFB51000F3F141 /* MiscMerge */, 457C26C6139A1EF900BF00DD /* ponso */, @@ -240,6 +247,19 @@ name = "External Frameworks and Libraries"; sourceTree = ""; }; + 147D172A1B8E2F170052E67D /* Templates */ = { + isa = PBXGroup; + children = ( + 147D172B1B8E2F480052E67D /* human.h.motemplate */, + 147D172C1B8E2F480052E67D /* human.m.motemplate */, + 147D172D1B8E2F480052E67D /* human.swift.motemplate */, + 147D172E1B8E2F480052E67D /* machine.h.motemplate */, + 147D172F1B8E2F480052E67D /* machine.m.motemplate */, + 147D17301B8E2F480052E67D /* machine.swift.motemplate */, + ); + name = Templates; + sourceTree = ""; + }; 1AB674ADFE9D54B511CA2CBB /* Products */ = { isa = PBXGroup; children = ( From f9366e052827e8f73c20e0acafbbbf4f3c91fafa Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 9 Oct 2024 18:08:22 -0400 Subject: [PATCH 2/3] Removed a stray extra space character in template --- templates/machine.h.motemplate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/machine.h.motemplate b/templates/machine.h.motemplate index 4b64aaa..fd44f77 100644 --- a/templates/machine.h.motemplate +++ b/templates/machine.h.motemplate @@ -60,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN */ <$endif$> <$if Attribute.hasDefinedAttributeType$> -<$if (Attribute.hasScalarAttributeType && !Attribute.optional && TemplateVar.scalarsWhenNonOptional)$> +<$if (Attribute.hasScalarAttributeType && !Attribute.optional && TemplateVar.scalarsWhenNonOptional)$> <$if Attribute.isReadonly$> @property (atomic, readonly) <$Attribute.scalarAttributeType$> <$Attribute.name$>; <$else$> From 0c477928ad5ad255439655ee512bfd348a0b6702 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 9 Oct 2024 18:10:54 -0400 Subject: [PATCH 3/3] Changed both scalar accessors and "Value" accessors from atomic to nonatomic For the scalar accessors, Xcode's own code generation code makes them nonatomic, so seems to make sense to match it. For the "Value" accessors, they just add/remove boxing to/from primative scalar types (like int32_t) to NSNumber. The accessor they call is nonatomic, so the addition of boxing doesn't seem to me to add any atomicity to anything. --- templates/machine.h.motemplate | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/machine.h.motemplate b/templates/machine.h.motemplate index fd44f77..9ecc29a 100644 --- a/templates/machine.h.motemplate +++ b/templates/machine.h.motemplate @@ -62,9 +62,9 @@ NS_ASSUME_NONNULL_BEGIN <$if Attribute.hasDefinedAttributeType$> <$if (Attribute.hasScalarAttributeType && !Attribute.optional && TemplateVar.scalarsWhenNonOptional)$> <$if Attribute.isReadonly$> -@property (atomic, readonly) <$Attribute.scalarAttributeType$> <$Attribute.name$>; +@property (nonatomic, readonly) <$Attribute.scalarAttributeType$> <$Attribute.name$>; <$else$> -@property (atomic) <$Attribute.scalarAttributeType$> <$Attribute.name$>; +@property (nonatomic) <$Attribute.scalarAttributeType$> <$Attribute.name$>; <$endif$> <$else$> <$if Attribute.isReadonly$> @@ -74,10 +74,10 @@ NS_ASSUME_NONNULL_BEGIN <$endif$> <$if Attribute.hasScalarAttributeType$> <$if Attribute.isReadonly$> -@property (atomic, readonly) <$Attribute.scalarAttributeType$> <$Attribute.name$>Value; +@property (nonatomic, readonly) <$Attribute.scalarAttributeType$> <$Attribute.name$>Value; - (<$Attribute.scalarAttributeType$>)<$Attribute.name$>Value; <$else$> -@property (atomic) <$Attribute.scalarAttributeType$> <$Attribute.name$>Value; +@property (nonatomic) <$Attribute.scalarAttributeType$> <$Attribute.name$>Value; - (<$Attribute.scalarAttributeType$>)<$Attribute.name$>Value; - (void)set<$Attribute.name.initialCapitalString$>Value:(<$Attribute.scalarAttributeType$>)value_; <$endif$>