create netsurf inttypes header to have portable integer formatting macros

This commit is contained in:
Vincent Sanders 2017-01-21 14:20:55 +00:00
parent 11f11e0a7f
commit 6075feb487
26 changed files with 95 additions and 49 deletions

View File

@ -21,10 +21,11 @@
* Content handling implementation.
*/
#include <inttypes.h>
#include <stdint.h>
#include <stdlib.h>
#include <nsutils/time.h>
#include "netsurf/inttypes.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "netsurf/browser_window.h"

View File

@ -27,6 +27,7 @@
#include <libwapcaplet/libwapcaplet.h>
#include <nsutils/base64.h>
#include "netsurf/inttypes.h"
#include "utils/url.h"
#include "utils/nsurl.h"
#include "utils/corestrings.h"

View File

@ -44,6 +44,7 @@
#endif
#include <libwapcaplet/libwapcaplet.h>
#include "netsurf/inttypes.h"
#include "utils/nsurl.h"
#include "utils/dirent.h"
#include "utils/corestrings.h"

View File

@ -29,6 +29,7 @@
#include <stdarg.h>
#include <libwapcaplet/libwapcaplet.h>
#include "netsurf/inttypes.h"
#include "utils/nsurl.h"
#include "utils/corestrings.h"
#include "utils/log.h"

View File

@ -43,11 +43,11 @@
#include <stdlib.h>
#include <nsutils/unistd.h>
#include "netsurf/inttypes.h"
#include "utils/filepath.h"
#include "utils/file.h"
#include "utils/nsurl.h"
#include "utils/log.h"
#include "utils/utils.h"
#include "utils/messages.h"
#include "desktop/gui_internal.h"
#include "netsurf/misc.h"

View File

@ -22,12 +22,12 @@
*/
#include <assert.h>
#include <inttypes.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include "netsurf/inttypes.h"
#include "utils/utils.h"
#include "utils/log.h"
#include "netsurf/misc.h"

View File

@ -22,6 +22,7 @@
#include <stdlib.h>
#include <png.h>
#include "netsurf/inttypes.h"
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/messages.h"

View File

@ -23,16 +23,15 @@
* Duktapeish implementation of javascript engine functions.
*/
#include <inttypes.h>
#include <stdint.h>
#include <nsutils/time.h>
#include "content/content.h"
#include "netsurf/inttypes.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/corestrings.h"
#include "content/content.h"
#include "javascript/js.h"
#include "javascript/content.h"

View File

@ -35,12 +35,10 @@
#include <stdint.h>
#include <string.h>
#include <strings.h>
#include <inttypes.h>
#include <nsutils/time.h>
#include "netsurf/inttypes.h"
#include "utils/config.h"
#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/messages.h"

View File

@ -25,12 +25,12 @@
#include <stdlib.h>
#include <libwapcaplet/libwapcaplet.h>
#include "netsurf/inttypes.h"
#include "utils/config.h"
#include "utils/nsoption.h"
#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
#include "utils/messages.h"
#include "content/content_factory.h"
#include "content/fetchers.h"

View File

@ -20,12 +20,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <svgtiny.h>
#include <proto/exec.h>
#include <string.h>
#include <proto/dos.h>
#include "netsurf/inttypes.h"
#ifndef AMIGA_DR2D_STANDALONE
#include "utils/nsurl.h"
#include "netsurf/content.h"

View File

@ -16,12 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include "netsurf/inttypes.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "netsurf/bitmap.h"

View File

@ -17,8 +17,8 @@
*/
#include <assert.h>
#include <inttypes.h>
#include "netsurf/inttypes.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "netsurf/mouse.h"

View File

@ -23,6 +23,7 @@
#include "utils/nsurl.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
#include "utils/utils.h"
#include "netsurf/browser_window.h"
#include "netsurf/keypress.h"
#include "desktop/save_complete.h"

View File

@ -16,11 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <inttypes.h>
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include "netsurf/inttypes.h"
#include "utils/utf8.h"
#include "utils/log.h"
#include "utils/nsoption.h"

View File

@ -16,13 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
#include "assert.h"
#include "cflib.h"
#include "netsurf/inttypes.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"

View File

@ -17,12 +17,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <inttypes.h>
#include <assert.h>
#include <ft2build.h>
#include FT_CACHE_H
#include "netsurf/inttypes.h"
#include "utils/filepath.h"
#include "utils/utf8.h"
#include "utils/log.h"

View File

