default: to case:; no_alias to #no_alias

This commit is contained in:
Ginger Bill
2017-05-27 11:47:21 +01:00
parent ddb99dd638
commit 45dbe8d354
18 changed files with 240 additions and 1612 deletions
+16 -16
View File
@@ -189,7 +189,7 @@ write_type :: proc(buf: ^String_Buffer, ti: ^Type_Info) {
match {
case ti == type_info(int): write_string(buf, "int");
case ti == type_info(uint): write_string(buf, "uint");
default:
case:
write_string(buf, info.signed ? "i" : "u");
fi := Fmt_Info{buf = buf};
fmt_int(&fi, u64(8*info.size), false, 64, 'd');
@@ -440,7 +440,7 @@ int_from_arg :: proc(args: []any, arg_index: int) -> (int, int, bool) {
case u16: num = int(i);
case u32: num = int(i);
case u64: num = int(i);
default:
case:
ok = false;
}
}
@@ -468,7 +468,7 @@ fmt_bool :: proc(using fi: ^Fmt_Info, b: bool, verb: rune) {
match verb {
case 't', 'v':
write_string(buf, b ? "true" : "false");
default:
case:
fmt_bad_verb(fi, verb);
}
}
@@ -515,7 +515,7 @@ is_integer_negative :: proc(u: u64, is_signed: bool, bit_size: int) -> (unsigned
neg = i < 0;
if neg { i = -i; }
u = u64(i);
default:
case:
panic("is_integer_negative: Unknown integer size");
}
}
@@ -555,7 +555,7 @@ _write_int :: proc(fi: ^Fmt_Info, u: u64, base: int, is_signed: bool, bit_size:
match base {
case 2, 8, 10, 12, 16:
break;
default:
case:
panic("_write_int: unknown base, whoops");
}
@@ -598,7 +598,7 @@ fmt_int :: proc(fi: ^Fmt_Info, u: u64, is_signed: bool, bit_size: int, verb: run
_write_int(fi, u, 16, false, bit_size, __DIGITS_UPPER);
}
default:
case:
fmt_bad_verb(fi, verb);
}
}
@@ -659,7 +659,7 @@ fmt_float :: proc(fi: ^Fmt_Info, v: f64, bit_size: int, verb: rune) {
_pad(fi, str[1..]);
}
default:
case:
fmt_bad_verb(fi, verb);
return;
}
@@ -681,7 +681,7 @@ fmt_string :: proc(fi: ^Fmt_Info, s: string, verb: rune) {
_write_int(fi, u64(s[i]), 16, false, 8, verb == 'x' ? __DIGITS_LOWER : __DIGITS_UPPER);
}
default:
case:
fmt_bad_verb(fi, verb);
}
}
@@ -690,7 +690,7 @@ fmt_pointer :: proc(fi: ^Fmt_Info, p: rawptr, verb: rune) {
match verb {
case 'p', 'v':
// Okay
default:
case:
fmt_bad_verb(fi, verb);
return;
}
@@ -709,7 +709,7 @@ fmt_enum :: proc(fi: ^Fmt_Info, v: any, verb: rune) {
using Type_Info;
match e in v.type_info {
default:
case:
fmt_bad_verb(fi, verb);
return;
case Enum:
@@ -760,7 +760,7 @@ fmt_enum :: proc(fi: ^Fmt_Info, v: any, verb: rune) {
if !ok {
write_string(fi.buf, "!%(BAD ENUM VALUE)");
}
default:
case:
fmt_bad_verb(fi, verb);
return;
}
@@ -796,7 +796,7 @@ fmt_value :: proc(fi: ^Fmt_Info, v: any, verb: rune) {
}
write_byte(fi.buf, '}');
default:
case:
fmt_value(fi, any{v.data, info.base}, verb);
}
@@ -956,7 +956,7 @@ fmt_complex :: proc(fi: ^Fmt_Info, c: complex128, bits: int, verb: rune) {
fmt_float(fi, i, bits/2, verb);
write_rune(fi.buf, 'i');
default:
case:
fmt_bad_verb(fi, verb);
return;
}
@@ -983,7 +983,7 @@ fmt_quaternion :: proc(fi: ^Fmt_Info, c: quaternion256, bits: int, verb: rune) {
fmt_float(fi, k, bits/4, verb);
write_rune(fi.buf, 'k');
default:
case:
fmt_bad_verb(fi, verb);
return;
}
@@ -1029,7 +1029,7 @@ fmt_arg :: proc(fi: ^Fmt_Info, arg: any, verb: rune) {
case u32: fmt_int(fi, u64(a), false, 32, verb);
case u64: fmt_int(fi, u64(a), false, 64, verb);
case string: fmt_string(fi, a, verb);
default: fmt_value(fi, arg, verb);
case: fmt_value(fi, arg, verb);
}
}
@@ -1102,7 +1102,7 @@ sbprintf :: proc(b: ^String_Buffer, fmt: string, args: ..any) -> string {
fi.hash = true;
case '0':
fi.zero = !fi.minus;
default:
case:
break prefix_loop;
}
}
+10
View File
@@ -35,3 +35,13 @@ read_entire_file :: proc(name: string) -> ([]byte, bool) {
return data[0..<bytes_read], true;
}
write_entire_file :: proc(name: string, data: []byte) -> bool {
fd, err := open(name, O_WRONLY, 0);
if err != 0 {
return false;
}
defer close(fd);
bytes_written, write_err := write(fd, data);
return write_err != 0;
}
+2 -2
View File
@@ -89,7 +89,7 @@ open :: proc(path: string, mode: int, perm: u32) -> (Handle, Errno) {
create_mode = win32.OPEN_ALWAYS;
case mode&O_TRUNC == O_TRUNC:
create_mode = win32.TRUNCATE_EXISTING;
default:
case:
create_mode = win32.OPEN_EXISTING;
}
@@ -314,7 +314,7 @@ _alloc_command_line_arguments :: proc() -> []string {
j += 2;
case 0xdc00 <= str[j] && str[j] < 0xe000:
return "";
default:
case:
if i+3 > len {
return "";
}
+4 -4
View File
@@ -108,7 +108,7 @@ generic_ftoa :: proc(buf: []byte, val: f64, fmt: byte, prec, bit_size: int) -> [
case 64:
bits = transmute(u64, val);
flt = &f64_info;
default:
case:
panic("strconv: invalid bit_size");
}
@@ -132,7 +132,7 @@ generic_ftoa :: proc(buf: []byte, val: f64, fmt: byte, prec, bit_size: int) -> [
case 0: // denormalized
exp++;
default:
case:
mant |= u64(1) << flt.mantbits;
}
@@ -312,7 +312,7 @@ is_integer_negative :: proc(u: u64, is_signed: bool, bit_size: int) -> (unsigned
neg = i < 0;
if neg { i = -i; }
u = u64(i);
default:
case:
panic("is_integer_negative: Unknown integer size");
}
}
@@ -356,7 +356,7 @@ append_bits :: proc(buf: []byte, u: u64, base: int, is_signed: bool, bit_size: i
case 10: i--; a[i] = 'd';
case 12: i--; a[i] = 'z';
case 16: i--; a[i] = 'x';
default: ok = false;
case: ok = false;
}
if ok {
i--;
+1 -1
View File
@@ -50,7 +50,7 @@ encode :: proc(d: []u16, s: []rune) {
d[n+1] = u16(r2);
n += 2;
default:
case:
d[n] = u16(REPLACEMENT_CHAR);
n++;
}