Mercurial > ~dholland > hg > ag > index.cgi
view anagram/support/agnotify.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. * * agnotify.cpp */ #include "agnotify.h" #include "myalloc.h" //#define INCLUDE_LOGGING #include "log.h" AgNotificationActionBase::~AgNotificationActionBase() { LOGSECTION("AgNotificationActionBase::~AgNotificationActionBase"); LOGV(notifierStack.size()); int n = notifierStack.size(); while (n--) { LOGV(n); notifierStack[n]->remove(this); } } AgNotificationActionBase & AgNotificationActionBase::attach(AgNotifierBase *notifier) { LOGSECTION("AgNotificationActionBase::attach"); notifierStack.push(notifier); notifier->attach(this); return *this; } void AgNotificationActionBase::remove(AgNotifierBase *notifier) { LOGSECTION("AgNotificationActionBase::remove"); int i, n = notifierStack.size(); ok_ptr(this); ok_ptr(notifier); for (i = 0; i < n; i++) { if (notifierStack[i] == notifier) { n--; if (i < n) { notifierStack[i] = notifierStack.pop(); } else { notifierStack.pop(); } return; } } } AgNotifierBase::~AgNotifierBase() { LOGSECTION("AgNotifierBase::~AgNotifierBase"); int n = notifyStack.size(); while (n--) { notifyStack[n]->remove(this); } } void AgNotifierBase::notify() { LOGSECTION("AgNotifierBase::notify"); int n = notifyStack.size(); int i; for (i = 0; i < n; i++) { notifyStack[i]->perform(); } } void AgNotifierBase::remove(AgNotificationActionBase *action) { LOGSECTION("AgNotifierBase::remove"); int i, n = notifyStack.size(); for (i = 0; i < n; i++) { if (notifyStack[i] == action) { n--; LOGV(i); LOGV(n); LOGV(notifyStack.size()); if (i < n) { notifyStack[i] = notifyStack.pop(); } else { notifyStack.pop(); } return; } } }