Skip to content

Commit

Permalink
SQUASH: feat(lib/xtintin): 增加新数据类型 queue 及其 API
Browse files Browse the repository at this point in the history
  • Loading branch information
dzpao committed Jan 22, 2024
1 parent ef9b877 commit 81113c6
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions plugins/lib/xtintin/queue.tin
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,7 @@ PaoTin++ © 2020~2023 的所有版权均由担子炮(dzp <danzipao@gmail.com>)
//
// ASSERT: {\$q} === {{1}{{1}{f}{2}{o}{3}{o}}{2}{{1}{b}{2}{a}{3}{r}}{3}{{1}{b}{2}{a}{3}{z}}}
// };
#func {queue.Push} {
#local queue.local.queue {%1};
#local queue.local.value {%2};

#list {$queue.local.queue} add {{$queue.local.value}};
};
#func {queue.Push} {queue.Push {%1} {%2}; #return {}};

///=== {
// #@ queue.Pop <队列名称>
Expand Down Expand Up @@ -263,12 +258,7 @@ PaoTin++ © 2020~2023 的所有版权均由担子炮(dzp <danzipao@gmail.com>)
//
// ASSERT: {\$q} === {{1}{{1}{f}{2}{o}{3}{o}}{2}{{1}{b}{2}{a}{3}{r}}{3}{{1}{b}{2}{a}{3}{z}}}
// };
#func {queue.Unshift} {
#local queue.local.queue {%1};
#local queue.local.value {%2};

#list {$queue.local.queue} insert {1} {$queue.local.value};
};
#func {queue.Unshift} {queue.Unshift {%1} {%2}; #return {}};

///=== {
///// 别名版队列处理:
Expand Down Expand Up @@ -388,7 +378,19 @@ PaoTin++ © 2020~2023 的所有版权均由担子炮(dzp <danzipao@gmail.com>)
// ASSERT: {\$q} === {{1}{{1}{f}{2}{o}{3}{o}}{2}{{1}{b}{2}{a}{3}{r}}{3}{{1}{b}{2}{a}{3}{z}}}
// };

#alias {queue.Push} {#local _ @queue.Push{{%1};{%2}}};
#alias {queue.Push} {
#local queue.local.queue {%1};
#local queue.local.value {%2};

#list {$queue.local.queue} add {{$queue.local.value}};
};

#alias {queue.Pop} {#local _ @queue.Pop{{%1}}};
#alias {queue.Shift} {#local _ @queue.Shift{{%1}}};
#alias {queue.Unshift} {#local _ @queue.Unshift{{%1};{%2}}};

#alias {queue.Unshift} {
#local queue.local.queue {%1};
#local queue.local.value {%2};

#list {$queue.local.queue} insert {1} {$queue.local.value};
};

0 comments on commit 81113c6

Please sign in to comment.