aboutsummaryrefslogtreecommitdiff
path: root/mod/io.c
blob: 380566f583e00437bf08aae373c685feff2f6207 (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
#include <stdint.h>
#include <assert.h>
#include <stdio.h>

#include <fwd/mod.h>

long print_nl(fwd_extern_args_t args)
{
	assert(args.argc == 0);
	putchar('\n');
	return 0;
}

long print_i64(fwd_extern_args_t args)
{
	assert(args.argc == 1);
	int64_t n = FWD_ARG_T(args, 0, int64_t);
	printf("%lld", (long long)n);
	return 0;
}

int fwdopen(fwd_state_t *state)
{
	FWD_REGISTER(state, print_nl,
			FWD_VOID);

	FWD_REGISTER(state, print_i64,
			FWD_VOID, FWD_T(int64_t));

	return 0;
}