Mercurial > ~dholland > hg > ag > index.cgi
view anagram/support/agcstack.cpp @ 13:43d8b194fb4e
Remove unused variables.
author | David A. Holland |
---|---|
date | Tue, 31 May 2022 00:59:00 -0400 |
parents | 13d2b8934445 |
children |
line wrap: on
line source
/* * AnaGram, A System for Syntax Directed Programming * Copyright 1997-2002 Parsifal Software. All Rights Reserved. * See the file COPYING for license and usage terms. * * agcstk.cpp - character stack */ #include "agcstack.h" #include "assert.h" //#define INCLUDE_LOGGING #include "log.h" AgString AgCharStack::popString(unsigned n) { LOGSECTION("AgCharStack::popString(unsigned)"); assert(n <= size()); LOGV(size()); LOGV(n); AgString result(n); char *p = result.pointer(); while (n--) { p[n] = pop(); } return result; } AgString AgCharStack::popString() { LOGSECTION("AgCharStack::popString"); unsigned n = size(); LOGV(size()); LOGV(n); AgString result(n); char *p = result.pointer(); while (n--) { p[n] = pop(); } return result; } AgCharStack &AgCharStack::push(const char *s) { while (*s) { push(*s++); } return *this; } AgCharStack &AgCharStack::push(const char *s, unsigned n) { for (unsigned i = 0; i < n; i++) { push(s[i]); } return *this; } AgCharStack &AgCharStack::operator << (AgString s) { int n = s.size(); char *p = s.pointer(); while (n--) { (*this) << *p++; } return *this; } AgCharStack &AgCharStack::operator << (const char *s) { if (s) { while (*s) { push(*s++); } } return *this; }