1
0
forked from GitHub/gf-core

first steps towards porting to Windows

This commit is contained in:
krangelov
2021-11-09 19:08:49 +01:00
parent 9eb88f9281
commit befb61b0e3
2 changed files with 28 additions and 0 deletions

View File

@@ -1,11 +1,29 @@
#include <stdlib.h>
#include <string.h>
#ifndef _WIN32
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <pthread.h>
#else
#include <io.h>
#include <windows.h>
static
size_t getpagesize()
{
SYSTEM_INFO si;
GetSystemInfo(&si);
return si.dwPageSize;
}
#define ftruncate _chsize
#endif
#include "data.h"
#include "ipc.h"

View File

@@ -118,6 +118,7 @@ typedef struct {
/* Arbitrary size integers are represented as an array of uintmax_t
* values. Each value in the array is at most LINT_BASE-1 big.
* LINT_BASE itself is always 10 ^ LINT_BASE_LOG. */
#if defined(__WORDSIZE)
#if __WORDSIZE == 8
#define LINT_BASE 100
#define LINT_BASE_LOG 2
@@ -133,6 +134,15 @@ typedef struct {
#else
#error "Platforms with the current __WORDSIZE are not supported yet"
#endif
#elif defined(_WIN64)
#define LINT_BASE 10000000000000000000UL
#define LINT_BASE_LOG 19
#elif defined(_WIN32)
#define LINT_BASE 1000000000
#define LINT_BASE_LOG 9
#else
#error "Unsupported platform"
#endif
/* The PgfUnmarshaller structure tells the runtime how to create
* abstract syntax expressions and types in the heap of