]> granicus.if.org Git - multimarkdown/commitdiff
CHANGED: Refactor GLibFacade to d_string; Use Xcode specific build directories
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Fri, 2 Dec 2016 21:10:43 +0000 (16:10 -0500)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Fri, 2 Dec 2016 21:10:43 +0000 (16:10 -0500)
CMakeLists.txt
Makefile
README.md
src/GLibFacade.h [deleted file]
src/d_string.c [moved from src/GLibFacade.c with 65% similarity]
src/d_string.h [new file with mode: 0644]
src/main.c

index 5d0ed634b92a8bc9a6d6e6c0e5d2452445448c49..9e63c006d1ea9c8c436f067b2f2de202dc811f2d 100644 (file)
@@ -8,10 +8,10 @@ cmake_minimum_required (VERSION 2.6)
 set (My_Project_Title "C-Template")
 set (My_Project_Description "Boilerplate c project with cmake support, CuTest unit testing, and more.")
 set (My_Project_Author "Fletcher T. Penney")
-set (My_Project_Revised_Date "2016-08-24")
+set (My_Project_Revised_Date "2016-12-02")
 set (My_Project_Version_Major 1)
 set (My_Project_Version_Minor 0)
-set (My_Project_Version_Patch 3)
+set (My_Project_Version_Patch 4)
 
 set (My_Project_Version "${My_Project_Version_Major}.${My_Project_Version_Minor}.${My_Project_Version_Patch}")
 
