diff options
Diffstat (limited to 'erts/emulator/beam/erl_nif.h')
-rw-r--r-- | erts/emulator/beam/erl_nif.h | 58 |
1 files changed, 45 insertions, 13 deletions
diff --git a/erts/emulator/beam/erl_nif.h b/erts/emulator/beam/erl_nif.h index 8650b7ce47..1ccf00293e 100644 --- a/erts/emulator/beam/erl_nif.h +++ b/erts/emulator/beam/erl_nif.h @@ -1,42 +1,51 @@ /* * %CopyrightBegin% - * - * Copyright Ericsson AB 2009. All Rights Reserved. - * + * + * Copyright Ericsson AB 2009-2010. All Rights Reserved. + * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in * compliance with the License. You should have received a copy of the * Erlang Public License along with this software. If not, it can be * retrieved online at http://www.erlang.org/. - * + * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. - * + * * %CopyrightEnd% */ /* Include file for writers of Native Implemented Functions. */ -#define ERL_NIF_MAJOR_VERSION 0 -#define ERL_NIF_MINOR_VERSION 1 +#ifndef __ERL_NIF_H__ +#define __ERL_NIF_H__ + +#include "erl_drv_nif.h" + +/* Version history: +** 0.1: R13B03 +** 1.0: R13B04 +*/ +#define ERL_NIF_MAJOR_VERSION 1 +#define ERL_NIF_MINOR_VERSION 0 #include <stdlib.h> typedef unsigned long ERL_NIF_TERM; +struct enif_environment_t; +typedef struct enif_environment_t ErlNifEnv; + typedef struct { const char* name; unsigned arity; - void* fptr; //ERL_NIF_TERM (*fptr)(void*, ...); + ERL_NIF_TERM (*fptr)(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]); }ErlNifFunc; -struct enif_environment_t; -typedef struct enif_environment_t ErlNifEnv; - typedef struct enif_entry_t { int major; @@ -59,11 +68,32 @@ typedef struct /* Internals (avert your eyes) */ ERL_NIF_TERM bin_term; - unsigned char* tmp_alloc; void* ref_bin; - }ErlNifBinary; +typedef struct enif_resource_type_t ErlNifResourceType; +typedef void ErlNifResourceDtor(ErlNifEnv*, void*); +enum ErlNifResourceFlags +{ + ERL_NIF_RT_CREATE = 1, + ERL_NIF_RT_TAKEOVER = 2 +}; + +typedef enum +{ + ERL_NIF_LATIN1 = 1 +}ErlNifCharEncoding; + +typedef ErlDrvSysInfo ErlNifSysInfo; + +typedef struct ErlDrvTid_ *ErlNifTid; +typedef struct ErlDrvMutex_ ErlNifMutex; +typedef struct ErlDrvCond_ ErlNifCond; +typedef struct ErlDrvRWLock_ ErlNifRWLock; +typedef int ErlNifTSDKey; + +typedef ErlDrvThreadOpts ErlNifThreadOpts; + #if (defined(__WIN32__) || defined(_WIN32) || defined(_WIN32_)) # define ERL_NIF_API_FUNC_DECL(RET_TYPE, NAME, ARGS) RET_TYPE (*NAME) ARGS typedef struct { @@ -120,3 +150,5 @@ ERL_NIF_INIT_DECL(NAME) \ return &entry; \ } +#endif /* __ERL_NIF_H__ */ + |