File: testlog.cpp

package info (click to toggle)
freej 0.10git20100110-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 32,080 kB
  • ctags: 22,705
  • sloc: cpp: 156,254; ansic: 25,531; sh: 13,538; perl: 4,624; makefile: 3,278; python: 2,889; objc: 1,284; asm: 1,125; ruby: 126
file content (50 lines) | stat: -rw-r--r-- 704 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
44
45
46
47
48
49
50

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>

#include <slw.h>
#include <slw_console.h>
#include <slw_log.h>
#include <slw_prompt.h>


SLangConsole con;
SLW_Log log;
SLW_Prompt prompt;

int main(int argc, char **argv) {
  int key;
  bool quit;

  assert( con.init() );

  SLtt_set_cursor_visibility(0);

  assert( con.place(&log, 1, 0, con.w, con.h-2) );
  assert( log.init() );

  assert( con.place(&prompt, 0, con.h-1, con.w, con.h) );
  assert( prompt.init() );

  con.focused = &prompt;

  quit = false;

  while(!quit) {

    key = con.getkey();

    prompt.feed(key);
    log.feed(key);

    if( ! con.refresh() ) quit = true;
  }

  con.close();

  exit(1);
}