GOLF(2gg)
π GOLF(2gg) β the read-fifo page, bestie edition π
okay so you opened the GOLF(2gg) manual, section 2gg, and the star of this page is read-fifo. Development vibes only. let's get into it π¦
β¨ NAME β¨
read-fifo β (FIFO)
π― PURPOSE π―
Reads a key/value pair from a FIFO list. that's the whole job. she's focused, she's employed, she slays π
π SYNTAX π
read-fifo <list> \
key <key> \
value <value> \
[ status <status> ]
πΈ DESCRIPTION πΈ
so read-fifo retrieves an element from the FIFO <list> and drops it into the <key> string (that's the "key" clause) and the <value> string (that's the "value" clause). two little presents, one call π
Once an element has been retrieved, the next time you use read-fifo you get the following one β same order they were put in, no queue-jumping, no cap. read-fifo starts with the first element that was put in and just keeps moving forward from thereβ¦ unless rewind-fifo gets called, which positions you back to the first one. time travel, but legal β¨
If the element is successfully retrieved, the <status> number (in the "status" clause) is GG_OKAY. Otherwise it's GG_ERR_EXIST, which literally means there are no more elements to retrieve. that's it, the list said "no thoughts, empty" π
π₯ EXAMPLES π₯
In this example a FIFO list is created, and two key/value pairs get added. They're then retrieved in a loop and printed out (twice, with rewind), and then the list is purged. peak demonstration behavior, honestly:
// 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
π SEE ALSO π
FIFO
delete-fifo new-fifo purge-fifo read-fifo rewind-fifo write-fifo
See all documentation π«Ά
and that's the page, bestie!! this was GOLF(2gg), dated $DATE, version $VERSION β mwah, go read a FIFO or whatever ππ§
π¦ where this page comes from
- ubuntu questing: golf 601.4.41-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms