From 2614830c6931e6601f800d3010d269991dcae15e Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 31 Mar 2019 18:29:57 +0100 Subject: [PATCH 1/3] Minor code organization change --- src/common.cpp | 14 ++++++++++---- src/unicode.cpp | 2 +- src/utf8proc/utf8proc.c | 12 ++++++------ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/common.cpp b/src/common.cpp index 3911315f6..b3169e89f 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -203,16 +203,22 @@ u64 u64_from_string(String string) { return result; } +gb_global char const global_num_to_char_table[] = + "0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "@$"; + String u64_to_string(u64 v, char *out_buf, isize out_buf_len) { char buf[32] = {0}; isize i = gb_size_of(buf); u64 b = 10; while (v >= b) { - buf[--i] = gb__num_to_char_table[v%b]; + buf[--i] = global_num_to_char_table[v%b]; v /= b; } - buf[--i] = gb__num_to_char_table[v%b]; + buf[--i] = global_num_to_char_table[v%b]; isize len = gb_min(gb_size_of(buf)-i, out_buf_len); gb_memmove(out_buf, &buf[i], len); @@ -230,10 +236,10 @@ String i64_to_string(i64 a, char *out_buf, isize out_buf_len) { u64 v = cast(u64)a; u64 b = 10; while (v >= b) { - buf[--i] = gb__num_to_char_table[v%b]; + buf[--i] = global_num_to_char_table[v%b]; v /= b; } - buf[--i] = gb__num_to_char_table[v%b]; + buf[--i] = global_num_to_char_table[v%b]; if (negative) { buf[--i] = '-'; diff --git a/src/unicode.cpp b/src/unicode.cpp index 78c94e84e..0ad658806 100644 --- a/src/unicode.cpp +++ b/src/unicode.cpp @@ -2,7 +2,7 @@ #pragma warning(disable: 4245) extern "C" { -// #include "utf8proc/utf8proc.h" +#include "utf8proc/utf8proc.h" #include "utf8proc/utf8proc.c" } #pragma warning(pop) diff --git a/src/utf8proc/utf8proc.c b/src/utf8proc/utf8proc.c index f637390f7..e821889c6 100644 --- a/src/utf8proc/utf8proc.c +++ b/src/utf8proc/utf8proc.c @@ -383,7 +383,7 @@ UTF8PROC_DLLEXPORT int utf8proc_charwidth(utf8proc_int32_t c) { } UTF8PROC_DLLEXPORT utf8proc_category_t utf8proc_category(utf8proc_int32_t c) { - return cast(utf8proc_category_t)utf8proc_get_property(c)->category; + return (utf8proc_category_t)utf8proc_get_property(c)->category; } UTF8PROC_DLLEXPORT const char *utf8proc_category_string(utf8proc_int32_t c) { @@ -401,7 +401,7 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_char(utf8proc_int32_t uc, utf8proc_int32_t hangul_sindex; if (uc < 0 || uc >= 0x110000) return UTF8PROC_ERROR_NOTASSIGNED; property = unsafe_get_property(uc); - category = cast(utf8proc_category_t)property->category; + category = (utf8proc_category_t)property->category; hangul_sindex = uc - UTF8PROC_HANGUL_SBASE; if (options & (UTF8PROC_COMPOSE|UTF8PROC_DECOMPOSE)) { if (hangul_sindex >= 0 && hangul_sindex < UTF8PROC_HANGUL_SCOUNT) { @@ -728,24 +728,24 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_map_custom( UTF8PROC_DLLEXPORT utf8proc_uint8_t *utf8proc_NFD(const utf8proc_uint8_t *str) { utf8proc_uint8_t *retval; - utf8proc_map(str, 0, &retval, cast(utf8proc_option_t)(UTF8PROC_NULLTERM|UTF8PROC_STABLE|UTF8PROC_DECOMPOSE)); + utf8proc_map(str, 0, &retval, (utf8proc_option_t)(UTF8PROC_NULLTERM|UTF8PROC_STABLE|UTF8PROC_DECOMPOSE)); return retval; } UTF8PROC_DLLEXPORT utf8proc_uint8_t *utf8proc_NFC(const utf8proc_uint8_t *str) { utf8proc_uint8_t *retval; - utf8proc_map(str, 0, &retval, cast(utf8proc_option_t)(UTF8PROC_NULLTERM|UTF8PROC_STABLE|UTF8PROC_COMPOSE)); + utf8proc_map(str, 0, &retval, (utf8proc_option_t)(UTF8PROC_NULLTERM|UTF8PROC_STABLE|UTF8PROC_COMPOSE)); return retval; } UTF8PROC_DLLEXPORT utf8proc_uint8_t *utf8proc_NFKD(const utf8proc_uint8_t *str) { utf8proc_uint8_t *retval; - utf8proc_map(str, 0, &retval, cast(utf8proc_option_t)(UTF8PROC_NULLTERM|UTF8PROC_STABLE|UTF8PROC_DECOMPOSE|UTF8PROC_COMPAT)); + utf8proc_map(str, 0, &retval, (utf8proc_option_t)(UTF8PROC_NULLTERM|UTF8PROC_STABLE|UTF8PROC_DECOMPOSE|UTF8PROC_COMPAT)); return retval; } UTF8PROC_DLLEXPORT utf8proc_uint8_t *utf8proc_NFKC(const utf8proc_uint8_t *str) { utf8proc_uint8_t *retval; - utf8proc_map(str, 0, &retval, cast(utf8proc_option_t)(UTF8PROC_NULLTERM|UTF8PROC_STABLE|UTF8PROC_COMPOSE|UTF8PROC_COMPAT)); + utf8proc_map(str, 0, &retval, (utf8proc_option_t)(UTF8PROC_NULLTERM|UTF8PROC_STABLE|UTF8PROC_COMPOSE|UTF8PROC_COMPAT)); return retval; } From ecd2eacd7589fd3eea5082f9b28ac548c39fd8ff Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 31 Mar 2019 22:35:05 +0100 Subject: [PATCH 2/3] Remove dead keywords; Fix `min` and `max` for enum types --- src/check_type.cpp | 16 ++++++++++++++-- src/parser.cpp | 1 - src/tokenizer.cpp | 3 --- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/check_type.cpp b/src/check_type.cpp index 22cd409ee..445b93fb8 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -759,6 +759,8 @@ void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *named_type, Ast ExactValue iota = exact_value_i64(-1); ExactValue min_value = exact_value_i64(0); ExactValue max_value = exact_value_i64(0); + bool min_value_set = false; + bool max_value_set = false; scope_reserve(ctx->scope, et->fields.count); @@ -810,11 +812,21 @@ void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *named_type, Ast continue; } - if (compare_exact_values(Token_Gt, min_value, iota)) { + if (min_value_set) { + if (compare_exact_values(Token_Gt, min_value, iota)) { + min_value = iota; + } + } else { min_value = iota; + min_value_set = true; } - if (compare_exact_values(Token_Lt, max_value, iota)) { + if (max_value_set) { + if (compare_exact_values(Token_Lt, max_value, iota)) { + max_value = iota; + } + } else { max_value = iota; + max_value_set = true; } Entity *e = alloc_entity_constant(ctx->scope, ident->Ident.token, constant_type, iota); diff --git a/src/parser.cpp b/src/parser.cpp index 12b7edb01..821c699c2 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1223,7 +1223,6 @@ void fix_advance_to_next_stmt(AstFile *f) { case Token_return: case Token_switch: case Token_defer: - case Token_asm: case Token_using: case Token_break: diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 1537b8139..6fed6d97d 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -122,9 +122,6 @@ TOKEN_KIND(Token__KeywordBegin, ""), \ TOKEN_KIND(Token_type_of, "type_of"), \ TOKEN_KIND(Token_macro, "macro"), \ TOKEN_KIND(Token_const, "const"), \ - TOKEN_KIND(Token_asm, "asm"), \ - TOKEN_KIND(Token_yield, "yield"), \ - TOKEN_KIND(Token_await, "await"), \ TOKEN_KIND(Token__KeywordEnd, ""), \ TOKEN_KIND(Token_Count, "") From 133f88406f77db28ec041399b00770046469934d Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 31 Mar 2019 23:50:56 +0100 Subject: [PATCH 3/3] The Proposal Process --- PROPOSAL-PROCESS.md | 64 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 PROPOSAL-PROCESS.md diff --git a/PROPOSAL-PROCESS.md b/PROPOSAL-PROCESS.md new file mode 100644 index 000000000..d82fc02dd --- /dev/null +++ b/PROPOSAL-PROCESS.md @@ -0,0 +1,64 @@ +# The Proposal Process + +## Introduction + +The Odin project's development process is driven by design and pragmatism. Significant changes to the language, libraries, or tools _must_ be first discussed, and maybe formally documented, before they can be implemented. + +This document describes the process for proposing, documenting, and implementing changes to the Odin project. + +## The Proposal Process + +The proposal process is the process for reviewing a proposal and reaching a decision about whether to accept or decline the proposal. + +1. [Ginger Bill](https://github.com/gingerBill) is [BDFL](https://wikipedia.org/wiki/Benevolent_dictator_for_life) and significant changes _must_ be passed by him. + +2. The proposal author creates a brief issue describing the proposal. + + Note: There is no need for a design document at this point.
+ Note: A non-proposal issue can be turned into a proposal by simply adding the _proposal_ label. + +3. A discussion on the issue tracker will classify the proposal into one of three outcomes: + * Accept proposal + * Decline proposal + * Ask for a design document. + + If the proposal is accepted or declined, the process is done. Otherwise the discussion around the process is expected to identify issues that ought to be addressed in a more detailed design. + +4. The proposal author writes a design document to work out details of the proposed design and address the concerns raised in the initial discussion. + +5. Once comments and revisions on the design document calm, there is a final discussion on the issue, to reach one of two outcomes: + * Accept proposal + * Decline proposal + +After the proposal is accepted or declined, implementation of the proprosal proceeds in the same way as any other contribution to the project. + +## Design Documents + +The design document should follow this template: + + +``` +# Proposal: [Title] + +Author(s): [Author Name, Co-Author Name] +Last updated: [Date ISO-8601] +Discussion at https://github.com/odin-lang/Odin/issues/###### + +## Abstract + +## Background + +## Proposal + +## Rationale + +## Compatibility + +## Implementation + +``` + + +## Help + +If you need help with this process, please contact an Odin contributor by posting an issue to the [issue tracker](https://github.com/odin-lang/Odin/issues).