-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_container.cxx
72 lines (64 loc) · 1.75 KB
/
data_container.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// Data Container test program for the Fast Light Tool Kit (FLTK).
//
// Copyright 2020-2021 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// https://www.fltk.org/COPYING.php
//
// Please see the following page on how to report bugs and issues:
//
// https://www.fltk.org/bugs.php
//
//#include "../src/fl_data_container.h"
#include "fl_data_container.cxx"
#include <stdio.h>
int main() {
int i;
const char *pr;
Fl_Int_Cn ii;
ii.push(-1);
ii.push(1);
ii.push(-1);
ii.push(1);
ii.push(2);
ii.push(3);
printf("pushed: -1, 2, -1, 1, 2, 3, size = %d\n", (int)ii.size());
i = ii.back();
printf("back: %d, size = %d\n", i, (int)ii.size());
i = ii.back();
printf("back: %d, size = %d\n", i, (int)ii.size());
i = ii.pop();
printf("popped: %d, size = %d\n", i, (int)ii.size());
i = ii.pop();
printf("popped: %d, size = %d\n", i, (int)ii.size());
i = ii.pop();
printf("popped: %d, size = %d\n", i, (int)ii.size());
Fl_String_Cn ss;
ss.push("abc");
char *s = ss.pop();
printf("%s\n", s);
free(s);
Fl_Ptr_Cn dd;
const char *p = "abcdef";
dd.push(p);
dd.push("alpha-beta");
dd.push("xyz");
while (dd.size() > 0) {
pr = (const char *)dd.pop();
printf("size = %d, popped = %s\n", int(dd.size()), pr);
}
Fl_String_Cn *cs = new Fl_String_Cn();
cs->push("ab");
cs->push("abcd");
cs->push("abcdefg");
cs->push("xyzasjhfaew.fyknds");
cs->push("qrquzoiqwzqiztitzitzitzqitziozrtoiret");
pr = (const char *)cs->pop();
printf("size = %d, popped = %s\n", (int)cs->size(), pr);
free((void *)pr);
delete cs;
}