1 /* src/vm/assertion.cpp - assertion options
3 Copyright (C) 2007, 2008
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
32 #include "mm/memory.hpp"
34 #include "toolbox/list.hpp"
36 #include "vm/assertion.hpp"
37 #include "vm/global.h"
41 /* -ea/-da options ************************************************************/
43 List<assertion_name_t*>* list_assertion_names = NULL;
44 int32_t assertion_class_count = 0;
45 int32_t assertion_package_count = 0;
46 bool assertion_user_enabled = false;
47 bool assertion_system_enabled = false;
50 /* assertion_ea_da *************************************************************
52 Handle -ea:/-enableassertions: and -da:/-disableassertions: options.
54 *******************************************************************************/
56 void assertion_ea_da(const char *name, bool enabled)
61 assertion_name_t *item;
64 assertion_user_enabled = enabled;
69 len = os::strlen(name);
71 if (name[len - 1] == '/') {
75 buf = os::strdup(name);
78 os::abort_errno("assertion_ea_da: strdup failed");
81 if ((len > 2) && (strcmp(name + (len - 3), "...") == 0)) {
83 assertion_package_count += 1;
84 #if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
92 assertion_class_count += 1;
95 len = os::strlen(buf);
97 for (size_t i = 0; i < len; i++) {
98 #if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
109 item = NEW(assertion_name_t);
111 item->enabled = enabled;
112 item->package = package;
114 if (list_assertion_names == NULL) {
115 list_assertion_names = new List<assertion_name_t*>();
118 list_assertion_names->push_back(item);
123 * These are local overrides for various environment variables in Emacs.
124 * Please do not remove this and leave it at the end of the file, where
125 * Emacs will automagically detect them.
126 * ---------------------------------------------------------------------
129 * indent-tabs-mode: t
133 * vim:noexpandtab:sw=4:ts=4: