aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/src/legacy/erl_eterm.h
blob: 661cacbf835f83ed3c29f3712fe6cf94d2dc83a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* 
 * %CopyrightBegin%
 * 
 * Copyright Ericsson AB 1996-2016. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * %CopyrightEnd%
 */
#ifndef _ERL_ETERM_H
#define _ERL_ETERM_H

#ifndef SILENT
#include <stdio.h>
#endif

#include "portability.h"

#define ERL_MAX_COUNT     0xffffff
#define ERL_MAX ((1 << 27)-1)
#define ERL_MIN -(1 << 27)

/* FIXME should this be documented and in erl_interface.h ??? */
#define ERL_BIG_ARITY(x)     ((x)->uval.bigval.arity)
#define ERL_BIG_IS_NEG(x)    ((x)->uval.bigval.is_neg)
#define ERL_BIG_DIGITS(x)    ((x)->uval.bigval.digits)
#define ERL_BIG_DIGIT(x,i)   (ERL_BIG_DIGITS(x)[(i)])

/*
 * Typing checking macros.
 */

/* FIXME should this be documented and in erl_interface.h ??? */
#define ERL_IS_DEFINED(x)  (ERL_TYPE(x) != 0)
#define ERL_IS_COMPOUND(x) (ERL_TYPE(x) & ERL_COMPOUND)
#define ERL_IS_FUNCTION(x) (ERL_TYPE(x) == ERL_FUNCTION)
#define ERL_IS_BIG(x)      (ERL_TYPE(x) == ERL_BIG)


typedef struct _heapmark {
  unsigned long mark;      /* id */
  int size;                /* size of buffer */
  Erl_Heap *base;          /* points to start of buffer */
  Erl_Heap *cur;           /* points into buffer */
  struct _heapmark *prev;  /* previous heapmark */
} Erl_HeapMark;


void erl_mk_port_helper(ETERM* ep, unsigned number, unsigned char creation);
void erl_mk_pid_helper(ETERM*, unsigned,unsigned, unsigned char);
ETERM * __erl_mk_reference(ETERM*, const char *, size_t, unsigned int n[], unsigned char);
int erl_current_fix_desc(void);

#endif /* _ERL_ETERM_H */