예제 #1
0
// This is basically a rewrite of the putp that's supposed to appear in
// term.h, except it uses our "mini buffered IO code" from above
static void putp( char *s )
{
    int         c;
    int         pad;
    int         mand = FALSE;
    int         i;
    char        *bbuf;

    if( s == NULL )
        return;
    while( (c = *s++) != '\0' ) {
        // check and see if we're at the start of a padding sequence
        if( c == '$' && *s == '<' ) {
            bbuf = s;
            s++;
            pad = 0;
            // read until the end of the sequence or the end of the string
            while( (c = *s++) != '\0' && ( c != '>' ) ) {
                // suck up digits
                if( c >= '0' && c <= '9' ) {
                    pad *= 10;
                    pad += c;
                } else if( c == '.' ) {
                    // Skip tenth's
                    if( (c = *s) >= '0' && c <= '9' ) {
                        s++;
                        // cheap rounding
                        if( c >= '5' ) {
                            pad++;
                        }
                    }
                // Pay attention to the mandatory flag
                } else if( c == '/' ) {
                    mand = TRUE;
                }
                // Note that I'm completely ignoring the * flag( proportional
                // to number of lines padding ). I'm just assuming 1 line
                // always. This should work virtually all of the time because
                // we don't do anything excessively weird. ( like insert over
                // multiple lines )
                // Actually, we ignore any extra chars that end up in here.
            }
            if( c == '>' ) {
                // output padding only if required
                if( !xon_xoff || mand ) {
                    mand = FALSE;
                    for( i = 0; i < pad; i++ ) {
                        __putchar( pad_char[0] );
                    }
                }
            } else {
                __putchar( '$' );
                __puts( bbuf );
                return;
            }
        } else {
            __putchar( c );
        }
    }
}
예제 #2
0
파일: eedebug.c 프로젝트: madnessw/thesnow
int  __printf(const char *format, ...) {
	char buf[4096];
	va_list args;
	int ret;

	va_start(args, format);
	ret = vsnprintf(buf, 4096, format, args);
	va_end(args);

	__puts((u8*)buf);
	return ret;
}
예제 #3
0
/*---------------------------------------------------------------------*/
void cmd_parsing( void )
{
    u8 buff[_CMD_ARGS_ARGC_MAX];
    smemset( buff, 0x00, sizeof(buff) );
    bool _enter = do_replace_queue( &cmd_queue, _KEY_ENTER_RELEASED, 0 );
    get_contents_queue( &cmd_queue, sizeof(buff), buff, sizeof(buff), false );

    _set_cmd_args( &_cmd_args, buff );

    if( _enter )
        do_empty_queue( &cmd_queue );

    if( _enter ) {
        if( cmd_mode == false ) {
            if( strcmp( _get_cmd_arg(&_cmd_args, 0), "cmd" ) == 0 ) {
                __puts("ooooooooooooooooooooooooooooooooooooooo");
                __puts("         Start Command Mode");
                __puts("ooooooooooooooooooooooooooooooooooooooo");
                cmd_mode = true;
            }
        } else {
            // view process all
            if( strcmp( _get_cmd_arg(&_cmd_args, 0), "PROCALL") == 0 ) {
                //	__puts("view all process");
#if defined __SDEBUG__
                debug_print_proc_all( );
#endif // __SDEBUG__
            } else
                // kill specific process
                if( strcmp( _get_cmd_arg(&_cmd_args, 0), "KILL") == 0 ) {
                    const u8* _num = _get_cmd_arg(&_cmd_args, 1);
                    s32 _type = get_number_type( _num );
                    s32 _pid = 0;
                    switch( _type ) {
                    case NUMBER_TYPE_DECIMAL:
                        _pid = sdtoi( _num );
                        __puts("number type is decimal");
                        break;

                    case NUMBER_TYPE_HEXADECIMAL:
                        _pid = shtoi( _num );
                        __puts("number type is hexadecimal");
                        break;

                    default :
                        __puts("none number type");
                    }
                    if( _pid ) {
                        kill( _pid );
                    }
                } else
                    // help
                    if( strcmp( _get_cmd_arg(&_cmd_args, 0), "HELP") == 0 ) {
                    }
        }
    }
}
예제 #4
0
파일: eeload.c 프로젝트: madnessw/thesnow
void __attribute__((noreturn)) eeload_start() {
	void (*entry)();
	__puts("EELOAD start\n");

	__printf("about to SifInitRpc(0)\n");
	SifInitRpc(0);
    __printf("done rpc\n");

	entry = (void (*)())loadElfFile("INTRO");
	entry();

	entry = (void (*)())loadElfFile("LOADER");
	entry();

	for (;;);
}
예제 #5
0
void CBanner( void )
{
    if( CompFlags.banner_printed ) return;
    if( CompFlags.quiet_mode )     return;
#if defined( _BETAVER )
    __puts( banner1w1( "C++ " _TARGET_ " Optimizing Compiler" ) );
    __puts( banner1w2( _WPP_VERSION_ ) );
#else
    __puts( banner1w( "C++ " _TARGET_ " Optimizing Compiler", _WPP_VERSION_ ) );
#endif
    __puts( banner2 );
    __puts( banner2a( "1989" ) );
    __puts( banner3 );
    __puts( banner3a );
    if( Token[0] != '$' ) {             /* if finger print present */
        __puts( Token );                /* - print it */
    }
    CompFlags.banner_printed = 1;                       /* 13-mar-90 */
}
예제 #6
0
파일: main.c 프로젝트: hozmaster/octaneos
//
// Start Kernel
asmlinkage void start_kernel(void) {

  char buf[255];
  int _i = 0;
  int _diff = 0;
  _video_draw_char('O', 79, 10);
  _video_draw_char('c', 79, 11);
  _video_draw_char('t', 79, 12);
  _video_draw_char('a', 79, 13);
  _video_draw_char('n', 79, 14);
  _video_draw_char('e', 79, 15);
  _video_draw_char(' ', 79, 16);
  _video_draw_char(' ', 79, 17);

  // Draw a banner line of the right side of the screen
  for (_i = 0; _i < 10; _i++)  { _video_draw_char(' ', 79,_i); }
  for (_i = 18; _i < 22; _i++) { _video_draw_char(' ', 79,_i); }  
   
  load_misc_kprint();  
  __sprintf(buf, "=========== Octane ===========\n"); __puts(buf);
  __sprintf(buf, "@INFO: Build: %ld; since (10/15/2007) %s\n", 
		  	main_get_build_count, main_get_version); __puts(buf);

  //memory_end = (1<<20) + (EXT_MEM_K<<10);
  //  memory_end &= PAGE_MASK;
  memory_end = 16*1024*1024;
  memory_start = 1024*1024;
  low_memory_start = (unsigned long) &_end;

  // now lets load the IDT
  load_exception_table();

  init_interrupts();
  sched_init();
  load_keyboard_driver();
  
  //memory_start = blk_dev_init(memory_start, memory_end);
  sti();
  //calibrate_delay();
  
  //memory_start = inode_init(memory_start, memory_end);
  //memory_start = file_table_init(memory_start, memory_end);  
  //mem_init(low_memory_start, memory_start, memory_end);
  //buffer_init();
  time_init();
 
  // Print the current time.
  printk("INFO: current time: %d\n", xtime.tv_sec);
  printk("INFO: %d/%d/%d %d:%d\n", cur_simpletime.mon,
		 cur_simpletime.day, cur_simpletime.year,
		 cur_simpletime.hour, cur_simpletime.min);

  floppy_init();
  sti();

  //__debug_floppy_open();
  //__debug_floppy_release();
  test_time_1();
  test_block_1();

  tests();
  for(;;) {  
	  _nop();
  }
}