-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcaux.c
33 lines (27 loc) · 866 Bytes
/
caux.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
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
extern int ghdl_main(int argc, void** argv);
void (*save_screenshot_cb)(int32_t*, uint32_t, uint32_t, int);
void save_screenshot(int32_t *ptr, uint32_t width, uint32_t height, int id) {
save_screenshot_cb(ptr, width, height, id);
}
void (*sim_cleanup_cb)(void);
void sim_cleanup(void) {
sim_cleanup_cb();
}
int py_main(
int argc,
void** argv,
void (*fptr_save_screenshot)(int32_t*, uint32_t, uint32_t, int),
void (*fptr_sim_cleanup)(void)
) {
printf("fptr_save_screenshot is %p\n", (void*)fptr_save_screenshot);
assert(fptr_save_screenshot != NULL);
save_screenshot_cb = fptr_save_screenshot;
printf("fptr_sim_cleanup is %p\n", (void*)fptr_sim_cleanup);
assert(fptr_sim_cleanup != NULL);
sim_cleanup_cb = fptr_sim_cleanup;
return ghdl_main(argc, argv);
}