aboutsummaryrefslogtreecommitdiffstats
path: root/tools/file2c/Source
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2013-04-03 12:32:57 +0200
committerJoel Bodenmann <joel@unormal.org>2013-04-03 12:32:57 +0200
commit9b1dd95ff75aedd4982a988e3e3d603d33337570 (patch)
tree452feb5bc6fcb510c2edaa44a37eaf33f34fb83c /tools/file2c/Source
parentfb641b712ebca402d298310bd153680601eeef8b (diff)
downloaduGFX-9b1dd95ff75aedd4982a988e3e3d603d33337570.tar.gz
uGFX-9b1dd95ff75aedd4982a988e3e3d603d33337570.tar.bz2
uGFX-9b1dd95ff75aedd4982a988e3e3d603d33337570.zip
file2c tool - Makefile, readme, linux binary
Diffstat (limited to 'tools/file2c/Source')
-rw-r--r--tools/file2c/Source/VS 2012 Project/file2c.sln22
-rw-r--r--tools/file2c/Source/VS 2012 Project/file2c.v11.suobin25600 -> 0 bytes
-rw-r--r--tools/file2c/Source/VS 2012 Project/file2c/file2c.vcxproj84
-rw-r--r--tools/file2c/Source/VS 2012 Project/file2c/file2c.vcxproj.filters22
-rw-r--r--tools/file2c/Source/VS 2012 Project/file2c/file2c.vcxproj.user4
-rw-r--r--tools/file2c/Source/file2c.c152
6 files changed, 0 insertions, 284 deletions
diff --git a/tools/file2c/Source/VS 2012 Project/file2c.sln b/tools/file2c/Source/VS 2012 Project/file2c.sln
deleted file mode 100644
index 5e067d5b..00000000
--- a/tools/file2c/Source/VS 2012 Project/file2c.sln
+++ /dev/null
@@ -1,22 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "file2c", "file2c\file2c.vcxproj", "{16787B20-A841-4DC1-9C15-E6677A0D7342}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {16787B20-A841-4DC1-9C15-E6677A0D7342}.Debug|Win32.ActiveCfg = Debug|Win32
- {16787B20-A841-4DC1-9C15-E6677A0D7342}.Debug|Win32.Build.0 = Debug|Win32
- {16787B20-A841-4DC1-9C15-E6677A0D7342}.Debug|Win32.Deploy.0 = Debug|Win32
- {16787B20-A841-4DC1-9C15-E6677A0D7342}.Release|Win32.ActiveCfg = Release|Win32
- {16787B20-A841-4DC1-9C15-E6677A0D7342}.Release|Win32.Build.0 = Release|Win32
- {16787B20-A841-4DC1-9C15-E6677A0D7342}.Release|Win32.Deploy.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/tools/file2c/Source/VS 2012 Project/file2c.v11.suo b/tools/file2c/Source/VS 2012 Project/file2c.v11.suo
deleted file mode 100644
index 586b2c04..00000000
--- a/tools/file2c/Source/VS 2012 Project/file2c.v11.suo
+++ /dev/null
Binary files differ
diff --git a/tools/file2c/Source/VS 2012 Project/file2c/file2c.vcxproj b/tools/file2c/Source/VS 2012 Project/file2c/file2c.vcxproj
deleted file mode 100644
index b0b846c7..00000000
--- a/tools/file2c/Source/VS 2012 Project/file2c/file2c.vcxproj
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\..\file2c.c" />
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{16787B20-A841-4DC1-9C15-E6677A0D7342}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>file2c</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v110</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v110</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <LinkIncremental>true</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/tools/file2c/Source/VS 2012 Project/file2c/file2c.vcxproj.filters b/tools/file2c/Source/VS 2012 Project/file2c/file2c.vcxproj.filters
deleted file mode 100644
index 97daa75f..00000000
--- a/tools/file2c/Source/VS 2012 Project/file2c/file2c.vcxproj.filters
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\..\file2c.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/tools/file2c/Source/VS 2012 Project/file2c/file2c.vcxproj.user b/tools/file2c/Source/VS 2012 Project/file2c/file2c.vcxproj.user
deleted file mode 100644
index a375ae35..00000000
--- a/tools/file2c/Source/VS 2012 Project/file2c/file2c.vcxproj.user
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup />
-</Project> \ No newline at end of file
diff --git a/tools/file2c/Source/file2c.c b/tools/file2c/Source/file2c.c
deleted file mode 100644
index d2b862e6..00000000
--- a/tools/file2c/Source/file2c.c
+++ /dev/null
@@ -1,152 +0,0 @@
-#include <stdio.h>
-#include <fcntl.h>
-#include <string.h>
-#ifdef WIN32
- #include <io.h>
-#endif
-
-static unsigned char buf[1024];
-
-static char *filenameof(char *fname) {
- char *p;
-
-#ifdef WIN32
- if (fname[1] == ':')
- fname = fname+2;
- p = strrchr(fname, '\\');
- if (p) fname = p+1;
-#endif
- p = strrchr(fname, '/');
- if (p) fname = p+1;
- p = strchr(fname, '.');
- if (p) *p = 0;
- return fname;
-}
-
-static char *clean4c(char *fname) {
- char *p;
-
- while((p = strpbrk(fname, "-+ `~!@#$%^&*(){}[]|:;'\",<>?/|="))) *p = '_';
- return fname;
-}
-
-int main(int argc, char * argv[])
-{
-char * opt_progname;
-char * opt_inputfile;
-char * opt_outputfile;
-char * opt_arrayname;
-int opt_breakblocks;
-char * opt_static;
-char * opt_const;
-FILE * f_input;
-FILE * f_output;
-unsigned blocknum;
-size_t len;
-size_t i;
-
- /* Default values for our parameters */
- opt_progname = argv[0];
- opt_inputfile = 0;
- opt_outputfile = 0;
- opt_arrayname = 0;
- opt_breakblocks = 0;
- opt_static = "";
- opt_const = "";
-
- /* Read the arguments */
- while(*++argv) {
- if (argv[0][0] == '-') {
- while (*++(argv[0])) {
- switch(argv[0][0]) {
- case 'b': opt_breakblocks = 1; break;
- case 'c': opt_const = "const "; break;
- case 's': opt_static = "static "; break;
- case 'n': opt_arrayname = *++argv; goto nextarg;
- default:
- fprintf(stderr, "Unknown flag -%c\n", argv[0][0]);
- goto usage;
- }
- }
- } else if (!opt_inputfile)
- opt_inputfile = argv[0];
- else if (!opt_outputfile)
- opt_outputfile = argv[0];
- else {
- usage:
- fprintf(stderr, "Usage:\n\t%s -?\n"
- "\t%s [-bs] [-n name] [inputfile] [outputfile]\n"
- "\t\t-?\tThis help\n"
- "\t\t-b\tBreak the arrays for compilers that won't handle large arrays\n"
- "\t\t-c\tDeclare the arrays as const (useful to ensure they end up in Flash)\n"
- "\t\t-s\tDeclare the arrays as static\n"
- "\t\t-n name\tUse \"name\" as the name of the array\n"
- , opt_progname, opt_progname);
- return 1;
- }
- nextarg: ;
- }
-
- /* Open the input file */
- if (opt_inputfile) {
- f_input = fopen(opt_inputfile,
-#ifdef WIN32
- "rb");
-#else
- "r");
-#endif
- if (!f_input) {
- fprintf(stderr, "Could not open input file '%s'\n", opt_inputfile);
- goto usage;
- }
- } else {
- f_input = stdin;
-#ifdef WIN32
- _setmode(_fileno(stdin), _O_BINARY);
-#endif
- }
-
- /* Open the output file */
- if (opt_outputfile) {
- f_output = fopen(opt_outputfile, "w");
- if (!f_output) {
- fprintf(stderr, "Could not open output file '%s'\n", opt_outputfile);
- goto usage;
- }
- } else
- f_output = stdout;
-
- /* Set the array name */
- if (!opt_arrayname) {
- if (opt_inputfile)
- opt_arrayname = filenameof(opt_inputfile);
- if (!opt_arrayname || !opt_arrayname[0])
- opt_arrayname = "filearray";
- opt_arrayname = clean4c(opt_arrayname);
- }
-
- /* Read the file processing 1K at a time */
- blocknum = 0;
- while((len = fread(buf, 1, sizeof(buf), f_input))) {
- if (!blocknum++)
- fprintf(f_output, "%s%sunsigned char %s[] = {", opt_static, opt_const, opt_arrayname);
- else if (opt_breakblocks)
- fprintf(f_output, "\n};\n%s%sunsigned char %s_p%u[] = {", opt_static, opt_const, opt_arrayname, blocknum);
- for(i = 0; i < len; i++) {
- fprintf(f_output, (i & 0x0F) ? " 0x%02X," : "\n\t0x%02X,", buf[i]);
- }
- }
- fprintf(f_output, "\n};\n");
-
- /* Clean up */
- if (ferror(f_input))
- fprintf(stderr, "Input file read error\n");
- if (ferror(f_output))
- fprintf(stderr, "Output file write error - disk full?\n");
- if (f_input != stdin)
- fclose(f_input);
- if (f_output != stdout)
- fclose(f_output);
-
- return 0;
-}