mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-26 09:23:48 +00:00
Change rune literals to #rune "C"
This commit is contained in:
+11
-11
@@ -53,8 +53,8 @@ print_rune :: proc(r: rune) {
|
||||
print_string(str);
|
||||
}
|
||||
|
||||
print_space :: proc() { print_rune($ $); }
|
||||
print_nl :: proc() { print_rune($\n$); }
|
||||
print_space :: proc() { print_rune(#rune " "); }
|
||||
print_nl :: proc() { print_rune(#rune "\n"); }
|
||||
|
||||
print_int :: proc(i: int) {
|
||||
print_int_base(i, 10);
|
||||
@@ -70,7 +70,7 @@ print_int_base :: proc(i, base: int) {
|
||||
i = -i;
|
||||
}
|
||||
if i == 0 {
|
||||
buf[len] = $0$;
|
||||
buf[len] = #rune "0";
|
||||
len++;
|
||||
}
|
||||
for i > 0 {
|
||||
@@ -80,7 +80,7 @@ print_int_base :: proc(i, base: int) {
|
||||
}
|
||||
|
||||
if negative {
|
||||
buf[len] = $-$;
|
||||
buf[len] = #rune "-";
|
||||
len++;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ print_int_base :: proc(i, base: int) {
|
||||
}
|
||||
|
||||
print_uint :: proc(i: uint) {
|
||||
print__uint(i, 10, 0, $ $);
|
||||
print__uint(i, 10, 0, #rune " ");
|
||||
}
|
||||
print__uint :: proc(i, base: uint, min_width: int, pad_char: byte) {
|
||||
NUM_TO_CHAR_TABLE :: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@$";
|
||||
@@ -97,7 +97,7 @@ print__uint :: proc(i, base: uint, min_width: int, pad_char: byte) {
|
||||
buf: [65]byte;
|
||||
len := 0;
|
||||
if i == 0 {
|
||||
buf[len] = $0$;
|
||||
buf[len] = #rune "0";
|
||||
len++;
|
||||
}
|
||||
for i > 0 {
|
||||
@@ -119,18 +119,18 @@ print_bool :: proc(b : bool) {
|
||||
else { print_string("false"); }
|
||||
}
|
||||
|
||||
print_pointer :: proc(p: rawptr) #inline { print__uint(p as uint, 16, 0, $ $); }
|
||||
print_pointer :: proc(p: rawptr) #inline { print__uint(p as uint, 16, 0, #rune " "); }
|
||||
|
||||
print_f32 :: proc(f: f32) #inline { print__f64(f as f64, 7); }
|
||||
print_f64 :: proc(f: f64) #inline { print__f64(f, 10); }
|
||||
|
||||
print__f64 :: proc(f: f64, decimal_places: int) {
|
||||
if f == 0 {
|
||||
print_rune($0$);
|
||||
print_rune(#rune "0");
|
||||
return;
|
||||
}
|
||||
if f < 0 {
|
||||
print_rune($-$);
|
||||
print_rune(#rune "-");
|
||||
f = -f;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ print__f64 :: proc(f: f64, decimal_places: int) {
|
||||
buf: [22]byte;
|
||||
len := 0;
|
||||
if i == 0 {
|
||||
buf[len] = $0$;
|
||||
buf[len] = #rune "0";
|
||||
len++;
|
||||
}
|
||||
for i > 0 {
|
||||
@@ -156,7 +156,7 @@ print__f64 :: proc(f: f64, decimal_places: int) {
|
||||
print_u64(i);
|
||||
f -= i as f64;
|
||||
|
||||
print_rune($.$);
|
||||
print_rune(#rune ".");
|
||||
|
||||
mult := 10.0;
|
||||
for decimal_places := 6; decimal_places >= 0; decimal_places-- {
|
||||
|
||||
+14
-14
@@ -3,16 +3,16 @@
|
||||
#load "game.odin"
|
||||
|
||||
main :: proc() {
|
||||
_ = hellope();
|
||||
procedures();
|
||||
variables();
|
||||
constants();
|
||||
types();
|
||||
data_control();
|
||||
using_fields();
|
||||
// _ = hellope();
|
||||
// procedures();
|
||||
// variables();
|
||||
// constants();
|
||||
// types();
|
||||
// data_control();
|
||||
// using_fields();
|
||||
|
||||
|
||||
// run_game();
|
||||
run_game();
|
||||
}
|
||||
|
||||
hellope :: proc() -> int {
|
||||
@@ -440,7 +440,7 @@ types :: proc() {
|
||||
// FORENOTE: 5 * h was originally allowed but it was an edge case in the
|
||||
// compiler I didn't think it was enough to justify have it it.
|
||||
|
||||
print_f32(i[0]); print_rune($,$);
|
||||
print_f32(i[0]); print_rune(#rune ",");
|
||||
print_f32(i[1]); print_nl();
|
||||
}
|
||||
|
||||
@@ -502,12 +502,12 @@ void main() {
|
||||
}`;
|
||||
|
||||
|
||||
hearts1 := $💕$;
|
||||
hearts2 := $\U0001f495$; // 32 bit
|
||||
hearts3 := "\xf0\x9f\x92\x95"; // Note it's a string, should I allow untyped string -> untyped rune casts?
|
||||
hearts1 := #rune "💕";
|
||||
hearts2 := #rune "\U0001f495"; // 32 bit
|
||||
hearts3 := #rune "\xf0\x9f\x92\x95";
|
||||
|
||||
㐒 := $㐒$;
|
||||
㐒16 := $\u4db5$; // 16 bit
|
||||
㐒 := #rune "㐒";
|
||||
㐒16 := #rune "\u4db5"; // 16 bit but will be `rune`
|
||||
// String ideas "nicked" from Go, so far. I think I might change how some of it works later.
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#load "opengl.odin"
|
||||
#load "math.odin"
|
||||
|
||||
TWO_HEARTS :: $💕$;
|
||||
TWO_HEARTS :: #rune "💕";
|
||||
|
||||
win32_perf_count_freq := GetQueryPerformanceFrequency();
|
||||
time_now :: proc() -> f64 {
|
||||
|
||||
+36
-36
@@ -291,43 +291,43 @@ VK_INSERT :: 0x2D;
|
||||
VK_DELETE :: 0x2E;
|
||||
VK_HELP :: 0x2F;
|
||||
|
||||
VK_0 :: $0$;
|
||||
VK_1 :: $1$;
|
||||
VK_2 :: $2$;
|
||||
VK_3 :: $3$;
|
||||
VK_4 :: $4$;
|
||||
VK_5 :: $5$;
|
||||
VK_6 :: $6$;
|
||||
VK_7 :: $7$;
|
||||
VK_8 :: $8$;
|
||||
VK_9 :: $9$;
|
||||
VK_0 :: #rune "0";
|
||||
VK_1 :: #rune "1";
|
||||
VK_2 :: #rune "2";
|
||||
VK_3 :: #rune "3";
|
||||
VK_4 :: #rune "4";
|
||||
VK_5 :: #rune "5";
|
||||
VK_6 :: #rune "6";
|
||||
VK_7 :: #rune "7";
|
||||
VK_8 :: #rune "8";
|
||||
VK_9 :: #rune "9";
|
||||
|
||||
VK_A :: $A$;
|
||||
VK_B :: $B$;
|
||||
VK_C :: $C$;
|
||||
VK_D :: $D$;
|
||||
VK_E :: $E$;
|
||||
VK_F :: $F$;
|
||||
VK_G :: $G$;
|
||||
VK_H :: $H$;
|
||||
VK_I :: $I$;
|
||||
VK_J :: $J$;
|
||||
VK_K :: $K$;
|
||||
VK_L :: $L$;
|
||||
VK_M :: $M$;
|
||||
VK_N :: $N$;
|
||||
VK_O :: $O$;
|
||||
VK_P :: $P$;
|
||||
VK_Q :: $Q$;
|
||||
VK_R :: $R$;
|
||||
VK_S :: $S$;
|
||||
VK_T :: $T$;
|
||||
VK_U :: $U$;
|
||||
VK_V :: $V$;
|
||||
VK_W :: $W$;
|
||||
VK_X :: $X$;
|
||||
VK_Y :: $Y$;
|
||||
VK_Z :: $Z$;
|
||||
VK_A :: #rune "A";
|
||||
VK_B :: #rune "B";
|
||||
VK_C :: #rune "C";
|
||||
VK_D :: #rune "D";
|
||||
VK_E :: #rune "E";
|
||||
VK_F :: #rune "F";
|
||||
VK_G :: #rune "G";
|
||||
VK_H :: #rune "H";
|
||||
VK_I :: #rune "I";
|
||||
VK_J :: #rune "J";
|
||||
VK_K :: #rune "K";
|
||||
VK_L :: #rune "L";
|
||||
VK_M :: #rune "M";
|
||||
VK_N :: #rune "N";
|
||||
VK_O :: #rune "O";
|
||||
VK_P :: #rune "P";
|
||||
VK_Q :: #rune "Q";
|
||||
VK_R :: #rune "R";
|
||||
VK_S :: #rune "S";
|
||||
VK_T :: #rune "T";
|
||||
VK_U :: #rune "U";
|
||||
VK_V :: #rune "V";
|
||||
VK_W :: #rune "W";
|
||||
VK_X :: #rune "X";
|
||||
VK_Y :: #rune "Y";
|
||||
VK_Z :: #rune "Z";
|
||||
|
||||
VK_LWIN :: 0x5B;
|
||||
VK_RWIN :: 0x5C;
|
||||
|
||||
Reference in New Issue
Block a user