Changeset 5183:41993c72f4d3 in roaraudio


Ignore:
Timestamp:
10/22/11 17:16:12 (8 years ago)
Author:
phi
Branch:
default
Message:

added opmode option

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/config.h

    r5109 r5183  
    5959#define ROAR_LIBROAR_CONFIG_MODE_UWB        ROAR_SPEEX_MODE_UWB 
    6060 
     61// mode of operation: 
     62enum roar_libroar_config_opmode { 
     63 ROAR_LIBROAR_CONFIG_OPMODE_NORMAL = 0, 
     64#define ROAR_LIBROAR_CONFIG_OPMODE_NORMAL   ROAR_LIBROAR_CONFIG_OPMODE_NORMAL 
     65 ROAR_LIBROAR_CONFIG_OPMODE_FUNNY  = 1 
     66#define ROAR_LIBROAR_CONFIG_OPMODE_FUNNY    ROAR_LIBROAR_CONFIG_OPMODE_FUNNY 
     67}; 
     68 
    6169struct roar_libroar_config_codec { 
    6270 unsigned int codec; // Codec ID 
     
    104112 enum roar_trap_policy trap_policy; 
    105113#endif 
     114 enum roar_libroar_config_opmode opmode; 
    106115}; 
    107116 
  • libroar/config.c

    r5010 r5183  
    5252  config.trap_policy = ROAR_TRAP_IGNORE; 
    5353#endif 
     54  config.opmode      = ROAR_LIBROAR_CONFIG_OPMODE_NORMAL; 
    5455  config.server   = NULL; 
    5556  config.authfile = NULL; 
     
    251252    ROAR_WARN("roar_libroar_config_parse(*): Unknown warning option: %s", v); 
    252253   } 
     254  } else if ( !strcmp(k, "opmode") ) { 
     255   if ( !strcmp(v, "normal") ) { 
     256    config->opmode = ROAR_LIBROAR_CONFIG_OPMODE_NORMAL; 
     257   } else if ( !strcmp(v, "funny") ) { 
     258    config->opmode = ROAR_LIBROAR_CONFIG_OPMODE_FUNNY; 
     259   } else { 
     260    ROAR_WARN("roar_libroar_config_parse(*): Unknown opmode: %s", v); 
     261   } 
    253262#ifdef ROAR_SUPPORT_TRAP 
    254263  } else if ( !strcmp(k, "trap-policy") ) { 
  • libroar/error.c

    r5150 r5183  
    913913 
    914914const char * roar_error2str(const int error) { 
     915 struct roar_libroar_config * config = roar_libroar_get_config(); 
    915916 const struct { 
    916917  const int    err; 
     
    980981  {ROAR_ERROR_IDREMOVED,   "Identifier removed"}, 
    981982  {ROAR_ERROR_INPROGRESS,  "Operation in progress"}, 
    982   {ROAR_ERROR_NOCHILD,     "No child processesobject"}, 
     983  {ROAR_ERROR_NOCHILD,     "No child processes or object"}, 
    983984  {ROAR_ERROR_NETUNREACH,  "Network unreachable"}, 
    984985  {ROAR_ERROR_CANCELED,    "Operation canceled"}, 
     
    10051006  {ROAR_ERROR_CONNABORTED, "Connection aborted"}, 
    10061007  {-1, NULL} 
     1008 }, msgs_funny[] = { 
     1009//  {ROAR_ERROR_UNKNOWN,     "Unknown (maybe no) error"}, 
     1010  {ROAR_ERROR_NONE,        "No error, huh?"}, 
     1011  {ROAR_ERROR_PERM,        "Little kitty is not allowed to do this"}, 
     1012  {ROAR_ERROR_NOENT,       "Mouse not found"}, 
     1013//  {ROAR_ERROR_BADMSG,      "Bad message"}, 
     1014  {ROAR_ERROR_BUSY,        "Another kitty is playing with this mouse"}, 
     1015//  {ROAR_ERROR_CONNREFUSED, "Connection refused"}, 
     1016//  {ROAR_ERROR_NOSYS,       "Function not implemented"}, 
     1017//  {ROAR_ERROR_NOTSUP,      "Operation not supported"}, 
     1018  {ROAR_ERROR_PIPE,        "Flood"}, 
     1019//  {ROAR_ERROR_PROTO,       "Protocol error"}, 
     1020//  {ROAR_ERROR_RANGE,       "Result too largegeneral out of range"}, 
     1021//  {ROAR_ERROR_MSGSIZE,     "Message too long"}, 
     1022//  {ROAR_ERROR_NOMEM,       "Not enough space"}, 
     1023//  {ROAR_ERROR_INVAL,       "Invalid argument"}, 
     1024//  {ROAR_ERROR_ALREADY,     "Connection already in progress"}, 
     1025  {ROAR_ERROR_BADRQC,      "Stupid staff"}, 
     1026//  {ROAR_ERROR_DOM,         "Mathematics argument out of domain of function"}, 
     1027//  {ROAR_ERROR_EXIST,       "File or object exists"}, 
     1028//  {ROAR_ERROR_FAULT,       "Bad address"}, 
     1029//  {ROAR_ERROR_IO,          "IO-Error"}, 
     1030//  {ROAR_ERROR_KEYEXPIRED,  "Key has expired"}, 
     1031//  {ROAR_ERROR_KEYREJECTED, "Key was rejected by service"}, 
     1032//  {ROAR_ERROR_LOOP,        "Too many recursions"}, 
     1033//  {ROAR_ERROR_MFILE,       "Too many open files or objects"}, 
     1034  {ROAR_ERROR_NAMETOOLONG, "Staff can not remember long names"}, 
     1035//  {ROAR_ERROR_NODATA,      "No message is available on the read queue"}, 
     1036  {ROAR_ERROR_NODEV,       "No such mouse"}, 
     1037//  {ROAR_ERROR_NODRV,       "No such driver"}, 
     1038  {ROAR_ERROR_NOSPC,       "Too many fish on desk"}, 
     1039//  {ROAR_ERROR_TYPEMM,      "Type missmatch. Object of diffrent type required"}, 
     1040//  {ROAR_ERROR_NORSYS,      "Feature not implemented by remote end"}, 
     1041//  {ROAR_ERROR_NOTCONN,     "Socket or object not connected"}, 
     1042//  {ROAR_ERROR_PROTONOSUP,  "Protocol not supported"}, 
     1043//  {ROAR_ERROR_RIO,         "Remote IO Error"}, 
     1044  {ROAR_ERROR_RO,          "Touching disallowed"}, 
     1045//  {ROAR_ERROR_TIMEDOUT,    "Connection timed out"}, 
     1046//  {ROAR_ERROR_AGAIN,       "Resource temporarily unavailable"}, 
     1047//  {ROAR_ERROR_NOISE,       "Line too noisy"}, 
     1048//  {ROAR_ERROR_LINKDOWN,    "Physical or logical link down"}, 
     1049//  {ROAR_ERROR_INTERRUPTED, "Operation was interruped"}, 
     1050//  {ROAR_ERROR_CAUSALITY,   "Causality error"}, 
     1051//  {ROAR_ERROR_QUOTA,       "Quota exceeded"}, 
     1052//  {ROAR_ERROR_BADLIB,      "Accessing a corrupted shared library"}, 
     1053//  {ROAR_ERROR_NOMEDIUM,    "No medium found"}, 
     1054//  {ROAR_ERROR_NOTUNIQ,     "Name not unique"}, 
     1055//  {ROAR_ERROR_ILLSEQ,      "Illegal byte sequence"}, 
     1056//  {ROAR_ERROR_ADDRINUSE,   "Address in use"}, 
     1057  {ROAR_ERROR_HOLE,        "Hole in wall"}, 
     1058//  {ROAR_ERROR_BADVERSION,  "Bad version"}, 
     1059//  {ROAR_ERROR_NSVERSION,   "Not supported version"}, 
     1060  {ROAR_ERROR_BADMAGIC,    "Magician's fault"}, 
     1061//  {ROAR_ERROR_LOSTSYNC,    "Lost synchronization"}, 
     1062//  {ROAR_ERROR_BADSEEK,     "Can not seek to destination position"}, 
     1063//  {ROAR_ERROR_NOSEEK,      "Seeking not supported on resource"}, 
     1064//  {ROAR_ERROR_BADCKSUM,    "Data integrity error"}, 
     1065  {ROAR_ERROR_NOHORSE,     "No horse"}, 
     1066//  {ROAR_ERROR_CHERNOBYL,   "Fatal device error"}, 
     1067  {ROAR_ERROR_NOHUG,       "No hug"}, 
     1068//  {ROAR_ERROR_TEXTBUSY,    "Text file busy"}, 
     1069//  {ROAR_ERROR_NOTEMPTY,    "Directory not empty"}, 
     1070//  {ROAR_ERROR_NODEUNREACH, "Node is unreachable"}, 
     1071//  {ROAR_ERROR_IDREMOVED,   "Identifier removed"}, 
     1072//  {ROAR_ERROR_INPROGRESS,  "Operation in progress"}, 
     1073//  {ROAR_ERROR_NOCHILD,     "No child processesobject"}, 
     1074//  {ROAR_ERROR_NETUNREACH,  "Network unreachable"}, 
     1075//  {ROAR_ERROR_CANCELED,    "Operation canceled"}, 
     1076//  {ROAR_ERROR_ISDIR,       "Is a directory"}, 
     1077//  {ROAR_ERROR_NOTDIR,      "Not a directory"}, 
     1078//  {ROAR_ERROR_BADEXEC,     "Executable file format error"}, 
     1079//  {ROAR_ERROR_ISCONN,      "Socket/Object is connected"}, 
     1080  {ROAR_ERROR_DEADLOCK,    "Mouse would die"}, 
     1081//  {ROAR_ERROR_CONNRST,     "Connection reset"}, 
     1082//  {ROAR_ERROR_BADFH,       "Bad file handle"}, 
     1083//  {ROAR_ERROR_NOTSOCK,     "Not a socket"}, 
     1084//  {ROAR_ERROR_TOOMANYARGS, "Argument list too long"}, 
     1085//  {ROAR_ERROR_TOOLARGE,    "File/Object too large"}, 
     1086//  {ROAR_ERROR_DESTADDRREQ, "Destination address required"}, 
     1087//  {ROAR_ERROR_AFNOTSUP,    "Address family not supported"}, 
     1088//  {ROAR_ERROR_NOPOWER,     "Operation can not be completed because we are low on power"}, 
     1089//  {ROAR_ERROR_USER,        "Error in front of screen"}, 
     1090//  {ROAR_ERROR_NFILE,       "Too many filesobjects open in system"}, 
     1091//  {ROAR_ERROR_STALE,       "Stale file handle or object"}, 
     1092  {ROAR_ERROR_XDEVLINK,    "Mice tails too short for kinking"}, 
     1093//  {ROAR_ERROR_MLINK,       "Too many links to file or object"}, 
     1094//  {ROAR_ERROR_NONET,       "Not connected to any network"}, 
     1095//  {ROAR_ERROR_CONNRSTNET,  "Connection reset by network"}, 
     1096//  {ROAR_ERROR_CONNABORTED, "Connection aborted"}, 
     1097  {-1, NULL} 
    10071098 }; 
    10081099 int i; 
     1100 
     1101 if ( config->opmode == ROAR_LIBROAR_CONFIG_OPMODE_FUNNY ) 
     1102  for (i = 0; msgs_funny[i].msg != NULL; i++) 
     1103   if ( msgs_funny[i].err == error ) 
     1104    return msgs_funny[i].msg; 
    10091105 
    10101106 for (i = 0; msgs[i].msg != NULL; i++) 
Note: See TracChangeset for help on using the changeset viewer.