Back to index

plt-scheme  4.2.1
Functions
curses.c File Reference
#include "escheme.h"
#include <curses.h>

Go to the source code of this file.

Functions

static Scheme_Objectsch_clear (int argc, Scheme_Object **argv)
static Scheme_Objectsch_put (int argc, Scheme_Object **argv)
static Scheme_Objectsch_get (int argc, Scheme_Object **argv)
static Scheme_Objectsch_move (int argc, Scheme_Object **argv)
static Scheme_Objectsch_get_size (int argc, Scheme_Object **argv)
static Scheme_Objectsch_refresh (int argc, Scheme_Object **argv)
Scheme_Objectscheme_reload (Scheme_Env *env)
Scheme_Objectscheme_initialize (Scheme_Env *env)
Scheme_Objectscheme_module_name ()

Function Documentation

static Scheme_Object* sch_clear ( int  argc,
Scheme_Object **  argv 
) [static]

Definition at line 17 of file curses.c.

{
  clear();
}

Here is the caller graph for this function:

static Scheme_Object* sch_get ( int  argc,
Scheme_Object **  argv 
) [static]

Definition at line 39 of file curses.c.

{
  /* Gets keyboard input */
  int c = getch();
  return scheme_make_character(c);
}

Here is the caller graph for this function:

static Scheme_Object* sch_get_size ( int  argc,
Scheme_Object **  argv 
) [static]

Definition at line 59 of file curses.c.

{
  /* Returns two values */
  int w, h;
  Scheme_Object *a[2];

  w = getmaxx(stdscr);
  h = getmaxy(stdscr);

  a[0] = scheme_make_integer(w);
  a[1] = scheme_make_integer(h);
  return scheme_values(1, a);
}

Here is the caller graph for this function:

static Scheme_Object* sch_move ( int  argc,
Scheme_Object **  argv 
) [static]

Definition at line 46 of file curses.c.

{
  /* Move the output cursor */
  if (!SCHEME_INTP(argv[0]))
    scheme_wrong_type("move", "exact integer", 0, argc, argv);
  if (!SCHEME_INTP(argv[1]))
    scheme_wrong_type("move", "exact integer", 1, argc, argv);

  move(SCHEME_INT_VAL(argv[0]), SCHEME_INT_VAL(argv[1]));

  return scheme_void;
}

Here is the caller graph for this function:

static Scheme_Object* sch_put ( int  argc,
Scheme_Object **  argv 
) [static]

Definition at line 22 of file curses.c.

{
  /* Puts a char or string on the screen */
  if (SCHEME_CHARP(argv[0]))
    addch(SCHEME_CHAR_VAL(argv[0]));
  else if (SCHEME_BYTE_STRINGP(argv[0]))
    addstr(SCHEME_BYTE_STR_VAL(argv[0]));
  else if (SCHEME_CHAR_STRINGP(argv[0])) {
    Scheme_Object *bs;
    bs = scheme_char_string_to_byte_string(argv[0]);
    addstr(SCHEME_BYTE_STR_VAL(bs));
  } else
    scheme_wrong_type("put", "character, string, or byte string", 0, argc, argv);

  return scheme_void;
}

Here is the caller graph for this function:

static Scheme_Object* sch_refresh ( int  argc,
Scheme_Object **  argv 
) [static]

Definition at line 73 of file curses.c.

{
  refresh();
  return scheme_void;
}

Here is the caller graph for this function:

Definition at line 114 of file curses.c.

{
  /* The first time we're loaded, initialize the screen: */
  initscr();
  cbreak();
  noecho();
  atexit(endwin);

  /* Then do the usual stuff: */
  return scheme_reload(env);
}

Here is the call graph for this function:

Definition at line 126 of file curses.c.

{
  /* This extension doesn't define a module: */
  return scheme_false;
}

Definition at line 81 of file curses.c.

{
  /* The MZ_GC... lines are for for 3m, because env is live across an
     allocating call. They're not needed for plain old (conservatively
     collected) Mzscheme. See makeadder3m.c for more info. */
  Scheme_Object *v;
  MZ_GC_DECL_REG(1);
  MZ_GC_VAR_IN_REG(0, env);
  MZ_GC_REG();

  v = scheme_make_prim_w_arity(sch_clear, "clear", 0, 0),
  scheme_add_global("clear", v, env);

  v = scheme_make_prim_w_arity(sch_put, "put", 1, 1);
  scheme_add_global("put", v, env);

  v = scheme_make_prim_w_arity(sch_get, "get", 0, 0);
  scheme_add_global("get", v, env);

  v = scheme_make_prim_w_arity(sch_move, "move", 2, 2);
  scheme_add_global("move", v, env);

  v = scheme_make_prim_w_arity(sch_get_size, "get-size", 0, 0);
  scheme_add_global("get-size", v, env);

  v = scheme_make_prim_w_arity(sch_refresh, "refresh", 0, 0);
  scheme_add_global("refresh", v, env);

  MZ_GC_UNREG();

  return scheme_void;
}

Here is the call graph for this function: