~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to erts/emulator/beam/erl_nif.h

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2010-03-09 17:34:57 UTC
  • mfrom: (10.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100309173457-4yd6hlcb2osfhx31
Tags: 1:13.b.4-dfsg-3
Manpages in section 1 are needed even if only arch-dependent packages are
built. So, re-enabled them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * %CopyrightBegin%
3
 
 * 
4
 
 * Copyright Ericsson AB 2009. All Rights Reserved.
5
 
 * 
 
3
 *
 
4
 * Copyright Ericsson AB 2009-2010. All Rights Reserved.
 
5
 *
6
6
 * The contents of this file are subject to the Erlang Public License,
7
7
 * Version 1.1, (the "License"); you may not use this file except in
8
8
 * compliance with the License. You should have received a copy of the
9
9
 * Erlang Public License along with this software. If not, it can be
10
10
 * retrieved online at http://www.erlang.org/.
11
 
 * 
 
11
 *
12
12
 * Software distributed under the License is distributed on an "AS IS"
13
13
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
14
 * the License for the specific language governing rights and limitations
15
15
 * under the License.
16
 
 * 
 
16
 *
17
17
 * %CopyrightEnd%
18
18
 */
19
19
 
20
20
/* Include file for writers of Native Implemented Functions. 
21
21
*/
22
22
 
23
 
#define ERL_NIF_MAJOR_VERSION 0
24
 
#define ERL_NIF_MINOR_VERSION 1
 
23
#ifndef __ERL_NIF_H__
 
24
#define __ERL_NIF_H__
 
25
 
 
26
#include "erl_drv_nif.h"
 
27
 
 
28
/* Version history:
 
29
** 0.1: R13B03
 
30
** 1.0: R13B04
 
31
*/
 
32
#define ERL_NIF_MAJOR_VERSION 1
 
33
#define ERL_NIF_MINOR_VERSION 0
25
34
 
26
35
#include <stdlib.h>
27
36
 
28
37
typedef unsigned long ERL_NIF_TERM;
29
38
 
 
39
struct enif_environment_t;
 
40
typedef struct enif_environment_t ErlNifEnv;
 
41
 
30
42
typedef struct
31
43
{
32
44
    const char* name;
33
45
    unsigned arity;
34
 
    void* fptr; //ERL_NIF_TERM (*fptr)(void*, ...);
 
46
    ERL_NIF_TERM (*fptr)(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]);
35
47
}ErlNifFunc;
36
48
 
37
 
struct enif_environment_t;
38
 
typedef struct enif_environment_t ErlNifEnv;
39
 
 
40
49
typedef struct enif_entry_t
41
50
{
42
51
    int major;
59
68
 
60
69
    /* Internals (avert your eyes) */
61
70
    ERL_NIF_TERM bin_term;
62
 
    unsigned char* tmp_alloc;
63
71
    void* ref_bin;
64
 
    
65
72
}ErlNifBinary;
66
73
 
 
74
typedef struct enif_resource_type_t ErlNifResourceType;
 
75
typedef void ErlNifResourceDtor(ErlNifEnv*, void*);
 
76
enum ErlNifResourceFlags
 
77
{
 
78
    ERL_NIF_RT_CREATE = 1,
 
79
    ERL_NIF_RT_TAKEOVER = 2
 
80
};
 
81
 
 
82
typedef enum
 
83
{
 
84
    ERL_NIF_LATIN1 = 1
 
85
}ErlNifCharEncoding;
 
86
 
 
87
typedef ErlDrvSysInfo ErlNifSysInfo;
 
88
 
 
89
typedef struct ErlDrvTid_ *ErlNifTid;
 
90
typedef struct ErlDrvMutex_ ErlNifMutex;
 
91
typedef struct ErlDrvCond_ ErlNifCond;
 
92
typedef struct ErlDrvRWLock_ ErlNifRWLock;
 
93
typedef int ErlNifTSDKey;
 
94
 
 
95
typedef ErlDrvThreadOpts ErlNifThreadOpts;
 
96
 
67
97
#if (defined(__WIN32__) || defined(_WIN32) || defined(_WIN32_))
68
98
#  define ERL_NIF_API_FUNC_DECL(RET_TYPE, NAME, ARGS) RET_TYPE (*NAME) ARGS
69
99
typedef struct {
120
150
    return &entry;                      \
121
151
}
122
152
 
 
153
#endif /* __ERL_NIF_H__ */
 
154