compiler: remove remaining switch statements and show a warning

pull/2532/head
Alexander Medvednikov 2019-10-24 19:19:03 +03:00
parent 753fe32793
commit 36eb1b77d0
8 changed files with 203 additions and 143 deletions

View File

@ -271,18 +271,18 @@ fn build_thirdparty_obj_file(path string, moduleflags []CFlag) {
} }
fn os_name_to_ifdef(name string) string { fn os_name_to_ifdef(name string) string {
switch name { match name {
case 'windows': return '_WIN32' 'windows' { return '_WIN32'}
case 'mac': return '__APPLE__' 'mac' { return '__APPLE__'}
case 'linux': return '__linux__' 'linux' { return '__linux__'}
case 'freebsd': return '__FreeBSD__' 'freebsd' { return '__FreeBSD__'}
case 'openbsd': return '__OpenBSD__' 'openbsd'{ return '__OpenBSD__'}
case 'netbsd': return '__NetBSD__' 'netbsd'{ return '__NetBSD__'}
case 'dragonfly': return '__DragonFly__' 'dragonfly'{ return '__DragonFly__'}
case 'msvc': return '_MSC_VER' 'msvc'{ return '_MSC_VER'}
case 'android': return '__BIONIC__' 'android'{ return '__BIONIC__'}
case 'js': return '_VJS' 'js' {return '_VJS'}
case 'solaris': return '__sun' 'solaris'{ return '__sun'}
} }
verror('bad os ifdef name "$name"') verror('bad os ifdef name "$name"')
return '' return ''

View File

@ -270,6 +270,8 @@ fn (s mut Scanner) eat_single_newline(){
if s.text[ s.pos ] == `\r` { s.pos ++ return } if s.text[ s.pos ] == `\r` { s.pos ++ return }
} }
///////////////////////////////
const ( const (
match_arrow_warning = '=> is no longer needed in match statements, use\n' + match_arrow_warning = '=> is no longer needed in match statements, use\n' +
'match foo { 'match foo {
@ -277,4 +279,6 @@ const (
2 { baz } 2 { baz }
else { ... } else { ... }
}' }'
//make_receiver_mutable =
) )

View File

@ -512,22 +512,22 @@ fn type_default(typ string) string {
return '{0}' return '{0}'
} }
// Default values for other types are not needed because of mandatory initialization // Default values for other types are not needed because of mandatory initialization
switch typ { match typ {
case 'bool': return '0' 'bool'{ return '0'}
case 'string': return 'tos((byte *)"", 0)' 'string'{ return 'tos3("")'}
case 'i8': return '0' 'i8'{ return '0'}
case 'i16': return '0' 'i16'{ return '0'}
case 'i64': return '0' 'i64'{ return '0'}
case 'u16': return '0' 'u16'{ return '0'}
case 'u32': return '0' 'u32'{ return '0'}
case 'u64': return '0' 'u64'{ return '0'}
case 'byte': return '0' 'byte'{ return '0'}
case 'int': return '0' 'int'{ return '0'}
case 'rune': return '0' 'rune'{ return '0'}
case 'f32': return '0.0' 'f32'{ return '0.0'}
case 'f64': return '0.0' 'f64'{ return '0.0'}
case 'byteptr': return '0' 'byteptr'{ return '0'}
case 'voidptr': return '0' 'voidptr'{ return '0'}
} }
return '{0}' return '{0}'
} }

View File

@ -1081,21 +1081,22 @@ pub fn cescaped_path(s string) string {
} }
pub fn os_from_string(os string) OS { pub fn os_from_string(os string) OS {
switch os { match os {
case 'linux': return .linux 'linux' { return .linux}
case 'windows': return .windows 'windows' { return .windows}
case 'mac': return .mac 'mac' { return .mac}
case 'freebsd': return .freebsd 'freebsd' { return .freebsd}
case 'openbsd': return .openbsd 'openbsd' { return .openbsd}
case 'netbsd': return .netbsd 'netbsd' { return .netbsd}
case 'dragonfly': return .dragonfly 'dragonfly' { return .dragonfly}
case 'js': return .js 'js' { return .js}
case 'solaris': return .solaris 'solaris' { return .solaris}
case 'android': return .android 'android' { return .android}
case 'msvc': 'msvc' {
// notice that `-os msvc` became `-cc msvc` // notice that `-os msvc` became `-cc msvc`
verror('use the flag `-cc msvc` to build using msvc') verror('use the flag `-cc msvc` to build using msvc')
} }
}
println('bad os $os') // todo panic? println('bad os $os') // todo panic?
return .linux return .linux
} }

