Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4263 → Rev 4262

/branches/network/uspace/app/init/init.c
44,7 → 44,6
#include <task.h>
#include <malloc.h>
#include <macros.h>
#include <console.h>
#include "init.h"
#include "version.h"
 
/branches/network/uspace/app/bdsh/input.c
34,10 → 34,6
#include <string.h>
#include <io/stream.h>
#include <console.h>
#include <kbd/kbd.h>
#include <kbd/keycode.h>
#include <errno.h>
#include <bool.h>
 
#include "config.h"
#include "util.h"
100,44 → 96,30
 
static void read_line(char *buffer, int n)
{
kbd_event_t ev;
size_t offs, otmp;
wchar_t dec;
char c;
int chars;
 
offs = 0;
while (true) {
fflush(stdout);
if (kbd_get_event(&ev) < 0)
chars = 0;
while (chars < n - 1) {
c = getchar();
if (c < 0)
return;
if (ev.type == KE_RELEASE)
continue;
 
if (ev.key == KC_ENTER || ev.key == KC_NENTER)
if (c == '\n')
break;
if (ev.key == KC_BACKSPACE) {
if (offs > 0) {
/*
* Back up until we reach valid start of
* character.
*/
while (offs > 0) {
--offs; otmp = offs;
dec = str_decode(buffer, &otmp, n);
if (dec != U_SPECIAL)
break;
}
if (c == '\b') {
if (chars > 0) {
putchar('\b');
--chars;
}
continue;
}
if (ev.c >= ' ') {
//putchar(ev.c);
if (chr_encode(ev.c, buffer, &offs, n - 1) == EOK)
console_putchar(ev.c);
if (c >= ' ') {
putchar(c);
buffer[chars++] = c;
}
}
putchar('\n');
buffer[offs] = '\0';
buffer[chars] = '\0';
}
 
/* TODO:
/branches/network/uspace/app/bdsh/cmds/modules/kcon/kcon_def.h
File deleted
/branches/network/uspace/app/bdsh/cmds/modules/kcon/kcon.h
File deleted
/branches/network/uspace/app/bdsh/cmds/modules/kcon/entry.h
File deleted
/branches/network/uspace/app/bdsh/cmds/modules/kcon/kcon.c
File deleted
/branches/network/uspace/app/bdsh/cmds/modules/modules.h
26,7 → 26,6
#include "pwd/entry.h"
#include "sleep/entry.h"
#include "cp/entry.h"
#include "kcon/entry.h"
 
/* Each .def function fills the module_t struct with the individual name, entry
* point, help entry point, etc. You can use config.h to control what modules
42,7 → 41,6
#include "pwd/pwd_def.h"
#include "sleep/sleep_def.h"
#include "cp/cp_def.h"
#include "kcon/kcon_def.h"
{NULL, NULL, NULL, NULL}
};
 
/branches/network/uspace/app/bdsh/Makefile
57,7 → 57,6
cmds/modules/pwd/ \
cmds/modules/sleep/ \
cmds/modules/cp/ \
cmds/modules/kcon/ \
cmds/builtins/ \
cmds/builtins/exit/\
cmds/builtins/cd/
72,7 → 71,6
cmds/modules/pwd/pwd.c \
cmds/modules/sleep/sleep.c \
cmds/modules/cp/cp.c \
cmds/modules/kcon/kcon.c \
cmds/builtins/exit/exit.c \
cmds/builtins/cd/cd.c \
cmds/mod_cmds.c \
/branches/network/uspace/app/tester/tester.c
47,7 → 47,6
test_t tests[] = {
#include "thread/thread1.def"
#include "print/print1.def"
#include "print/print4.def"
#include "fault/fault1.def"
#include "fault/fault2.def"
#include "ipc/register.def"
/branches/network/uspace/app/tester/tester.h
60,7 → 60,6
 
extern char * test_thread1(bool quiet);
extern char * test_print1(bool quiet);
extern char * test_print4(bool quiet);
extern char * test_fault1(bool quiet);
extern char * test_fault2(bool quiet);
extern char * test_register(bool quiet);
/branches/network/uspace/app/tester/Makefile
45,7 → 45,6
SOURCES = tester.c \
thread/thread1.c \
print/print1.c \
print/print4.c \
fault/fault1.c \
fault/fault2.c \
ipc/register.c \
/branches/network/uspace/app/tester/print/print4.def
File deleted
Property changes:
Deleted: svn:mergeinfo
/branches/network/uspace/app/tester/print/print4.c
File deleted
Property changes:
Deleted: svn:mergeinfo
/branches/network/uspace/app/tetris/input.c
58,7 → 58,6
 
#include <async.h>
#include <ipc/console.h>
#include <console.h>
#include <kbd/kbd.h>
 
/* return true iff the given timeval is positive */
115,7 → 114,7
if (!lastchar) {
again:
if (!getchar_inprog) {
cons_phone = console_phone_get(true);
cons_phone = get_console_phone();
getchar_inprog = async_send_2(cons_phone,
CONSOLE_GETKEY, 0, 0, &charcall);
}
/branches/network/uspace/app/tetris/screen.c
117,6 → 117,11
console_goto(r, c);
}
 
static void fflush(void)
{
console_flush();
}
 
winsize_t winsize;
 
static int get_display_size(winsize_t *ws)
269,7 → 274,7
}
if (cur_so)
resume_normal();
fflush(stdout);
fflush();
}
 
/*
/branches/network/uspace/app/tetris/scores.c
55,9 → 55,6
#include <stdio.h>
/* #include <stdlib.h> */
#include <string.h>
#include <kbd/kbd.h>
#include <kbd/keycode.h>
#include <stdlib.h>
/* #include <time.h> */
/* #include <term.h> */
/* #include <unistd.h> */
125,57 → 122,32
void insertscore(int score, int level)
{
int i,j;
size_t off;
kbd_event_t ev;
int key;
 
clear_screen();
moveto(10 , 10);
puts("Insert your name: ");
strncpy(scores[NUMSPOTS - 1].hs_name, "Player", MAXLOGNAME);
i = 6; off = 6;
i = 6;
 
moveto(10 , 28);
printf("%s%.*s",scores[NUMSPOTS - 1].hs_name,MAXLOGNAME-i,"........................................");
 
while (1) {
fflush(stdout);
if (kbd_get_event(&ev) != EOK)
exit(1);
 
if (ev.type == KE_RELEASE)
continue;
 
if (ev.key == KC_ENTER || ev.key == KC_NENTER)
break;
 
if (ev.key == KC_BACKSPACE) {
if (i > 0) {
wchar_t uc;
 
--i;
while (off > 0) {
--off;
size_t otmp = off;
uc = str_decode(scores[NUMSPOTS - 1].hs_name,
&otmp, STR_BOUNDS(MAXLOGNAME) + 1);
if (uc != U_SPECIAL)
break;
}
 
scores[NUMSPOTS - 1].hs_name[off] = '\0';
}
} else if (ev.c != '\0') {
if (i < (MAXLOGNAME - 1)) {
if (chr_encode(ev.c, scores[NUMSPOTS - 1].hs_name,
&off, STR_BOUNDS(MAXLOGNAME) + 1) == EOK) {
++i;
}
scores[NUMSPOTS - 1].hs_name[off] = '\0';
}
key = getchar();
while(key != '\n') {
if (key == '\b') {
if (i > 0)
scores[NUMSPOTS - 1].hs_name[--i] = '\0';
} else {
if (i < (MAXLOGNAME - 1))
scores[NUMSPOTS - 1].hs_name[i++] = key;
scores[NUMSPOTS - 1].hs_name[i] = '\0';
}
moveto(10 , 28);
printf("%s%.*s",scores[NUMSPOTS - 1].hs_name,MAXLOGNAME-i,"........................................");
key = getchar();
}
scores[NUMSPOTS - 1].hs_score = score;
/branches/network/uspace/app/tetris/tetris.c
390,7 → 390,7
scr_update();
scr_msg(key_msg, 0);
scr_msg(msg, 1);
(void) fflush(stdout);
// (void) fflush(stdout);
} while (rwait((struct timeval *)NULL) == -1);
scr_msg(msg, 0);
scr_msg(key_msg, 1);
/branches/network/uspace/app/tetris/scores.h
45,11 → 45,9
* Tetris scores.
*/
#include <sys/time.h>
#include <string.h>
 
#define MAXLOGNAME 16
struct highscore {
char hs_name[STR_BOUNDS(MAXLOGNAME) + 1]; /* login name */
char hs_name[MAXLOGNAME + 1]; /* login name */
int hs_score; /* raw score */
int hs_level; /* play level */
// time_t hs_time; /* time at game end */
/branches/network/uspace/app/klog/klog.c
41,27 → 41,25
#include <as.h>
#include <sysinfo.h>
#include <io/stream.h>
#include <console.h>
#include <event.h>
#include <errno.h>
 
#define NAME "klog"
 
#define KLOG_SIZE PAGE_SIZE
 
/* Pointer to klog area */
static wchar_t *klog;
static count_t klog_length;
static char *klog;
 
static void interrupt_received(ipc_callid_t callid, ipc_call_t *call)
{
async_serialize_start();
count_t klog_start = (count_t) IPC_GET_ARG1(*call);
count_t klog_len = (count_t) IPC_GET_ARG2(*call);
count_t klog_stored = (count_t) IPC_GET_ARG3(*call);
count_t i;
size_t klog_start = (size_t) IPC_GET_ARG1(*call);
size_t klog_len = (size_t) IPC_GET_ARG2(*call);
size_t klog_stored = (size_t) IPC_GET_ARG3(*call);
size_t i;
for (i = klog_len - klog_stored; i < klog_len; i++)
putchar(klog[(klog_start + i) % klog_length]);
putchar(klog[(klog_start + i) % KLOG_SIZE]);
async_serialize_end();
}
70,32 → 68,29
{
console_wait();
count_t klog_pages = sysinfo_value("klog.pages");
size_t klog_size = klog_pages * PAGE_SIZE;
klog_length = klog_size / sizeof(wchar_t);
klog = (wchar_t *) as_get_mappable_page(klog_pages);
klog = (char *) as_get_mappable_page(KLOG_SIZE);
if (klog == NULL) {
printf(NAME ": Error allocating memory area\n");
return -1;
}
int res = ipc_share_in_start_1_0(PHONE_NS, (void *) klog,
klog_size, SERVICE_MEM_KLOG);
int res = ipc_share_in_start_1_0(PHONE_NS, (void *) klog, KLOG_SIZE,
SERVICE_MEM_KLOG);
if (res != EOK) {
printf(NAME ": Error initializing memory area\n");
return -1;
}
if (event_subscribe(EVENT_KLOG, 0) != EOK) {
printf(NAME ": Error registering klog notifications\n");
return -1;
}
// int inr = sysinfo_value("klog.inr");
// if (ipc_register_irq(inr, devno, 0, NULL) != EOK) {
// printf(NAME ": Error registering klog notifications\n");
// return -1;
// }
async_set_interrupt_received(interrupt_received);
klog_update();
async_manager();
 
return 0;
}
 
/branches/network/uspace/app/trace/syscalls.c
65,8 → 65,6
[SYS_IPC_REGISTER_IRQ] = { "ipc_register_irq", 4, V_ERRNO },
[SYS_IPC_UNREGISTER_IRQ] = { "ipc_unregister_irq", 2, V_ERRNO },
 
[SYS_EVENT_SUBSCRIBE] = { "event_subscribe", 2, V_ERRNO },
 
[SYS_CAP_GRANT] = { "cap_grant", 2, V_ERRNO },
[SYS_CAP_REVOKE] = { "cap_revoke", 2, V_ERRNO },
[SYS_PHYSMEM_MAP] = { "physmem_map", 4, V_ERRNO },