@@ -169,11 +169,11 @@ set(public_header_files
 
 # Utility source files will not be included in doxygen
 set(src_utility_files
-#      src/GLibFacade.c
+#      src/d_string.c
 )
 
 set(header_utility_files
-#      src/GLibFacade.h
+#      src/d_string.h
        ${PROJECT_BINARY_DIR}/version.h
 )
 
@@ -304,8 +304,8 @@ endif (WIN32)
 # if (NOT DEFINED TEST)
 #      add_executable(main
 #              src/main.c
-#              src/GLibFacade.c
-#              src/GLibFacade.h
+#              src/d_string.c
+#              src/d_string.h
 #              ${header_files}
 #      )
 # 
index bcc835e7ea320b0ea67d4488224994adf0607dde..13802fc54077b8348b1690c8522fd8f821c05f7d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,6 @@
 BUILD_DIR = build
+XCODE_BUILD_DIR = build-xcode
+XCODE_DEBUG_BUILD_DIR = build-xcode-debug
 
 # The release target will perform additional optimization
 .PHONY : release
@@ -32,10 +34,15 @@ analyze: $(BUILD_DIR)
 #      xcodebuild -configuration Debug
 #      xcodebuild -configuration Release
 .PHONY : xcode
-xcode: $(BUILD_DIR)
-       cd $(BUILD_DIR); \
+xcode: $(XCOD_BUILD_DIR)
+       cd $(XCOD_BUILD_DIR); \
        cmake -G Xcode ..
 
+.PHONY : xcode-debug
+xcode-debug: $(XCODE_DEBUG_BUILD_DIR)
+       cd $(XCODE_DEBUG_BUILD_DIR); \
+       cmake -G Xcode -DTEST=1 ..
+
 # Cross-compile for Windows using MinGW on *nix
 .PHONY : windows
 windows: $(BUILD_DIR)
@@ -81,6 +88,15 @@ $(BUILD_DIR): CHANGELOG
        -mkdir $(BUILD_DIR) 2>/dev/null
        -cd $(BUILD_DIR); rm -rf *
 
+# Build xcode directories if they don't exist
+$(XCODE_BUILD_DIR):
+       -mkdir $(XCODE_BUILD_DIR) 2>/dev/null
+       -cd $(XCODE_BUILD_DIR); rm -rf *
+
+$(XCODE_DEBUG_BUILD_DIR):
+       -mkdir $(XCODE_DEBUG_BUILD_DIR) 2>/dev/null
+       -cd $(XCODE_DEBUG_BUILD_DIR); rm -rf *
+
 # Generate a list of changes since last commit to 'master' branch
 .PHONY : CHANGELOG
 CHANGELOG:
index 648068d117acdd6cf5ee831c383ce00f506faf62..eeb13da18434d492a4d0a20a46ecc60a4f1ad365 100644 (file)
--- a/README.md
+++ b/README.md
@@ -4,9 +4,9 @@
 | ---------- | ------------------------- |  
 | Title:     | C-Template        |  
 | Author:    | Fletcher T. Penney       |  
-| Date:      | 2016-08-24 |  
+| Date:      | 2016-12-02 |  
 | Copyright: | Copyright © 2015-2016 Fletcher T. Penney.    |  
-| Version:   | 1.0.3      |  
+| Version:   | 1.0.4      |  
 
 
 ## Introduction ##
diff --git a/src/GLibFacade.h b/src/GLibFacade.h
deleted file mode 100644 (file)
index 5a0cabf..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- *     GLibFacade.h
- *     MultiMarkdown
- *     
- *     Created by Daniel Jalkut on 7/26/11.
- *     Modified by Fletcher T. Penney 9/15/11 - 5/6/16.
- *             Changes Copyright 2011-2016
- *     Modified by Dan Lowe on 1/3/12.
- *
- *     License for original code by Daniel Jalkut:
- *     
- *     Copyright 2011 Daniel Jalkut. All rights reserved.
- *     
- *     Permission is hereby granted, free of charge, to any person obtaining a copy of
- *     this software and associated documentation files (the “Software”), to deal in
- *     the Software without restriction, including without limitation the rights to
- *     use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- *     of the Software, and to permit persons to whom the Software is furnished to do
- *     so, subject to the following conditions:
- *     
- *     The above copyright notice and this permission notice shall be included in all
- *     copies or substantial portions of the Software.
- *     
- *     THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- *     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- *     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- *     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- *     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- *     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- *     SOFTWARE.
- */
-
-#ifndef __MARKDOWN_GLIB_FACADE__
-#define __MARKDOWN_GLIB_FACADE__
-
-/* peg_markdown uses the link symbol for its own purposes */
-#define link MARKDOWN_LINK_IGNORED
-#include <unistd.h>
-#undef link
-
-#include <stdbool.h>
-#include <ctype.h>
-
-typedef int gboolean;
-typedef char gchar;
-
-/* This style of bool is used in shared source code */
-#if !defined(FALSE)
-#define FALSE false
-#endif
-#if !defined(TRUE)
-#define TRUE true
-#endif
-
-/* WE implement minimal mirror implementations of GLib's GString and GSList 
- * sufficient to cover the functionality required by MultiMarkdown.
- *
- * NOTE: THese are 100% clean, from-scratch implementations using only the 
- * GLib function prototype as guide for behavior.
- */
-
-typedef struct 
-{      
-       /* Current UTF8 byte stream this string represents */
-       char* str;
-
-       /* Where in the str buffer will we add new characters */
-       /* or append new strings? */
-       unsigned long currentStringBufferSize;
-       unsigned long currentStringLength;
-} GString;
-
-GString* g_string_new(const char *startingString);
-char* g_string_free(GString* ripString, bool freeCharacterData);
-
-void g_string_append_c(GString* baseString, char appendedCharacter);
-void g_string_append_c_array(GString *baseString, char * appendedChars, size_t bytes);
-void g_string_append(GString* baseString, char *appendedString);
-
-void g_string_prepend(GString* baseString, char* prependedString);
-
-void g_string_append_printf(GString* baseString, char* format, ...);
-
-void g_string_insert(GString* baseString, size_t pos, char * insertedString);
-void g_string_insert_c(GString* baseString, size_t pos, char insertedCharacter);
-void g_string_insert_printf(GString* baseString, size_t pos, char* format, ...);
-
-void g_string_erase(GString* baseString, size_t pos, size_t len);
-
-/* Just implement a very simple singly linked list. */
-
-typedef struct _GSList
-{
-       void* data;     
-       struct _GSList* next;
-} GSList;
-
-void g_slist_free(GSList* ripList);
-GSList* g_slist_prepend(GSList* targetElement, void* newElementData);
-GSList* g_slist_reverse(GSList* theList);
-
-#endif
similarity index 65%
rename from src/GLibFacade.c
rename to src/d_string.c
index 572dab11163db61f06f49a19cb604ee1a7fb80e4..93d86540a2171b017023b020bc5730f860a60b51 100644 (file)
@@ -1,42 +1,67 @@
+/**
+
+       Smart String -- Library to abstract smart typing features from MMD Composer
+
+       @file d_string.c
+
+       @brief Dynamic string -- refactoring of old GLibFacade
+
+
+       @author Daniel Jalkut, modified by Fletcher T. Penney and Dan Lowe
+       @bug    
+
+**/
+
 /*
- *     GLibFacade.c
- *     MultiMarkdown
- *     
- *     Created by Daniel Jalkut on 7/26/11.
- *  Modified by Fletcher T. Penney 9/15/11 - 5/6/16.
- *             Changes Copyright 2011-2016
- *  Modified by Dan Lowe on 1/3/12.
- *
- *     License for original code by Daniel Jalkut:
- *     
- *     Copyright 2011 Daniel Jalkut. All rights reserved.
- *     
- *     Permission is hereby granted, free of charge, to any person obtaining a copy of
- *     this software and associated documentation files (the “Software”), to deal in
- *     the Software without restriction, including without limitation the rights to
- *     use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- *     of the Software, and to permit persons to whom the Software is furnished to do
- *     so, subject to the following conditions:
- *     
- *     The above copyright notice and this permission notice shall be included in all
- *     copies or substantial portions of the Software.
- *     
- *     THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- *     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- *     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- *     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- *     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- *     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- *     SOFTWARE.
- */
 
-#include "GLibFacade.h"
+       Copyright © 2011 Daniel Jalkut.
+       Modifications by Fletcher T. Penney, Copyright © 2011-2016 Fletcher T. Penney.
+       Modifications by Dan Lowe, Copyright © 2011 Dan Lowe.
+
+
+       The `c-template` project is released under the MIT License.
+       
+       GLibFacade.c and GLibFacade.h are from the MultiMarkdown v4 project:
+       
+               https://github.com/fletcher/MultiMarkdown-4/
+       
+       MMD 4 is released under both the MIT License and GPL.
+       
+       
+       CuTest is released under the zlib/libpng license. See CuTest.c for the text
+       of the license.
+       
+       
+       ## The MIT License ##
+       
+       Permission is hereby granted, free of charge, to any person obtaining a copy
+       of this software and associated documentation files (the "Software"), to deal
+       in the Software without restriction, including without limitation the rights
+       to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+       copies of the Software, and to permit persons to whom the Software is
+       furnished to do so, subject to the following conditions:
+       
+       The above copyright notice and this permission notice shall be included in
+       all copies or substantial portions of the Software.
+       
+       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+       IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+       FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+       AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+       LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+       OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+       THE SOFTWARE.
+
+*/
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
 
+#include "d_string.h"
+
+
 /*
  * The following section came from:
  *
@@ -72,14 +97,14 @@ int asprintf( char **sptr, char *fmt, ... )
 #endif
 
 
-/* GString */
+/* DString */
 
 #define kStringBufferStartingSize 1024
 #define kStringBufferGrowthMultiplier 2
 
-GString* g_string_new(const char *startingString)
+DString* d_string_new(const char *startingString)
 {
-       GString* newString = malloc(sizeof(GString));
+       DString* newString = malloc(sizeof(DString));
 
        if (startingString == NULL) startingString = "";
 
@@ -99,7 +124,7 @@ GString* g_string_new(const char *startingString)
        return newString;
 }
 
-char* g_string_free(GString* ripString, bool freeCharacterData)
+char* d_string_free(DString* ripString, bool freeCharacterData)
 {      
        if (ripString == NULL)
                return NULL;
@@ -119,7 +144,7 @@ char* g_string_free(GString* ripString, bool freeCharacterData)
        return returnedString;
 }
 
-static void ensureStringBufferCanHold(GString* baseString, size_t newStringSize)
+static void ensureStringBufferCanHold(DString* baseString, size_t newStringSize)
 {
        size_t newBufferSizeNeeded = newStringSize + 1;
        if (newBufferSizeNeeded > baseString->currentStringBufferSize)
@@ -145,7 +170,7 @@ static void ensureStringBufferCanHold(GString* baseString, size_t newStringSize)
        }
 }
 
