libdrawtext

changeset 16:baec6ad7b2dd

added visual studio project and fixed some windows build problems
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 10 Mar 2013 18:29:21 +0200
parents 462bcb69de15
children 080e5b45297c
files libdrawtext.sln libdrawtext.vcproj src/drawgl.c src/drawtext_impl.h src/font.c
diffstat 5 files changed, 217 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libdrawtext.sln	Sun Mar 10 18:29:21 2013 +0200
     1.3 @@ -0,0 +1,20 @@
     1.4 +
     1.5 +Microsoft Visual Studio Solution File, Format Version 10.00
     1.6 +# Visual C++ Express 2008
     1.7 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdrawtext", "libdrawtext.vcproj", "{F6241CAB-984D-457D-A7EA-E66A57889490}"
     1.8 +EndProject
     1.9 +Global
    1.10 +	GlobalSection(SolutionConfigurationPlatforms) = preSolution
    1.11 +		Debug|Win32 = Debug|Win32
    1.12 +		Release|Win32 = Release|Win32
    1.13 +	EndGlobalSection
    1.14 +	GlobalSection(ProjectConfigurationPlatforms) = postSolution
    1.15 +		{F6241CAB-984D-457D-A7EA-E66A57889490}.Debug|Win32.ActiveCfg = Debug|Win32
    1.16 +		{F6241CAB-984D-457D-A7EA-E66A57889490}.Debug|Win32.Build.0 = Debug|Win32
    1.17 +		{F6241CAB-984D-457D-A7EA-E66A57889490}.Release|Win32.ActiveCfg = Release|Win32
    1.18 +		{F6241CAB-984D-457D-A7EA-E66A57889490}.Release|Win32.Build.0 = Release|Win32
    1.19 +	EndGlobalSection
    1.20 +	GlobalSection(SolutionProperties) = preSolution
    1.21 +		HideSolutionNode = FALSE
    1.22 +	EndGlobalSection
    1.23 +EndGlobal
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/libdrawtext.vcproj	Sun Mar 10 18:29:21 2013 +0200
     2.3 @@ -0,0 +1,183 @@
     2.4 +<?xml version="1.0" encoding="Windows-1252"?>
     2.5 +<VisualStudioProject
     2.6 +	ProjectType="Visual C++"
     2.7 +	Version="9.00"
     2.8 +	Name="libdrawtext"
     2.9 +	ProjectGUID="{F6241CAB-984D-457D-A7EA-E66A57889490}"
    2.10 +	RootNamespace="libdrawtext"
    2.11 +	Keyword="Win32Proj"
    2.12 +	TargetFrameworkVersion="196613"
    2.13 +	>
    2.14 +	<Platforms>
    2.15 +		<Platform
    2.16 +			Name="Win32"
    2.17 +		/>
    2.18 +	</Platforms>
    2.19 +	<ToolFiles>
    2.20 +	</ToolFiles>
    2.21 +	<Configurations>
    2.22 +		<Configuration
    2.23 +			Name="Debug|Win32"
    2.24 +			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
    2.25 +			IntermediateDirectory="$(ConfigurationName)"
    2.26 +			ConfigurationType="4"
    2.27 +			CharacterSet="1"
    2.28 +			>
    2.29 +			<Tool
    2.30 +				Name="VCPreBuildEventTool"
    2.31 +			/>
    2.32 +			<Tool
    2.33 +				Name="VCCustomBuildTool"
    2.34 +			/>
    2.35 +			<Tool
    2.36 +				Name="VCXMLDataGeneratorTool"
    2.37 +			/>
    2.38 +			<Tool
    2.39 +				Name="VCWebServiceProxyGeneratorTool"
    2.40 +			/>
    2.41 +			<Tool
    2.42 +				Name="VCMIDLTool"
    2.43 +			/>
    2.44 +			<Tool
    2.45 +				Name="VCCLCompilerTool"
    2.46 +				Optimization="0"
    2.47 +				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
    2.48 +				MinimalRebuild="true"
    2.49 +				BasicRuntimeChecks="3"
    2.50 +				RuntimeLibrary="3"
    2.51 +				UsePrecompiledHeader="0"
    2.52 +				WarningLevel="3"
    2.53 +				DebugInformationFormat="4"
    2.54 +				DisableSpecificWarnings="4996"
    2.55 +			/>
    2.56 +			<Tool
    2.57 +				Name="VCManagedResourceCompilerTool"
    2.58 +			/>
    2.59 +			<Tool
    2.60 +				Name="VCResourceCompilerTool"
    2.61 +			/>
    2.62 +			<Tool
    2.63 +				Name="VCPreLinkEventTool"
    2.64 +			/>
    2.65 +			<Tool
    2.66 +				Name="VCLibrarianTool"
    2.67 +			/>
    2.68 +			<Tool
    2.69 +				Name="VCALinkTool"
    2.70 +			/>
    2.71 +			<Tool
    2.72 +				Name="VCXDCMakeTool"
    2.73 +			/>
    2.74 +			<Tool
    2.75 +				Name="VCBscMakeTool"
    2.76 +			/>
    2.77 +			<Tool
    2.78 +				Name="VCFxCopTool"
    2.79 +			/>
    2.80 +			<Tool
    2.81 +				Name="VCPostBuildEventTool"
    2.82 +			/>
    2.83 +		</Configuration>
    2.84 +		<Configuration
    2.85 +			Name="Release|Win32"
    2.86 +			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
    2.87 +			IntermediateDirectory="$(ConfigurationName)"
    2.88 +			ConfigurationType="4"
    2.89 +			CharacterSet="1"
    2.90 +			WholeProgramOptimization="1"
    2.91 +			>
    2.92 +			<Tool
    2.93 +				Name="VCPreBuildEventTool"
    2.94 +			/>
    2.95 +			<Tool
    2.96 +				Name="VCCustomBuildTool"
    2.97 +			/>
    2.98 +			<Tool
    2.99 +				Name="VCXMLDataGeneratorTool"
   2.100 +			/>
   2.101 +			<Tool
   2.102 +				Name="VCWebServiceProxyGeneratorTool"
   2.103 +			/>
   2.104 +			<Tool
   2.105 +				Name="VCMIDLTool"
   2.106 +			/>
   2.107 +			<Tool
   2.108 +				Name="VCCLCompilerTool"
   2.109 +				Optimization="2"
   2.110 +				EnableIntrinsicFunctions="true"
   2.111 +				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
   2.112 +				RuntimeLibrary="2"
   2.113 +				EnableFunctionLevelLinking="true"
   2.114 +				UsePrecompiledHeader="0"
   2.115 +				WarningLevel="3"
   2.116 +				DebugInformationFormat="3"
   2.117 +				DisableSpecificWarnings="4996"
   2.118 +			/>
   2.119 +			<Tool
   2.120 +				Name="VCManagedResourceCompilerTool"
   2.121 +			/>
   2.122 +			<Tool
   2.123 +				Name="VCResourceCompilerTool"
   2.124 +			/>
   2.125 +			<Tool
   2.126 +				Name="VCPreLinkEventTool"
   2.127 +			/>
   2.128 +			<Tool
   2.129 +				Name="VCLibrarianTool"
   2.130 +			/>
   2.131 +			<Tool
   2.132 +				Name="VCALinkTool"
   2.133 +			/>
   2.134 +			<Tool
   2.135 +				Name="VCXDCMakeTool"
   2.136 +			/>
   2.137 +			<Tool
   2.138 +				Name="VCBscMakeTool"
   2.139 +			/>
   2.140 +			<Tool
   2.141 +				Name="VCFxCopTool"
   2.142 +			/>
   2.143 +			<Tool
   2.144 +				Name="VCPostBuildEventTool"
   2.145 +			/>
   2.146 +		</Configuration>
   2.147 +	</Configurations>
   2.148 +	<References>
   2.149 +	</References>
   2.150 +	<Files>
   2.151 +		<Filter
   2.152 +			Name="Source Files"
   2.153 +			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
   2.154 +			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
   2.155 +			>
   2.156 +			<File
   2.157 +				RelativePath=".\src\drawgl.c"
   2.158 +				>
   2.159 +			</File>
   2.160 +			<File
   2.161 +				RelativePath=".\src\font.c"
   2.162 +				>
   2.163 +			</File>
   2.164 +			<File
   2.165 +				RelativePath=".\src\utf8.c"
   2.166 +				>
   2.167 +			</File>
   2.168 +		</Filter>
   2.169 +		<Filter
   2.170 +			Name="Header Files"
   2.171 +			Filter="h;hpp;hxx;hm;inl;inc;xsd"
   2.172 +			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
   2.173 +			>
   2.174 +			<File
   2.175 +				RelativePath=".\src\drawtext.h"
   2.176 +				>
   2.177 +			</File>
   2.178 +			<File
   2.179 +				RelativePath=".\src\drawtext_impl.h"
   2.180 +				>
   2.181 +			</File>
   2.182 +		</Filter>
   2.183 +	</Files>
   2.184 +	<Globals>
   2.185 +	</Globals>
   2.186 +</VisualStudioProject>
     3.1 --- a/src/drawgl.c	Thu Feb 28 18:51:33 2013 +0200
     3.2 +++ b/src/drawgl.c	Sun Mar 10 18:29:21 2013 +0200
     3.3 @@ -22,6 +22,12 @@
     3.4  
     3.5  #include <stdlib.h>
     3.6  
     3.7 +#ifndef _MSC_VER
     3.8 +#include <alloca.h>
     3.9 +#else
    3.10 +#include <malloc.h>
    3.11 +#endif
    3.12 +
    3.13  #ifdef TARGET_IPHONE
    3.14  #include <OpenGLES/ES2/gl.h>
    3.15  #else
     4.1 --- a/src/drawtext_impl.h	Thu Feb 28 18:51:33 2013 +0200
     4.2 +++ b/src/drawtext_impl.h	Sun Mar 10 18:29:21 2013 +0200
     4.3 @@ -61,7 +61,7 @@
     4.4  
     4.5  
     4.6  #define fperror(str) \
     4.7 -	fprintf(stderr, "%s: %s: %s\n", __func__, (str), strerror(errno))
     4.8 +	fprintf(stderr, "%s: %s: %s\n", __FUNCTION__, (str), strerror(errno))
     4.9  
    4.10  int dtx_gl_init(void);
    4.11  
     5.1 --- a/src/font.c	Thu Feb 28 18:51:33 2013 +0200
     5.2 +++ b/src/font.c	Sun Mar 10 18:29:21 2013 +0200
     5.3 @@ -331,12 +331,12 @@
     5.4  
     5.5  		if(line[0] == '#') {
     5.6  			struct glyph *g;
     5.7 -			int c;
     5.8 -			float x, y, xsz, ysz, res;
     5.9 +			int c, res;
    5.10 +			float x, y, xsz, ysz;
    5.11  
    5.12  			res = sscanf(line + 1, "%d: %fx%f+%f+%f\n", &c, &xsz, &ysz, &x, &y);
    5.13  			if(res != 5) {
    5.14 -				fprintf(stderr, "%s: invalid glyph info line\n", __func__);
    5.15 +				fprintf(stderr, "%s: invalid glyph info line\n", __FUNCTION__);
    5.16  				goto err;
    5.17  			}
    5.18  
    5.19 @@ -362,14 +362,14 @@
    5.20  			switch(hdr_lines) {
    5.21  			case 0:
    5.22  				if(0[line] != 'P' || 1[line] != '6') {
    5.23 -					fprintf(stderr, "%s: invalid file format (magic)\n", __func__);
    5.24 +					fprintf(stderr, "%s: invalid file format (magic)\n", __FUNCTION__);
    5.25  					goto err;
    5.26  				}
    5.27  				break;
    5.28  
    5.29  			case 1:
    5.30  				if(sscanf(line, "%d %d", &gmap->xsz, &gmap->ysz) != 2) {
    5.31 -					fprintf(stderr, "%s: invalid file format (dim)\n", __func__);
    5.32 +					fprintf(stderr, "%s: invalid file format (dim)\n", __FUNCTION__);
    5.33  					goto err;
    5.34  				}
    5.35  				break;
    5.36 @@ -379,7 +379,7 @@
    5.37  					char *endp;
    5.38  					max_pixval = strtol(line, &endp, 10);
    5.39  					if(endp == line) {
    5.40 -						fprintf(stderr, "%s: invalid file format (maxval)\n", __func__);
    5.41 +						fprintf(stderr, "%s: invalid file format (maxval)\n", __FUNCTION__);
    5.42  						goto err;
    5.43  					}
    5.44  				}
    5.45 @@ -442,7 +442,7 @@
    5.46  	int res;
    5.47  
    5.48  	if(!(fp = fopen(fname, "wb"))) {
    5.49 -		fprintf(stderr, "%s: failed to open file: %s: %s\n", __func__, fname, strerror(errno));
    5.50 +		fprintf(stderr, "%s: failed to open file: %s: %s\n", __FUNCTION__, fname, strerror(errno));
    5.51  		return -1;
    5.52  	}
    5.53  	res = dtx_save_glyphmap_stream(fp, gmap);