View File

@ -658,10 +658,10 @@ fn (p mut Parser) interface_method(field_name, receiver string) &Fn {
} }
fn key_to_type_cat(tok TokenKind) TypeCategory { fn key_to_type_cat(tok TokenKind) TypeCategory {
switch tok { match tok {
case TokenKind.key_interface: return TypeCategory.interface_ .key_interface { return TypeCategory.interface_ }
case TokenKind.key_struct: return TypeCategory.struct_ .key_struct { return TypeCategory.struct_ }
case TokenKind.key_union: return TypeCategory.union_ .key_union { return TypeCategory.union_ }
//TokenKind.key_ => return .interface_ //TokenKind.key_ => return .interface_
} }
verror('Unknown token: $tok') verror('Unknown token: $tok')
@ -2447,8 +2447,8 @@ fn (p mut Parser) term() string {
fn (p mut Parser) unary() string { fn (p mut Parser) unary() string {
mut typ := '' mut typ := ''
tok := p.tok tok := p.tok
switch tok { match tok {
case TokenKind.not: .not {
p.gen('!') p.gen('!')
p.check(.not) p.check(.not)
// typ should be bool type // typ should be bool type
@ -2456,29 +2456,32 @@ fn (p mut Parser) unary() string {
if typ != 'bool' { if typ != 'bool' {
p.error('operator ! requires bool type, not `$typ`') p.error('operator ! requires bool type, not `$typ`')
} }
}
case TokenKind.bit_not: .bit_not {
p.gen('~') p.gen('~')
p.check(.bit_not) p.check(.bit_not)
typ = p.bool_expression() typ = p.bool_expression()
default: }
else {
typ = p.factor() typ = p.factor()
} }
}
return typ return typ
} }
fn (p mut Parser) factor() string { fn (p mut Parser) factor() string {
mut typ := '' mut typ := ''
tok := p.tok tok := p.tok
switch tok { match tok {
case .key_none: .key_none {
if !p.expected_type.starts_with('Option_') { if !p.expected_type.starts_with('Option_') {
p.error('need "$p.expected_type" got none') p.error('need "$p.expected_type" got none')
} }
p.gen('opt_none()') p.gen('opt_none()')
p.check(.key_none) p.check(.key_none)
return p.expected_type return p.expected_type
case TokenKind.number: }
.number {
typ = 'int' typ = 'int'
// Check if float (`1.0`, `1e+3`) but not if is hexa // Check if float (`1.0`, `1e+3`) but not if is hexa
if (p.lit.contains('.') || (p.lit.contains('e') || p.lit.contains('E'))) && if (p.lit.contains('.') || (p.lit.contains('e') || p.lit.contains('E'))) &&
@ -2496,13 +2499,15 @@ fn (p mut Parser) factor() string {
} }
p.gen(p.lit) p.gen(p.lit)
p.fgen(p.lit) p.fgen(p.lit)
case TokenKind.minus: }
.minus {
p.gen('-') p.gen('-')
p.fgen('-') p.fgen('-')
p.next() p.next()
return p.factor() return p.factor()
// Variable // Variable
case TokenKind.key_sizeof: }
.key_sizeof {
p.gen('sizeof(') p.gen('sizeof(')
p.fgen('sizeof(') p.fgen('sizeof(')
p.next() p.next()
@ -2512,10 +2517,12 @@ fn (p mut Parser) factor() string {
p.gen('$sizeof_typ)') p.gen('$sizeof_typ)')
p.fgen('$sizeof_typ)') p.fgen('$sizeof_typ)')
return 'int' return 'int'
case TokenKind.amp, TokenKind.dot, TokenKind.mul: }
.amp, .dot, .mul {
// (dot is for enum vals: `.green`) // (dot is for enum vals: `.green`)
return p.name_expr() return p.name_expr()
case TokenKind.name: }
.name {
// map[string]int // map[string]int
if p.lit == 'map' && p.peek() == .lsbr { if p.lit == 'map' && p.peek() == .lsbr {
return p.map_init() return p.map_init()
@ -2532,7 +2539,8 @@ fn (p mut Parser) factor() string {
//} //}
typ = p.name_expr() typ = p.name_expr()
return typ return typ
case TokenKind.key_default: }
.key_default {
p.next() p.next()
p.next() p.next()
name := p.check_name() name := p.check_name()
@ -2542,7 +2550,8 @@ fn (p mut Parser) factor() string {
p.gen('default(T)') p.gen('default(T)')
p.next() p.next()
return 'T' return 'T'
case TokenKind.lpar: }
.lpar {
//p.gen('(/*lpar*/') //p.gen('(/*lpar*/')
p.gen('(') p.gen('(')
p.check(.lpar) p.check(.lpar)
@ -2556,41 +2565,50 @@ fn (p mut Parser) factor() string {
p.ptr_cast = false p.ptr_cast = false
p.gen(')') p.gen(')')
return typ return typ
case TokenKind.chartoken: }
.chartoken {
p.char_expr() p.char_expr()
typ = 'byte' typ = 'byte'
return typ return typ
case TokenKind.str: }
.str {
p.string_expr() p.string_expr()
typ = 'string' typ = 'string'
return typ return typ
case TokenKind.key_false: }
.key_false {
typ = 'bool' typ = 'bool'
p.gen('0') p.gen('0')
p.fgen('false') p.fgen('false')
case TokenKind.key_true: }
.key_true {
typ = 'bool' typ = 'bool'
p.gen('1') p.gen('1')
p.fgen('true') p.fgen('true')
case TokenKind.lsbr: }
.lsbr {
// `[1,2,3]` or `[]` or `[20]byte` // `[1,2,3]` or `[]` or `[20]byte`
// TODO have to return because arrayInit does next() // TODO have to return because arrayInit does next()
// everything should do next() // everything should do next()
return p.array_init() return p.array_init()
case TokenKind.lcbr: }
.lcbr {
// `m := { 'one': 1 }` // `m := { 'one': 1 }`
if p.peek() == .str { if p.peek() == .str {
return p.map_init() return p.map_init()
} }
// { user | name :'new name' } // { user | name :'new name' }
return p.assoc() return p.assoc()
case TokenKind.key_if: }
.key_if {
typ = p.if_st(true, 0) typ = p.if_st(true, 0)
return typ return typ
case TokenKind.key_match: }
.key_match {
typ = p.match_statement(true) typ = p.match_statement(true)
return typ return typ
default: }
else {
if p.pref.is_verbose || p.pref.is_debug { if p.pref.is_verbose || p.pref.is_debug {
next := p.peek() next := p.peek()
println('prev=${p.prev_tok.str()}') println('prev=${p.prev_tok.str()}')
@ -2598,6 +2616,7 @@ fn (p mut Parser) factor() string {
} }
p.error('unexpected token: `${p.tok.str()}`') p.error('unexpected token: `${p.tok.str()}`')
} }
}
p.next()// TODO everything should next() p.next()// TODO everything should next()
return typ return typ
} }
@ -3316,6 +3335,8 @@ fn (p mut Parser) for_st() {
} }
fn (p mut Parser) switch_statement() { fn (p mut Parser) switch_statement() {
p.warn('`switch` statement has been deprecated, use `match` instead:\n' +
'https://vlang.io/docs#match')
if p.tok == .key_switch { if p.tok == .key_switch {
p.check(.key_switch) p.check(.key_switch)
} else { } else {

View File

@ -306,8 +306,8 @@ fn (s mut Scanner) scan() ScanRes {
return scan_res(.number, num) return scan_res(.number, num)
} }
// all other tokens // all other tokens
switch c { match c {
case `+`: `+` {
if nextc == `+` { if nextc == `+` {
s.pos++ s.pos++
return scan_res(.inc, '') return scan_res(.inc, '')
@ -317,7 +317,8 @@ fn (s mut Scanner) scan() ScanRes {
return scan_res(.plus_assign, '') return scan_res(.plus_assign, '')
} }
return scan_res(.plus, '') return scan_res(.plus, '')
case `-`: }
`-` {
if nextc == `-` { if nextc == `-` {
s.pos++ s.pos++
return scan_res(.dec, '') return scan_res(.dec, '')
@ -327,47 +328,62 @@ fn (s mut Scanner) scan() ScanRes {
return scan_res(.minus_assign, '') return scan_res(.minus_assign, '')
} }
return scan_res(.minus, '') return scan_res(.minus, '')
case `*`: }
`*` {
if nextc == `=` { if nextc == `=` {
s.pos++ s.pos++
return scan_res(.mult_assign, '') return scan_res(.mult_assign, '')
} }
return scan_res(.mul, '') return scan_res(.mul, '')
case `^`: }
`^` {
if nextc == `=` { if nextc == `=` {
s.pos++ s.pos++
return scan_res(.xor_assign, '') return scan_res(.xor_assign, '')
} }
return scan_res(.xor, '') return scan_res(.xor, '')
case `%`: }
`%` {
if nextc == `=` { if nextc == `=` {
s.pos++ s.pos++
return scan_res(.mod_assign, '') return scan_res(.mod_assign, '')
} }
return scan_res(.mod, '') return scan_res(.mod, '')
case `?`: }
`?` {
return scan_res(.question, '') return scan_res(.question, '')
case single_quote, double_quote: }
single_quote, double_quote {
return scan_res(.str, s.ident_string()) return scan_res(.str, s.ident_string())
case `\``: // ` // apostrophe balance comment. do not remove }
`\`` { // ` // apostrophe balance comment. do not remove
return scan_res(.chartoken, s.ident_char()) return scan_res(.chartoken, s.ident_char())
case `(`: }
`(` {
return scan_res(.lpar, '') return scan_res(.lpar, '')
case `)`: }
`)` {
return scan_res(.rpar, '') return scan_res(.rpar, '')
case `[`: }
`[` {
return scan_res(.lsbr, '') return scan_res(.lsbr, '')
case `]`: }
`]` {
return scan_res(.rsbr, '') return scan_res(.rsbr, '')
case `{`: }
`{` {
// Skip { in ${ in strings // Skip { in ${ in strings
// }
if s.inside_string { if s.inside_string {
return s.scan() return s.scan()
} }
return scan_res(.lcbr, '') return scan_res(.lcbr, '')
case `$`: }
`$` {
return scan_res(.dollar, '') return scan_res(.dollar, '')
case `}`: }
`}` {
// s = `hello $name !` // s = `hello $name !`
// s = `hello ${name} !` // s = `hello ${name} !`
if s.inside_string { if s.inside_string {
@ -382,7 +398,8 @@ fn (s mut Scanner) scan() ScanRes {
else { else {
return scan_res(.rcbr, '') return scan_res(.rcbr, '')
} }
case `&`: }
`&` {
if nextc == `=` { if nextc == `=` {
s.pos++ s.pos++
return scan_res(.and_assign, '') return scan_res(.and_assign, '')
@ -392,7 +409,8 @@ fn (s mut Scanner) scan() ScanRes {
return scan_res(.and, '') return scan_res(.and, '')
} }
return scan_res(.amp, '') return scan_res(.amp, '')
case `|`: }
`|` {
if nextc == `|` { if nextc == `|` {
s.pos++ s.pos++
return scan_res(.logical_or, '') return scan_res(.logical_or, '')
@ -402,9 +420,11 @@ fn (s mut Scanner) scan() ScanRes {
return scan_res(.or_assign, '') return scan_res(.or_assign, '')
} }
return scan_res(.pipe, '') return scan_res(.pipe, '')
case `,`: }
`,` {
return scan_res(.comma, '') return scan_res(.comma, '')
case `@`: }
`@` {
s.pos++ s.pos++
name := s.ident_name() name := s.ident_name()
// @FN => will be substituted with the name of the current V function // @FN => will be substituted with the name of the current V function
@ -424,6 +444,7 @@ fn (s mut Scanner) scan() ScanRes {
s.error('@ must be used before keywords (e.g. `@type string`)') s.error('@ must be used before keywords (e.g. `@type string`)')
} }
return scan_res(.name, name) return scan_res(.name, name)
}
/* /*
case `\r`: case `\r`:
if nextc == `\n` { if nextc == `\n` {
@ -431,11 +452,13 @@ fn (s mut Scanner) scan() ScanRes {
s.last_nl_pos = s.pos s.last_nl_pos = s.pos
return scan_res(.nl, '') return scan_res(.nl, '')
} }
}
case `\n`: case `\n`:
s.last_nl_pos = s.pos s.last_nl_pos = s.pos
return scan_res(.nl, '') return scan_res(.nl, '')
}
*/ */
case `.`: `.` {
if nextc == `.` { if nextc == `.` {
s.pos++ s.pos++
if s.text[s.pos+1] == `.` { if s.text[s.pos+1] == `.` {
@ -445,7 +468,8 @@ fn (s mut Scanner) scan() ScanRes {
return scan_res(.dotdot, '') return scan_res(.dotdot, '')
} }
return scan_res(.dot, '') return scan_res(.dot, '')
case `#`: }
`#` {
start := s.pos + 1 start := s.pos + 1
s.ignore_line() s.ignore_line()
if nextc == `!` { if nextc == `!` {
@ -456,7 +480,8 @@ fn (s mut Scanner) scan() ScanRes {
} }
hash := s.text.substr(start, s.pos) hash := s.text.substr(start, s.pos)
return scan_res(.hash, hash.trim_space()) return scan_res(.hash, hash.trim_space())
case `>`: }
`>` {
if nextc == `=` { if nextc == `=` {
s.pos++ s.pos++
return scan_res(.ge, '') return scan_res(.ge, '')
@ -472,7 +497,8 @@ fn (s mut Scanner) scan() ScanRes {
else { else {
return scan_res(.gt, '') return scan_res(.gt, '')
} }
case 0xE2: }
0xE2 {
//case `≠`: //case `≠`:
if nextc == 0x89 && s.text[s.pos + 2] == 0xA0 { if nextc == 0x89 && s.text[s.pos + 2] == 0xA0 {
s.pos += 2 s.pos += 2
@ -488,7 +514,8 @@ fn (s mut Scanner) scan() ScanRes {
s.pos += 2 s.pos += 2
return scan_res(.ge, '') return scan_res(.ge, '')
} }
case `<`: }
`<` {
if nextc == `=` { if nextc == `=` {
s.pos++ s.pos++
return scan_res(.le, '') return scan_res(.le, '')
@ -504,7 +531,8 @@ fn (s mut Scanner) scan() ScanRes {
else { else {
return scan_res(.lt, '') return scan_res(.lt, '')
} }
case `=`: }
`=` {
if nextc == `=` { if nextc == `=` {
s.pos++ s.pos++
return scan_res(.eq, '') return scan_res(.eq, '')
@ -516,7 +544,8 @@ fn (s mut Scanner) scan() ScanRes {
else { else {
return scan_res(.assign, '') return scan_res(.assign, '')
} }
case `:`: }
`:` {
if nextc == `=` { if nextc == `=` {
s.pos++ s.pos++
return scan_res(.decl_assign, '') return scan_res(.decl_assign, '')
@ -524,9 +553,11 @@ fn (s mut Scanner) scan() ScanRes {
else { else {
return scan_res(.colon, '') return scan_res(.colon, '')
} }
case `;`: }
`;` {
return scan_res(.semicolon, '') return scan_res(.semicolon, '')
case `!`: }
`!` {
if nextc == `=` { if nextc == `=` {
s.pos++ s.pos++
return scan_res(.ne, '') return scan_res(.ne, '')
@ -534,9 +565,11 @@ fn (s mut Scanner) scan() ScanRes {
else { else {
return scan_res(.not, '') return scan_res(.not, '')
} }
case `~`: }
`~` {
return scan_res(.bit_not, '') return scan_res(.bit_not, '')
case `/`: }
`/` {
if nextc == `=` { if nextc == `=` {
s.pos++ s.pos++
return scan_res(.div_assign, '') return scan_res(.div_assign, '')
@ -581,6 +614,7 @@ fn (s mut Scanner) scan() ScanRes {
return s.scan() return s.scan()
} }
return scan_res(.div, '') return scan_res(.div, '')
}
} }
$if windows { $if windows {
if c == `\0` { if c == `\0` {

View File

@ -803,13 +803,13 @@ fn (table &Table) cgen_name_type_pair(name, typ string) string {
fn is_valid_int_const(val, typ string) bool { fn is_valid_int_const(val, typ string) bool {
x := val.int() x := val.int()
switch typ { match typ {
case 'byte': return 0 <= x && x <= 255 'byte' { return 0 <= x && x <= 255 }
case 'u16': return 0 <= x && x <= 65535 'u16' { return 0 <= x && x <= 65535 }
//case 'u32': return 0 <= x && x <= math.MaxU32 //case 'u32': return 0 <= x && x <= math.MaxU32
//case 'u64': return 0 <= x && x <= math.MaxU64 //case 'u64': return 0 <= x && x <= math.MaxU64
////////////// //////////////
case 'i8': return -128 <= x && x <= 127 'i8' { return -128 <= x && x <= 127 }
/* /*
case 'i16': return math.min_i16 <= x && x <= math.max_i16 case 'i16': return math.min_i16 <= x && x <= math.max_i16
case 'int': return math.min_i32 <= x && x <= math.max_i32 case 'int': return math.min_i32 <= x && x <= math.max_i32
@ -826,22 +826,23 @@ fn (p mut Parser) typ_to_fmt(typ string, level int) string {
if t.cat == .enum_ { if t.cat == .enum_ {
return '%d' return '%d'
} }
switch typ { match typ {
case 'string': return '%.*s' 'string' { return '%.*s'}
//case 'bool': return '%.*s' //case 'bool': return '%.*s'
case 'ustring': return '%.*s' 'ustring' { return '%.*s'}
case 'byte', 'bool', 'int', 'char', 'byte', 'i16', 'i8': return '%d' 'byte', 'bool', 'int', 'char', 'byte', 'i16', 'i8' { return '%d'}
case 'u16', 'u32': return '%u' 'u16', 'u32' { return '%u'}
case 'f64', 'f32': return '%f' 'f64', 'f32' { return '%f'}
case 'i64': return '%lld' 'i64' { return '%lld'}
case 'u64': return '%llu' 'u64' { return '%llu'}
case 'byte*', 'byteptr': return '%s' 'byte*', 'byteptr' { return '%s'}
// case 'array_string': return '%s' // case 'array_string': return '%s'
// case 'array_int': return '%s' // case 'array_int': return '%s'
case 'void': p.error('cannot interpolate this value') 'void' { p.error('cannot interpolate this value')}
default: else {
if typ.ends_with('*') { if typ.ends_with('*') {
return '%p' return '%p'
}
} }
} }
if t.parent != '' && level == 0 { if t.parent != '' && level == 0 {

View File

@ -380,34 +380,33 @@ pub fn system(cmd string) int {
pub fn sigint_to_signal_name(si int) string { pub fn sigint_to_signal_name(si int) string {
// POSIX signals: // POSIX signals:
switch si { match si {
case 1: return 'SIGHUP' 1 {return 'SIGHUP'}
case 2: return 'SIGINT' 2 {return 'SIGINT'}
case 3: return 'SIGQUIT' 3 {return 'SIGQUIT'}
case 4: return 'SIGILL' 4 {return 'SIGILL'}
case 6: return 'SIGABRT' 6 {return 'SIGABRT'}
case 8: return 'SIGFPE' 8 {return 'SIGFPE'}
case 9: return 'SIGKILL' 9 {return 'SIGKILL'}
case 11: return 'SIGSEGV' 11 {return 'SIGSEGV'}
case 13: return 'SIGPIPE' 13 {return 'SIGPIPE'}
case 14: return 'SIGALRM' 14 {return 'SIGALRM'}
case 15: return 'SIGTERM' 15 {return 'SIGTERM'}
} }
///////////////////////////////////
$if linux { $if linux {
// From `man 7 signal` on linux: // From `man 7 signal` on linux:
switch si { match si {
case 30,10,16: return 'SIGUSR1' 30,10,16{ return 'SIGUSR1'}
case 31,12,17: return 'SIGUSR2' 31,12,17{ return 'SIGUSR2'}
case 20,17,18: return 'SIGCHLD' 20,17,18{ return 'SIGCHLD'}
case 19,18,25: return 'SIGCONT' 19,18,25{ return 'SIGCONT'}
case 17,19,23: return 'SIGSTOP' 17,19,23{ return 'SIGSTOP'}
case 18,20,24: return 'SIGTSTP' 18,20,24{ return 'SIGTSTP'}
case 21,21,26: return 'SIGTTIN' 21,21,26{ return 'SIGTTIN'}
case 22,22,27: return 'SIGTTOU' 22,22,27{ return 'SIGTTOU'}
/////////////////////////////// ///////////////////////////////
case 5: return 'SIGTRAP' 5{ return 'SIGTRAP'}
case 7: return 'SIGBUS' 7{ return 'SIGBUS' }
} }
} }
return 'unknown' return 'unknown'