-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDartDelegate.c
45 lines (39 loc) · 1.09 KB
/
DartDelegate.c
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
//
// DartDelegate.c
// DART4iOS
//
// Created by Will Stafford on 6/5/14.
// Copyright (c) 2014 iWill LLC. All rights reserved.
//
#include <stdio.h>
#include "Dart.h"
dart_delegate dartDelegateWithInOutErrFinishObj(dart_input_handler in, dart_output_handler out, dart_error_handler err, dart_finish_handler finish, void *obj) {
dart_delegate returnMe;
returnMe.input = in;
returnMe.output = out;
returnMe.error = err;
returnMe.finish = finish;
returnMe.object = obj;
returnMe.initialized = 1;
return returnMe;
}
void dart_sendOutputToDelegate(char *output) {
if (dartDelegate.initialized) {
dartDelegate.output(dartDelegate.object, output);
}
}
void dart_sendErrorToDelegate(int retCode) {
if (dartDelegate.initialized) {
dartDelegate.error(dartDelegate.object, retCode);
}
}
void dart_sendFinishToDelegate(int retCode) {
if (dartDelegate.initialized) {
dartDelegate.finish(dartDelegate.object, retCode);
}
}
void dart_requestInputFromDelegate() {
if (dartDelegate.initialized) {
dart_Input_Pointer = dartDelegate.input(dartDelegate.object);
}
}