@ -23,7 +23,6 @@
*/
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
#include <limits.h>
#include <assert.h>
@ -32,6 +31,7 @@
#include <gdk/gdkkeysyms.h>
#include <gdk-pixbuf/gdk-pixdata.h>
#include "netsurf/inttypes.h"
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/nsoption.h"

View File

@ -23,9 +23,8 @@
#ifndef _NETSURF_RISCOS_URLCOMPLETE_H_
#define _NETSURF_RISCOS_URLCOMPLETE_H_
#include <inttypes.h>
#include <stdbool.h>
#include "oslib/wimp.h"
#include <oslib/wimp.h>
struct gui_window;

View File

@ -29,10 +29,10 @@
#include <assert.h>
#include <ctype.h>
#include <inttypes.h>
#include <math.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <time.h>
#include <string.h>
#include <oslib/colourtrans.h>
@ -43,6 +43,7 @@
#include <oslib/wimpspriteop.h>
#include <nsutils/time.h>
#include "netsurf/inttypes.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/talloc.h"

View File

@ -23,10 +23,10 @@
*/
#include "utils/config.h"
#include <inttypes.h>
#include <assert.h>
#include <windows.h>
#include "netsurf/inttypes.h"
#include "utils/log.h"
#include "utils/nsoption.h"
#include "utils/utf8.h"

View File

@ -0,0 +1,59 @@
/*
* Copyright 2017 Vincent Sanders <vince@netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
* NetSurf is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* NetSurf is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file
* Netsurf additional integer type formatting macros.
*/
#ifndef NETSURF_INTTYPES_H
#define NETSURF_INTTYPES_H
#include <inttypes.h>
#ifndef PRIxPTR
#define PRIxPTR "x"
#endif
#ifndef PRId64
#define PRId64 "lld"
#endif
/* Windows does not have sizet formating codes */
#if defined(_WIN32)
/** windows printf formatting for size_t type */
#define PRIsizet "Iu"
/** windows printf formatting for ssize_t type */
#define PRIssizet "Id"
#else
/** c99 standard printf formatting for size_t type */
#define PRIsizet "zu"
/** c99 standard printf formatting for ssize_t type */
#define PRIssizet "zd"
#endif
#endif

View File

@ -21,18 +21,19 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <dom/dom.h>
#include <libwapcaplet/libwapcaplet.h>
#include "netsurf/inttypes.h"
#include "utils/config.h"
#include "content/fetch.h"
#include "content/fetchers.h"
#include "render/html_internal.h"
#include "utils/log.h"
#include "utils/ring.h"
#include "utils/nsurl.h"
#include "utils/utils.h"
#include "content/fetch.h"
#include "content/fetchers.h"
#include "render/html_internal.h"
typedef struct html_css_fetcher_item {
uint32_t key;

View File

@ -16,11 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "netsurf/inttypes.h"
#include "utils/http/primitives.h"
/**

View File

@ -28,6 +28,8 @@
#include <string.h>
#include <libutf8proc/utf8proc.h>
#include "netsurf/inttypes.h"
#include "utils/errors.h"
#include "utils/idna.h"
#include "utils/idna_props.h"

View File

@ -23,10 +23,9 @@
* \todo Many of these functions and macros should have their own headers.
*/
#ifndef _NETSURF_UTILS_UTILS_H_
#define _NETSURF_UTILS_UTILS_H_
#ifndef NETSURF_UTILS_UTILS_H
#define NETSURF_UTILS_UTILS_H
#include <inttypes.h>
#include <stdbool.h>
#ifndef NOF_ELEMENTS
@ -52,29 +51,11 @@
#endif
#endif
#ifndef PRIxPTR
#define PRIxPTR "x"
#endif
#ifndef PRId64
#define PRId64 "lld"
#endif
/* Windows does not have sizet formating codes or POSIX mkdir so work
* around that
*/
/* Windows does not have POSIX mkdir so work around that */
#if defined(_WIN32)
/** windows printf formatting for size_t type */
#define PRIsizet "Iu"
/** windows printf formatting for ssize_t type */
#define PRIssizet "Id"
/** windows mkdir function */
#define nsmkdir(dir, mode) mkdir((dir))
#else
/** c99 standard printf formatting for size_t type */
#define PRIsizet "zu"
/** c99 standard printf formatting for ssize_t type */
#define PRIssizet "zd"
/** POSIX mkdir function */
#define nsmkdir(dir, mode) mkdir((dir), (mode))
#endif