239
|
1 // Template stack class -*- C++ -*- |
|
2 /* |
|
3 |
|
4 Copyright (C) 1993 John W. Eaton |
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #ifdef HAVE_CONFIG_H |
|
25 #include "config.h" |
|
26 #endif |
|
27 |
|
28 #if defined (__GNUG__) && defined (USE_EXTERNAL_TEMPLATES) |
|
29 #pragma implementation |
|
30 #endif |
|
31 |
|
32 #include "SLStack.h" |
|
33 |
|
34 template <class T> |
|
35 SLStack<T>::SLStack (void) : p () |
|
36 { |
|
37 } |
|
38 |
|
39 template <class T> |
|
40 SLStack<T>::SLStack (const SLStack<T>& a) : p (a.p) |
|
41 { |
|
42 } |
|
43 |
|
44 template <class T> |
|
45 SLStack<T>::~SLStack (void) |
|
46 { |
|
47 } |
|
48 |
|
49 template <class T> |
|
50 void |
|
51 SLStack<T>::push (const T& item) |
|
52 { |
|
53 p.prepend (item); |
|
54 } |
|
55 |
|
56 template <class T> |
|
57 T |
|
58 SLStack<T>::pop (void) |
|
59 { |
|
60 return p.remove_front (); |
|
61 } |
|
62 |
|
63 template <class T> |
|
64 T& |
|
65 SLStack<T>::top (void) |
|
66 { |
|
67 return p.front (); |
|
68 } |
|
69 |
|
70 template <class T> |
|
71 void |
|
72 SLStack<T>::del_top (void) |
|
73 { |
|
74 p.del_front (); |
|
75 } |
|
76 |
|
77 template <class T> |
|
78 void |
|
79 SLStack<T>::operator = (const SLStack<T>& s) |
|
80 { |
|
81 p = s.p; |
|
82 } |
|
83 |
|
84 template <class T> |
|
85 int |
|
86 SLStack<T>::empty (void) |
|
87 { |
|
88 return p.empty (); |
|
89 } |
|
90 |
|
91 template <class T> |
|
92 int |
|
93 SLStack<T>::full (void) |
|
94 { |
|
95 return 0; |
|
96 } |
|
97 |
|
98 template <class T> |
|
99 int |
|
100 SLStack<T>::length (void) |
|
101 { |
|
102 return p.length (); |
|
103 } |
|
104 |
|
105 template <class T> |
|
106 int |
|
107 SLStack<T>::OK (void) |
|
108 { |
|
109 return p.OK (); |
|
110 } |
|
111 |
|
112 template <class T> |
|
113 void |
|
114 SLStack<T>::clear (void) |
|
115 { |
|
116 p.clear (); |
|
117 } |
|
118 |
|
119 #ifdef __GNUG__ |
|
120 #if defined (OCTAVE_SOURCE) && defined (USE_EXTERNAL_TEMPLATES) |
|
121 |
|
122 typedef SLStack<int> slstack_type_int; |
|
123 typedef SLStack<char *> slstack_type_p_char; |
|
124 |
|
125 #include "symtab.h" |
|
126 typedef SLStack<symbol_def *> slstack_type_p_symbol_def; |
|
127 |
|
128 #include "token.h" |
|
129 typedef SLStack<token *> slstack_type_p_token; |
|
130 |
|
131 #include "tree.h" |
|
132 typedef SLStack<tree_matrix *> slstack_type_p_tree_matrix; |
|
133 |
|
134 #include "unwind-prot.h" |
|
135 typedef SLStack<unwind_elem> slstack_type_unwind_elem; |
|
136 |
|
137 #endif |
|
138 #endif |
|
139 |
|
140 /* |
|
141 ;;; Local Variables: *** |
|
142 ;;; mode: C++ *** |
|
143 ;;; page-delimiter: "^/\\*" *** |
|
144 ;;; End: *** |
|
145 */ |