Implement deque, fix luaconsole

This commit is contained in:
2021-07-12 00:37:07 -04:00
parent 16c0fd45de
commit 7290beee34
4 changed files with 202 additions and 124 deletions

View File

@@ -79,37 +79,38 @@ int table_count(lua_State *L);
//
int table_clear(lua_State *L);
// queue_create
//
// Create and return an empty queue. Queues are implemented
// as tables which are used as dynamically-expandable circular
// buffers.
//
int queue_create(lua_State *L);
int deque_create(lua_State *L);
// queue_push
//
// Given a queue and a value, pushes the value onto the queue.
// Given a deque and a value, pushes the value onto the
// left or right end.
//
int queue_push(lua_State *L);
int deque_pushl(lua_State *L);
int deque_pushr(lua_State *L);
// queue_pop
//
// Given a queue, pop and return a value. If the queue is empty,
// returns nil.
// Given a deque, pop from the left or right end. Returns the
// value and removes it from the deque. If the deque is
// empty, returns nil.
//
int queue_pop(lua_State *L);
int deque_popl(lua_State *L);
int deque_popr(lua_State *L);
// queue_size
//
// Return the number of values in the queue.
// Return the nth element from the left or right end of a deque.
//
int queue_size(lua_State *L);
int deque_nthl(lua_State *L);
int deque_nthr(lua_State *L);
// queue_nth
//
// Return the nth element in the queue.
// Return the number of values in the deque.
//
int queue_nth(lua_State *L);
int deque_size(lua_State *L);
#endif // TABLE_HPP