program run_buffer
use TYPES
use SYSTEM
use STR
use BUFFER
use TEXTFILE
#include "macros"
implicit none
BUFFER :: b
STR :: word
REAL :: real
INT :: int
tonto.initialize
stdout.create_stdout
stdout.open
stdout.text("I am creating a buffer below ...")
stdout.flush
b.set(" this is a buffer string, 0.1 0.2 10 ! comment","!")
stdout.show("buffer string =",b.string)
stdout.show("item start =",b.item_start)
stdout.show("item end =",b.item_end)
stdout.show("item index =",b.item_index)
stdout.show("n_items =",b.n_items)
stdout.show("analysed =",b.analysed)
stdout.show("comment_chars =",b.comment_chars)
stdout.flush
stdout.text("Now I am extracting from this buffer ...")
stdout.flush
b.get(word)
stdout.show("1st word =",word)
b.get(word)
stdout.show("2nd word =",word)
b.get(word)
stdout.show("3rd word =",word)
b.get(word)
stdout.show("4th word =",word)
b.get(word)
stdout.show("5th word =",word)
b.get(word)
stdout.show("6th word =",word)
b.get(real)
stdout.show("7th real =",real)
b.get(int)
stdout.show("8th int =",int)
stdout.flush
stdout.text("Now move back to the 2nd item and get it ...")
stdout.flush
b.move_to_item(2)
b.get(word)
stdout.show("2nd word =",word)
stdout.flush
stdout.text("Now I will print out a cursor to the current position")
stdout.flush
stdout.flush
stdout.show("buffer string =", b.string)
stdout.text("Cursor---------"//b.cursor_pointer.align_left.trim)
stdout.flush
stdout.text('The last item I processed was "'// b.previous_item.trim //'"')
end |