From 5e742fc395410df7908fd274e17bab3ac5d9e3de Mon Sep 17 00:00:00 2001 From: CBWhiz Date: Mon, 10 Sep 2012 16:36:16 -0400 Subject: [PATCH 1/3] Add config header and project for MS Embedded C++ 3.0 --- win32/evc30/.gitattributes | 2 + win32/evc30/jansson.vcp | 221 ++++++++++++++++++++++++++ win32/evc30/jansson.vcw | 29 ++++ win32/evc30/jansson_config.h | 1 + win32/evc30/jansson_config.h.evc_30.h | 46 ++++++ 5 files changed, 299 insertions(+) create mode 100644 win32/evc30/.gitattributes create mode 100644 win32/evc30/jansson.vcp create mode 100644 win32/evc30/jansson.vcw create mode 100644 win32/evc30/jansson_config.h create mode 100644 win32/evc30/jansson_config.h.evc_30.h diff --git a/win32/evc30/.gitattributes b/win32/evc30/.gitattributes new file mode 100644 index 0000000..c776d47 --- /dev/null +++ b/win32/evc30/.gitattributes @@ -0,0 +1,2 @@ +jansson.vcp -text -crlf eol=crlf +jansson.vcw -text -crlf eol=crlf \ No newline at end of file diff --git a/win32/evc30/jansson.vcp b/win32/evc30/jansson.vcp new file mode 100644 index 0000000..27041cd --- /dev/null +++ b/win32/evc30/jansson.vcp @@ -0,0 +1,221 @@ +# Microsoft eMbedded Visual Tools Project File - Name="jansson" - Package Owner=<4> +# Microsoft eMbedded Visual Tools Generated Build File, Format Version 6.02 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (WCE ARM) Static Library" 0x8504 + +CFG=jansson - Win32 (WCE ARM) Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "jansson.vcn". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "jansson.vcn" CFG="jansson - Win32 (WCE ARM) Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "jansson - Win32 (WCE ARM) Release" (based on "Win32 (WCE ARM) Static Library") +!MESSAGE "jansson - Win32 (WCE ARM) Debug" (based on "Win32 (WCE ARM) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +# PROP ATL_Project 2 +CPP=clarm.exe + +!IF "$(CFG)" == "jansson - Win32 (WCE ARM) Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ARMRel" +# PROP BASE Intermediate_Dir "ARMRel" +# PROP BASE CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}" +# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ARMRel" +# PROP Intermediate_Dir "ARMRel" +# PROP CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}" +# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /Oxs /M$(CECrtMT) /c +# ADD CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /Oxs /M$(CECrtMT) /c +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo + +!ELSEIF "$(CFG)" == "jansson - Win32 (WCE ARM) Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ARMDbg" +# PROP BASE Intermediate_Dir "ARMDbg" +# PROP BASE CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}" +# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "ARMDbg" +# PROP Intermediate_Dir "ARMDbg" +# PROP CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}" +# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c +# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo + +!ENDIF + +# Begin Target + +# Name "jansson - Win32 (WCE ARM) Release" +# Name "jansson - Win32 (WCE ARM) Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\src\dump.c +DEP_CPP_DUMP_=\ + "..\..\src\hashtable.h"\ + "..\..\src\jansson.h"\ + "..\..\src\jansson_private.h"\ + "..\..\src\strbuffer.h"\ + "..\..\src\utf.h"\ + +# End Source File +# Begin Source File + +SOURCE=..\..\src\error.c +DEP_CPP_ERROR=\ + "..\..\src\hashtable.h"\ + "..\..\src\jansson.h"\ + "..\..\src\jansson_private.h"\ + "..\..\src\strbuffer.h"\ + +# End Source File +# Begin Source File + +SOURCE=..\..\src\hashtable.c +DEP_CPP_HASHT=\ + "..\..\src\hashtable.h"\ + "..\..\src\jansson.h"\ + "..\..\src\jansson_private.h"\ + "..\..\src\strbuffer.h"\ + +# End Source File +# Begin Source File + +SOURCE=..\..\src\load.c +DEP_CPP_LOAD_=\ + "..\..\src\hashtable.h"\ + "..\..\src\jansson.h"\ + "..\..\src\jansson_private.h"\ + "..\..\src\strbuffer.h"\ + "..\..\src\utf.h"\ + +# End Source File +# Begin Source File + +SOURCE=..\..\src\memory.c +DEP_CPP_MEMOR=\ + "..\..\src\hashtable.h"\ + "..\..\src\jansson.h"\ + "..\..\src\jansson_private.h"\ + "..\..\src\strbuffer.h"\ + +# End Source File +# Begin Source File + +SOURCE=..\..\src\pack_unpack.c +DEP_CPP_PACK_=\ + "..\..\src\hashtable.h"\ + "..\..\src\jansson.h"\ + "..\..\src\jansson_private.h"\ + "..\..\src\strbuffer.h"\ + "..\..\src\utf.h"\ + +# End Source File +# Begin Source File + +SOURCE=..\..\src\strbuffer.c +DEP_CPP_STRBU=\ + "..\..\src\hashtable.h"\ + "..\..\src\jansson.h"\ + "..\..\src\jansson_private.h"\ + "..\..\src\strbuffer.h"\ + +# End Source File +# Begin Source File + +SOURCE=..\..\src\strconv.c +DEP_CPP_STRCO=\ + "..\..\src\hashtable.h"\ + "..\..\src\jansson.h"\ + "..\..\src\jansson_private.h"\ + "..\..\src\strbuffer.h"\ + +# End Source File +# Begin Source File + +SOURCE=..\..\src\utf.c +DEP_CPP_UTF_C=\ + "..\..\src\utf.h"\ + +# End Source File +# Begin Source File + +SOURCE=..\..\src\value.c +DEP_CPP_VALUE=\ + "..\..\src\hashtable.h"\ + "..\..\src\jansson.h"\ + "..\..\src\jansson_private.h"\ + "..\..\src\strbuffer.h"\ + "..\..\src\utf.h"\ + +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\src\hashtable.h +# End Source File +# Begin Source File + +SOURCE=..\..\src\jansson.h +# End Source File +# Begin Source File + +SOURCE=..\..\src\jansson_config.h +# End Source File +# Begin Source File + +SOURCE=..\..\src\jansson_private.h +# End Source File +# Begin Source File + +SOURCE=..\..\src\strbuffer.h +# End Source File +# Begin Source File + +SOURCE=..\..\src\utf.h +# End Source File +# End Group +# End Target +# End Project diff --git a/win32/evc30/jansson.vcw b/win32/evc30/jansson.vcw new file mode 100644 index 0000000..1bf5096 --- /dev/null +++ b/win32/evc30/jansson.vcw @@ -0,0 +1,29 @@ +Microsoft eMbedded Visual Tools Workspace File, Format Version 3.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "jansson"=.\jansson.vcp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/win32/evc30/jansson_config.h b/win32/evc30/jansson_config.h new file mode 100644 index 0000000..3e6da0b --- /dev/null +++ b/win32/evc30/jansson_config.h @@ -0,0 +1 @@ +#include "jansson_config.h.evc_30.h" \ No newline at end of file diff --git a/win32/evc30/jansson_config.h.evc_30.h b/win32/evc30/jansson_config.h.evc_30.h new file mode 100644 index 0000000..627a383 --- /dev/null +++ b/win32/evc30/jansson_config.h.evc_30.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2010-2012 Petri Lehtinen + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + * + * + * This file specifies a part of the site-specific configuration for + * Jansson, namely those things that affect the public API in + * jansson.h. + * + * The configure script copies this file to jansson_config.h and + * replaces @var@ substitutions by values that fit your system. If you + * cannot run the configure script, you can do the value substitution + * by hand. + */ + +#ifndef JANSSON_CONFIG_H +#define JANSSON_CONFIG_H + +/* If your compiler supports the inline keyword in C, JSON_INLINE is + defined to `inline', otherwise empty. In C++, the inline is always + supported. */ +#ifdef __cplusplus +#define JSON_INLINE inline +#else +#define JSON_INLINE __inline +#endif + +/* If your compiler supports the `long long` type and the strtoll() + library function, JSON_INTEGER_IS_LONG_LONG is defined to 1, + otherwise to 0. */ +#define JSON_INTEGER_IS_LONG_LONG 0 + +/* If locale.h and localeconv() are available, define to 1, + otherwise to 0. */ +#define JSON_HAVE_LOCALECONV 0 + +#undef HAVE_INTTYPES_H +#undef HAVE_CONFIG_H + +#define JSON_HAVE_ERRNO 0 + +#define _STLP_ASSERT(x) + +#endif From d64fe0c53d832767f2a0137500361510b13f2381 Mon Sep 17 00:00:00 2001 From: CBWhiz Date: Mon, 10 Sep 2012 16:47:51 -0400 Subject: [PATCH 2/3] Add patches for evc30 (Add JSON_HAVE_ERRNO) --- src/load.c | 13 ++++++++++--- src/strconv.c | 7 +++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/load.c b/src/load.c index d88a704..f5c3869 100644 --- a/src/load.c +++ b/src/load.c @@ -490,7 +490,7 @@ static int lex_scan_number(lex_t *lex, int c, json_error_t *error) lex_unget_unsave(lex, c); saved_text = strbuffer_value(&lex->saved_text); - +#if JSON_HAVE_ERRNO errno = 0; value = json_strtoint(saved_text, &end, 10); if(errno == ERANGE) { @@ -500,7 +500,9 @@ static int lex_scan_number(lex_t *lex, int c, json_error_t *error) error_set(error, lex, "too big integer"); goto out; } - +#else + value = json_strtoint(saved_text, &end, 10); +#endif assert(end == saved_text + lex->saved_text.length); lex->token = TOKEN_INTEGER; @@ -987,9 +989,14 @@ json_t *json_load_file(const char *path, size_t flags, json_error_t *error) fp = fopen(path, "rb"); if(!fp) { +#if JSON_HAVE_ERRNO error_set(error, NULL, "unable to open %s: %s", path, strerror(errno)); - return NULL; +#else + error_set(error, NULL, "unable to open %s: %s", + path, ""); +#endif + return NULL; } result = json_loadf(fp, flags, error); diff --git a/src/strconv.c b/src/strconv.c index caa9ab8..29e8b81 100644 --- a/src/strconv.c +++ b/src/strconv.c @@ -59,7 +59,7 @@ int jsonp_strtod(strbuffer_t *strbuffer, double *out) #if JSON_HAVE_LOCALECONV to_locale(strbuffer); #endif - +#if JSON_HAVE_ERRNO errno = 0; value = strtod(strbuffer->value, &end); assert(end == strbuffer->value + strbuffer->length); @@ -68,7 +68,10 @@ int jsonp_strtod(strbuffer_t *strbuffer, double *out) /* Overflow */ return -1; } - +#else + value = strtod(strbuffer->value, &end); + assert(end == strbuffer->value + strbuffer->length); +#endif *out = value; return 0; } From af19fc668033aacc9c9cac6573f2754dc34c365c Mon Sep 17 00:00:00 2001 From: CBWhiz Date: Mon, 10 Sep 2012 16:48:19 -0400 Subject: [PATCH 3/3] Add readme for building for evc30 --- win32/evc30/README.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 win32/evc30/README.txt diff --git a/win32/evc30/README.txt b/win32/evc30/README.txt new file mode 100644 index 0000000..9944348 --- /dev/null +++ b/win32/evc30/README.txt @@ -0,0 +1,7 @@ +To build jansson in evc3.0: + +1. Setup EVC++ + a. Tools -> Options -> Directories -> Include Files -> New + b. Add win32/evc30 to include path (EVC doesn't have per-project include paths) +2. Ensure you have the minor patches from this branch (to silence errors about errno features Windows CE 3.0 doesn't have) +3. Build \ No newline at end of file