Commit d35e5b3a by Jessica Hawkwell

Initial Commit

0 parents
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
CE5816BF1F72125400F8AB3C /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = CE5816BE1F72125400F8AB3C /* main.c */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
CE5816B91F72125400F8AB3C /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
CE5816BB1F72125400F8AB3C /* unicoder */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = unicoder; sourceTree = BUILT_PRODUCTS_DIR; };
CE5816BE1F72125400F8AB3C /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
CE5816B81F72125400F8AB3C /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
CE5816B21F72125400F8AB3C = {
isa = PBXGroup;
children = (
CE5816BD1F72125400F8AB3C /* unicoder */,
CE5816BC1F72125400F8AB3C /* Products */,
);
sourceTree = "<group>";
};
CE5816BC1F72125400F8AB3C /* Products */ = {
isa = PBXGroup;
children = (
CE5816BB1F72125400F8AB3C /* unicoder */,
);
name = Products;
sourceTree = "<group>";
};
CE5816BD1F72125400F8AB3C /* unicoder */ = {
isa = PBXGroup;
children = (
CE5816BE1F72125400F8AB3C /* main.c */,
);
path = unicoder;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
CE5816BA1F72125400F8AB3C /* unicoder */ = {
isa = PBXNativeTarget;
buildConfigurationList = CE5816C21F72125400F8AB3C /* Build configuration list for PBXNativeTarget "unicoder" */;
buildPhases = (
CE5816B71F72125400F8AB3C /* Sources */,
CE5816B81F72125400F8AB3C /* Frameworks */,
CE5816B91F72125400F8AB3C /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = unicoder;
productName = asciitable;
productReference = CE5816BB1F72125400F8AB3C /* unicoder */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
CE5816B31F72125400F8AB3C /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "StarPhoenix Media";
TargetAttributes = {
CE5816BA1F72125400F8AB3C = {
CreatedOnToolsVersion = 8.3.3;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = CE5816B61F72125400F8AB3C /* Build configuration list for PBXProject "unicoder" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = CE5816B21F72125400F8AB3C;
productRefGroup = CE5816BC1F72125400F8AB3C /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
CE5816BA1F72125400F8AB3C /* unicoder */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
CE5816B71F72125400F8AB3C /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
CE5816BF1F72125400F8AB3C /* main.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
CE5816C01F72125400F8AB3C /* 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++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = 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_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_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
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.12;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
CE5816C11F72125400F8AB3C /* 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++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = 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_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_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
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.12;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
};
name = Release;
};
CE5816C31F72125400F8AB3C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
CE5816C41F72125400F8AB3C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
CE5816B61F72125400F8AB3C /* Build configuration list for PBXProject "unicoder" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CE5816C01F72125400F8AB3C /* Debug */,
CE5816C11F72125400F8AB3C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
CE5816C21F72125400F8AB3C /* Build configuration list for PBXNativeTarget "unicoder" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CE5816C31F72125400F8AB3C /* Debug */,
CE5816C41F72125400F8AB3C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = CE5816B31F72125400F8AB3C /* Project object */;
}
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:/Users/jlhawkwell/Projects/asciitable/unicoder.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "asciitable/main.c"
timestampString = "527640168.468826"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "109"
endingLineNumber = "109"
landmarkName = "main"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CE5816BA1F72125400F8AB3C"
BuildableName = "unicoder"
BlueprintName = "unicoder"
ReferencedContainer = "container:unicoder.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CE5816BA1F72125400F8AB3C"
BuildableName = "unicoder"
BlueprintName = "unicoder"
ReferencedContainer = "container:unicoder.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CE5816BA1F72125400F8AB3C"
BuildableName = "unicoder"
BlueprintName = "unicoder"
ReferencedContainer = "container:unicoder.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "1FFFFF"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CE5816BA1F72125400F8AB3C"
BuildableName = "unicoder"
BlueprintName = "unicoder"
ReferencedContainer = "container:unicoder.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?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>SchemeUserState</key>
<dict>
<key>asciitable.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>CE5816BA1F72125400F8AB3C</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
//
// main.c
// asciitable
//
// Created by 😸 on 19 Sep 2017.
// Copyright © 2017 StarPhoenix Media. All rights reserved.
//
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void printer(char format[], int counter, char view[]) {
int cx = 0;
int sz = 0xffffffff & strlen(view);
printf(format, counter, counter, view, sz);
// print the byte values for the entire string
for ( cx = 0; cx < sz; cx++ ) {
printf(" %02x", 0xff & view[cx]);
}
printf("\n");
}
// get a mask without worrying about bit shifting
int shiftHelp(int input, int mask, int shift) {
int masker = mask << shift;
int value = (masker & input) >> shift;
return value;
}
char* int2utf8(int input) {
if (input <= 0x7f) { // simple ASCII equivalence
static char output[1];
char tmp = input;
output[0] = tmp;
return output;
}
else if (input <= 0x7ff) { // UTF-8 2-byte
static char output[2];
output[0] = 0xc0 + ((0x7c0 & input) >> 6);
output[1] = 0x80 + (0x3f & input);
return output;
}
else if (input <= 0xffff) { // UTF-8 3-byte
static char output[3];
output[0] = 0xe0 + shiftHelp(input, 0x0f, 12);
output[1] = 0x80 + shiftHelp(input, 0x3f, 6);
output[2] = 0x80 + (0x3f & input);
return output;
}
else if (input <= 0x1fffff) { // UTF-8 4-byte
static char output[4];
output[0] = 0xf0 + shiftHelp(input, 0x07, 18);
output[1] = 0x80 + shiftHelp(input, 0x3f, 12);
output[2] = 0x80 + shiftHelp(input, 0x3f, 6);
output[3] = 0x80 + (0x3f & input);
return output;
}
static char output[] = "Provided value too high! (> 0x1fffffff)";
return output;
}
int main(int argc, const char * argv[]) {
int counter = 0;
int start = 0;
int end = 0xff;
char *ptr;
if (argc == 2) { // single number provided
int number = 0x7fffffff & strtol(argv[1], &ptr, 16);
if ( number < 0 ) {
printf("Error: Range cannot be less than zero\n");
return -1;
}
printer("| %d | 0x%02x | %1s | (%d)>", number, int2utf8(number));
return 0;
}
else if (argc == 3) { // 2 numbers for a range
start = 0x7fffffff & strtol(argv[1], &ptr, 16);
end = 0x7fffffff & strtol(argv[2], &ptr, 16);
if ( (start < 0) || (end < 0) ) {
printf("Error: Range cannot be less than zero\n");
return -1;
}
// one of the args is a dash, indicating a fast range
if ( strcmp(argv[1], "-") == 0 ) { start = end - 0xf; }
if ( strcmp(argv[2], "-") == 0 ) { end = start + 0xf; }
}
// this is a convoluted way to get the length of a number
char lenInt[10];
char lenHex[10];
sprintf(lenInt, "%d", end);
sprintf(lenHex, "%x", end);
// note we have to do this twice
int iLen = 0xff & strlen(lenInt);
int xLen = 0xff & strlen(lenHex);
sprintf(lenInt, "%d", iLen);
sprintf(lenHex, "%d", xLen);
// build the format specification
char format[50] = "| %";
strcat(format, lenInt);
strcat(format, "d | 0x%0");
strcat(format, lenHex);
strcat(format, "x | %1s | (%d)> ");
printf("All characters from 0x%x to 0x%x\n", start, end);
for ( counter = start; counter <= end; counter++ ) {
if ( counter <= 0x20 ) { printer(format, counter, " "); }
else { printer(format, counter, int2utf8(counter)); }
}
return 0;
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!