Changeset 5202:a6267bfa61b1 in roaraudio for libroar


Ignore:
Timestamp:
10/23/11 20:01:40 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added opmode:ms

Location:
libroar
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libroar/config.c

    r5201 r5202  
    257257   } else if ( !strcmp(v, "funny") ) { 
    258258    config->opmode = ROAR_LIBROAR_CONFIG_OPMODE_FUNNY; 
     259   } else if ( !strcmp(v, "ms") ) { 
     260    config->opmode = ROAR_LIBROAR_CONFIG_OPMODE_MS; 
    259261   } else { 
    260262    ROAR_WARN("roar_libroar_config_parse(*): Unknown opmode: %s", v); 
  • libroar/error.c

    r5184 r5202  
    911911 
    912912// phi@ph7:roaraudio $ grep '^#define ROAR_ERROR_' error.h  | tr -d /\* | while read d c d t; do printf "  {%-23s \"%s\"},\n" $c, "$t"; done 
     913 
     914static const char * roar_error2str_ms(const int error, const char * msg) { 
     915 static char buf[1024] = ""; 
     916 int num[8]; 
     917 int i; 
     918 int _ra_err = roar_error; 
     919 int _sys_err = errno; 
     920 
     921 for (i = 0; i < (sizeof(num)/sizeof(*num)); i++) 
     922  num[i] = roar_random_uint32(); 
     923 
     924 snprintf(buf, sizeof(buf), "\e[44;39;1m\e[2J\e[H" 
     925                            "                                   RoarAudio\n" 
     926                            "\n\n" 
     927                            "Fatal error %.4x: %s\n" 
     928                            "RA Error: %.4i, Sys Error: %.4i (%s)\n" 
     929                            "Random numbers:\n" 
     930                            " A: 0x%.8X B: 0x%.8X\n" 
     931                            " C: 0x%.8X D: 0x%.8X\n" 
     932                            " E: 0x%.8X F: 0x%.8X\n" 
     933                            " G: 0x%.8X H: 0x%.8X\n" 
     934                            "\n\n" 
     935                            "\e[0m", 
     936                            error, msg, 
     937                            _ra_err, _sys_err, strerror(_sys_err), 
     938                            num[0], num[1], num[2], num[3], num[4], num[5], num[6], num[7]); 
     939 
     940 return buf; 
     941} 
    913942 
    914943const char * roar_error2str(const int error) { 
     
    10991128 int i; 
    11001129 
     1130 if ( config->opmode == ROAR_LIBROAR_CONFIG_OPMODE_MS ) 
     1131  for (i = 0; msgs[i].msg != NULL; i++) 
     1132   if ( msgs[i].err == error ) 
     1133    return roar_error2str_ms(error, msgs[i].msg); 
     1134 
    11011135 if ( config->opmode == ROAR_LIBROAR_CONFIG_OPMODE_FUNNY ) 
    11021136  for (i = 0; msgs_funny[i].msg != NULL; i++) 
Note: See TracChangeset for help on using the changeset viewer.