-
Notifications
You must be signed in to change notification settings - Fork 2
/
specializedRuntime.h
108 lines (79 loc) · 3.15 KB
/
specializedRuntime.h
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#pragma once
#ifndef SPECIALIZED_RUNTIME_H
#define SPECIALIZED_RUNTIME_H
#include "runtime.h"
extern "C" {
/** Unboxes value to the double vector it contains.
*/
DoubleVector * doubleFromValue(RVal * v);
/** Unboxes double vector to the scalar double it contains.
*/
double scalarFromVector(DoubleVector * v);
/** Unboxes value to the character vector it contains.
*/
CharacterVector * characterFromValue(RVal *v);
/** Unboxes value to the function object it contains.
*/
RFun * functionFromValue(RVal *v);
/** Returns a scalar double element from given double vector.
*/
double doubleGetSingleElement(DoubleVector * from, double index);
/** Returns a subset of double vector.
*/
DoubleVector * doubleGetElement(DoubleVector * from, DoubleVector * index);
/** Returns a subset of character vector.
*/
CharacterVector * characterGetElement(CharacterVector * from, DoubleVector * index);
/** Sets the index-th element of given double vector.
*/
void doubleSetElement(DoubleVector * target, DoubleVector * index, DoubleVector * value);
/** Sets the specified subset of given double vector.
*/
void scalarSetElement(DoubleVector * target, double index, double value);
/** Sets the given subset of character vector.
*/
void characterSetElement(CharacterVector * target, DoubleVector * index, CharacterVector * value);
/** Adds two double vectors.
*/
DoubleVector * doubleAdd(DoubleVector * lhs, DoubleVector * rhs);
/** Concatenates two character vectors.
*/
CharacterVector * characterAdd(CharacterVector * lhs, CharacterVector * rhs);
/** Subtracts two double vectors.
*/
DoubleVector * doubleSub(DoubleVector * lhs, DoubleVector * rhs);
/** Multiplies two double vectors.
*/
DoubleVector * doubleMul(DoubleVector * lhs, DoubleVector * rhs);
/** Divides two double vectors.
*/
DoubleVector * doubleDiv(DoubleVector * lhs, DoubleVector * rhs);
/** Compares the equality of two double vectors.
*/
DoubleVector * doubleEq(DoubleVector * lhs, DoubleVector * rhs);
/** Compares the equality of two character vectors.
*/
DoubleVector * characterEq(CharacterVector * lhs, CharacterVector * rhs);
/** Compaes the inequality of two double vectors.
*/
DoubleVector * doubleNeq(DoubleVector * lhs, DoubleVector * rhs);
/** Compares the inequality of two character vectors.
*/
DoubleVector * characterNeq(CharacterVector * lhs, CharacterVector * rhs);
/** Compares two double vectors.
*/
DoubleVector * doubleLt(DoubleVector * lhs, DoubleVector * rhs);
/** Compares two double vectors.
*/
DoubleVector * doubleGt(DoubleVector * lhs, DoubleVector * rhs);
/** Evaluates given character vector in the specified environment and returns its result.
*/
RVal * characterEval(Environment * env, CharacterVector * value);
/** Joins N double vectors together.
*/
DoubleVector * doublec(int size, ...);
/** Joins N character vectors together.
*/
CharacterVector * characterc(int size, ...);
} // extern "C"
#endif // SPECIALIZED_RUNTIME_H