-void g_string_append(GString* baseString, char* appendedString)
+void d_string_append(DString* baseString, char* appendedString)
 {
        if ((appendedString != NULL) && (strlen(appendedString) > 0))
        {
@@ -159,7 +184,7 @@ void g_string_append(GString* baseString, char* appendedString)
        }
 }
 
-void g_string_append_c(GString* baseString, char appendedCharacter)
+void d_string_append_c(DString* baseString, char appendedCharacter)
 {      
        size_t newSizeNeeded = baseString->currentStringLength + 1;
        ensureStringBufferCanHold(baseString, newSizeNeeded);
@@ -169,7 +194,7 @@ void g_string_append_c(GString* baseString, char appendedCharacter)
        baseString->str[baseString->currentStringLength] = '\0';
 }
 
-void g_string_append_c_array(GString *baseString, char * appendedChars, size_t bytes)
+void d_string_append_c_array(DString *baseString, const char * appendedChars, size_t bytes)
 {
        size_t newSizeNeeded = baseString->currentStringLength + bytes;
        ensureStringBufferCanHold(baseString, newSizeNeeded);
@@ -180,7 +205,7 @@ void g_string_append_c_array(GString *baseString, char * appendedChars, size_t b
        baseString->str[baseString->currentStringLength] = '\0';
 }
 
-void g_string_append_printf(GString* baseString, char* format, ...)
+void d_string_append_printf(DString* baseString, char* format, ...)
 {
        va_list args;
        va_start(args, format);
@@ -189,13 +214,13 @@ void g_string_append_printf(GString* baseString, char* format, ...)
        vasprintf(&formattedString, format, args);
        if (formattedString != NULL)
        {
-               g_string_append(baseString, formattedString);
+               d_string_append(baseString, formattedString);
                free(formattedString);
        }
        va_end(args);
 } 
 
-void g_string_prepend(GString* baseString, char* prependedString)
+void d_string_prepend(DString* baseString, char* prependedString)
 {
        if ((prependedString != NULL) && (strlen(prependedString) > 0))
        {
@@ -210,7 +235,7 @@ void g_string_prepend(GString* baseString, char* prependedString)
        }
 }
 
-void g_string_insert(GString* baseString, size_t pos, char * insertedString)
+void d_string_insert(DString* baseString, size_t pos, const char * insertedString)
 {
        if ((insertedString != NULL) && (strlen(insertedString) > 0))
        {
@@ -229,7 +254,7 @@ void g_string_insert(GString* baseString, size_t pos, char * insertedString)
        }
 }
 
-void g_string_insert_c(GString* baseString, size_t pos, char insertedCharacter)
+void d_string_insert_c(DString* baseString, size_t pos, char insertedCharacter)
 {      
        if (pos > baseString->currentStringLength)
                pos = baseString->currentStringLength;
@@ -246,7 +271,7 @@ void g_string_insert_c(GString* baseString, size_t pos, char insertedCharacter)
 }
 
 
-void g_string_insert_printf(GString* baseString, size_t pos, char* format, ...)
+void d_string_insert_printf(DString* baseString, size_t pos, char* format, ...)
 {
        va_list args;
        va_start(args, format);
@@ -255,13 +280,13 @@ void g_string_insert_printf(GString* baseString, size_t pos, char* format, ...)
        vasprintf(&formattedString, format, args);
        if (formattedString != NULL)
        {
-               g_string_insert(baseString, pos, formattedString);
+               d_string_insert(baseString, pos, formattedString);
                free(formattedString);
        }
        va_end(args);
 }
 
-void g_string_erase(GString* baseString, size_t pos, size_t len)
+void d_string_erase(DString* baseString, size_t pos, size_t len)
 {
        if ((pos > baseString->currentStringLength) || (len <= 0))
                return;
@@ -277,46 +302,3 @@ void g_string_erase(GString* baseString, size_t pos, size_t len)
        }
        baseString->str[baseString->currentStringLength] = '\0';
 }
