Canola  0.8.D001
lib/interpose/goto.cc
Go to the documentation of this file.
00001 //
00002 // canola - canon canola 1614p emulator
00003 // Copyright (C) 2011 Peter Miller
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License, version 3, as
00007 // published by the Free Software Foundation.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License along
00015 // with this program. If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 
00018 #include <lib/interpose/goto.h>
00019 
00020 
00021 interpose_goto::~interpose_goto()
00022 {
00023 }
00024 
00025 
00026 interpose_goto::interpose_goto(const pointer &a_deeper) :
00027     deeper(a_deeper)
00028 {
00029 }
00030 
00031 
00032 interpose_goto::pointer
00033 interpose_goto::create(const pointer &a_deeper)
00034 {
00035     return pointer(new interpose_goto(a_deeper));
00036 }
00037 
00038 
00039 void
00040 interpose_goto::on_opcode(opcode_t op, const location::pointer &where)
00041 {
00042     int n = op;
00043     if (n >= 0 && n < 128)
00044     {
00045         if (!opcode_valid_label(n))
00046         {
00047             on_error
00048             (
00049                 "'%s' is not a valid jump label",
00050                 opcode_name(opcode_t(n)).c_str()
00051             );
00052         }
00053         deeper->on_opcode(opcode_t(opcode_extended_goto_000 + n), where);
00054     }
00055     else
00056     {
00057         on_error
00058         (
00059             "'%s' not valid at this time, waiting for a UJ flag",
00060             opcode_name(op).c_str()
00061         );
00062     }
00063 }
00064 
00065 
00066 bool
00067 interpose_goto::strict_memory_number_checking_required(void)
00068     const
00069 {
00070     return deeper->strict_memory_number_checking_required();
00071 }
00072 
00073 
00074 void
00075 interpose_goto::on_error_v(char const *fmt, va_list ap)
00076 {
00077     deeper->on_error_v(fmt, ap);
00078 }