├── autogen.sh ├── .travis.yml ├── Bombe ├── Makefile.am ├── BOMStack.h ├── BOMDefines.h ├── BOMTree.h ├── Bombe.h ├── BOMStore.h └── BOMStream.h ├── src ├── Makefile.am ├── BOMStack.c ├── Internal.h ├── BOMTree.c ├── BOMStream.c └── BOMStore.c ├── README.md ├── Bombe.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── project.pbxproj ├── Makefile.am ├── m4 ├── ltversion.m4 ├── ltsugar.m4 ├── lt~obsolete.m4 └── ltoptions.m4 ├── configure.ac ├── .gitignore └── LICENSE /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | autoreconf -fvi 3 | 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - ./autogen.sh 3 | 4 | language: c 5 | 6 | -------------------------------------------------------------------------------- /Bombe/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | 3 | bombedir=$(includedir)/Bombe 4 | 5 | bombe_HEADERS= 6 | BOMDefines.h \ 7 | Bombe.h \ 8 | Internal.h 9 | 10 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | 3 | lib_LTLIBRARIES=libBombe.la 4 | 5 | libBombe_la_SOURCES= 6 | BOMStream.c \ 7 | BOMStack.c \ 8 | BOMTree.c \ 9 | BOMStore.c 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/NUIKit/Bombe.svg?branch=master)](https://travis-ci.org/NUIKit/Bombe) 2 | 3 | # Bombe 4 | A library for manipulating Bill Of Materials and CAR files. 5 | 6 | -------------------------------------------------------------------------------- /Bombe.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | ACLOCAL_AMFLAGS = -I m4 3 | 4 | SUBDIRS= 5 | Bombe \ 6 | src \ 7 | test 8 | 9 | EXTRA_DIST= 10 | LICENSE \ 11 | autogen.sh \ 12 | config/config.h \ 13 | Bombe.xcodeproj 14 | 15 | test : ; 16 | -------------------------------------------------------------------------------- /Bombe/BOMStack.h: -------------------------------------------------------------------------------- 1 | // 2 | // BOMStack.h 3 | // Bombe 4 | // 5 | // Created by Robert Widmann on 2/15/15. 6 | // Copyright (c) 2015 CodaFi. All rights reserved. 7 | // 8 | 9 | #ifndef __BOMBE_STACK__ 10 | #define __BOMBE_STACK__ 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | typedef const struct __BOMStack * BOMStackRef; 18 | 19 | BOMBE_EXPORT 20 | BOMStackRef BOMStackNew(void); 21 | 22 | BOMBE_EXPORT 23 | void BOMStackFree(BOMStackRef stack); 24 | 25 | BOMBE_EXPORT 26 | void BOMStackPush(BOMStackRef stack, void *item); 27 | 28 | BOMBE_EXPORT 29 | void *BOMStackPop(BOMStackRef stack); 30 | 31 | BOMBE_EXPORT 32 | bool BOMStackIsEmpty(BOMStackRef stack); 33 | 34 | BOMBE_EXPORT 35 | int32_t BOMStackCount(BOMStackRef stack); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 4179 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.6]) 16 | m4_define([LT_PACKAGE_REVISION], [2.4.6]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.6' 20 | macro_revision='2.4.6' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /Bombe/BOMDefines.h: -------------------------------------------------------------------------------- 1 | // 2 | // Defines.h 3 | // Bombe 4 | // 5 | // Created by Robert Widmann on 2/6/15. 6 | // Copyright (c) 2015 CodaFi. All rights reserved. 7 | // 8 | 9 | #ifndef __BOMBE_DEFINES__ 10 | #define __BOMBE_DEFINES__ 11 | 12 | #if defined(__cplusplus) 13 | #define BOMBE_EXPORT extern "C" extern __declspec(dllexport) 14 | #elif __GNUC__ 15 | #define BOMBE_EXPORT extern __attribute__((visibility("default"))) 16 | #else 17 | #define BOMBE_EXPORT extern 18 | #endif 19 | 20 | #if __GNUC__ 21 | #define BOMBE_INLINE static __inline__ 22 | #else 23 | #define BOMBE_INLINE static inline 24 | #endif 25 | 26 | #if __GNUC__ 27 | #define BOMBE_EXPECT(x, v) __builtin_expect((x), (v)) 28 | #else 29 | #define BOMBE_EXPECT(x, v) (x) 30 | #endif 31 | 32 | #define BOMAssert(e, MSG) \ 33 | do { \ 34 | typeof(e) _e = ((typeof(e))__builtin_expect((long)(e), ~0l)); \ 35 | if (!_e) { \ 36 | abort(); \ 37 | } \ 38 | } while (0) 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | AC_PREREQ(2.59) 2 | AC_INIT([libBombe], [0.1], [devteam.codafi@gmail.com], [libBombe]) 3 | AC_REVISION([$$]) 4 | AC_CONFIG_AUX_DIR(config) 5 | AC_CONFIG_HEADER([config/config.h]) 6 | ac_clean_files=a.out.dSYM 7 | AM_MAINTAINER_MODE 8 | 9 | AC_PROG_CC([clang gcc cc]) 10 | AC_PROG_CXX([clang++ g++ c++]) 11 | AC_PROG_OBJC([clang gcc cc]) 12 | 13 | AC_USE_SYSTEM_EXTENSIONS 14 | AM_INIT_AUTOMAKE([foreign no-dependencies]) 15 | LT_INIT([disable-static]) 16 | 17 | # 18 | ## Checks for header files. 19 | # 20 | AC_HEADER_STDC 21 | AC_CHECK_HEADERS([TargetConditionals.h fcntl.h malloc/malloc.h libkern/OSCrossEndian.h libkern/OSAtomic.h]) 22 | 23 | # 24 | ## Checks for mach. 25 | # 26 | AC_CHECK_HEADER([mach/mach.h], [ 27 | AC_DEFINE(HAVE_MACH, 1, [Define if mach is present]) 28 | have_mach=true], [have_mach=false] 29 | ) 30 | 31 | # 32 | ## Generate Makefiles. 33 | # 34 | AC_CONFIG_FILES([Makefile Bombe/Makefile src/Makefile]) 35 | AC_OUTPUT 36 | 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | .DS_Store 4 | build/ 5 | *.pbxuser 6 | !default.pbxuser 7 | *.mode1v3 8 | !default.mode1v3 9 | *.mode2v3 10 | !default.mode2v3 11 | *.perspectivev3 12 | !default.perspectivev3 13 | xcuserdata 14 | *.xccheckout 15 | *.moved-aside 16 | DerivedData 17 | *.hmap 18 | *.ipa 19 | *.xcuserstate 20 | 21 | *.lo 22 | *.o 23 | *.la 24 | config.* 25 | .deps 26 | .libs 27 | 28 | # http://www.gnu.org/software/automake 29 | 30 | Makefile.in 31 | CMakeCache.txt 32 | CMakeFiles 33 | Makefile 34 | libtool 35 | cmake_install.cmake 36 | install_manifest.txt 37 | 38 | # http://www.gnu.org/software/autoconf 39 | 40 | /autom4te.cache 41 | /aclocal.m4 42 | /compile 43 | /config 44 | /configure 45 | /depcomp 46 | /install-sh 47 | /missing 48 | /stamp-h1 49 | 50 | # CocoaPods 51 | # 52 | # We recommend against adding the Pods directory to your .gitignore. However 53 | # you should judge for yourself, the pros and cons are mentioned at: 54 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 55 | # 56 | #Pods/ 57 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/BOMStack.c: -------------------------------------------------------------------------------- 1 | // 2 | // BOMStack.c 3 | // Bombe 4 | // 5 | // Created by Robert Widmann on 2/15/15. 6 | // Copyright (c) 2015 CodaFi. All rights reserved. 7 | // 8 | 9 | #include "BOMStack.h" 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | struct __BOMStack { 16 | void **buf; 17 | int32_t maxSize; 18 | int32_t count; 19 | }; 20 | 21 | BOMStackRef BOMStackNew(void) { 22 | struct __BOMStack *stack = malloc(sizeof(struct __BOMStack)); 23 | if (stack != NULL) { 24 | stack->maxSize = 1024; 25 | stack->buf = malloc(stack->maxSize * sizeof(void *)); 26 | if (stack->buf == NULL) { 27 | free(stack); 28 | return NULL; 29 | } 30 | } 31 | return stack; 32 | } 33 | 34 | void BOMStackFree(BOMStackRef stk) { 35 | struct __BOMStack *stack = (struct __BOMStack *)stk; 36 | 37 | free(stack->buf); 38 | free(stack); 39 | } 40 | 41 | void BOMStackPush(BOMStackRef stk, void *r14) { 42 | struct __BOMStack *stack = (struct __BOMStack *)stk; 43 | 44 | void **buffer = NULL; 45 | if (stack->count + 1 < stack->maxSize) { 46 | buffer = stack->buf; 47 | } else { 48 | stack->maxSize *= 2; 49 | buffer = realloc(stack->buf, stack->maxSize * sizeof(void *)); 50 | } 51 | buffer[stack->count++] = r14; 52 | stack->buf = buffer; 53 | } 54 | 55 | void *BOMStackPop(BOMStackRef stk) { 56 | struct __BOMStack *stack = (struct __BOMStack *)stk; 57 | 58 | if (stack != NULL && stack->count > 0) { 59 | return stack->buf[stack->count--]; 60 | } 61 | return NULL; 62 | } 63 | 64 | bool BOMStackIsEmpty(BOMStackRef stack) { 65 | return stack->count <= 0; 66 | } 67 | 68 | int32_t BOMStackCount(BOMStackRef stack) { 69 | if (stack != NULL) { 70 | return stack->count; 71 | } 72 | return 0; 73 | } 74 | 75 | -------------------------------------------------------------------------------- /src/Internal.h: -------------------------------------------------------------------------------- 1 | // 2 | // Internal.h 3 | // Bombe 4 | // 5 | // Created by Robert Widmann on 2/6/15. 6 | // Copyright (c) 2015 CodaFi. All rights reserved. 7 | // 8 | 9 | #ifndef __BOMBE_INTERNAL__ 10 | #define __BOMBE_INTERNAL__ 11 | 12 | #include 13 | 14 | #if HAVE_LIBKERN_OSCROSSENDIAN_H 15 | #include 16 | #endif 17 | #if HAVE_LIBKERN_OSATOMIC_H 18 | #include 19 | #endif 20 | #if HAVE_MACH 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #endif /* HAVE_MACH */ 39 | #if HAVE_MALLOC_MALLOC_H 40 | #include 41 | #endif 42 | 43 | #include 44 | 45 | #if !TARGET_OS_WIN32 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #else 55 | #include "sys_queue.h" 56 | #endif 57 | 58 | #include 59 | #include 60 | #if HAVE_FCNTL_H 61 | #include 62 | #endif 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #if HAVE_UNISTD_H 73 | #include 74 | #endif 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /Bombe/BOMTree.h: -------------------------------------------------------------------------------- 1 | // 2 | // BOMTree.h 3 | // Bombe 4 | // 5 | // Created by Robert Widmann on 2/7/15. 6 | // Copyright (c) 2015 CodaFi. All rights reserved. 7 | // 8 | 9 | /* 10 | * +-------------------------------------+ 11 | * | | 12 | * | TREE | 13 | * | ---- | 14 | * | | 15 | * | 8 magic | 16 | * | 32 version | 17 | * | ? Root Node | 18 | * | | | 19 | * | / \ | 20 | * | / \ | 21 | * | File Node | 22 | * | | | 23 | * | / \ | 24 | * | / \ | 25 | * | File File | 26 | * +-------------------------------------+ 27 | * 28 | * Fig. 2. A tree is a named block in the table of contents of a BOM file that points to a number 29 | * of paths and files. A tree is comprised of nodes that either point to file paths if they 30 | * reside at a leaf, or point to another node if they sit at a branch. 31 | */ 32 | 33 | #ifndef __BOMBE_BOMTREE__ 34 | #define __BOMBE_BOMTREE__ 35 | 36 | #include 37 | #include 38 | 39 | /// The type of BOM trees. 40 | typedef const struct __BOMTree * BOMTreeRef; 41 | 42 | /// Creates a new tree that loads a named entry in the table of contents in the given BOM store. 43 | /// 44 | /// If the named block does not exist in the store, the result is NULL. 45 | BOMBE_EXPORT 46 | BOMTreeRef BOMTreeCreateTraversingPath(BOMStoreRef store, const char *name); 47 | 48 | /// Releases a tree and its associated nodes and resources. 49 | BOMBE_EXPORT 50 | void BOMTreeFree(BOMTreeRef tree); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /Bombe/Bombe.h: -------------------------------------------------------------------------------- 1 | // 2 | // Bombe.h 3 | // Bombe 4 | // 5 | // Created by Robert Widmann on 2/6/15. 6 | // Copyright (c) 2015 CodaFi. All rights reserved. 7 | // 8 | 9 | #ifndef __BOMBE_PUBLIC__ 10 | #define __BOMBE_PUBLIC__ 11 | 12 | #ifdef __APPLE__ 13 | #include 14 | #include 15 | #endif 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #endif 24 | 25 | /* 26 | * +-------------------------------------------------+ 27 | * | BOM | 28 | * +-------------------------------------------------+ 29 | * | | 30 | * | HEADER | 31 | * | ------ | 32 | * | | 33 | * | 8 magic - 'BOMStore' | 34 | * | 32 version - 1 | 35 | * | 32 block count - "73" | 36 | * | 32 index offset - | 37 | * | 32 index length - | 38 | * | 32 table of contents offset - | 39 | * | 32 table of contents size - | 40 | * | | 41 | * +-------------------------------------------------+ 42 | * | Index | 43 | * +-------------------------------------------------+ 44 | * | Block 1 | 45 | * | | 46 | * | 32 index | 47 | * | 8 name length | 48 | * | ? name | 49 | * +-------------------------------------------------+ 50 | * | Block 2 | 51 | * +-------------------------------------------------+ 52 | * | ... | 53 | * +-------------------------------------------------+ 54 | * | Block n | 55 | * +-------------------------------------------------+ 56 | */ 57 | -------------------------------------------------------------------------------- /Bombe/BOMStore.h: -------------------------------------------------------------------------------- 1 | // 2 | // BOMStore.h 3 | // Bombe 4 | // 5 | // Created by Robert Widmann on 2/6/15. 6 | // Copyright (c) 2015 CodaFi. All rights reserved. 7 | // 8 | 9 | 10 | /* 11 | * +-------------------------------------+ 12 | * | | 13 | * | HEADER | 14 | * | ------ | 15 | * | | 16 | * | 8 magic | 17 | * | 32 version | 18 | * | 32 block count | 19 | * | 32 index offset | 20 | * | 32 index length | 21 | * | 32 table of contents offset | 22 | * | 32 table of contents size | 23 | * | | 24 | * +-------------------------------------+ 25 | * 26 | * Fig. 1. The BOM header begins with a magic number, spelling 'BOMStore', followed by a version 27 | * number. After that we are given the number of blocks present in the index, the offset 28 | * at which to find such blocks, and the total length of the blocks section. Each block is 29 | * a pointer into the BOM file to some chunk of data for an asset. After that comes the 30 | * Table of Contents offset and size. Entries in the table of contents are blocks, but they 31 | * also include a name that can be looked up. 32 | */ 33 | 34 | 35 | #ifndef __BOMBE_STORE__ 36 | #define __BOMBE_STORE__ 37 | 38 | #include 39 | 40 | #include 41 | #include 42 | 43 | /// The type of references to immutable BOM Stores. 44 | typedef const struct __BOMStore * BOMStoreRef; 45 | 46 | /// The type of references to mutable BOM Stores. 47 | typedef struct __BOMStore * BOMMutableStoreRef; 48 | 49 | typedef struct __BOMBlock { 50 | uint32_t index; 51 | uint32_t size; 52 | } BOMBlock; 53 | 54 | /// Creates an immutable store from the BOM file at a given path. 55 | BOMBE_EXPORT 56 | BOMStoreRef BOMStoreCreateWithPath(const char *path); 57 | 58 | /// Frees a store and its associated resources. 59 | BOMBE_EXPORT 60 | void BOMStoreFree(BOMStoreRef store); 61 | 62 | /// Gets a block entry in the table of contents with the given name. 63 | BOMBE_EXPORT 64 | bool BOMStoreGetBlockWithName(BOMStoreRef sto, const char *name, BOMBlock *outBlock); 65 | 66 | /// Returns the size of a given block in the store. 67 | /// 68 | /// If the block does not exist, or it resides at an invalid index, the result will be 0. 69 | BOMBE_EXPORT 70 | uint32_t BOMStoreGetBlockSize(BOMStoreRef sto, BOMBlock block); 71 | 72 | /// Returns the data associated with a given block. 73 | /// 74 | /// It is the responsibility of the caller to release the pointer given by this function. 75 | BOMBE_EXPORT 76 | void *BOMStoreCopyBlockData(BOMStoreRef sto, BOMBlock block); 77 | 78 | 79 | /// Creates a mutable store from the BOM file at a given path. 80 | BOMBE_EXPORT 81 | BOMMutableStoreRef BOMStoreCreateMutableWithPath(const char *path); 82 | 83 | /// Creates and adds a new empty block to the BOM store. The result of this function is the Block 84 | /// ID of the added block. 85 | BOMBE_EXPORT 86 | uint32_t BOMStoreCreateNewBlock(BOMMutableStoreRef sto); 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /src/BOMTree.c: -------------------------------------------------------------------------------- 1 | // 2 | // BOMTree.c 3 | // Bombe 4 | // 5 | // Created by Robert Widmann on 2/7/15. 6 | // Copyright (c) 2015 CodaFi. All rights reserved. 7 | // 8 | 9 | #include "BOMTree.h" 10 | #include "BOMStore.h" 11 | #include "BOMStream.h" 12 | #include "BOMStack.h" 13 | #include "Internal.h" 14 | 15 | #include 16 | 17 | typedef struct BOMTreeNode { 18 | uint32_t blockID; 19 | int16_t isLeaf; 20 | int32_t nextNode; 21 | int32_t previousNode; 22 | int16_t count; 23 | 24 | uint32_t *paths; 25 | uint32_t *files; 26 | } *BOMTreeNodeRef; 27 | 28 | struct __BOMTree { 29 | BOMStoreRef storage; 30 | char *path; 31 | BOMBlock block; 32 | uint32_t blockSize; 33 | uint32_t pathCount; 34 | uint8_t unknown; 35 | 36 | BOMTreeNodeRef rootNode; 37 | }; 38 | 39 | static BOMTreeNodeRef BOMTreeNodeCreateWithBlockID(BOMTreeRef tree, uint32_t blockID); 40 | 41 | BOMTreeRef BOMTreeCreateTraversingPath(BOMStoreRef store, const char *name) { 42 | if (store == NULL || name == NULL) { 43 | return NULL; 44 | } 45 | 46 | BOMBlock block; 47 | if (!BOMStoreGetBlockWithName(store, name, &block)) { 48 | return NULL; 49 | } 50 | 51 | struct __BOMTree *tree = malloc(sizeof(struct __BOMTree)); 52 | if (tree == NULL) { 53 | return NULL; 54 | } 55 | 56 | tree->storage = store; 57 | tree->block = block; 58 | 59 | if (name != NULL) { 60 | tree->path = strdup(name); 61 | } 62 | 63 | BOMStreamRef stream = BOMStreamCreateWithBlockID(store, block, 0); 64 | if (stream == NULL) { 65 | BOMTreeFree(tree); 66 | return NULL; 67 | } 68 | 69 | uint32_t magic; 70 | BOMStreamReadUInt32(stream, &magic); 71 | 72 | if (magic != 'tree') { 73 | BOMTreeFree(tree); 74 | return NULL; 75 | } 76 | 77 | uint32_t version; 78 | BOMStreamReadUInt32(stream, &version); 79 | 80 | if (version != 1) { 81 | BOMTreeFree(tree); 82 | return NULL; 83 | } 84 | 85 | uint32_t children, blockSize, pathCount; 86 | uint8_t unknown; 87 | BOMStreamReadUInt32(stream, &children); 88 | BOMStreamReadUInt32(stream, &blockSize); 89 | BOMStreamReadUInt32(stream, &pathCount); 90 | BOMStreamReadUInt8(stream, &unknown); 91 | 92 | tree->blockSize = blockSize; 93 | tree->pathCount = ntohl(pathCount); 94 | tree->unknown = unknown; 95 | 96 | BOMStreamFree(stream); 97 | 98 | tree->rootNode = BOMTreeNodeCreateWithBlockID(tree, children); 99 | 100 | return (BOMTreeRef)tree; 101 | } 102 | 103 | BOMTreeNodeRef BOMTreeNodeCreateWithBlockID(BOMTreeRef tree, uint32_t blockID) { 104 | uint32_t *pathBuf = malloc((tree->pathCount + 1) * sizeof(uint32_t)); 105 | if (pathBuf == NULL) { 106 | return NULL; 107 | } 108 | 109 | 110 | uint32_t *filesBuf = malloc((tree->pathCount + 2) * sizeof(uint32_t)); 111 | if (filesBuf == NULL) { 112 | free(pathBuf); 113 | return NULL; 114 | } 115 | 116 | struct BOMTreeNode *freshPage = calloc(1, sizeof(struct BOMTreeNode)); 117 | if (freshPage == NULL) { 118 | free(filesBuf); 119 | free(pathBuf); 120 | return NULL; 121 | } 122 | 123 | if (blockID == 0) { 124 | blockID = BOMStoreCreateNewBlock((BOMMutableStoreRef)tree->storage); 125 | } 126 | 127 | freshPage->paths = pathBuf; 128 | freshPage->files = filesBuf; 129 | freshPage->blockID = blockID; 130 | 131 | return freshPage; 132 | } 133 | 134 | void BOMTreeFree(BOMTreeRef t) { 135 | struct __BOMTree *tree = (struct __BOMTree *)t; 136 | if (tree == NULL) { 137 | return; 138 | } 139 | 140 | free(tree->path); 141 | free(tree); 142 | } 143 | -------------------------------------------------------------------------------- /m4/ltsugar.m4: -------------------------------------------------------------------------------- 1 | # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- 2 | # 3 | # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software 4 | # Foundation, Inc. 5 | # Written by Gary V. Vaughan, 2004 6 | # 7 | # This file is free software; the Free Software Foundation gives 8 | # unlimited permission to copy and/or distribute it, with or without 9 | # modifications, as long as this notice is preserved. 10 | 11 | # serial 6 ltsugar.m4 12 | 13 | # This is to help aclocal find these macros, as it can't see m4_define. 14 | AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) 15 | 16 | 17 | # lt_join(SEP, ARG1, [ARG2...]) 18 | # ----------------------------- 19 | # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their 20 | # associated separator. 21 | # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier 22 | # versions in m4sugar had bugs. 23 | m4_define([lt_join], 24 | [m4_if([$#], [1], [], 25 | [$#], [2], [[$2]], 26 | [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) 27 | m4_define([_lt_join], 28 | [m4_if([$#$2], [2], [], 29 | [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) 30 | 31 | 32 | # lt_car(LIST) 33 | # lt_cdr(LIST) 34 | # ------------ 35 | # Manipulate m4 lists. 36 | # These macros are necessary as long as will still need to support 37 | # Autoconf-2.59, which quotes differently. 38 | m4_define([lt_car], [[$1]]) 39 | m4_define([lt_cdr], 40 | [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], 41 | [$#], 1, [], 42 | [m4_dquote(m4_shift($@))])]) 43 | m4_define([lt_unquote], $1) 44 | 45 | 46 | # lt_append(MACRO-NAME, STRING, [SEPARATOR]) 47 | # ------------------------------------------ 48 | # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. 49 | # Note that neither SEPARATOR nor STRING are expanded; they are appended 50 | # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). 51 | # No SEPARATOR is output if MACRO-NAME was previously undefined (different 52 | # than defined and empty). 53 | # 54 | # This macro is needed until we can rely on Autoconf 2.62, since earlier 55 | # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. 56 | m4_define([lt_append], 57 | [m4_define([$1], 58 | m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) 59 | 60 | 61 | 62 | # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) 63 | # ---------------------------------------------------------- 64 | # Produce a SEP delimited list of all paired combinations of elements of 65 | # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list 66 | # has the form PREFIXmINFIXSUFFIXn. 67 | # Needed until we can rely on m4_combine added in Autoconf 2.62. 68 | m4_define([lt_combine], 69 | [m4_if(m4_eval([$# > 3]), [1], 70 | [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl 71 | [[m4_foreach([_Lt_prefix], [$2], 72 | [m4_foreach([_Lt_suffix], 73 | ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, 74 | [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) 75 | 76 | 77 | # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) 78 | # ----------------------------------------------------------------------- 79 | # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited 80 | # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. 81 | m4_define([lt_if_append_uniq], 82 | [m4_ifdef([$1], 83 | [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], 84 | [lt_append([$1], [$2], [$3])$4], 85 | [$5])], 86 | [lt_append([$1], [$2], [$3])$4])]) 87 | 88 | 89 | # lt_dict_add(DICT, KEY, VALUE) 90 | # ----------------------------- 91 | m4_define([lt_dict_add], 92 | [m4_define([$1($2)], [$3])]) 93 | 94 | 95 | # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) 96 | # -------------------------------------------- 97 | m4_define([lt_dict_add_subkey], 98 | [m4_define([$1($2:$3)], [$4])]) 99 | 100 | 101 | # lt_dict_fetch(DICT, KEY, [SUBKEY]) 102 | # ---------------------------------- 103 | m4_define([lt_dict_fetch], 104 | [m4_ifval([$3], 105 | m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), 106 | m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) 107 | 108 | 109 | # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) 110 | # ----------------------------------------------------------------- 111 | m4_define([lt_if_dict_fetch], 112 | [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], 113 | [$5], 114 | [$6])]) 115 | 116 | 117 | # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) 118 | # -------------------------------------------------------------- 119 | m4_define([lt_dict_filter], 120 | [m4_if([$5], [], [], 121 | [lt_join(m4_quote(m4_default([$4], [[, ]])), 122 | lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), 123 | [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl 124 | ]) 125 | -------------------------------------------------------------------------------- /Bombe/BOMStream.h: -------------------------------------------------------------------------------- 1 | // 2 | // BOMStream.h 3 | // Bombe 4 | // 5 | // Created by Robert Widmann on 2/6/15. 6 | // Copyright (c) 2015 CodaFi. All rights reserved. 7 | // 8 | 9 | #ifndef __BOMBE_STREAM__ 10 | #define __BOMBE_STREAM__ 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | /// The byte order a stream can have. 19 | typedef enum { 20 | /// The stream's byte order is unknown. 21 | BOMStreamByteOrderNone = 0, 22 | /// The stream is little endian. 23 | BOMStreamByteOrderLittleEndian = 1, 24 | /// The stream is big endian. 25 | BOMStreamByteOrderBigEndian = 2, 26 | } BOMStreamByteOrder; 27 | 28 | /// The types of bytes a stream represents. 29 | typedef enum { 30 | /// The stream represents a block ID in a BOM file. 31 | BOMStreamTypeBlockID = 0, 32 | /// The stream represents a file. 33 | BOMStreamTypeFile = 1, 34 | /// The stream represents a buffer. 35 | BOMStreamTypeBuffer = 2, 36 | } BOMStreamType; 37 | 38 | /// The type of streams. 39 | typedef struct __BOMStream * const BOMStreamRef; 40 | 41 | /// Creates a stream that can traverse a buffer of a given size. 42 | BOMBE_EXPORT 43 | BOMStreamRef BOMStreamCreateWithBuffer(void *buffer, size_t size); 44 | 45 | /// Creates a stream that can traverse the contents of a file of a given size. 46 | BOMBE_EXPORT 47 | BOMStreamRef BOMStreamCreateWithFileDescriptor(int fd, size_t size); 48 | 49 | /// Creates a stream that can traverse the contents of a block. 50 | BOMBE_EXPORT 51 | BOMStreamRef BOMStreamCreateWithBlockID(BOMStoreRef sto, BOMBlock block, uint32_t blockID); 52 | 53 | /// Writes the bytes from a stream that represent files to memory. 54 | BOMBE_EXPORT 55 | bool BOMStreamFlush(BOMStreamRef stream); 56 | 57 | /// Frees a stream and its associated resources. 58 | BOMBE_EXPORT 59 | void BOMStreamFree(BOMStreamRef stream); 60 | 61 | /// Gets the byte order of a stream. 62 | BOMBE_EXPORT 63 | BOMStreamByteOrder BOMStreamGetByteOrder(BOMStreamRef stream); 64 | 65 | 66 | /// Reads a given amount of bytes from a stream into a buffer. 67 | BOMBE_EXPORT 68 | bool BOMStreamRead(BOMStreamRef str, void *ptr, size_t size); 69 | 70 | /// Writes a given amount of bytes from a buffer into a stream. 71 | BOMBE_EXPORT 72 | bool BOMStreamWrite(BOMStreamRef str, const void *buf, size_t size); 73 | 74 | /// Advances the offset of a stream by a given number of bytes. 75 | BOMBE_EXPORT 76 | bool BOMStreamAdvance(BOMStreamRef str, size_t offset); 77 | 78 | /// Sets the pointer into the stream. 79 | BOMBE_EXPORT 80 | bool BOMStreamSeek(BOMStreamRef str, size_t pos, size_t offset); 81 | 82 | 83 | /// Reads an integer from the stream. 84 | BOMBE_EXPORT 85 | bool BOMStreamReadUInt8(BOMStreamRef stream, uint8_t *to); 86 | 87 | /// Reads an integer from the stream. 88 | BOMBE_EXPORT 89 | bool BOMStreamReadInt8(BOMStreamRef stream, int8_t *to); 90 | 91 | /// Reads an integer from the stream. 92 | BOMBE_EXPORT 93 | bool BOMStreamReadUInt16(BOMStreamRef stream, uint16_t *to); 94 | 95 | /// Reads an integer from the stream. 96 | BOMBE_EXPORT 97 | bool BOMStreamReadInt16(BOMStreamRef stream, int16_t *to); 98 | 99 | /// Reads an integer from the stream. 100 | BOMBE_EXPORT 101 | bool BOMStreamReadUInt32(BOMStreamRef stream, uint32_t *to); 102 | 103 | /// Reads an integer from the stream. 104 | BOMBE_EXPORT 105 | bool BOMStreamReadInt32(BOMStreamRef stream, int32_t *to); 106 | 107 | /// Reads an integer from the stream. 108 | BOMBE_EXPORT 109 | bool BOMStreamReadUInt64(BOMStreamRef stream, uint64_t *to); 110 | 111 | /// Reads an integer from the stream. 112 | BOMBE_EXPORT 113 | bool BOMStreamReadInt64(BOMStreamRef stream, int64_t *to); 114 | 115 | /// Reads a float from the stream. 116 | BOMBE_EXPORT 117 | bool BOMStreamReadFloat(BOMStreamRef stream, float *to); 118 | 119 | /// Reads a double from the stream. 120 | BOMBE_EXPORT 121 | bool BOMStreamReadDouble(BOMStreamRef stream, double *to); 122 | 123 | 124 | /// Writes an integer into the stream. 125 | BOMBE_EXPORT 126 | bool BOMStreamWriteUInt8(BOMStreamRef stream, const uint8_t from); 127 | 128 | /// Writes an integer into the stream. 129 | BOMBE_EXPORT 130 | bool BOMStreamWriteInt8(BOMStreamRef stream, const int8_t from); 131 | 132 | /// Writes an integer into the stream. 133 | BOMBE_EXPORT 134 | bool BOMStreamWriteUInt16(BOMStreamRef stream, const uint16_t from); 135 | 136 | /// Writes an integer into the stream. 137 | BOMBE_EXPORT 138 | bool BOMStreamWriteInt16(BOMStreamRef stream, const int16_t from); 139 | 140 | /// Writes an integer into the stream. 141 | BOMBE_EXPORT 142 | bool BOMStreamWriteUInt32(BOMStreamRef stream, const uint32_t from); 143 | 144 | /// Writes an integer into the stream. 145 | BOMBE_EXPORT 146 | bool BOMStreamWriteInt32(BOMStreamRef stream, const int32_t from); 147 | 148 | /// Writes an integer into the stream. 149 | BOMBE_EXPORT 150 | bool BOMStreamWriteUInt64(BOMStreamRef stream, const uint64_t from); 151 | 152 | /// Writes an integer into the stream. 153 | BOMBE_EXPORT 154 | bool BOMStreamWriteInt64(BOMStreamRef stream, const int64_t from); 155 | 156 | /// Writes a float into the stream. 157 | BOMBE_EXPORT 158 | bool BOMStreamWriteFloat(BOMStreamRef stream, const float from); 159 | 160 | /// Writes a double into the stream. 161 | BOMBE_EXPORT 162 | bool BOMStreamWriteDouble(BOMStreamRef stream, const double from); 163 | 164 | #endif 165 | -------------------------------------------------------------------------------- /m4/lt~obsolete.m4: -------------------------------------------------------------------------------- 1 | # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- 2 | # 3 | # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software 4 | # Foundation, Inc. 5 | # Written by Scott James Remnant, 2004. 6 | # 7 | # This file is free software; the Free Software Foundation gives 8 | # unlimited permission to copy and/or distribute it, with or without 9 | # modifications, as long as this notice is preserved. 10 | 11 | # serial 5 lt~obsolete.m4 12 | 13 | # These exist entirely to fool aclocal when bootstrapping libtool. 14 | # 15 | # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), 16 | # which have later been changed to m4_define as they aren't part of the 17 | # exported API, or moved to Autoconf or Automake where they belong. 18 | # 19 | # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN 20 | # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us 21 | # using a macro with the same name in our local m4/libtool.m4 it'll 22 | # pull the old libtool.m4 in (it doesn't see our shiny new m4_define 23 | # and doesn't know about Autoconf macros at all.) 24 | # 25 | # So we provide this file, which has a silly filename so it's always 26 | # included after everything else. This provides aclocal with the 27 | # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything 28 | # because those macros already exist, or will be overwritten later. 29 | # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 30 | # 31 | # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. 32 | # Yes, that means every name once taken will need to remain here until 33 | # we give up compatibility with versions before 1.7, at which point 34 | # we need to keep only those names which we still refer to. 35 | 36 | # This is to help aclocal find these macros, as it can't see m4_define. 37 | AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) 38 | 39 | m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) 40 | m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) 41 | m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) 42 | m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) 43 | m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) 44 | m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) 45 | m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) 46 | m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) 47 | m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) 48 | m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) 49 | m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) 50 | m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) 51 | m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) 52 | m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) 53 | m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) 54 | m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) 55 | m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) 56 | m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) 57 | m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) 58 | m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) 59 | m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) 60 | m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) 61 | m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) 62 | m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) 63 | m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) 64 | m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) 65 | m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) 66 | m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) 67 | m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) 68 | m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) 69 | m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) 70 | m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) 71 | m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) 72 | m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) 73 | m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) 74 | m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) 75 | m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) 76 | m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) 77 | m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) 78 | m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) 79 | m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) 80 | m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) 81 | m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) 82 | m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) 83 | m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) 84 | m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) 85 | m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) 86 | m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) 87 | m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) 88 | m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) 89 | m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) 90 | m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) 91 | m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) 92 | m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) 93 | m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) 94 | m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) 95 | m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) 96 | m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) 97 | m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) 98 | m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) 99 | m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) 100 | -------------------------------------------------------------------------------- /src/BOMStream.c: -------------------------------------------------------------------------------- 1 | // 2 | // BOMStream.c 3 | // Bombe 4 | // 5 | // Created by Robert Widmann on 2/6/15. 6 | // Copyright (c) 2015 CodaFi. All rights reserved. 7 | // 8 | 9 | #include "BOMStream.h" 10 | #include "Internal.h" 11 | 12 | struct __BOMStream { 13 | int fd; 14 | uint32_t blockID; 15 | BOMStreamType type; 16 | BOMStreamByteOrder byteOrder; 17 | void *buf; 18 | size_t size; 19 | size_t pos; 20 | bool dirty; 21 | }; 22 | 23 | BOMStreamRef BOMStreamCreateWithBuffer(void *buffer, size_t size) { 24 | if (buffer == NULL) { 25 | return NULL; 26 | } 27 | 28 | struct __BOMStream *stream = malloc(sizeof(struct __BOMStream)); 29 | if (stream == NULL) { 30 | return NULL; 31 | } 32 | 33 | stream->fd = -1; 34 | stream->blockID = 0; 35 | stream->type = BOMStreamTypeBuffer; 36 | stream->byteOrder = BOMStreamByteOrderLittleEndian; 37 | stream->size = size; 38 | stream->buf = buffer; 39 | stream->pos = 0; 40 | stream->dirty = false; 41 | return stream; 42 | } 43 | 44 | BOMStreamRef BOMStreamCreateWithFileDescriptor(int fd, size_t size) { 45 | if (fd == -1) { 46 | return NULL; 47 | } 48 | 49 | struct __BOMStream *stream = malloc(sizeof(struct __BOMStream)); 50 | if (stream == NULL) { 51 | return NULL; 52 | } 53 | 54 | stream->fd = fd; 55 | stream->type = BOMStreamTypeFile; 56 | stream->buf = NULL; 57 | 58 | void *buffer = malloc(size); 59 | if (buffer == NULL) { 60 | BOMStreamFree(stream); 61 | return NULL; 62 | } 63 | 64 | stream->blockID = 0; 65 | stream->byteOrder = BOMStreamByteOrderLittleEndian; 66 | stream->size = size; 67 | stream->buf = buffer; 68 | stream->pos = 0; 69 | stream->dirty = false; 70 | return stream; 71 | } 72 | 73 | BOMStreamRef BOMStreamCreateWithBlockID(BOMStoreRef sto, BOMBlock var, uint32_t blockID) { 74 | if (blockID == 0) { 75 | return NULL; 76 | } 77 | 78 | struct __BOMStream *stream = malloc(sizeof(struct __BOMStream)); 79 | if (stream == NULL) { 80 | return NULL; 81 | } 82 | 83 | stream->fd = -1; 84 | stream->blockID = blockID; 85 | stream->type = BOMStreamTypeBlockID; 86 | stream->byteOrder = BOMStreamByteOrderLittleEndian; 87 | stream->size = 0; 88 | stream->buf = BOMStoreCopyBlockData(sto, var); 89 | stream->pos = 0; 90 | stream->dirty = false; 91 | return stream; 92 | } 93 | 94 | bool BOMStreamFlush(BOMStreamRef stream) { 95 | if (stream == NULL || (stream->dirty == false)) { 96 | return false; 97 | } 98 | 99 | if (stream->type == BOMStreamTypeFile) { 100 | if (lseek(stream->fd, 0, SEEK_SET) == -1) { 101 | return false; 102 | } 103 | 104 | if (write(stream->fd, stream->buf, stream->size) != stream->size) { 105 | return false; 106 | } 107 | } 108 | 109 | stream->dirty = false; 110 | 111 | return true; 112 | } 113 | 114 | void BOMStreamFree(BOMStreamRef stream) { 115 | if (stream == NULL) { 116 | return; 117 | } 118 | 119 | if (stream->type == BOMStreamTypeBuffer) { 120 | free(stream->buf); 121 | free(stream); 122 | } else if (stream->type == BOMStreamTypeFile) { 123 | close(stream->fd); 124 | free(stream->buf); 125 | free(stream); 126 | } 127 | } 128 | 129 | BOMStreamByteOrder BOMStreamGetByteOrder(BOMStreamRef stream) { 130 | if (stream == NULL) { 131 | return BOMStreamByteOrderNone; 132 | } 133 | return stream->byteOrder; 134 | } 135 | 136 | bool BOMStreamRead(BOMStreamRef str, void *ptr, size_t size) { 137 | struct __BOMStream *stream = (struct __BOMStream *)str; 138 | 139 | if (stream == NULL) { 140 | return false; 141 | } 142 | 143 | size_t newPosition = str->pos + size; 144 | if (stream->size <= newPosition) { 145 | return false; 146 | } 147 | 148 | memcpy(ptr, stream->buf, size); 149 | return BOMStreamSeek(str, size, str->pos); 150 | } 151 | 152 | bool BOMStreamWrite(BOMStreamRef str, const void *buf, size_t size) { 153 | struct __BOMStream *stream = (struct __BOMStream *)str; 154 | 155 | if (stream == NULL) { 156 | return false; 157 | } 158 | 159 | memcpy(stream->buf, buf, size); 160 | stream->dirty = true; 161 | 162 | return BOMStreamSeek(str, size, str->pos); 163 | } 164 | 165 | bool BOMStreamAdvance(BOMStreamRef str, size_t offset) { 166 | return BOMStreamSeek(str, str->pos, offset); 167 | } 168 | 169 | bool BOMStreamSeek(BOMStreamRef str, size_t pos, size_t offset) { 170 | struct __BOMStream *stream = (struct __BOMStream *)str; 171 | 172 | if (stream == NULL) { 173 | return false; 174 | } 175 | 176 | size_t newPosition = pos + offset; 177 | if (stream->size <= newPosition) { 178 | return false; 179 | } 180 | 181 | stream->pos = newPosition; 182 | return true; 183 | } 184 | 185 | 186 | bool BOMStreamReadUInt8(BOMStreamRef stream, uint8_t *to) { 187 | return BOMStreamRead(stream, to, sizeof(*to)); 188 | } 189 | 190 | bool BOMStreamReadInt8(BOMStreamRef stream, int8_t *to){ 191 | return BOMStreamRead(stream, to, sizeof(*to)); 192 | } 193 | 194 | bool BOMStreamReadUInt16(BOMStreamRef stream, uint16_t *to) { 195 | return BOMStreamRead(stream, to, sizeof(*to)); 196 | } 197 | 198 | bool BOMStreamReadInt16(BOMStreamRef stream, int16_t *to){ 199 | return BOMStreamRead(stream, to, sizeof(*to)); 200 | } 201 | 202 | bool BOMStreamReadUInt32(BOMStreamRef stream, uint32_t *to) { 203 | return BOMStreamRead(stream, to, sizeof(*to)); 204 | } 205 | 206 | bool BOMStreamReadInt32(BOMStreamRef stream, int32_t *to) { 207 | return BOMStreamRead(stream, to, sizeof(*to)); 208 | } 209 | 210 | bool BOMStreamReadUInt64(BOMStreamRef stream, uint64_t *to) { 211 | return BOMStreamRead(stream, to, sizeof(*to)); 212 | } 213 | 214 | bool BOMStreamReadInt64(BOMStreamRef stream, int64_t *to) { 215 | return BOMStreamRead(stream, to, sizeof(*to)); 216 | } 217 | 218 | bool BOMStreamReadFloat(BOMStreamRef stream, float *to) { 219 | return BOMStreamRead(stream, to, sizeof(*to)); 220 | } 221 | 222 | bool BOMStreamReadDouble(BOMStreamRef stream, double *to) { 223 | return BOMStreamRead(stream, to, sizeof(*to)); 224 | } 225 | 226 | 227 | bool BOMStreamWriteUInt8(BOMStreamRef stream, const uint8_t from) { 228 | return BOMStreamWrite(stream, &from, sizeof(from)); 229 | } 230 | 231 | bool BOMStreamWriteInt8(BOMStreamRef stream, const int8_t from) { 232 | return BOMStreamWrite(stream, &from, sizeof(from)); 233 | } 234 | 235 | bool BOMStreamWriteUInt16(BOMStreamRef stream, const uint16_t from) { 236 | return BOMStreamWrite(stream, &from, sizeof(from)); 237 | } 238 | 239 | bool BOMStreamWriteInt16(BOMStreamRef stream, const int16_t from) { 240 | return BOMStreamWrite(stream, &from, sizeof(from)); 241 | } 242 | 243 | bool BOMStreamWriteUInt32(BOMStreamRef stream, const uint32_t from) { 244 | return BOMStreamWrite(stream, &from, sizeof(from)); 245 | } 246 | 247 | bool BOMStreamWriteInt32(BOMStreamRef stream, const int32_t from) { 248 | return BOMStreamWrite(stream, &from, sizeof(from)); 249 | } 250 | 251 | bool BOMStreamWriteUInt64(BOMStreamRef stream, const uint64_t from) { 252 | return BOMStreamWrite(stream, &from, sizeof(from)); 253 | } 254 | 255 | bool BOMStreamWriteInt64(BOMStreamRef stream, const int64_t from) { 256 | return BOMStreamWrite(stream, &from, sizeof(from)); 257 | } 258 | 259 | bool BOMStreamWriteFloat(BOMStreamRef stream, const float from) { 260 | return BOMStreamWrite(stream, &from, sizeof(from)); 261 | } 262 | 263 | bool BOMStreamWriteDouble(BOMStreamRef stream, const double from) { 264 | return BOMStreamWrite(stream, &from, sizeof(from)); 265 | } 266 | -------------------------------------------------------------------------------- /src/BOMStore.c: -------------------------------------------------------------------------------- 1 | // 2 | // BOMStore.c 3 | // Bombe 4 | // 5 | // Created by Robert Widmann on 2/6/15. 6 | // Copyright (c) 2015 CodaFi. All rights reserved. 7 | // 8 | 9 | #include "BOMStore.h" 10 | #include "BOMStream.h" 11 | #include "Internal.h" 12 | 13 | struct __BOMStore { 14 | struct BOMHeader { 15 | uint32_t blockCount; 16 | uint32_t indexOffset; 17 | uint32_t indexLength; 18 | uint32_t tocOffset; 19 | uint32_t tocSize; 20 | } header; 21 | 22 | void *mmapAddr; 23 | size_t mmapSize; 24 | 25 | uint32_t blockTableCount; 26 | BOMBlock *blockTable; 27 | ssize_t blockTableSize; 28 | }; 29 | 30 | static struct __BOMStore *BOMStoreCreate(const char *, bool); 31 | static void BOMStoreCreateBlockTable(BOMStoreRef); 32 | static bool BOMReadBlockTable(BOMStoreRef, BOMStreamRef); 33 | static void BOMExpandBlockTable(BOMStoreRef, size_t); 34 | 35 | BOMMutableStoreRef BOMStoreCreateMutableWithPath(const char *path) { 36 | return BOMStoreCreate(path, true); 37 | } 38 | 39 | BOMStoreRef BOMStoreCreateWithPath(const char *path) { 40 | return BOMStoreCreate(path, false); 41 | } 42 | 43 | struct __BOMStore *BOMStoreCreate(const char *path, bool mutable) { 44 | int flags = O_NOFOLLOW | O_NONBLOCK | O_TRUNC; 45 | flags |= mutable ? O_RDWR : O_RDONLY; 46 | int fd = open(path, flags); 47 | if (fd == -1) { 48 | return NULL; 49 | } 50 | 51 | struct stat stat; 52 | if (fstat(fd, &stat) == -1) { 53 | close(fd); 54 | return NULL; 55 | } 56 | 57 | BOMStreamRef stream = BOMStreamCreateWithFileDescriptor(fd, stat.st_size); 58 | if (stream == NULL) { 59 | close(fd); 60 | return NULL; 61 | } 62 | 63 | uint32_t head1, head2; 64 | BOMStreamReadUInt32(stream, &head1); 65 | BOMStreamReadUInt32(stream, &head2); 66 | 67 | // All BOM files begin with `BOMStore` 68 | if ((head1 != 'BOMS') || (head2 != 'tore')) { 69 | close(fd); 70 | BOMStreamFree(stream); 71 | return NULL; 72 | } 73 | 74 | uint32_t version; 75 | BOMStreamReadUInt32(stream, &version); 76 | 77 | // We only read version 1. 78 | if (version != 1) { 79 | fprintf(stderr, "BOM file at path '%s' has an unknown version: %d\n", path, version); 80 | } 81 | 82 | struct __BOMStore *store = malloc(sizeof(struct __BOMStore)); 83 | if (store == NULL) { 84 | close(fd); 85 | BOMStreamFree(stream); 86 | return NULL; 87 | } 88 | 89 | // Read in the header. 90 | BOMStreamReadUInt32(stream, &store->header.blockCount); 91 | BOMStreamReadUInt32(stream, &store->header.indexOffset); 92 | BOMStreamReadUInt32(stream, &store->header.indexLength); 93 | BOMStreamReadUInt32(stream, &store->header.tocOffset); 94 | BOMStreamReadUInt32(stream, &store->header.tocSize); 95 | BOMStreamFree(stream); 96 | 97 | // mmap in the BOM file. 98 | if ((store->mmapAddr = mmap(NULL, stat.st_size, PROT_READ, MAP_ANON | MAP_PRIVATE, fd, VM_FLAGS_FIXED)) == MAP_FAILED) { 99 | close(fd); 100 | BOMStoreFree(store); 101 | return NULL; 102 | } 103 | 104 | // Create the block table... 105 | BOMStoreCreateBlockTable(store); 106 | 107 | // Stream the index into memory and extract the block table. 108 | BOMStreamRef indexStream = BOMStreamCreateWithBuffer(store->mmapAddr + store->header.indexOffset, store->header.indexLength); 109 | if (BOMReadBlockTable(store, indexStream) == false) { 110 | close(fd); 111 | BOMStoreFree(store); 112 | return NULL; 113 | } 114 | 115 | close(fd); 116 | BOMStreamFree(indexStream); 117 | 118 | return store; 119 | } 120 | 121 | void BOMStoreFree(BOMStoreRef sto) { 122 | struct __BOMStore *store = (struct __BOMStore *)sto; 123 | if (store != NULL) { 124 | if (store->blockTable != 0) { 125 | if (vm_deallocate(mach_task_self(), (vm_address_t)store->blockTable, store->blockTableSize) != KERN_SUCCESS) { 126 | BOMAssert(false, "vm_deallocate failed"); 127 | } 128 | } 129 | if (store->mmapSize != 0) { 130 | if (munmap(store->mmapAddr, store->mmapSize) == -1) { 131 | BOMAssert(false, "munmap failed"); 132 | } 133 | } 134 | free(store); 135 | } 136 | } 137 | 138 | bool BOMStoreGetBlockWithName(BOMStoreRef sto, const char *name, BOMBlock *outBlock) { 139 | struct __BOMStore *store = (struct __BOMStore *)sto; 140 | 141 | if (name == NULL) { 142 | return NULL; 143 | } 144 | 145 | if (store->header.tocOffset == 0 || store->header.tocSize == 0) { 146 | return NULL; 147 | } 148 | 149 | BOMStreamRef stream = BOMStreamCreateWithBuffer(store->mmapAddr + store->header.tocOffset, store->header.tocSize); 150 | if (stream == NULL) { 151 | return NULL; 152 | } 153 | 154 | uint32_t contentsCount; 155 | BOMStreamReadUInt32(stream, &contentsCount); 156 | 157 | if (contentsCount == 0) { 158 | BOMStreamFree(stream); 159 | return NULL; 160 | } 161 | for (size_t i = 0; i < contentsCount; i++) { 162 | uint32_t index; 163 | BOMStreamReadUInt32(stream, &index); 164 | uint8_t nameLen; 165 | BOMStreamReadUInt8(stream, &nameLen); 166 | 167 | char buf[nameLen]; 168 | BOMStreamRead(stream, buf, nameLen); 169 | if (strcmp(buf, name) == 0) { 170 | BOMStreamFree(stream); 171 | *outBlock = (BOMBlock){ index, nameLen }; 172 | } 173 | } 174 | BOMStreamFree(stream); 175 | return outBlock != NULL; 176 | } 177 | 178 | uint32_t BOMStoreGetBlockSize(BOMStoreRef sto, BOMBlock block) { 179 | uint32_t result = 0; 180 | if ((sto != NULL) && (block.index != 0)) { 181 | if (sto->header.blockCount >= block.index) { 182 | return block.size; 183 | } 184 | } 185 | return result; 186 | } 187 | 188 | 189 | uint32_t BOMStoreCreateNewBlock(BOMMutableStoreRef sto) { 190 | struct __BOMStore *store = (struct __BOMStore *)sto; 191 | 192 | uint32_t result = 0; 193 | if (store != NULL) { 194 | struct BOMHeader head = store->header; 195 | result = (head.blockCount++); 196 | store->header = head; 197 | if (result >= store->blockTableCount) { 198 | BOMExpandBlockTable(store, store->blockTableSize * 2); 199 | store->blockTableCount++; 200 | } 201 | store->blockTable[result] = (BOMBlock){0}; 202 | } 203 | return result; 204 | } 205 | 206 | void *BOMStoreCopyBlockData(BOMStoreRef sto, BOMBlock var) { 207 | struct __BOMStore *store = (struct __BOMStore *)sto; 208 | 209 | if (ntohl(var.index) >= ntohl(store->blockTableCount)) { 210 | return NULL; 211 | } 212 | 213 | BOMBlock *block = sto->blockTable + ntohl(var.index); 214 | uint32_t addr = ntohl(block->index); 215 | 216 | BOMStreamRef blockStream = BOMStreamCreateWithBuffer(store->mmapAddr + addr, block->size); 217 | void *blockData = malloc(block->size); 218 | if (blockStream != NULL && blockData != NULL) { 219 | BOMStreamRead(blockStream, blockData, block->size); 220 | } 221 | BOMStreamFree(blockStream); 222 | 223 | return blockData; 224 | } 225 | 226 | static void BOMStoreCreateBlockTable(BOMStoreRef sto) { 227 | struct __BOMStore *store = (struct __BOMStore *)sto; 228 | if (store != NULL) { 229 | size_t size = PAGE_SIZE; 230 | if (size % vm_page_size != 0) { 231 | size += vm_page_size - (size % vm_page_size); 232 | } 233 | if (vm_allocate(mach_task_self(), (vm_address_t *)&store->blockTable, size, VM_FLAGS_ANYWHERE) != KERN_SUCCESS) { 234 | store->blockTable = 0; 235 | } 236 | store->blockTableSize = size; 237 | } 238 | } 239 | 240 | static bool BOMReadBlockTable(BOMStoreRef st, BOMStreamRef stream) { 241 | struct __BOMStore *store = (struct __BOMStore *)st; 242 | uint32_t count; 243 | BOMStreamReadUInt32(stream, &count); 244 | 245 | if (count != 0) { 246 | if ((count > 0x1fffffff) || ((count << 0x3) > store->header.indexLength)) { 247 | fwrite("bad value for block table count\n", 0x20, 0x1, stderr); 248 | return false; 249 | } 250 | BOMExpandBlockTable(st, count * sizeof(BOMBlock)); 251 | if (store->blockTable != 0) { 252 | store->blockTableCount = count; 253 | for (size_t i = 0; i < count; i++) { 254 | BOMBlock block; 255 | uint32_t index, size; 256 | BOMStreamReadUInt32(stream, &index); 257 | BOMStreamReadUInt32(stream, &size); 258 | block.index = index; 259 | block.size = size; 260 | BOMStreamAdvance(stream, sizeof(BOMBlock) + block.size); 261 | store->blockTable[i] = block; 262 | } 263 | } 264 | } 265 | return true; 266 | } 267 | 268 | static void BOMExpandBlockTable(BOMStoreRef st, vm_size_t newSize) { 269 | struct __BOMStore *store = (struct __BOMStore *)st; 270 | 271 | if (store->blockTableSize < newSize) { 272 | vm_size_t size = newSize; 273 | if (size % vm_page_size != 0) { 274 | size = (vm_page_size + size) - (size % vm_page_size); 275 | } 276 | BOMBlock *reallocAddr; 277 | if (vm_allocate(mach_task_self(), (vm_address_t *)&reallocAddr, size, VM_FLAGS_ANYWHERE) != KERN_SUCCESS) { 278 | BOMAssert(false, "vm_allocate failed"); 279 | } 280 | if (vm_copy(mach_task_self(), (vm_address_t)store->blockTable, store->blockTableSize, (vm_address_t)reallocAddr) != KERN_SUCCESS) { 281 | BOMAssert(false, "vm_copy failed"); 282 | } 283 | if (vm_deallocate(mach_task_self(), (vm_address_t)store->blockTable, store->blockTableSize) != KERN_SUCCESS) { 284 | BOMAssert(false, "vm_deallocate failed"); 285 | } 286 | store->blockTable = reallocAddr; 287 | store->blockTableSize = newSize; 288 | } 289 | } 290 | -------------------------------------------------------------------------------- /Bombe.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 841DBC521A915D35003F4EE0 /* BOMStack.c in Sources */ = {isa = PBXBuildFile; fileRef = 841DBC511A915D35003F4EE0 /* BOMStack.c */; }; 11 | 841DBC541A915D40003F4EE0 /* BOMStack.h in Headers */ = {isa = PBXBuildFile; fileRef = 841DBC531A915D40003F4EE0 /* BOMStack.h */; }; 12 | 84FE01B31A85A1C0006D3EEA /* BOMStream.c in Sources */ = {isa = PBXBuildFile; fileRef = 84FE01B21A85A1C0006D3EEA /* BOMStream.c */; }; 13 | 84FE01B51A85A3BF006D3EEA /* BOMStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 84FE01B41A85A3AE006D3EEA /* BOMStream.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14 | 84FE01B61A85A3C5006D3EEA /* Bombe.h in Headers */ = {isa = PBXBuildFile; fileRef = 84FE01B11A85A0B5006D3EEA /* Bombe.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15 | 84FE01B81A85A595006D3EEA /* Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 84FE01B71A85A595006D3EEA /* Internal.h */; }; 16 | 84FE01BA1A85A91E006D3EEA /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 84FE01B91A85A91E006D3EEA /* config.h */; }; 17 | 84FE01BC1A85ABE7006D3EEA /* BOMDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 84FE01BB1A85ABE7006D3EEA /* BOMDefines.h */; settings = {ATTRIBUTES = (Public, ); }; }; 18 | 84FE01BE1A85B298006D3EEA /* BOMStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 84FE01BD1A85B298006D3EEA /* BOMStore.h */; }; 19 | 84FE01C01A85B2A4006D3EEA /* BOMStore.c in Sources */ = {isa = PBXBuildFile; fileRef = 84FE01BF1A85B2A4006D3EEA /* BOMStore.c */; }; 20 | 84FE01C21A86AAE8006D3EEA /* BOMTree.c in Sources */ = {isa = PBXBuildFile; fileRef = 84FE01C11A86AAE8006D3EEA /* BOMTree.c */; }; 21 | 84FE01C41A86AAF7006D3EEA /* BOMTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 84FE01C31A86AAF7006D3EEA /* BOMTree.h */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXFileReference section */ 25 | 841DBC511A915D35003F4EE0 /* BOMStack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = BOMStack.c; path = src/BOMStack.c; sourceTree = ""; }; 26 | 841DBC531A915D40003F4EE0 /* BOMStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BOMStack.h; path = Bombe/BOMStack.h; sourceTree = ""; }; 27 | 84FE01AA1A859E07006D3EEA /* libBombe.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libBombe.a; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 84FE01B11A85A0B5006D3EEA /* Bombe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Bombe.h; path = Bombe/Bombe.h; sourceTree = ""; }; 29 | 84FE01B21A85A1C0006D3EEA /* BOMStream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = BOMStream.c; path = src/BOMStream.c; sourceTree = ""; }; 30 | 84FE01B41A85A3AE006D3EEA /* BOMStream.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = BOMStream.h; path = Bombe/BOMStream.h; sourceTree = ""; }; 31 | 84FE01B71A85A595006D3EEA /* Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Internal.h; path = src/Internal.h; sourceTree = ""; }; 32 | 84FE01B91A85A91E006D3EEA /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = config.h; path = config/config.h; sourceTree = ""; }; 33 | 84FE01BB1A85ABE7006D3EEA /* BOMDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BOMDefines.h; path = Bombe/BOMDefines.h; sourceTree = ""; }; 34 | 84FE01BD1A85B298006D3EEA /* BOMStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BOMStore.h; path = Bombe/BOMStore.h; sourceTree = ""; }; 35 | 84FE01BF1A85B2A4006D3EEA /* BOMStore.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = BOMStore.c; path = src/BOMStore.c; sourceTree = ""; }; 36 | 84FE01C11A86AAE8006D3EEA /* BOMTree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = BOMTree.c; path = src/BOMTree.c; sourceTree = ""; }; 37 | 84FE01C31A86AAF7006D3EEA /* BOMTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BOMTree.h; path = Bombe/BOMTree.h; sourceTree = ""; }; 38 | /* End PBXFileReference section */ 39 | 40 | /* Begin PBXFrameworksBuildPhase section */ 41 | 84FE01A71A859E07006D3EEA /* Frameworks */ = { 42 | isa = PBXFrameworksBuildPhase; 43 | buildActionMask = 2147483647; 44 | files = ( 45 | ); 46 | runOnlyForDeploymentPostprocessing = 0; 47 | }; 48 | /* End PBXFrameworksBuildPhase section */ 49 | 50 | /* Begin PBXGroup section */ 51 | 84FE01A11A859E07006D3EEA = { 52 | isa = PBXGroup; 53 | children = ( 54 | 84FE01B11A85A0B5006D3EEA /* Bombe.h */, 55 | 84FE01B71A85A595006D3EEA /* Internal.h */, 56 | 84FE01BB1A85ABE7006D3EEA /* BOMDefines.h */, 57 | 84FE01B91A85A91E006D3EEA /* config.h */, 58 | 84FE01BF1A85B2A4006D3EEA /* BOMStore.c */, 59 | 84FE01BD1A85B298006D3EEA /* BOMStore.h */, 60 | 841DBC511A915D35003F4EE0 /* BOMStack.c */, 61 | 841DBC531A915D40003F4EE0 /* BOMStack.h */, 62 | 84FE01B21A85A1C0006D3EEA /* BOMStream.c */, 63 | 84FE01B41A85A3AE006D3EEA /* BOMStream.h */, 64 | 84FE01C11A86AAE8006D3EEA /* BOMTree.c */, 65 | 84FE01C31A86AAF7006D3EEA /* BOMTree.h */, 66 | 84FE01AB1A859E07006D3EEA /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 84FE01AB1A859E07006D3EEA /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 84FE01AA1A859E07006D3EEA /* libBombe.a */, 74 | ); 75 | name = Products; 76 | sourceTree = ""; 77 | }; 78 | /* End PBXGroup section */ 79 | 80 | /* Begin PBXHeadersBuildPhase section */ 81 | 84FE01A81A859E07006D3EEA /* Headers */ = { 82 | isa = PBXHeadersBuildPhase; 83 | buildActionMask = 2147483647; 84 | files = ( 85 | 84FE01BA1A85A91E006D3EEA /* config.h in Headers */, 86 | 84FE01B81A85A595006D3EEA /* Internal.h in Headers */, 87 | 84FE01B61A85A3C5006D3EEA /* Bombe.h in Headers */, 88 | 84FE01C41A86AAF7006D3EEA /* BOMTree.h in Headers */, 89 | 841DBC541A915D40003F4EE0 /* BOMStack.h in Headers */, 90 | 84FE01B51A85A3BF006D3EEA /* BOMStream.h in Headers */, 91 | 84FE01BC1A85ABE7006D3EEA /* BOMDefines.h in Headers */, 92 | 84FE01BE1A85B298006D3EEA /* BOMStore.h in Headers */, 93 | ); 94 | runOnlyForDeploymentPostprocessing = 0; 95 | }; 96 | /* End PBXHeadersBuildPhase section */ 97 | 98 | /* Begin PBXNativeTarget section */ 99 | 84FE01A91A859E07006D3EEA /* Bombe */ = { 100 | isa = PBXNativeTarget; 101 | buildConfigurationList = 84FE01AE1A859E07006D3EEA /* Build configuration list for PBXNativeTarget "Bombe" */; 102 | buildPhases = ( 103 | 84FE01A61A859E07006D3EEA /* Sources */, 104 | 84FE01A71A859E07006D3EEA /* Frameworks */, 105 | 84FE01A81A859E07006D3EEA /* Headers */, 106 | ); 107 | buildRules = ( 108 | ); 109 | dependencies = ( 110 | ); 111 | name = Bombe; 112 | productName = Bombe; 113 | productReference = 84FE01AA1A859E07006D3EEA /* libBombe.a */; 114 | productType = "com.apple.product-type.library.static"; 115 | }; 116 | /* End PBXNativeTarget section */ 117 | 118 | /* Begin PBXProject section */ 119 | 84FE01A21A859E07006D3EEA /* Project object */ = { 120 | isa = PBXProject; 121 | attributes = { 122 | LastUpgradeCheck = 0830; 123 | ORGANIZATIONNAME = CodaFi; 124 | TargetAttributes = { 125 | 84FE01A91A859E07006D3EEA = { 126 | CreatedOnToolsVersion = 6.2; 127 | }; 128 | }; 129 | }; 130 | buildConfigurationList = 84FE01A51A859E07006D3EEA /* Build configuration list for PBXProject "Bombe" */; 131 | compatibilityVersion = "Xcode 3.2"; 132 | developmentRegion = English; 133 | hasScannedForEncodings = 0; 134 | knownRegions = ( 135 | en, 136 | ); 137 | mainGroup = 84FE01A11A859E07006D3EEA; 138 | productRefGroup = 84FE01AB1A859E07006D3EEA /* Products */; 139 | projectDirPath = ""; 140 | projectRoot = ""; 141 | targets = ( 142 | 84FE01A91A859E07006D3EEA /* Bombe */, 143 | ); 144 | }; 145 | /* End PBXProject section */ 146 | 147 | /* Begin PBXSourcesBuildPhase section */ 148 | 84FE01A61A859E07006D3EEA /* Sources */ = { 149 | isa = PBXSourcesBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | 84FE01C01A85B2A4006D3EEA /* BOMStore.c in Sources */, 153 | 84FE01C21A86AAE8006D3EEA /* BOMTree.c in Sources */, 154 | 84FE01B31A85A1C0006D3EEA /* BOMStream.c in Sources */, 155 | 841DBC521A915D35003F4EE0 /* BOMStack.c in Sources */, 156 | ); 157 | runOnlyForDeploymentPostprocessing = 0; 158 | }; 159 | /* End PBXSourcesBuildPhase section */ 160 | 161 | /* Begin XCBuildConfiguration section */ 162 | 84FE01AC1A859E07006D3EEA /* Debug */ = { 163 | isa = XCBuildConfiguration; 164 | buildSettings = { 165 | ALWAYS_SEARCH_USER_PATHS = NO; 166 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 167 | CLANG_CXX_LIBRARY = "libc++"; 168 | CLANG_ENABLE_MODULES = YES; 169 | CLANG_ENABLE_OBJC_ARC = YES; 170 | CLANG_WARN_BOOL_CONVERSION = YES; 171 | CLANG_WARN_CONSTANT_CONVERSION = YES; 172 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 173 | CLANG_WARN_EMPTY_BODY = YES; 174 | CLANG_WARN_ENUM_CONVERSION = YES; 175 | CLANG_WARN_INFINITE_RECURSION = YES; 176 | CLANG_WARN_INT_CONVERSION = YES; 177 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 178 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 179 | CLANG_WARN_UNREACHABLE_CODE = YES; 180 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 181 | COPY_PHASE_STRIP = NO; 182 | ENABLE_STRICT_OBJC_MSGSEND = YES; 183 | ENABLE_TESTABILITY = YES; 184 | GCC_C_LANGUAGE_STANDARD = gnu99; 185 | GCC_DYNAMIC_NO_PIC = NO; 186 | GCC_NO_COMMON_BLOCKS = YES; 187 | GCC_OPTIMIZATION_LEVEL = 0; 188 | GCC_PREPROCESSOR_DEFINITIONS = ( 189 | "DEBUG=1", 190 | "$(inherited)", 191 | ); 192 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 193 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 194 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 195 | GCC_WARN_UNDECLARED_SELECTOR = YES; 196 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 197 | GCC_WARN_UNUSED_FUNCTION = YES; 198 | GCC_WARN_UNUSED_VARIABLE = YES; 199 | MACOSX_DEPLOYMENT_TARGET = 10.10; 200 | MTL_ENABLE_DEBUG_INFO = YES; 201 | ONLY_ACTIVE_ARCH = YES; 202 | SDKROOT = macosx; 203 | }; 204 | name = Debug; 205 | }; 206 | 84FE01AD1A859E07006D3EEA /* Release */ = { 207 | isa = XCBuildConfiguration; 208 | buildSettings = { 209 | ALWAYS_SEARCH_USER_PATHS = NO; 210 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 211 | CLANG_CXX_LIBRARY = "libc++"; 212 | CLANG_ENABLE_MODULES = YES; 213 | CLANG_ENABLE_OBJC_ARC = YES; 214 | CLANG_WARN_BOOL_CONVERSION = YES; 215 | CLANG_WARN_CONSTANT_CONVERSION = YES; 216 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 217 | CLANG_WARN_EMPTY_BODY = YES; 218 | CLANG_WARN_ENUM_CONVERSION = YES; 219 | CLANG_WARN_INFINITE_RECURSION = YES; 220 | CLANG_WARN_INT_CONVERSION = YES; 221 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 222 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 223 | CLANG_WARN_UNREACHABLE_CODE = YES; 224 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 225 | COPY_PHASE_STRIP = NO; 226 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 227 | ENABLE_NS_ASSERTIONS = NO; 228 | ENABLE_STRICT_OBJC_MSGSEND = YES; 229 | GCC_C_LANGUAGE_STANDARD = gnu99; 230 | GCC_NO_COMMON_BLOCKS = YES; 231 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 232 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 233 | GCC_WARN_UNDECLARED_SELECTOR = YES; 234 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 235 | GCC_WARN_UNUSED_FUNCTION = YES; 236 | GCC_WARN_UNUSED_VARIABLE = YES; 237 | MACOSX_DEPLOYMENT_TARGET = 10.10; 238 | MTL_ENABLE_DEBUG_INFO = NO; 239 | SDKROOT = macosx; 240 | }; 241 | name = Release; 242 | }; 243 | 84FE01AF1A859E07006D3EEA /* Debug */ = { 244 | isa = XCBuildConfiguration; 245 | buildSettings = { 246 | COMBINE_HIDPI_IMAGES = YES; 247 | EXECUTABLE_PREFIX = lib; 248 | HEADER_SEARCH_PATHS = ( 249 | "$(inherited)", 250 | "/Applications/Xcode-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include", 251 | "$(PROJECT_DIR)", 252 | ); 253 | PRODUCT_NAME = "$(TARGET_NAME)"; 254 | PUBLIC_HEADERS_FOLDER_PATH = "$(INSTALL_PATH_PREFIX)/usr/include/Bombe"; 255 | }; 256 | name = Debug; 257 | }; 258 | 84FE01B01A859E07006D3EEA /* Release */ = { 259 | isa = XCBuildConfiguration; 260 | buildSettings = { 261 | COMBINE_HIDPI_IMAGES = YES; 262 | EXECUTABLE_PREFIX = lib; 263 | HEADER_SEARCH_PATHS = ( 264 | "$(inherited)", 265 | "/Applications/Xcode-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include", 266 | "$(PROJECT_DIR)", 267 | ); 268 | PRODUCT_NAME = "$(TARGET_NAME)"; 269 | PUBLIC_HEADERS_FOLDER_PATH = "$(INSTALL_PATH_PREFIX)/usr/include/Bombe"; 270 | }; 271 | name = Release; 272 | }; 273 | /* End XCBuildConfiguration section */ 274 | 275 | /* Begin XCConfigurationList section */ 276 | 84FE01A51A859E07006D3EEA /* Build configuration list for PBXProject "Bombe" */ = { 277 | isa = XCConfigurationList; 278 | buildConfigurations = ( 279 | 84FE01AC1A859E07006D3EEA /* Debug */, 280 | 84FE01AD1A859E07006D3EEA /* Release */, 281 | ); 282 | defaultConfigurationIsVisible = 0; 283 | defaultConfigurationName = Release; 284 | }; 285 | 84FE01AE1A859E07006D3EEA /* Build configuration list for PBXNativeTarget "Bombe" */ = { 286 | isa = XCConfigurationList; 287 | buildConfigurations = ( 288 | 84FE01AF1A859E07006D3EEA /* Debug */, 289 | 84FE01B01A859E07006D3EEA /* Release */, 290 | ); 291 | defaultConfigurationIsVisible = 0; 292 | defaultConfigurationName = Release; 293 | }; 294 | /* End XCConfigurationList section */ 295 | }; 296 | rootObject = 84FE01A21A859E07006D3EEA /* Project object */; 297 | } 298 | -------------------------------------------------------------------------------- /m4/ltoptions.m4: -------------------------------------------------------------------------------- 1 | # Helper functions for option handling. -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software 4 | # Foundation, Inc. 5 | # Written by Gary V. Vaughan, 2004 6 | # 7 | # This file is free software; the Free Software Foundation gives 8 | # unlimited permission to copy and/or distribute it, with or without 9 | # modifications, as long as this notice is preserved. 10 | 11 | # serial 8 ltoptions.m4 12 | 13 | # This is to help aclocal find these macros, as it can't see m4_define. 14 | AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) 15 | 16 | 17 | # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) 18 | # ------------------------------------------ 19 | m4_define([_LT_MANGLE_OPTION], 20 | [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) 21 | 22 | 23 | # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) 24 | # --------------------------------------- 25 | # Set option OPTION-NAME for macro MACRO-NAME, and if there is a 26 | # matching handler defined, dispatch to it. Other OPTION-NAMEs are 27 | # saved as a flag. 28 | m4_define([_LT_SET_OPTION], 29 | [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl 30 | m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), 31 | _LT_MANGLE_DEFUN([$1], [$2]), 32 | [m4_warning([Unknown $1 option '$2'])])[]dnl 33 | ]) 34 | 35 | 36 | # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) 37 | # ------------------------------------------------------------ 38 | # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. 39 | m4_define([_LT_IF_OPTION], 40 | [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) 41 | 42 | 43 | # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) 44 | # ------------------------------------------------------- 45 | # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME 46 | # are set. 47 | m4_define([_LT_UNLESS_OPTIONS], 48 | [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 49 | [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), 50 | [m4_define([$0_found])])])[]dnl 51 | m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 52 | ])[]dnl 53 | ]) 54 | 55 | 56 | # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) 57 | # ---------------------------------------- 58 | # OPTION-LIST is a space-separated list of Libtool options associated 59 | # with MACRO-NAME. If any OPTION has a matching handler declared with 60 | # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about 61 | # the unknown option and exit. 62 | m4_defun([_LT_SET_OPTIONS], 63 | [# Set options 64 | m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 65 | [_LT_SET_OPTION([$1], _LT_Option)]) 66 | 67 | m4_if([$1],[LT_INIT],[ 68 | dnl 69 | dnl Simply set some default values (i.e off) if boolean options were not 70 | dnl specified: 71 | _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no 72 | ]) 73 | _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no 74 | ]) 75 | dnl 76 | dnl If no reference was made to various pairs of opposing options, then 77 | dnl we run the default mode handler for the pair. For example, if neither 78 | dnl 'shared' nor 'disable-shared' was passed, we enable building of shared 79 | dnl archives by default: 80 | _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) 81 | _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) 82 | _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) 83 | _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], 84 | [_LT_ENABLE_FAST_INSTALL]) 85 | _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], 86 | [_LT_WITH_AIX_SONAME([aix])]) 87 | ]) 88 | ])# _LT_SET_OPTIONS 89 | 90 | 91 | ## --------------------------------- ## 92 | ## Macros to handle LT_INIT options. ## 93 | ## --------------------------------- ## 94 | 95 | # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) 96 | # ----------------------------------------- 97 | m4_define([_LT_MANGLE_DEFUN], 98 | [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) 99 | 100 | 101 | # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) 102 | # ----------------------------------------------- 103 | m4_define([LT_OPTION_DEFINE], 104 | [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl 105 | ])# LT_OPTION_DEFINE 106 | 107 | 108 | # dlopen 109 | # ------ 110 | LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes 111 | ]) 112 | 113 | AU_DEFUN([AC_LIBTOOL_DLOPEN], 114 | [_LT_SET_OPTION([LT_INIT], [dlopen]) 115 | AC_DIAGNOSE([obsolete], 116 | [$0: Remove this warning and the call to _LT_SET_OPTION when you 117 | put the 'dlopen' option into LT_INIT's first parameter.]) 118 | ]) 119 | 120 | dnl aclocal-1.4 backwards compatibility: 121 | dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) 122 | 123 | 124 | # win32-dll 125 | # --------- 126 | # Declare package support for building win32 dll's. 127 | LT_OPTION_DEFINE([LT_INIT], [win32-dll], 128 | [enable_win32_dll=yes 129 | 130 | case $host in 131 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) 132 | AC_CHECK_TOOL(AS, as, false) 133 | AC_CHECK_TOOL(DLLTOOL, dlltool, false) 134 | AC_CHECK_TOOL(OBJDUMP, objdump, false) 135 | ;; 136 | esac 137 | 138 | test -z "$AS" && AS=as 139 | _LT_DECL([], [AS], [1], [Assembler program])dnl 140 | 141 | test -z "$DLLTOOL" && DLLTOOL=dlltool 142 | _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl 143 | 144 | test -z "$OBJDUMP" && OBJDUMP=objdump 145 | _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl 146 | ])# win32-dll 147 | 148 | AU_DEFUN([AC_LIBTOOL_WIN32_DLL], 149 | [AC_REQUIRE([AC_CANONICAL_HOST])dnl 150 | _LT_SET_OPTION([LT_INIT], [win32-dll]) 151 | AC_DIAGNOSE([obsolete], 152 | [$0: Remove this warning and the call to _LT_SET_OPTION when you 153 | put the 'win32-dll' option into LT_INIT's first parameter.]) 154 | ]) 155 | 156 | dnl aclocal-1.4 backwards compatibility: 157 | dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) 158 | 159 | 160 | # _LT_ENABLE_SHARED([DEFAULT]) 161 | # ---------------------------- 162 | # implement the --enable-shared flag, and supports the 'shared' and 163 | # 'disable-shared' LT_INIT options. 164 | # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. 165 | m4_define([_LT_ENABLE_SHARED], 166 | [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl 167 | AC_ARG_ENABLE([shared], 168 | [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], 169 | [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], 170 | [p=${PACKAGE-default} 171 | case $enableval in 172 | yes) enable_shared=yes ;; 173 | no) enable_shared=no ;; 174 | *) 175 | enable_shared=no 176 | # Look at the argument we got. We use all the common list separators. 177 | lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, 178 | for pkg in $enableval; do 179 | IFS=$lt_save_ifs 180 | if test "X$pkg" = "X$p"; then 181 | enable_shared=yes 182 | fi 183 | done 184 | IFS=$lt_save_ifs 185 | ;; 186 | esac], 187 | [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) 188 | 189 | _LT_DECL([build_libtool_libs], [enable_shared], [0], 190 | [Whether or not to build shared libraries]) 191 | ])# _LT_ENABLE_SHARED 192 | 193 | LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) 194 | LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) 195 | 196 | # Old names: 197 | AC_DEFUN([AC_ENABLE_SHARED], 198 | [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) 199 | ]) 200 | 201 | AC_DEFUN([AC_DISABLE_SHARED], 202 | [_LT_SET_OPTION([LT_INIT], [disable-shared]) 203 | ]) 204 | 205 | AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) 206 | AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) 207 | 208 | dnl aclocal-1.4 backwards compatibility: 209 | dnl AC_DEFUN([AM_ENABLE_SHARED], []) 210 | dnl AC_DEFUN([AM_DISABLE_SHARED], []) 211 | 212 | 213 | 214 | # _LT_ENABLE_STATIC([DEFAULT]) 215 | # ---------------------------- 216 | # implement the --enable-static flag, and support the 'static' and 217 | # 'disable-static' LT_INIT options. 218 | # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. 219 | m4_define([_LT_ENABLE_STATIC], 220 | [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl 221 | AC_ARG_ENABLE([static], 222 | [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], 223 | [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], 224 | [p=${PACKAGE-default} 225 | case $enableval in 226 | yes) enable_static=yes ;; 227 | no) enable_static=no ;; 228 | *) 229 | enable_static=no 230 | # Look at the argument we got. We use all the common list separators. 231 | lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, 232 | for pkg in $enableval; do 233 | IFS=$lt_save_ifs 234 | if test "X$pkg" = "X$p"; then 235 | enable_static=yes 236 | fi 237 | done 238 | IFS=$lt_save_ifs 239 | ;; 240 | esac], 241 | [enable_static=]_LT_ENABLE_STATIC_DEFAULT) 242 | 243 | _LT_DECL([build_old_libs], [enable_static], [0], 244 | [Whether or not to build static libraries]) 245 | ])# _LT_ENABLE_STATIC 246 | 247 | LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) 248 | LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) 249 | 250 | # Old names: 251 | AC_DEFUN([AC_ENABLE_STATIC], 252 | [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) 253 | ]) 254 | 255 | AC_DEFUN([AC_DISABLE_STATIC], 256 | [_LT_SET_OPTION([LT_INIT], [disable-static]) 257 | ]) 258 | 259 | AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) 260 | AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) 261 | 262 | dnl aclocal-1.4 backwards compatibility: 263 | dnl AC_DEFUN([AM_ENABLE_STATIC], []) 264 | dnl AC_DEFUN([AM_DISABLE_STATIC], []) 265 | 266 | 267 | 268 | # _LT_ENABLE_FAST_INSTALL([DEFAULT]) 269 | # ---------------------------------- 270 | # implement the --enable-fast-install flag, and support the 'fast-install' 271 | # and 'disable-fast-install' LT_INIT options. 272 | # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. 273 | m4_define([_LT_ENABLE_FAST_INSTALL], 274 | [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl 275 | AC_ARG_ENABLE([fast-install], 276 | [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], 277 | [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], 278 | [p=${PACKAGE-default} 279 | case $enableval in 280 | yes) enable_fast_install=yes ;; 281 | no) enable_fast_install=no ;; 282 | *) 283 | enable_fast_install=no 284 | # Look at the argument we got. We use all the common list separators. 285 | lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, 286 | for pkg in $enableval; do 287 | IFS=$lt_save_ifs 288 | if test "X$pkg" = "X$p"; then 289 | enable_fast_install=yes 290 | fi 291 | done 292 | IFS=$lt_save_ifs 293 | ;; 294 | esac], 295 | [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) 296 | 297 | _LT_DECL([fast_install], [enable_fast_install], [0], 298 | [Whether or not to optimize for fast installation])dnl 299 | ])# _LT_ENABLE_FAST_INSTALL 300 | 301 | LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) 302 | LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) 303 | 304 | # Old names: 305 | AU_DEFUN([AC_ENABLE_FAST_INSTALL], 306 | [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) 307 | AC_DIAGNOSE([obsolete], 308 | [$0: Remove this warning and the call to _LT_SET_OPTION when you put 309 | the 'fast-install' option into LT_INIT's first parameter.]) 310 | ]) 311 | 312 | AU_DEFUN([AC_DISABLE_FAST_INSTALL], 313 | [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) 314 | AC_DIAGNOSE([obsolete], 315 | [$0: Remove this warning and the call to _LT_SET_OPTION when you put 316 | the 'disable-fast-install' option into LT_INIT's first parameter.]) 317 | ]) 318 | 319 | dnl aclocal-1.4 backwards compatibility: 320 | dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) 321 | dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) 322 | 323 | 324 | # _LT_WITH_AIX_SONAME([DEFAULT]) 325 | # ---------------------------------- 326 | # implement the --with-aix-soname flag, and support the `aix-soname=aix' 327 | # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT 328 | # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. 329 | m4_define([_LT_WITH_AIX_SONAME], 330 | [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl 331 | shared_archive_member_spec= 332 | case $host,$enable_shared in 333 | power*-*-aix[[5-9]]*,yes) 334 | AC_MSG_CHECKING([which variant of shared library versioning to provide]) 335 | AC_ARG_WITH([aix-soname], 336 | [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], 337 | [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], 338 | [case $withval in 339 | aix|svr4|both) 340 | ;; 341 | *) 342 | AC_MSG_ERROR([Unknown argument to --with-aix-soname]) 343 | ;; 344 | esac 345 | lt_cv_with_aix_soname=$with_aix_soname], 346 | [AC_CACHE_VAL([lt_cv_with_aix_soname], 347 | [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) 348 | with_aix_soname=$lt_cv_with_aix_soname]) 349 | AC_MSG_RESULT([$with_aix_soname]) 350 | if test aix != "$with_aix_soname"; then 351 | # For the AIX way of multilib, we name the shared archive member 352 | # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', 353 | # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. 354 | # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, 355 | # the AIX toolchain works better with OBJECT_MODE set (default 32). 356 | if test 64 = "${OBJECT_MODE-32}"; then 357 | shared_archive_member_spec=shr_64 358 | else 359 | shared_archive_member_spec=shr 360 | fi 361 | fi 362 | ;; 363 | *) 364 | with_aix_soname=aix 365 | ;; 366 | esac 367 | 368 | _LT_DECL([], [shared_archive_member_spec], [0], 369 | [Shared archive member basename, for filename based shared library versioning on AIX])dnl 370 | ])# _LT_WITH_AIX_SONAME 371 | 372 | LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) 373 | LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) 374 | LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) 375 | 376 | 377 | # _LT_WITH_PIC([MODE]) 378 | # -------------------- 379 | # implement the --with-pic flag, and support the 'pic-only' and 'no-pic' 380 | # LT_INIT options. 381 | # MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. 382 | m4_define([_LT_WITH_PIC], 383 | [AC_ARG_WITH([pic], 384 | [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], 385 | [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], 386 | [lt_p=${PACKAGE-default} 387 | case $withval in 388 | yes|no) pic_mode=$withval ;; 389 | *) 390 | pic_mode=default 391 | # Look at the argument we got. We use all the common list separators. 392 | lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, 393 | for lt_pkg in $withval; do 394 | IFS=$lt_save_ifs 395 | if test "X$lt_pkg" = "X$lt_p"; then 396 | pic_mode=yes 397 | fi 398 | done 399 | IFS=$lt_save_ifs 400 | ;; 401 | esac], 402 | [pic_mode=m4_default([$1], [default])]) 403 | 404 | _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl 405 | ])# _LT_WITH_PIC 406 | 407 | LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) 408 | LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) 409 | 410 | # Old name: 411 | AU_DEFUN([AC_LIBTOOL_PICMODE], 412 | [_LT_SET_OPTION([LT_INIT], [pic-only]) 413 | AC_DIAGNOSE([obsolete], 414 | [$0: Remove this warning and the call to _LT_SET_OPTION when you 415 | put the 'pic-only' option into LT_INIT's first parameter.]) 416 | ]) 417 | 418 | dnl aclocal-1.4 backwards compatibility: 419 | dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) 420 | 421 | ## ----------------- ## 422 | ## LTDL_INIT Options ## 423 | ## ----------------- ## 424 | 425 | m4_define([_LTDL_MODE], []) 426 | LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], 427 | [m4_define([_LTDL_MODE], [nonrecursive])]) 428 | LT_OPTION_DEFINE([LTDL_INIT], [recursive], 429 | [m4_define([_LTDL_MODE], [recursive])]) 430 | LT_OPTION_DEFINE([LTDL_INIT], [subproject], 431 | [m4_define([_LTDL_MODE], [subproject])]) 432 | 433 | m4_define([_LTDL_TYPE], []) 434 | LT_OPTION_DEFINE([LTDL_INIT], [installable], 435 | [m4_define([_LTDL_TYPE], [installable])]) 436 | LT_OPTION_DEFINE([LTDL_INIT], [convenience], 437 | [m4_define([_LTDL_TYPE], [convenience])]) 438 | --------------------------------------------------------------------------------