Skip to content
This repository was archived by the owner on May 27, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
map/map.xcodeproj/project.xcworkspace/xcuserdata
map/map.xcodeproj/xcuserdata
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,42 @@ while ((key = map_next(&m, &iter))) {
}
```

## Extended maps for structure type keys

A user-defined key from struct type is supported with three additional functions.

Where a user's key type is

```c
typedef struct myTypeS {
uint8_t a;
int b;
} myType;
```

The related functions and their use are as follows to add a map instance and mapping with the myType key

```c
const myType c = { 0x40, 125};

map_int_t m;
map_init(&m);

map_set_sk(&m, &a, sizeof(myType), 123);
```

To look that up, you'd use this function

```c
int *val = map_get_sk(&m, &c, sizeof(myType));
```

To remove by that key, there is the like remove key function

```c
map_remove_sk(&m, &c, sizeof(myType));
```

## License
This library is free software; you can redistribute it and/or modify it under
the terms of the MIT license. See [LICENSE](LICENSE) for details.
297 changes: 297 additions & 0 deletions map/map.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,297 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {

/* Begin PBXBuildFile section */
0F99D0D8249B7B4E00E1F2DC /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 0F99D0D7249B7B4E00E1F2DC /* main.c */; };
0F99D0E2249B7EBC00E1F2DC /* map.c in Sources */ = {isa = PBXBuildFile; fileRef = 0F99D0E0249B7EBC00E1F2DC /* map.c */; };
0F99D0E5249B8E1800E1F2DC /* mapsk.c in Sources */ = {isa = PBXBuildFile; fileRef = 0F99D0E3249B8E1800E1F2DC /* mapsk.c */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
0F99D0D2249B7B4E00E1F2DC /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
0F99D0D4249B7B4E00E1F2DC /* map */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = map; sourceTree = BUILT_PRODUCTS_DIR; };
0F99D0D7249B7B4E00E1F2DC /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
0F99D0DF249B7BD600E1F2DC /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
0F99D0E0249B7EBC00E1F2DC /* map.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = map.c; path = ../../src/map.c; sourceTree = "<group>"; };
0F99D0E1249B7EBC00E1F2DC /* map.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = map.h; path = ../../src/map.h; sourceTree = "<group>"; };
0F99D0E3249B8E1800E1F2DC /* mapsk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mapsk.c; path = ../../src/mapsk.c; sourceTree = "<group>"; };
0F99D0E4249B8E1800E1F2DC /* mapsk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mapsk.h; path = ../../src/mapsk.h; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
0F99D0D1249B7B4E00E1F2DC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
0F99D0CB249B7B4D00E1F2DC = {
isa = PBXGroup;
children = (
0F99D0DF249B7BD600E1F2DC /* README.md */,
0F99D0D6249B7B4E00E1F2DC /* map */,
0F99D0D5249B7B4E00E1F2DC /* Products */,
);
sourceTree = "<group>";
};
0F99D0D5249B7B4E00E1F2DC /* Products */ = {
isa = PBXGroup;
children = (
0F99D0D4249B7B4E00E1F2DC /* map */,
);
name = Products;
sourceTree = "<group>";
};
0F99D0D6249B7B4E00E1F2DC /* map */ = {
isa = PBXGroup;
children = (
0F99D0E3249B8E1800E1F2DC /* mapsk.c */,
0F99D0E4249B8E1800E1F2DC /* mapsk.h */,
0F99D0D7249B7B4E00E1F2DC /* main.c */,
0F99D0E0249B7EBC00E1F2DC /* map.c */,
0F99D0E1249B7EBC00E1F2DC /* map.h */,
);
path = map;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
0F99D0D3249B7B4E00E1F2DC /* map */ = {
isa = PBXNativeTarget;
buildConfigurationList = 0F99D0DB249B7B4E00E1F2DC /* Build configuration list for PBXNativeTarget "map" */;
buildPhases = (
0F99D0D0249B7B4E00E1F2DC /* Sources */,
0F99D0D1249B7B4E00E1F2DC /* Frameworks */,
0F99D0D2249B7B4E00E1F2DC /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = map;
productName = map;
productReference = 0F99D0D4249B7B4E00E1F2DC /* map */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
0F99D0CC249B7B4D00E1F2DC /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = "Kevin Peck";
TargetAttributes = {
0F99D0D3249B7B4E00E1F2DC = {
CreatedOnToolsVersion = 10.1;
};
};
};
buildConfigurationList = 0F99D0CF249B7B4D00E1F2DC /* Build configuration list for PBXProject "map" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 0F99D0CB249B7B4D00E1F2DC;
productRefGroup = 0F99D0D5249B7B4E00E1F2DC /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
0F99D0D3249B7B4E00E1F2DC /* map */,
);
};
/* End PBXProject section */

/* Begin PBXSourcesBuildPhase section */
0F99D0D0249B7B4E00E1F2DC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0F99D0E5249B8E1800E1F2DC /* mapsk.c in Sources */,
0F99D0E2249B7EBC00E1F2DC /* map.c in Sources */,
0F99D0D8249B7B4E00E1F2DC /* main.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
0F99D0D9249B7B4E00E1F2DC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
0F99D0DA249B7B4E00E1F2DC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
};
name = Release;
};
0F99D0DC249B7B4E00E1F2DC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = GYAG48J958;
HEADER_SEARCH_PATHS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
0F99D0DD249B7B4E00E1F2DC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = GYAG48J958;
HEADER_SEARCH_PATHS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
0F99D0CF249B7B4D00E1F2DC /* Build configuration list for PBXProject "map" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0F99D0D9249B7B4E00E1F2DC /* Debug */,
0F99D0DA249B7B4E00E1F2DC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
0F99D0DB249B7B4E00E1F2DC /* Build configuration list for PBXNativeTarget "map" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0F99D0DC249B7B4E00E1F2DC /* Debug */,
0F99D0DD249B7B4E00E1F2DC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 0F99D0CC249B7B4D00E1F2DC /* Project object */;
}

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Loading