logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Description

read-fifo retrieves an element from the FIFO <list> into <key> string (in "key" clause) and <value> string (in "value" clause). Once an element has been retrieved, the next use of read-fifo will obtain the following one, in the same order they were put in. read-fifo starts with the first element put in, and moves forward from there, unless rewind-fifo is called, which positions back to the first one. If the element is successfully retrieved, <status> number (in "status" clause) is GG_OKAY, otherwise it is GG_ERR_EXIST, which means there are no more elements to retrieve.

Examples

In this example, a FIFO list is created, and two key/value pairs added. They are then retrieved in a loop and printed out (twice with rewind), and then the list is purged: // Create a list new-fifo mylist // Add data to the list write-fifo mylist key "key1" value "value1" write-fifo mylist key "some2" value "other2" start-loop // Get data from the list read-fifo mylist key k value v status st // Check if no more data if-true st not-equal GG_OKAY break-loop end-if @Obtained key <<print-out k>> with value <<print-out v>> end-loop // Go through the list again, use rewind-fifo for that rewind-fifo mylist start-loop read-fifo mylist key k value v status st if-true st not-equal GG_OKAY break-loop end-if @Again obtained key <<print-out k>> with value <<print-out v>> end-loop purge-fifo mylist

Name

read-fifo - (FIFO)

Purpose

Reads key/value pair from a FIFO list.

See Also

FIFO delete-fifonew-fifopurge-fiforead-fiforewind-fifowrite-fifo See all documentation $DATE $VERSION GOLF(2gg)

Syntax

read-fifo <list> \ key <key> \ value <value> \ [ status <status> ]

See Also