💾 Archived View for gmi.noulin.net › gitRepositories › ring › file › ring.c.gmi captured on 2023-01-29 at 13:19:13. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

ring

Log

Files

Refs

LICENSE

ring.c (864B)

     1 #! /usr/bin/env sheepy
     2 
     3 #include "libsheepyObject.h"
     4 #include "cRing.h"
     5 
     6 int argc; char **argv;
     7 
     8 int main(int ARGC, char** ARGV) {
     9 
    10   argc = ARGC; argv = ARGV;
    11 
    12   initLibsheepy(argv[0]);
    13 
    14   createAllocateRing(rg);
    15 
    16   if (isEmptyG(cAr(rg))) {
    17     puts("rg is empty.");
    18   }
    19 
    20   setSizeG(rg, 3);
    21 
    22   smallStringt *s = allocG("ring");
    23   pushG(cAr(rg), (baset*)s);
    24   //pushG(cAr(rg), "elem");
    25   finishG(s);
    26 
    27   baset *r = lastG(rg);
    28 
    29   puts(GRN "Last:" RST);
    30   putsG(r);
    31   finishG(r);
    32 
    33   r = popG(cAr(rg), rtBaset);
    34 
    35   puts(GRN "Poped:" RST);
    36   putsG(r);
    37   finishG(r);
    38 
    39   r = lastG(rg);
    40 
    41   puts(GRN "Last:" RST);
    42   putsG(r);
    43   finishG(r);
    44 
    45   printf("Max Count: %d\n", (int)maxCountG(rg) );
    46   printf("Count: %d\n", (int)rCountG(rg));
    47 
    48   if (isFullG(rg)) {
    49     puts("rg is full.");
    50   }
    51   else {
    52     puts("rg is not full.");
    53   }
    54 
    55   terminateO(rg);
    56 
    57   finalizeLibsheepy();
    58 
    59 }