44 * -------------------------------------------------------------
55 * Lib Authors : 曾奥然 <[email protected] > 667- * Contributors : juzeon <skyjuzheng@gmail .com>
8- * | Mikachu2333 <mikachu.23333@zohomail .com>
7+ * Contributors : Mikachu2333 <mikachu.23333@zohomail .com>
8+ * | juzeon <skyjuzheng@gmail .com>
99 * | BingChunMoLi <[email protected] > 1010 * |
1111 * Created On : <2023-08-28>
12- * Last Modified : <2025-09-29 >
12+ * Last Modified : <2025-10-06 >
1313 *
1414 *
1515 * xy: 襄阳、咸阳
2323#ifndef XY_H
2424#define XY_H
2525
26- #define _XY_Version "v0.2.0 .0-2025/08/27 "
26+ #define _XY_Version "v0.2.1 .0-2025/10/06 "
2727#define _XY_Maintain_URL "https://github.com/RubyMetric/chsrc/blob/dev/lib/xy.h"
2828#define _XY_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc/blob/dev/lib/xy.h"
2929
@@ -123,6 +123,10 @@ xy =
123123#define assert_str (a , b ) assert (xy_streql ((a), (b)))
124124
125125#define xy_panic (reason ) assert(!reason)
126+
127+ // @flavor Perl, PHP, Raku
128+ #define die xy_panic
129+
126130#define xy_unsupported () xy_panic("Unsuppoted")
127131#define xy_unimplemented () xy_panic("Unimplemented temporarily")
128132#define xy_unreached () xy_panic("This code shouldn't be reached")
@@ -177,7 +181,7 @@ static void _xy_println_const_str (const char *str) {printf ("%s\n", str);}
177181 const char *: _xy_println_const_str, \
178182 default: xy_panic("Unsupported type for println()/say()!") \
179183)(x)
180- /* @flavor Perl/ Raku */
184+ /* @flavor Raku, Perl */
181185#define say println
182186/* @flavor PHP */
183187#define echo println
@@ -668,10 +672,11 @@ xy_str_find (const char *str, const char *substr)
668672
669673/**
670674 * @brief 获取字符串下一行的内容
675+ *
671676 * @note 将忽略开头的换行,截取至下一个换行前(不含换行符)
672677 */
673678static char *
674- xy_str_take_until_newline (const char * str )
679+ xy_str_next_nonempty_line (const char * str )
675680{
676681 if (!str )
677682 return xy_strdup ("" );
@@ -696,10 +701,13 @@ xy_str_take_until_newline (const char *str)
696701
697702/**
698703 * @brief 读取文件内容并返回字符串,失败时返回空字符串
699- * @note 已处理 `\r\n` 和 `\r`,返回的字符串均为 `\n` 换行
704+ *
705+ * @note 已处理 \r\n 和 \r,返回的字符串均为 \n 换行
706+ *
707+ * @flavor Ruby: IO::read
700708 */
701709static char *
702- xy_file_to_str (const char * path )
710+ xy_file_read (const char * path )
703711{
704712 FILE * fp = fopen (path , "rb" );
705713 if (!fp )
0 commit comments