Sha256: c5d151a08d61d444aacf7ff028024e71b6c093d23a6bc33a5c5e8fce550acc1e

Contents?: true

Size: 1.09 KB

Versions: 234

Compression:

Stored size: 1.09 KB

Contents

/*
 * Copyright (c) 2007 Wayne Meissner. All rights reserved.
 *
 * For licensing, see LICENSE.SPECS
 */

#include <sys/types.h>
#include <sys/param.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef void* ptr;
typedef void* pointer;
#ifdef _WIN32
typedef char* caddr_t;
#endif

#define RET(T) T ptr_ret_##T(void* arg1, int offset) { \
    T tmp; memcpy(&tmp, (caddr_t) arg1 + offset, sizeof(tmp)); return tmp; \
}
#define SET(T) void ptr_set_##T(void* arg1, int offset, T value) { \
    memcpy((caddr_t) arg1 + offset, &value, sizeof(value)); \
}
#define TEST(T) SET(T) RET(T)

TEST(int8_t);
TEST(int16_t);
TEST(int32_t);
TEST(int64_t);
TEST(float);
TEST(double);
TEST(pointer);

void*
ptr_return_array_element(void **ptrArray, int arrayIndex) 
{
    return ptrArray[arrayIndex];
}

void
ptr_set_array_element(void **ptrArray, int arrayIndex, void *value)
{    
    ptrArray[arrayIndex] = value;
}

void*
ptr_malloc(int size) 
{
    return calloc(1, size);
}
void
ptr_free(void* ptr)
{
    free(ptr);
}

void*
ptr_from_address(uintptr_t addr)
{
    return (void *) addr;
}

Version data entries

234 entries across 129 versions & 21 rubygems

Version Path
comidita_ull-0.1.0 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18/libtest/PointerTest.c
comidita_ull-0.1.0 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18/spec/ffi/fixtures/PointerTest.c
vagrant-unbundled-2.0.1.0 vendor/bundle/ruby/2.4.0/gems/ffi-1.9.18/libtest/PointerTest.c
vagrant-unbundled-2.0.1.0 vendor/bundle/ruby/2.4.0/gems/ffi-1.9.18/spec/ffi/fixtures/PointerTest.c
cloudsmith-api-0.21.4 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18/spec/ffi/fixtures/PointerTest.c
cloudsmith-api-0.21.4 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18/libtest/PointerTest.c
tdiary-5.0.6 vendor/bundle/gems/ffi-1.9.18/libtest/PointerTest.c
tdiary-5.0.6 vendor/bundle/gems/ffi-1.9.18/spec/ffi/fixtures/PointerTest.c
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/gems/ffi-1.9.18/spec/ffi/fixtures/PointerTest.c
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/gems/ffi-1.9.18/libtest/PointerTest.c
vagrant-unbundled-1.9.8.1 vendor/bundle/ruby/2.4.0/gems/ffi-1.9.18/spec/ffi/fixtures/PointerTest.c
vagrant-unbundled-1.9.8.1 vendor/bundle/ruby/2.4.0/gems/ffi-1.9.18/libtest/PointerTest.c
vagrant-unbundled-1.9.7.1 vendor/bundle/ruby/2.4.0/gems/ffi-1.9.18/libtest/PointerTest.c
vagrant-unbundled-1.9.7.1 vendor/bundle/ruby/2.4.0/gems/ffi-1.9.18/spec/ffi/fixtures/PointerTest.c
tdiary-5.0.5 vendor/bundle/gems/ffi-1.9.18/libtest/PointerTest.c
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/ffi-1.9.18/libtest/PointerTest.c
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/ffi-1.9.18/spec/ffi/fixtures/PointerTest.c
tdiary-5.0.5 vendor/bundle/gems/ffi-1.9.18/spec/ffi/fixtures/PointerTest.c
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/ffi-1.9.18/libtest/PointerTest.c
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/ffi-1.9.18/spec/ffi/fixtures/PointerTest.c