Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
95 lines (92 loc) · 2.7 KB

File metadata and controls

95 lines (92 loc) · 2.7 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
/**
<% include doc.cc.ejs -%>
*/
Handle<Value> <%- cppClassName %>::<%- functionInfo.cppFunctionName %>(const Arguments& args) {
HandleScope scope;
<% include guardArguments.cc.ejs -%>
<%
for (var i = 0; i < functionInfo.args.length; i++) {
var arg = functionInfo.args[i];
if (!arg.isReturn) continue;
-%>
<% if (arg.shouldAlloc) { -%>
<%- arg.cType %><%- arg.name %> = (<%- arg.cType %>)malloc(sizeof(<%- unPointer(arg.cType) %>));
<% } else { -%>
<%- unPointer(arg.cType) %> <%- arg.name %> = <%- defaultValue(unPointer(arg.cType)) %>;
<% } -%>
<% } -%>
<%
for (var cArg = 0, jsArg = 0; cArg < functionInfo.args.length; cArg++) {
var arg = functionInfo.args[cArg];
if (arg.isSelf || arg.isReturn || arg.isPayload) continue;
-%>
<% include convertFromV8.cc.ejs -%>
<% jsArg++; -%>
<% } %>
<% if (returns.length || functionInfo.return.isErrorCode) { %><%- functionInfo.return.cType %> result = <% } %><%- functionInfo.cFunctionName %>(
<%
for (var cArg = 0, jsArg = 0; cArg < functionInfo.args.length; cArg++) {
var arg = functionInfo.args[cArg];
-%>
<% if (cArg > 0) { %>, <% } -%><% if (arg.isReturn && !arg.shouldAlloc) { %>&<% } -%>
<% if (arg.isSelf) { -%>
ObjectWrap::Unwrap<<%- cppClassName %>>(args.This())->GetValue()
<% } else if (arg.isReturn) { -%>
<%- arg.name %>
<% } else { -%>
from_<%- arg.name %>
<% } -%>
<%
if (!(arg.isReturn || arg.isSelf)) jsArg++;
}
-%>
);
<%
for (var i = 0; i < functionInfo.args.length; i++) {
var arg = functionInfo.args[i];
if (arg.isSelf || arg.isReturn) continue;
-%>
<% if (['String', 'Array'].indexOf(arg.cppClassName) > -1) { -%>
<% if (arg.freeFunctionName) { %>
<%- arg.freeFunctionName %>(from_<%- arg.name %>);
<% } else { -%>
free((void *)from_<%- arg.name %>);
<% } -%>
<% } -%>
<% } -%>
<% if (functionInfo.return.isErrorCode) { -%>
if (result != GIT_OK) {
<%
for (var i = 0; i < functionInfo.args.length; i++) {
var arg = functionInfo.args[i];
if (!arg.shouldAlloc) continue;
-%>
free(<%= arg.name %>);
<% } -%>
if (giterr_last()) {
return ThrowException(Exception::Error(String::New(giterr_last()->message)));
} else {
return ThrowException(Exception::Error(String::New("Unkown Error")));
}
}
<% } -%>
<% if (!returns.length) { -%>
return Undefined();
<% } else if (returns.length == 1) { -%>
<% var to = returns[0]; -%>
Handle<Value> to;
<% include convertToV8.cc.ejs -%>
return scope.Close(to);
<% } else { -%>
Handle<Object> toReturn = Object::New();
Handle<Value> to;
<%
for (r in returns) {
var to = returns[r];
-%>
<% include convertToV8.cc.ejs -%>
toReturn->Set(String::NewSymbol("<%- to.jsName || to.name %>"), to);
<% } -%>
return scope.Close(toReturn);
<% } -%>
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.