| 1 | /* Command.cpp |
| 2 | * |
| 3 | * Copyright (C) 1994-2019 David Weenink |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This code is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #include "Command.h"cxx . . $ `<file>/dwsys/Command.h`/ |
| 20 | |
| 21 | #pragma mark - class Command |
| 22 | |
| 23 | void structCommandcxx . . $ structCommand# :: v_docxx . . $ structCommand#v_do(49f6e7a06ebc5aa8). () { }; |
| 24 | void structCommandcxx . . $ structCommand# :: v_undocxx . . $ structCommand#v_undo(49f6e7a06ebc5aa8). () { }; |
| 25 | |
| 26 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (Command, Thing, 0); |
| 27 | |
| 28 | void Command_initcxx . . $ Command_init(47ae7cbabe6d8df8). (Commandcxx . . $ Command# me, conststring32cxx . . $ conststring32# name, Thingcxx . . $ Thing# boss) { |
| 29 | Thing_setNamecxx . . $ Thing_setName(b5a42e5e01c267b5). (me, name); |
| 30 | mycxx . . $ `melder/melder.h:44:9`! bosscxx . . $ structCommand#boss. = boss; |
| 31 | } |
| 32 | |
| 33 | void Command_docxx . . $ Command_do(822ebc8b9e234a4). (Commandcxx . . $ Command# me) { |
| 34 | mycxx . . $ `melder/melder.h:44:9`! v_docxx . . $ structCommand#v_do(49f6e7a06ebc5aa8). (); |
| 35 | } |
| 36 | |
| 37 | void Command_undocxx . . $ Command_undo(822ebc8b9e234a4). (Commandcxx . . $ Command# me) { |
| 38 | mycxx . . $ `melder/melder.h:44:9`! v_undocxx . . $ structCommand#v_undo(49f6e7a06ebc5aa8). (); |
| 39 | } |
| 40 | |
| 41 | #pragma mark - class CommandHistory |
| 42 | |
| 43 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (CommandHistory, Ordered, 0); |
| 44 | |
| 45 | void CommandHistory_forthcxx . . $ CommandHistory_forth(7258301033e2d904). (CommandHistorycxx . . $ CommandHistory# me) { |
| 46 | mycxx . . $ `melder/melder.h:44:9`! currentcxx . . $ structCommandHistory#current. ++; |
| 47 | } |
| 48 | |
| 49 | void CommandHistory_backcxx . . $ CommandHistory_back(7258301033e2d904). (CommandHistorycxx . . $ CommandHistory# me) { |
| 50 | mycxx . . $ `melder/melder.h:44:9`! currentcxx . . $ structCommandHistory#current. --; |
| 51 | } |
| 52 | |
| 53 | Commandcxx . . $ Command# CommandHistory_getItemcxx . . $ CommandHistory_getItem(af102feab7dfa2d0). (CommandHistorycxx . . $ CommandHistory# me) { |
| 54 | Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (mycxx . . $ `melder/melder.h:44:9`! current > 0 && mycxx . . $ `melder/melder.h:44:9`! current <= mycxx . . $ `melder/melder.h:44:9`! size); |
| 55 | return mycxx . . $ `melder/melder.h:44:9`! atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).mycxx . . $ `melder/melder.h:44:9`! currentcxx . . $ structCommandHistory#current.]; |
| 56 | } |
| 57 | |
| 58 | void CommandHistory_insertItem_movecxx . . $ CommandHistory_insertItem_move(e8345a325df32818). (CommandHistorycxx . . $ CommandHistory# me, autoCommandcxx . . $ autoCommand# command) { |
| 59 | for (integercxx . . $ integer# i = mycxx . . $ `melder/melder.h:44:9`! sizecxx . . $ CollectionOf#size.; i >= mycxx . . $ `melder/melder.h:44:9`! currentcxx . . $ structCommandHistory#current. + 1; i --) |
| 60 | mycxx . . $ `melder/melder.h:44:9`! removeItemcxx . . $ CollectionOf#removeItem(1624ee8275b10bda). (i); |
| 61 | mycxx . . $ `melder/melder.h:44:9`! addItem_movecxx . . $ CollectionOf#addItem_move(bcc0cff787be24fe). (commandcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).()); |
| 62 | while (mycxx . . $ `melder/melder.h:44:9`! sizecxx . . $ CollectionOf#size. > 20) |
| 63 | mycxx . . $ `melder/melder.h:44:9`! removeItemcxx . . $ CollectionOf#removeItem(1624ee8275b10bda). (1); |
| 64 | mycxx . . $ `melder/melder.h:44:9`! currentcxx . . $ structCommandHistory#current. = mycxx . . $ `melder/melder.h:44:9`! sizecxx . . $ CollectionOf#size.; |
| 65 | } |
| 66 | |
| 67 | bool CommandHistory_isEmptycxx . . $ CommandHistory_isEmpty(1e1e8785c23ca14b). (CommandHistorycxx . . $ CommandHistory# me) { |
| 68 | return mycxx . . $ `melder/melder.h:44:9`! sizecxx . . $ CollectionOf#size. == 0; |
| 69 | } |
| 70 | |
| 71 | bool CommandHistory_isOffleftcxx . . $ CommandHistory_isOffleft(1e1e8785c23ca14b). (CommandHistorycxx . . $ CommandHistory# me) { |
| 72 | return mycxx . . $ `melder/melder.h:44:9`! currentcxx . . $ structCommandHistory#current. == 0; |
| 73 | } |
| 74 | |
| 75 | bool CommandHistory_isOffrightcxx . . $ CommandHistory_isOffright(1e1e8785c23ca14b). (CommandHistorycxx . . $ CommandHistory# me) { |
| 76 | return mycxx . . $ `melder/melder.h:44:9`! sizecxx . . $ CollectionOf#size. == 0 || mycxx . . $ `melder/melder.h:44:9`! currentcxx . . $ structCommandHistory#current. == mycxx . . $ `melder/melder.h:44:9`! sizecxx . . $ CollectionOf#size. + 1; |
| 77 | } |
| 78 | |
| 79 | conststring32cxx . . $ conststring32# CommandHistory_commandNamecxx . . $ CommandHistory_commandName(cfbef1f0ff993ce0). (CommandHistorycxx . . $ CommandHistory# me, integercxx . . $ integer# offsetFromCurrent) { |
| 80 | const integercxx . . $ integer# pos = mycxx . . $ `melder/melder.h:44:9`! currentcxx . . $ structCommandHistory#current. + offsetFromCurrent; |
| 81 | return pos >= 1 && pos <= mycxx . . $ `melder/melder.h:44:9`! sizecxx . . $ CollectionOf#size. ? Thing_getNamecxx . . $ Thing_getName(fbb3dc34e3ef688d). (mycxx . . $ `melder/melder.h:44:9`! atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).pos]) : nullptr; |
| 82 | } |
| 83 | |
| 84 | /* End of file Command.cpp */ |