-
-/* GSList */
-
-void g_slist_free(GSList* ripList)
-{
-       GSList* thisListItem = ripList;
-       while (thisListItem != NULL)
-       {
-               GSList* nextItem = thisListItem->next;
-               
-               /* I guess we don't release the data? Non-retained memory management is hard... let's figure it out later. */
-               free(thisListItem);
-               
-               thisListItem = nextItem;
-       }
-}
-
-/* Currently only used for markdown_output.c endnotes printing */
-GSList* g_slist_reverse(GSList* theList)
-{      
-       GSList* lastNodeSeen = NULL;
-       
-       /* Iterate the list items, tacking them on to our new reversed List as we find them */
-       GSList* listWalker = theList;
-       while (listWalker != NULL)
-       {
-               GSList* nextNode = listWalker->next;
-               listWalker->next = lastNodeSeen;
-               lastNodeSeen = listWalker;
-               listWalker = nextNode;
-       }
-       
-       return lastNodeSeen;
-}
-
-GSList* g_slist_prepend(GSList* targetElement, void* newElementData)
-{
-       GSList* newElement = malloc(sizeof(GSList));
-       newElement->data = newElementData;
-       newElement->next = targetElement;
-       return newElement;
-}
-
diff --git a/src/d_string.h b/src/d_string.h
new file mode 100644 (file)
index 0000000..79dfb67
--- /dev/null
@@ -0,0 +1,100 @@
+/**
+
+       Smart String -- Library to abstract smart typing features from MMD Composer
+
+       @file d_string.h
+
+       @brief Dynamic string -- refactoring of old GLibFacade
+
+
+       @author Daniel Jalkut, modified by Fletcher T. Penney and Dan Lowe
+       @bug    
+
+**/
+
+/*
+
+       Copyright © 2011 Daniel Jalkut.
+       Modifications by Fletcher T. Penney, Copyright © 2011-2016 Fletcher T. Penney.
+       Modifications by Dan Lowe, Copyright © 2011 Dan Lowe.
+
+
+       The `c-template` project is released under the MIT License.
+       
+       GLibFacade.c and GLibFacade.h are from the MultiMarkdown v4 project:
+       
+               https://github.com/fletcher/MultiMarkdown-4/
+       
+       MMD 4 is released under both the MIT License and GPL.
+       
+       
+       CuTest is released under the zlib/libpng license. See CuTest.c for the text
+       of the license.
+       
+       
+       ## The MIT License ##
+       
+       Permission is hereby granted, free of charge, to any person obtaining a copy
+       of this software and associated documentation files (the "Software"), to deal
+       in the Software without restriction, including without limitation the rights
+       to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+       copies of the Software, and to permit persons to whom the Software is
+       furnished to do so, subject to the following conditions:
+       
+       The above copyright notice and this permission notice shall be included in
+       all copies or substantial portions of the Software.
+       
+       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+       IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+       FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+       AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+       LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+       OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+       THE SOFTWARE.
+
+*/
+
+
+#ifndef D_STRING_SMART_STRING_H
+#define D_STRING_SMART_STRING_H
+
+#include <stdbool.h>
+
+/* WE implement minimal mirror implementations of GLib's GString  
+ * sufficient to cover the functionality required by MultiMarkdown.
+ *
+ * NOTE: THese are 100% clean, from-scratch implementations using only the 
+ * GLib function prototype as guide for behavior.
+ */
+
+typedef struct 
+{      
+       /* Current UTF8 byte stream this string represents */
+       char* str;
+
+       /* Where in the str buffer will we add new characters */
+       /* or append new strings? */
+       unsigned long currentStringBufferSize;
+       unsigned long currentStringLength;
+} DString;
+
+DString* d_string_new(const char *startingString);
+
+char* d_string_free(DString* ripString, bool freeCharacterData);
+
+void d_string_append_c(DString* baseString, char appendedCharacter);
+void d_string_append_c_array(DString *baseString, const char * appendedChars, size_t bytes);
+void d_string_append(DString* baseString, char *appendedString);
+
+void d_string_prepend(DString* baseString, char* prependedString);
+
+void d_string_append_printf(DString* baseString, char* format, ...);
+
+void d_string_insert(DString* baseString, size_t pos, const char * insertedString);
+void d_string_insert_c(DString* baseString, size_t pos, char insertedCharacter);
+void d_string_insert_printf(DString* baseString, size_t pos, char* format, ...);
+
+void d_string_erase(DString* baseString, size_t pos, size_t len);
+
+
+#endif
index 270d19b3f67d884476e354c31349c812a6ad5818..7d8ab53b384cfea2c9bd55af6a40b2425e8c6b92 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "GLibFacade.h"
+#include "d_string.h"
 
 #define kBUFFERSIZE 4096       // How many bytes to read at a time
 
