File: testsingle.c

package info (click to toggle)
libspe2 2.2.80-95-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 940 kB
  • ctags: 1,214
  • sloc: ansic: 9,316; makefile: 551; ada: 448; sh: 24
file content (40 lines) | stat: -rw-r--r-- 733 bytes parent folder | download
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
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include "libspe2.h"

int main(void)
{
	spe_context_ptr_t ctx;
	int flags = 0;
	unsigned int entry = SPE_DEFAULT_ENTRY;
	void * argp = NULL;
	void * envp = NULL;
	spe_program_handle_t * program;
	spe_stop_info_t stop_info;
	int rc;
	
	program = spe_image_open("hello");
	if (!program) {
		perror("spe_open_image");
		return -1;
	}
	
	ctx = spe_context_create(flags, NULL);
	if (ctx == NULL) {
		perror("spe_context_create");
		return -2;
	}
	if (spe_program_load(ctx, program)) {
		perror("spe_program_load");
		return -3;
	}
	rc = spe_context_run(ctx, &entry, 0, argp, envp, &stop_info);
	if (rc < 0)
		perror("spe_context_run");
	
	spe_context_destroy(ctx);

	return 0;
}