Skip to content

Commit

Permalink
changed translator stacks to use QStack class
Browse files Browse the repository at this point in the history
the resize and size functions were used to simulate the push(void) and
  null_pop(void) functions of the Stack class
removed stack.h (all stacks now use Qt class), also removed test_stack2
  • Loading branch information
thunder422 committed Oct 29, 2012
1 parent a27e456 commit 5d7c634
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 294 deletions.
8 changes: 2 additions & 6 deletions CMakeLists.txt
Expand Up @@ -43,6 +43,7 @@
# 2012-10-25 added configuration of new memtest script on non-Windows builds
# 2012-10-26 added changed for Qt libraries
# 2012-10-28 removed list.h (Qt lists used) and test_stack program
# 2012-10-29 removed stack.h (Qt stacks used) and test_stack2 program

cmake_minimum_required(VERSION 2.8)

Expand Down Expand Up @@ -147,7 +148,6 @@ add_custom_command(OUTPUT test_names.h
# list the include files
set(ibcp_HDRS
ibcp.h
stack.h
string.h
)

Expand Down Expand Up @@ -179,7 +179,7 @@ endif (GCC_VERSION VERSION_GREATER 4.4)

# add "make tests" target for making test programs
add_custom_target(tests
DEPENDS test_nums test_string test_cons test_stack2
DEPENDS test_nums test_string test_cons
)

# test program executables for tests target (not built by default)
Expand All @@ -194,7 +194,3 @@ add_executable(test_string EXCLUDE_FROM_ALL
add_executable(test_cons EXCLUDE_FROM_ALL
test/test_cons.cpp
)
add_executable(test_stack2 EXCLUDE_FROM_ALL
stack.h
test/test_stack2.cpp
)
11 changes: 6 additions & 5 deletions ibcp.h
Expand Up @@ -300,17 +300,18 @@
// 2012-10-28 removed token lists and new/delete overload functions
// 2012-10-28 removed Error Template (no longer needed)
// changed Table class (constructor and new initialize() function)
// 2012-10-29 converted translator stacks from Stack class to QStack

#ifndef IBCP_H
#define IBCP_H

#include <QList>
#include <QLinkedList>
#include <QStack>
#include <QString>
#include <QStringList>

#include "string.h"
#include "stack.h" // 2010-04-02: added for Stack

// 2011-02-26: replaced code enumeration with include
// 2011-03-26: changed from codes.h, now includes all automatic enumerations
Expand Down Expand Up @@ -969,14 +970,14 @@ class Translator {
Token *token; // token pointer on hold stack
Token *first; // operator token's first operand pointer
};
Stack<HoldStackItem> hold_stack;// operator/function holding stack
QStack<HoldStackItem> hold_stack; // operator/function holding stack
// 2011-01-15: changed done stack to include first and last token pointers
struct DoneStackItem {
RpnItem *rpnItem; // pointer to RPN item
Token *first; // operator token's first operand pointer
Token *last; // operator token's last operand pointer
};
Stack<DoneStackItem> done_stack;// items processed stack
QStack<DoneStackItem> done_stack; // items processed stack
enum State {
Initial_State, // initial state
BinOp_State, // expecting binary operator
Expand All @@ -997,12 +998,12 @@ class Translator {
char nexpected; // number of arguments expected
Code code; // table index of internal function
};
Stack<CountItem> count_stack; // number of operands counter stack
QStack<CountItem> count_stack; // number of operands counter stack
// 2010-04-11: added mode for handling assignment statements
// 2010-05-29: moved enum definition outside Translator and renamed it
TokenMode mode; // current assignment mode
// 2010-06-05: moved CmdItem outside Translator for TableEntry
Stack<CmdItem> cmd_stack; // stack of commands waiting processing
QStack<CmdItem> cmd_stack; // stack of commands waiting processing
// 2010-06-06: variable to save expression only mode in
bool exprmode; // expression only mode active flag

Expand Down
184 changes: 0 additions & 184 deletions stack.h

This file was deleted.

24 changes: 0 additions & 24 deletions test/stack2.txt

This file was deleted.

60 changes: 0 additions & 60 deletions test/test_stack2.cpp

This file was deleted.

0 comments on commit 5d7c634

Please sign in to comment.