Skip to content

Commit

Permalink
* new function MulleObjCDescribeMemory
Browse files Browse the repository at this point in the history
* **breaking** renamed NSRangeUTF8String to MulleObjCRangeUTF8String
* added MulleObjCRangeFor
* added id helper functions such as mulle_flexarray_do_id or mulle_id_copy
  • Loading branch information
mulle-nat committed Jun 15, 2023
1 parent 5522b5e commit 50c4197
Show file tree
Hide file tree
Showing 20 changed files with 706 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .mulle/share/env/tool-extension

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .mulle/share/sde/extension

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

117 changes: 99 additions & 18 deletions MulleObjC.sublime-project
Original file line number Diff line number Diff line change
@@ -1,29 +1,110 @@
{
"folders":
[
{
"path": ".",
"file_exclude_patterns": [
"sublimegdb_workingdir": "${folder:kitchen/Debug/MulleObjC}",
"sublimegdb_commandline": "mulle-gdb --interpreter=mi kitchen/Debug/MulleObjC",
"folders":
[
{
"path": ".",
"file_exclude_patterns":
[
"*~",
"*~.*",
"*.old",
"*.chk",
".DS_Store",
"._.DS_Store",
"*.sublime-workspace",
"tmp.*"
],
"folder_exclude_patterns": [
"package",
"stash",
"build",
"addiction",
"dependency",
"stash",
".mulle-*",
".git*",
"include",
"lib"
"folder_exclude_patterns":
[
".git",
".mulle/var",
".unison*",
"addiction",
"build",
"Build",
"kitchen",
"dependency",
"stash",
"var"
],
}
]
"binary_patterns":
[
"*.o",
"*.lib",
"*.log",
"*.a",
"*.so",
"*.exe",
"*.zip",
"*.tgz",
"*.bz2",
"*.xz",
"*.gif",
"*.png",
"*.jpg",
"*.tiff"
]
}
],
"build_systems":
[
{
"name": "Craft",
"cmd": [ "mulle-sde", "craft" ],
"working_dir": "${project_path}",
"file_regex": "^(..[^:]*)(?::|\\()([0-9]+)(?::|\\))(?:([0-9]+):)?\\s*(.*)",
"env": { "NO_COLOR": "YES" }
},
{
"name": "Craft Debug",
"cmd": [ "mulle-sde", "craft", "--debug" ],
"working_dir": "${project_path}",
"file_regex": "^(..[^:]*)(?::|\\()([0-9]+)(?::|\\))(?:([0-9]+):)?\\s*(.*)",
"env": { "NO_COLOR": "YES" }
},
{
"name": "Craft Release",
"cmd": [ "mulle-sde", "craft", "--release"],
"working_dir": "${project_path}",
"file_regex": "^(..[^:]*)(?::|\\()([0-9]+)(?::|\\))(?:([0-9]+):)?\\s*(.*)",
"env": { "NO_COLOR": "YES" }
},
{
"name": "Clean",
"cmd": [ "mulle-sde", "clean" ],
"working_dir": "${project_path}",
"file_regex": "^(..[^:]*)(?::|\\()([0-9]+)(?::|\\))(?:([0-9]+):)?\\s*(.*)",
"env": { "NO_COLOR": "YES" }
},
{
"name": "Clean Tidy",
"cmd": [ "mulle-sde", "clean", "tidy" ],
"working_dir": "${project_path}",
"file_regex": "^(..[^:]*)(?::|\\()([0-9]+)(?::|\\))(?:([0-9]+):)?\\s*(.*)",
"env": { "NO_COLOR": "YES" }
},
{
"name": "Clean Download Caches",
"cmd": [ "mulle-sde", "clean", "tidy", "archive", "mirror" ],
"working_dir": "${project_path}",
"file_regex": "^(..[^:]*)(?::|\\()([0-9]+)(?::|\\))(?:([0-9]+):)?\\s*(.*)",
"env": { "NO_COLOR": "YES" }
},
{
"name": "Reflect",
"cmd": [ "mulle-sde", "reflect" ],
"working_dir": "${project_path}",
"file_regex": "^(..[^:]*)(?::|\\()([0-9]+)(?::|\\))(?:([0-9]+):)?\\s*(.*)",
"env": { "NO_COLOR": "YES" }
},
{
"name": "Upgrade",
"cmd": [ "mulle-sde", "upgrade", "--clean" ],
"working_dir": "${project_path}",
"file_regex": "^(..[^:]*)(?::|\\()([0-9]+)(?::|\\))(?:([0-9]+):)?\\s*(.*)",
"env": { "NO_COLOR": "YES" }
},
]
}
2 changes: 1 addition & 1 deletion src/class/NSAutoreleasePool.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static inline void NSPopAutoreleasePool( NSAutoreleasePool *pool)


// the compiler will inline this directly
__attribute__((always_inline))
MULLE_C_ALWAYS_INLINE
static inline id NSAutoreleaseObject( id obj)
{
if( obj)
Expand Down
2 changes: 1 addition & 1 deletion src/class/NSAutoreleasePool.m
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ static inline void addObjects( struct _mulle_objc_poolconfiguration *config,
}
else
{
memcpy( &array->objects[ array->used], objects, sizeof( id) * amount);
mulle_id_copy( &array->objects[ array->used], objects, amount);
objects = &objects[ amount];
}

Expand Down
1 change: 1 addition & 0 deletions src/class/NSObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@

- (struct mulle_allocator *) mulleAllocator;
- (void) mullePerformFinalize;
- (BOOL) mulleIsFinalized;

// advanced Autorelease and ObjectGraph support

Expand Down
6 changes: 6 additions & 0 deletions src/class/NSObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ - (void) mullePerformFinalize
}


- (BOOL) mulleIsFinalized
{
return( _mulle_objc_object_is_finalized( self));
}


- (void) finalize
{
_MulleObjCInstanceClearProperties( self);
Expand Down
8 changes: 4 additions & 4 deletions src/function/MulleObjCAllocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static inline void MulleObjCClassDeallocateMemory( Class cls, void *p)

// resist the urge to add placeholder detection code here
// resist the urge to add _mulle_objc_class_setup here
__attribute__((returns_nonnull))
MULLE_C_NONNULL_RETURN
static inline id _MulleObjCClassAllocateInstance( Class infraCls, NSUInteger extra)
{
struct mulle_allocator *allocator;
Expand All @@ -212,7 +212,7 @@ static inline id _MulleObjCClassAllocateInstance( Class infraCls, NSUInteger
}


__attribute__((returns_nonnull))
MULLE_C_NONNULL_RETURN
static inline id _MulleObjCClassAllocateNonZeroedObject( Class infraCls,
NSUInteger extra)
{
Expand All @@ -233,7 +233,7 @@ void _MulleObjCInstanceFree( id obj);

// resist the urge to add placeholder detection code here
// resist the urge to add _mulle_objc_class_setup here
__attribute__((returns_nonnull))
MULLE_C_NONNULL_RETURN
static inline id _MulleObjCClassAllocateInstanceWithAllocator( Class infraCls,
NSUInteger extra,
struct mulle_allocator *allocator)
Expand All @@ -247,7 +247,7 @@ static inline id _MulleObjCClassAllocateInstanceWithAllocator( Class infraCls
}


__attribute__((returns_nonnull))
MULLE_C_NONNULL_RETURN
static inline id _MulleObjCClassAllocateNonZeroedObjectWithAllocator( Class infraCls,
NSUInteger extra,
struct mulle_allocator *allocator)
Expand Down
20 changes: 16 additions & 4 deletions src/function/MulleObjCFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@
#include "minimal.h"


MULLE_OBJC_GLOBAL
char *NSGetSizeAndAlignment( char *type, NSUInteger *size, NSUInteger *alignment);


#pragma mark - accessor shortcuts

// BOOL
Expand Down Expand Up @@ -1004,3 +1000,19 @@ static inline struct _mulle_objc_property *MulleObjCInstanceSearchProperty( id
(mulle_objc_propertyid_t) propertyid));
}



MULLE_OBJC_GLOBAL
char *NSGetSizeAndAlignment( char *type, NSUInteger *size, NSUInteger *alignment);


// fill buffer with description of memory, that is defined by type which
// is an @encode() string.
//
// example:
// double a[ 3] = { 0, 1, 2 };
// MulleObjCDescribeMemory( buffer, mulle_data_make( a, sizeof( a)), @encode( a));
//
BOOL MulleObjCDescribeMemory( struct mulle_buffer *buffer,
struct mulle_data data,
char *type);
Loading

0 comments on commit 50c4197

Please sign in to comment.