[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 0/4] Implement version tools
From: |
Jose E. Marchesi |
Subject: |
Re: [PATCH v2 0/4] Implement version tools |
Date: |
Sun, 29 Jan 2023 21:44:45 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> Evening,
>
> I've addressed the few notes from before and refactored to operate
> around the "parse into struct" paradigm. Range diff included.
I find it difficult to read range diffs. For subsequent versions of
patches, we prefer to get full patches plus a little changelog like
[Changes from V1:
- Foo was changed to bar.
- Baz was a quux after all.]
> OK for master?
The series i OK for master.
Thanks! This is very nice stuff. Now pickles can do poke version control.
>
> Thanks in advance, have a great night.
>
> Arsen Arsenović (4):
> std.pk: Implement strrchr
> std.pk: Refactor atoi into strtoi
> std.pk: Implement strtok
> std.pk: Implement pk_version_parse, pk_vercmp
>
> ChangeLog | 54 ++++++
> autoconf/poke.m4 | 2 +-
> doc/poke.texi | 285 ++++++++++++++++++++++++++++++-
> libpoke/std.pk | 303 ++++++++++++++++++++++++++++++++-
> testsuite/poke.std/std-test.pk | 130 ++++++++++++++
> 5 files changed, 765 insertions(+), 9 deletions(-)
>
> Range-diff against v1:
> 1: c8f16234 ! 1: 6bf64f45 std.pk: Implement strrchr
> @@ doc/poke.texi: work on strings:
> * ltrim:: Remove leading characters.
> * rtrim:: Remove trailing characters.
> -* strchr:: Locate a character in a string.
> -+* strchr:: Locate a character in a string, from the
> beginning.
> ++* strchr:: Locate a character in a string, from the
> beginning.
> +* strrchr:: Locate a character in a string, from the end.
> @end menu
>
> 2: 87fd4129 = 2: c7ab6b8b std.pk: Refactor atoi into strtoi
> 3: 8018f305 ! 3: b30481c4 std.pk: Implement strtok
> @@ ChangeLog
> + (String Functions): Add strtok to menu.
> + (Concept Index): Merge fn -> cp, as there's not enough use of
> the
> + function index to justify separate section currently.
> -+ * libpoke/std.pk (Tokenizer): New type. Holds the persistent
> ++ * libpoke/std.pk (String_Tokenizer): New type. Holds the
> persistent
> + state of the strtok-like operation.
> -+ (strtok): New function. Returns a new Tokenizer.
> -+ (Tokenizer): New type. Holds tokenization state.
> ++ (strtok): New function. Returns a new String_Tokenizer.
> ++ (String_Tokenizer): New type. Holds tokenization state.
> + * testsuite/poke.std/std-test.pk: Add strtok test.
> +
> 2023-01-29 Arsen Arsenović <arsen@aarsen.me>
> @@ ChangeLog
> ## doc/poke.texi ##
> @@ doc/poke.texi: work on strings:
> * rtrim:: Remove trailing characters.
> - * strchr:: Locate a character in a string, from the
> beginning.
> + * strchr:: Locate a character in a string, from the
> beginning.
> * strrchr:: Locate a character in a string, from the end.
> -+* strtok:: String tokenization.
> ++* strtok:: String tokenization.
> @end menu
>
> @node ltrim
> @@ doc/poke.texi: It returns the index of the last occurrence of the
> character @var
> +this API are:
> +
> +@example
> -+type Tokenizer =
> ++type String_Tokenizer =
> + struct
> + @{
> + uint<64> i;
> @@ doc/poke.texi: It returns the index of the last occurrence of the
> character @var
> + method poprdelim = (string @var{delimiters}) string: @{ @dots{} @}
> + @}
> +
> -+fun strtok = (string @var{a}) Tokenizer: @{ @dots{} @}
> ++fun strtok = (string @var{a}) String_Tokenizer: @{ @dots{} @}
> +@end example
> +
> -+@deftypefun Tokenizer strtok (string @var{a})
> ++@deftypefun String_Tokenizer strtok (string @var{a})
> +Creates a new tokenizer for the string @var{a}, initially on the zero
> +position.
> +@end deftypefun
> +
> -+@cindex @code{Tokenizer}
> -+The members of the @code{Tokenizer} class are:
> ++@cindex @code{String_Tokenizer}
> ++The members of the @code{String_Tokenizer} class are:
> +
> -+@deftypeivar Tokenizer uint<64> i
> ++@deftypeivar String_Tokenizer uint<64> i
> +Offset to the next character to be tokenized, i.e. to the first
> +character that has not already been consumed.
> +@end deftypeivar
> +
> -+@deftypeivar Tokenizer string str
> ++@deftypeivar String_Tokenizer string str
> +The string being tokenized. This string is never tokenized.
> +@end deftypeivar
> +
> -+@deftypeivar Tokenizer uint<32> more
> ++@deftypeivar String_Tokenizer uint<32> more
> +A read-only computed property whose value is truthy if there's more
> +characters and falsey otherwise.
> +@end deftypeivar
> +
> -+@deftypemethod Tokenizer char poke ()
> ++@deftypemethod String_Tokenizer char poke ()
> +Returns the first unread character of the string, but does not advance
> +the @var{i} offset.
> +
> +Raises @code{E_out_of_bounds} if at the end of the string.
> +@end deftypemethod
> +
> -+@deftypemethod Tokenizer char peek ()
> ++@deftypemethod String_Tokenizer char peek ()
> +Returns the first unread character of the string, and advances the
> +tokenizer.
> +
> +Raises @code{E_out_of_bounds} if at the end of the string.
> +@end deftypemethod
> +
> -+@deftypemethod Tokenizer int<64> pop_number (int<32> @var{base} = 10)
> ++@deftypemethod String_Tokenizer int<64> pop_number (int<32> @var{base}
> = 10)
> +Returns the number at the start of the string and advances the
> +tokenizer in the given @var{base}. The bases that are supported are
> +the same as for @code{strtoi}.
> @@ doc/poke.texi: It returns the index of the last occurrence of the
> character @var
> +Raises @code{E_out_of_bounds} if at the end of the string.
> +@end deftypemethod
> +
> -+@deftypemethod Tokenizer string popdelim (string @var{delim})
> ++@deftypemethod String_Tokenizer string popdelim (string @var{delim})
> +Returns the substring up to the first character also present in the
> +string @var{delim}. Advances the tokenizer to after the delimiter
> +character (i.e. it consumes the delimiter character).
> @@ doc/poke.texi: It returns the index of the last occurrence of the
> character @var
> +Raises @code{E_out_of_bounds} if at the end of the string.
> +@end deftypemethod
> +
> -+@deftypemethod Tokenizer string poprdelim (string @var{delim})
> ++@deftypemethod String_Tokenizer string poprdelim (string @var{delim})
> +Returns the substring up to the last character also present in the
> +string @var{delim}. Advances the tokenizer to after the delimiter
> +character (i.e. it consumes the delimiter character).
> @@ libpoke/std.pk: fun isxdigit = (uint<8> c) int<32>:
> +
> +/* A helper object to tokenize a string. */
> +
> -+type Tokenizer =
> ++type String_Tokenizer =
> + struct
> + {
> + uint<64> i;
> @@ libpoke/std.pk: fun isxdigit = (uint<8> c) int<32>:
> + }
> + };
> +
> -+fun strtok = (string a) Tokenizer:
> ++fun strtok = (string a) String_Tokenizer:
> +{
> -+ return Tokenizer { str = a, i = 0 };
> ++ return String_Tokenizer { str = a, i = 0 };
> +}
>
> ## testsuite/poke.std/std-test.pk ##
> 4: a743af87 < -: -------- std.pk: Implement pk_vercmp
> -: -------- > 4: 3f4c91c2 std.pk: Implement pk_version_parse, pk_vercmp
- [PATCH v2 0/4] Implement version tools (was: add pk_vercmp), Arsen Arsenović, 2023/01/29
- [PATCH v2 2/4] std.pk: Refactor atoi into strtoi, Arsen Arsenović, 2023/01/29
- [PATCH v2 1/4] std.pk: Implement strrchr, Arsen Arsenović, 2023/01/29
- [PATCH v2 4/4] std.pk: Implement pk_version_parse, pk_vercmp, Arsen Arsenović, 2023/01/29
- [PATCH v2 3/4] std.pk: Implement strtok, Arsen Arsenović, 2023/01/29
- Re: [PATCH v2 0/4] Implement version tools,
Jose E. Marchesi <=