Lugaru's Epsilon
Programmer's
Editor 14.04

Context:
Epsilon User's Manual and Reference
   Primitives and EEL Subroutines
      Buffer Primitives
         . . .
         Managing Buffers
         Catching Buffer Changes
         Listing Buffers
      Display Primitives
         Creating & Destroying Windows
         Window Resizing Primitives
         Preserving Window Arrangements
         . . .
         Colors
      . . .

Previous   Up    Next
Catching Buffer Changes  Primitives and EEL Subroutines   Creating & Destroying Windows


Epsilon User's Manual and Reference > Primitives and EEL Subroutines > Buffer Primitives >

Listing Buffers

char *buffer_list(int start)
int buf_list(int offset, int mode)

The buffer_list( ) primitive gets the name of each buffer in turn. Each time you call this primitive, it returns the name of another buffer. It begins again when given a nonzero argument. When it has returned the names of all the buffers since the last call with a nonzero argument, it returns a null pointer.

The buf_list( ) primitive can return the number of each existing buffer, one at a time, like buffer_list( ). The mode can be 0, 1, or 2, to position to the lowest-numbered buffer in the list, the last buffer returned by buf_list( ), or the highest-numbered buffer, respectively. The offset lets you advance from these buffers to lower or higher-numbered buffers, by providing a negative or positive offset. Unlike buffer_list( ), this primitive lets you back up or go through the list backwards.

For example, this code fragment displays the names of all buffers, one at a time, once forward and once backward:

s = buffer_list(1);
do {
        say("Forward %d: %s", name_to_bufnum(s), s);
} while (s = buffer_list(0));

i = buf_list(0, 2);
do {
        say("Back %d: %s", i, bufnum_to_name(i));
} while (i = buf_list(-1, 1));
say("Done.");



Previous   Up    Next
Catching Buffer Changes  Primitives and EEL Subroutines   Creating & Destroying Windows


Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.