File: esdl_gen.c

package info (click to toggle)
esdl 1.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,312 kB
  • ctags: 7,213
  • sloc: ansic: 13,621; erlang: 8,825; makefile: 294; sh: 228; objc: 181
file content (43 lines) | stat: -rwxr-xr-x 842 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
41
42
43
/*
 *  Copyright (c) 2001 Dan Gudmundsson
 *  See the file "license.terms" for information on usage and redistribution
 *  of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 *     $Id$
 */

/* 
 * General SDL functions.
 */

#include "esdl.h"
#include <string.h>

void es_init(sdl_data *sd, int len, char *bp) 
{
   Uint32 mode;
   
   mode = * (Uint32 *) bp;
   if (SDL_Init(mode) < 0)  {
     char* e = SDL_GetError();
     fprintf(stderr, "Couldn't initialize SDL: %s\n\r", e);
   }
}

void es_quit(sdl_data *sd, int len, char * buff) 
{
    SDL_Quit();
}

void es_getError(sdl_data *sd, int len, char *buff)
{
   char * err, *bp, *start;  
   int length;
   err = SDL_GetError();
   length = strlen(err);
   bp = start = sdl_getbuff(sd, length);
   while(*err != '\0') {
      put8(bp, *err++);
   }
   sdl_send(sd, bp - start);
}