-GString * stdin_buffer() {
+DString * stdin_buffer() {
        /* Read from stdin and return a GString *
                `buffer` will need to be freed elsewhere */
 
        char chunk[kBUFFERSIZE];
        size_t bytes;
 
-       GString * buffer = g_string_new("");
+       DString * buffer = d_string_new("");
 
     while ((bytes = fread(chunk, 1, kBUFFERSIZE, stdin)) > 0) {
-       g_string_append_c_array(buffer, chunk, bytes);
+       d_string_append_c_array(buffer, chunk, bytes);
     }
 
        fclose(stdin);
@@ -46,7 +46,7 @@ GString * stdin_buffer() {
        return buffer;
 }
 
-GString * scan_file(char * fname) {
+DString * scan_file(char * fname) {
        /* Read from stdin and return a GString *
                `buffer` will need to be freed elsewhere */
 
@@ -59,10 +59,10 @@ GString * scan_file(char * fname) {
                return NULL;
        }
 
-       GString * buffer = g_string_new("");
+       DString * buffer = d_string_new("");
 
     while ((bytes = fread(chunk, 1, kBUFFERSIZE, file)) > 0) {
-       g_string_append_c_array(buffer, chunk, bytes);
+       d_string_append_c_array(buffer, chunk, bytes);
     }
 
        fclose(file);