1. Herbert Breunung
  2. Kephra

Commits

Herbert Breunung  committed 320b6b3

moved pure service modules into API namespace

  • Participants
  • Parent commits fd780e3
  • Branches default

Comments (0)

Files changed (35)

File lib/Kephra.pm

View file
  • Ignore whitespace
 
 package Kephra;
 our $NAME     = __PACKAGE__;    # name of entire application
-our $VERSION  = '0.4.5.10';
+our $VERSION  = '0.4.5.11';
 
 our @external_dependencies = (
 	qw/Benchmark Encode Encode::Guess Cwd/,

File lib/Kephra/API.pm

View file
  • Ignore whitespace
 use strict;
 use warnings;
 use Carp;
+use Kephra::API::Command;
+use Kephra::API::Docs;
+use Kephra::API::Event;
+use Kephra::API::KeyMap;
+use Kephra::API::Plugin;
+use Kephra::API::Sandrum;
 use Kephra::App::Focus;
 use Kephra::App::Window;
 use Kephra::Config;
-use Kephra::CommandList;
-use Kephra::DocumentStash;
-use Kephra::EventTable;
-use Kephra::KeyMap;
+use Kephra::Help;
 use Kephra::Log;
-use Kephra::PluginRegistrar;
-use Kephra::SandrumInterpreter;
 use Kephra::Worker;
 
 
 package Kephra::API;
 my $VERSION = 0.1;
 
-Kephra::CommandList::register_switch_var({
+Kephra::API::Command::register_switch_var({
 	'$app'    => 'app',
 	'$win'    => 'main_window',
 	'$docbar' => 'docbar',
 
 sub app             { $Kephra::App::_ref }
 sub main_window     { $Kephra::App::Window::_ref }
-sub editor          { Kephra::DocumentStash::active_editor() }
+sub editor          { Kephra::API::Docs::active_editor() }
 sub docbar          { Kephra::App::Part::Editor::active_docbar() }
-sub document        { Kephra::DocumentStash::active_doc() }
-sub all_documents   { Kephra::DocumentStash::all_doc() }
+sub document        { Kephra::API::Docs::active_doc() }
+sub all_documents   { Kephra::API::Docs::all_doc() }
 sub do_with_all_documents { }
 
 sub focus           { Kephra::App::Focus::set(@_) }

File lib/Kephra/API.pm~

View file
  • Ignore whitespace
+
+use strict;
+use warnings;
+use Carp;
+use Kephra::App::Focus;
+use Kephra::App::Window;
+use Kephra::Config;
+use Kephra::CommandList;
+use Kephra::DocumentStash;
+use Kephra::EventTable;
+use Kephra::KeyMap;
+use Kephra::Log;
+use Kephra::PluginRegistrar;
+use Kephra::SandrumInterpreter;
+use Kephra::Worker;
+
+
+package Kephra::API;
+my $VERSION = 0.1;
+
+Kephra::CommandList::register_switch_var({
+	'$app'    => 'app',
+	'$win'    => 'main_window',
+	'$docbar' => 'docbar',
+	'$doc'    => 'document',
+	'$ed'     => 'editor',
+});
+
+sub app             { $Kephra::App::_ref }
+sub main_window     { $Kephra::App::Window::_ref }
+sub editor          { Kephra::DocumentStash::active_editor() }
+sub docbar          { Kephra::App::Part::Editor::active_docbar() }
+sub document        { Kephra::DocumentStash::active_doc() }
+sub all_documents   { Kephra::DocumentStash::all_doc() }
+sub do_with_all_documents { }
+
+sub focus           { Kephra::App::Focus::set(@_) }
+sub focus_back      { Kephra::App::Focus::set_back(@_) }
+
+# IO-unit
+sub input  {main_window()->{'part'}{'iounit'}->get_line() if ref main_window() and exists main_window()->{'part'}{'iounit'} }
+sub output {main_window()->{'part'}{'iounit'}->output(@_) if ref main_window() and exists main_window()->{'part'}{'iounit'} }
+sub log    {main_window()->{'part'}{'iounit'}->output('log', @_) if ref main_window() and exists main_window()->{'part'}{'iounit'} }
+
+sub configs  { }
+
+# command list
+sub add_command { }
+sub del_command { }
+sub run_command { }
+sub command_status {}
+
+# cmd line lang
+sub run_sandrum_commands {}
+
+# event table
+sub add_event_callback { }
+sub del_event_callback { }
+sub trigger_event      { }
+sub freeze_event       { }
+sub thaw_event         { }
+
+# plugin API
+sub register_plugin {}
+sub get_plugin_status {}
+sub get_plugin_data {}
+sub available_plugins {}
+sub unregister_plugin {}
+
+# if you want to know more, read Kephra::Internals.pod
+
+
+1;
+

File lib/Kephra/API/Command.pm

View file
  • Ignore whitespace
+use strict;
+use warnings;
+use Kephra::API;
+
+package Kephra::API::Command;
+
+my %list;     # by ID
+my %keyproxy; # by keycode
+my %namespace;
+my %switch   = ( 'name' => {}, 'package' => {} ); #switchvar vor cmd definitions
+
+sub _raw_list { \%list }
+
+
+# register means: to be called before CommandList::init() - module body execution time
+
+sub register_switch_var {
+	my $var = shift;
+	my $calling_module = (caller)[0];
+	if (ref $var eq 'HASH'){
+		no strict 'refs';
+		#return Kephra::Log::error #("$- already registered as ".$switch{'name'}{$_}) if exists $switch{'name'}{$_};
+		for my $name (keys %$var){
+			$var->{$name} = $calling_module . '::' . $var->{$name}
+				if index($var->{$name}, '::') == -1 and $calling_module;
+			$switch{'name'}{$name} = $var->{$name}
+				if $var->{$name} and defined &{ $var->{$name} };
+		}
+	}
+	else { return Kephra::Log::warning("need a sub name string or of a var => sub hash") }
+}
+
+sub register_context_var {
+	my $var = shift;
+	my $calling_module = (caller)[0];
+	if (not ref $var and $var) {
+		$var = $calling_module . '::' . $var if index($var, '::') == -1;
+		$switch{'package'}{$calling_module} = $var if defined $calling_module;
+	}
+	else { return Kephra::Log::warning("need a sub name string or of a var => sub hash") }
+}
+
+sub register_namespace {
+	my $name = shift;
+	my $calling_module = (caller)[0];
+	return Kephra::Log::error("called without value from $calling_module") unless $name;
+	$namespace{ $calling_module } = $name;
+}
+
+sub register {
+	my $cmd = shift;
+	return Kephra::Log::error( '"$cmd" has to be a hash ref') unless ref $cmd eq ref {};
+	my $calling_module = (caller)[0];
+	my $cmd_namespace = $namespace{ $calling_module }; 
+	for my $ID (keys %$cmd) {
+		my $fullID = (substr($ID,0,1) eq '+' and $cmd_namespace)
+			? $cmd_namespace . substr $ID, 1
+			: $ID ;
+		Kephra::Log::warning("$cmd lacks command namespace to prefix"), next
+				if $fullID ne $ID and not $cmd_namespace;
+		Kephra::Log::warning( "$cmd already registered to do " .
+			property($fullID, 'sub') . " by " .
+			property($fullID, 'source')  ), next if registered( $fullID );
+		#for (qw/sub options state event label help keys icon/){} filter input later
+		$list{$fullID}           = $cmd->{$ID};
+		$list{$fullID}{'source'} = $calling_module;
+	}
+}
+
+
+sub init {
+	for my $cmd (keys %list) {
+		my $data = $list{$cmd};
+		my $call = $data->{'sub'};
+		Kephra::Log::warning( "$cmd lacks sub value"), next unless $call;
+		# insert start (prefix) of the call, module name mostly
+		if (substr($call, 0, 1) eq '$'){
+			if (substr($call, 1, 1) eq '_'){
+				Kephra::Log::warning
+					( "$cmd lacks switch declared by ".$data->{'source'}), next
+						unless $switch{'package'}{ $data->{'source'} };
+				$call = $switch{'package'}{ $data->{'source'} }.'()'.substr($call, 2);
+			}
+			else {
+				my $vl = index($call,'->');
+				$call = $switch{'name'}{ substr($call, 0, $vl) }.'()'.
+						substr($call, $vl) ;
+			}
+		}
+		else {
+			$call = $data->{'source'}.'::'.$call if index($call,'::') == -1;
+		}
+		# adding tail (suffix) of the call, signature part
+		$call .= exists $data->{'parameter'} # just one parameter yet
+			? '(\''.$data->{'parameter'}.'\')'
+			: '()';
+		$data->{'coderef'} = eval "sub { $call }";
+		Kephra::API::KeyMap::register_keys( { $cmd => $data->{'keys'} } )
+			if defined $data->{'keys'} and $data->{'keys'};
+	}
+}
+
+
+sub compile {}
+
+sub run {
+	my $cmd = shift;
+	$cmd = [$cmd] unless ref $cmd eq ref [];
+	my $return;
+	for (@$cmd) { $return = $list{$_}{'coderef'}->() if exists $list{$_} }
+	$return;
+}
+sub run_by_keycode {
+	my ($code, $map) = @_;
+}
+
+sub registered      { 1 if defined $_[0]  and exists $list{ $_[0] }             }
+sub property_exists { 1 if registered($_[0]) and exists $list{ $_[0] }{ $_[1] } }
+sub add {}
+
+sub all_properties { 
+	if ( registered($_[0]) ) { $list{$_[0]} }
+	else { Kephra::Log::warning('requested data of unknown command '.$_[0], 1) }
+}
+sub property       { $list{$_[0]}{$_[1]}         if property_exists(@_) }
+sub set_property   { $list{$_[0]}{$_[1]} = $_[2] if property_exists(@_) }
+
+
+1;
+
+__END__
+
+=head1 Command Definition
+
+cmd_ID => {
+	coderef   => compiled from sub, source and option, saves state
+	sub       => 'Kephra::File::new',
+	parameter => [],
+	source    => package that registered that cmd
+	state     => return value of the call or antother coderef
+	event     => '',
+	label     => 'New',
+	help      => '', # help text to be shown in statusbar or as popup
+	keys      => 'Ctrl + N',
+	icon      => '',
+	bitmap    => '',  #Wx::Bitmap Object
+}

File lib/Kephra/API/Docs.pm

View file
  • Ignore whitespace
+use strict;
+use warnings;
+
+use Kephra::API;
+use Kephra::Document;
+
+package Kephra::API::Docs;
+
+my %document;
+my $active;
+my $previous;
+
+sub previous_doc  { $previous }
+sub active_doc    { $active }
+sub active_editor { $active->editor }
+sub set_active_doc{
+	my $any = shift;
+	Kephra::Log::warning('need a parameter!') unless $any;
+	my $new_doc = doc_by_anything( $any ) ;
+	return unless defined $new_doc;
+	_activate($new_doc);
+	return 1;
+}
+sub _activate {
+	$previous = $active;
+	$active = shift;
+}
+sub add_and_activate {
+	my $doc = shift;
+	add($doc);
+	_activate($doc);
+}
+sub add {            # silently
+	my $doc = shift;
+	Kephra::Log::warning("add to me only docs, not $doc!") unless $doc->isa('Kephra::Document');
+	$document{$doc->editor} = $doc;
+}
+sub del {
+	my $doc = shift;
+	Kephra::Log::warning("add to me only docs, not $doc!") unless $doc->isa('Kephra::Document');
+	warn "DocStash:del: $doc was not in the stash!" unless $document{$doc->editor};
+	delete $document{$doc->editor};
+}
+
+
+sub doc_by_anything {
+	my $any = shift;
+	Kephra::Log::warning("need a parameter!") unless $any;
+	return     ref($any) eq ''                  ? doc_by_path ($any)
+			 : $any->isa('Wx::Panel')           ? doc_by_panel($any)
+			 : $any->isa('Kephra::App::Editor') ? doc_by_ed   ($any)
+			 : $any->isa('Kephra::Document')    ? $document{$any->editor} 
+			 :                                    undef;
+}
+sub doc_by_ed {
+	my $ed = shift;
+	Kephra::Log::warning("needs a Kephra::App::Editor, not $ed!")
+		unless $ed->isa('Kephra::App::Editor');
+	return $document{$ed};
+}
+sub doc_by_panel {
+	my $panel = shift;
+	Kephra::Log::warning("needs a Wx::Panel, not $panel!") unless $panel->isa('Wx::Panel');
+	for my $ed (keys %document) {
+		return $document{$ed} if $document{$ed}->panel and $document{$ed}->panel eq $panel;
+	}
+}
+sub doc_by_path {
+	my $file_path = shift;
+	Kephra::Log::warning("needs a file path as input!") unless $file_path and -e $file_path;
+	for my $ed (keys %document) {
+		return $document{$ed} if $document{$ed}->file_path eq $file_path;
+	}
+}
+sub all_doc { values %document }
+
+sub dump_all_ed { print "$_ + \n" for keys %document }
+
+sub file_loaded {
+	my $file_path = shift;
+	Kephra::Log::warning("needs a file path as input!") unless $file_path and -e $file_path;
+	for my $ed (keys %document) {
+		return 1 if $document{$ed}->file_path and $document{$ed}->file_path eq $file_path;
+	}
+}
+1;

File lib/Kephra/API/Event.pm

View file
  • Ignore whitespace
+use strict;
+use warnings;
+use Kephra::API;
+
+package Kephra::API::Event;
+
+my %event;
+
+sub add_callback {}
+sub del_callback {}
+sub trigger_callback {}
+sub freeze_callback {}
+sub thaw_callback{}
+
+sub add_event {}
+sub del_event {}
+sub trigger_event {}
+sub freeze_event {}
+sub thaw_event{}
+
+sub global_halt {}
+sub global_restore {}
+
+
+1;

File lib/Kephra/API/KeyMap.pm

View file
  • Ignore whitespace
+use strict;
+use warnings;
+use Wx;
+use Kephra::API;
+
+package Kephra::API::KeyMap;
+
+my %definition;
+my %code;
+my %mod_key_value = ( shift => 1000, ctrl => 2000, alt  => 4000);
+my %key_value = (
+	left  => &Wx::WXK_LEFT,      right => &Wx::WXK_RIGHT,
+	up    => &Wx::WXK_UP,         down => &Wx::WXK_DOWN,
+	pageup=> &Wx::WXK_PAGEUP, pagedown => &Wx::WXK_PAGEDOWN,
+	home  => &Wx::WXK_HOME,        end => &Wx::WXK_END,
+	delete => &Wx::WXK_DELETE,  insert => &Wx::WXK_INSERT,
+	back  => &Wx::WXK_BACK,        tab => &Wx::WXK_TAB,
+	esc   => &Wx::WXK_ESCAPE,    
+	enter => &Wx::WXK_RETURN,    space => &Wx::WXK_SPACE,
+	F1 => &Wx::WXK_F1, F2 => &Wx::WXK_F2,  F3 => &Wx::WXK_F3,  F4 => &Wx::WXK_F4,
+	F5 => &Wx::WXK_F5, F6 => &Wx::WXK_F6,  F7 => &Wx::WXK_F7,  F8 => &Wx::WXK_F8,
+	F9 => &Wx::WXK_F9,F10 => &Wx::WXK_F10,F11 => &Wx::WXK_F11,F12 => &Wx::WXK_F12,
+	pound => 35, tilde => 92,
+	num_left  => &Wx::WXK_NUMPAD_LEFT,  num_right=> &Wx::WXK_NUMPAD_RIGHT,
+	num_up    => &Wx::WXK_NUMPAD_UP,    num_down => &Wx::WXK_NUMPAD_DOWN,
+	num_space => &Wx::WXK_NUMPAD_SPACE, num_tab  => &Wx::WXK_NUMPAD_TAB,
+	num_enter => &Wx::WXK_NUMPAD_ENTER, num_F1   => &Wx::WXK_NUMPAD_F1,
+);
+my $main_map = 'editor';
+
+sub apply {}
+sub build {}
+sub copy {}
+sub overlay {}
+sub register_map {
+}
+
+sub register_keys {
+	my ($keys, $map) = @_;
+	return Kephra::Log::warning ("got no hashref") unless ref $keys eq ref {};
+	$map = $main_map unless defined $map;
+	for my $cmd (keys %$keys) {
+		$definition{$map}{ $cmd } = $keys->{$cmd};
+		my $code = code_from_definition( $keys->{$cmd} );
+		unless (exists $code{$map}{ $code }) { $code{$map}{ $code } = $cmd }
+		else {
+			Kephra::Log::warning("$cmd tried to register the already taken keycode $code");
+		}
+	}
+}
+
+sub code_registered {
+	my ($code, $map) = @_;
+	Kephra::Log::warning ('got no key code') unless $code;
+	$map = $main_map unless defined $map;
+	return 1 if defined $code{$map}{$code} and $code{$map}{$code}
+}
+
+sub cmd_from_code {
+	my ($code, $map) = @_;
+	Kephra::Log::warning ('got no key code') unless $code;
+	$map = $main_map unless defined $map;
+	$code{$map}{$code};
+}
+
+sub code_from_definition {
+	my $def = shift;
+	$def =~ tr/ 	//d;
+	Kephra::Log::warning ('got no key definition') unless $def;
+
+	my @key = split '\+', $def;           # only + can combine key in definition
+	my $code = length($key[-1]) == 1 ? ord uc $key[-1] : $key_value{ $key[-1] };
+	Kephra::Log::warning ('don\'t know this key '.$key[-1]) unless $code;
+
+	$code += $mod_key_value{ shift(@key) } while @key > 1;
+	Kephra::Log::warning ("got unknown key definition $def") unless $code;
+	return $code;
+}
+
+sub code_from_event {
+	my $event = shift;
+	Kephra::Log::warning ("got no event, but $event")unless $event and $event->isa('Wx::Event');
+	my $code = $event->GetKeyCode;
+	$code += $mod_key_value{'shift'} if $event->ShiftDown;
+	$code += $mod_key_value{'ctrl'} if $event->ControlDown;
+	$code += $mod_key_value{'alt'} if $event->AltDown;
+	return $code;
+}
+
+sub react_on_event {
+	my ($event, $map) = @_;
+	Kephra::Log::warning ("got no event, but $event") unless $event and $event->isa('Wx::Event');
+	$map = $main_map unless defined $map;
+	my $key = code_from_event($event);
+	Kephra::API::log("pressed key $key inside the ".(caller)[0]);
+	if (code_registered($key)){
+			my $cmd = cmd_from_code($key);
+			Kephra::API::log("run command: $cmd");
+			Kephra::CommandList::run_cmd( $cmd );
+	}
+	else {$event->Skip}
+}
+
+1;

File lib/Kephra/API/Plugin.pm

View file
  • Ignore whitespace
+use strict;
+use warnings;
+
+package Kephra::API::Plugin;
+
+# init the registered plugins
+sub start {}
+
+# register a plugin
+sub register {}
+sub unregister {}
+
+# load and unload a specific plugin
+sub load {}
+sub unload {}
+
+1;

File lib/Kephra/API/Sandrum.pm

View file
  • Ignore whitespace
+use strict;
+use warnings;
+
+package Kephra::API::Sandrum;
+
+
+1;

File lib/Kephra/App.pm

View file
  • Ignore whitespace
 our @ISA = 'Wx::App';
 our $_ref;
 
-Kephra::CommandList::register_cmd({
+Kephra::API::Command::register({
  'app-close-save'=> {sub => '$app->close_save', label=> 'Exit', keys=> 'alt+q'},
 });
 
 sub OnInit {
 	$_ref = shift;
 	Kephra::Config::init();
-	Kephra::CommandList::init();
+	Kephra::API::Command::init();
 
 	my $win = Kephra::App::Window->new(__PACKAGE__);
 

File lib/Kephra/App/Bar/Document.pm

View file
  • Ignore whitespace
 use Kephra::API;
 use Kephra::App::Panel;
 use Kephra::App::Util;
-use Kephra::CommandList;
-use Kephra::DocumentStash;
-use Kephra::Log;
 
 package Kephra::App::Bar::Document;
 our @ISA = 'Wx::AuiNotebook';
 
-Kephra::CommandList::register_cmd_namespace('document');
-Kephra::CommandList::register_switch_var('Kephra::API::docbar');
-Kephra::CommandList::register_cmd({
+Kephra::API::Command::register_namespace('document');
+Kephra::API::Command::register_context_var('Kephra::API::docbar');
+Kephra::API::Command::register({
  '+-select-left'     =>{sub=>'$_->select_page_left',     label=>'Previous Tab',  keys=>'ctrl+pageup'},
  '+-select-right'    =>{sub=>'$_->select_page_right',    label=>'Next Tab',      keys=>'ctrl+pagedown'},
  '+-select-leftmost' =>{sub=>'$_->select_page_leftmost', label=>'First Tab',     keys=>'ctrl+shift+pageup'},
 	Wx::Event::EVT_AUINOTEBOOK_PAGE_CHANGED( $self, -1, sub {
 		my ($nb, $event ) = @_;
 		my $new_page = $nb->GetPage( $event->GetSelection );
-		Kephra::DocumentStash::set_active_doc( $new_page );
+		Kephra::API::Docs::set_active_doc( $new_page );
 		Kephra::API::main_window()->refresh_title();
 		Wx::Window::SetFocus( $new_page );
 		$event->Skip;

File lib/Kephra/App/Dialog.pm

View file
  • Ignore whitespace
 
 package Kephra::App::Dialog;
 
-Kephra::CommandList::register_cmd({
+Kephra::API::Command::register({
  'config-global-dialog'=>{sub=>'config',       label=>'Dialog',       keys=> 'ctrl+alt+c'},
  'config-keymap-dialog'=>{sub=>'keymap',       label=>'Keymapping',   keys=> 'ctrl+alt+k'},
- 'help-documentation'  =>{sub=>'documentation',label=>'Documentation',keys=> 'F1'},
- 'help-about'          =>{sub=>'about',        label=>'About...',     keys=> 'ctrl+alt+a'},
- 'help-homepage'       =>{                     label=>'Homepage',     keys=> '',
-                          sub=>'Kephra::App::Util::lounch_browser',   parameter => 'http://kephra.sourceforge.net/site/en/home_news.shtml',},
- 'help-bugreport'      =>{                     label=>'Send a Wish',  keys=> '',
-                          sub=>'Kephra::App::Util::lounch_browser',   parameter => 'http://sourceforge.net/tracker/?func=add&group_id=169747&atid=851593',},
- 'help-forum'          =>{                     label=>'Perl Forum',   keys=> '',
-                          sub=>'Kephra::App::Util::lounch_browser',   parameter => 'http://www.perl-community.de/bat/poard/latest/24h',},
 });
 
 

File lib/Kephra/App/Dialog/Keymap.pm

View file
  • Ignore whitespace
 use warnings;
 
 use Wx;
-use Kephra::CommandList;
+use Kephra::API;
 
 package Kephra::App::Dialog::Keymap;
 my $cache;
 		$dialog, -1,  &Wx::wxDefaultPosition, &Wx::wxDefaultSize, &Wx::wxLC_REPORT 
 	);
 	my $col;
-	my $data = Kephra::CommandList::_raw();
+	my $data = Kephra::API::Command::_raw_list();
 	$list->InsertColumn($col++, $_) for qw(Command Keys Help);
 	$list->SetColumnWidth(0, 200);
 	$list->SetColumnWidth(1, 140);

File lib/Kephra/App/Editor.pm

View file
  • Ignore whitespace
 	} );
 	Wx::Event::EVT_KEY_DOWN ($self, sub {
 		my ($ed, $event) = @_;
-		my $key = Kephra::KeyMap::code_from_event($event);
+		my $key = Kephra::API::KeyMap::code_from_event($event);
 		Kephra::API::log("pressed key $key inside the editor");
-		if (Kephra::KeyMap::code_registered($key)){
-			my $cmd = Kephra::KeyMap::cmd_from_code($key);
+		if (Kephra::API::KeyMap::code_registered($key)){
+			my $cmd = Kephra::API::KeyMap::cmd_from_code($key);
 			Kephra::API::log("run command: $cmd");
-			Kephra::CommandList::run_cmd( $cmd );
+			Kephra::API::Command::run( $cmd );
 		}
 		else {$event->Skip}
 	});

File lib/Kephra/App/Menu.pm

View file
  • Ignore whitespace
 use Wx;
 
 use Kephra::API;
-use Kephra::CommandList;
-use Kephra::Log;
 
 
 package Kephra::App::Menu;
 			if    ($first_chr eq '+') {$item_def = join('-', @$parents, $menu_name).substr($item_def, 1)}
 			elsif ($first_chr eq '-') {$item_def = join('-', @$parents)          .substr($item_def, 1)}
 
-			my $cmd_data = Kephra::CommandList::cmd_all_properties( $item_def );
+			my $cmd_data = Kephra::API::Command::all_properties( $item_def );
 			next unless ref $cmd_data;
 			push @menu_data, {
 				'type' => 'item',

File lib/Kephra/App/Panel.pm

View file
  • Ignore whitespace
 use warnings;
 use Kephra::API;
 use Kephra::App::Sizer;
-use Kephra::App::Util;
 
 
 package Kephra::App::Panel;
 our @ISA = 'Wx::Panel';
 
-my ($is_widget, $is_sizer) = Kephra::App::Util::get('is_widget', 'is_sizer');
+use Kephra::App::Util qw(is_widget is_sizer);
 
 
 sub new {
 	my $class = shift;
 	my $parent = shift;
-	$parent = Kephra::API::main_window() unless defined $parent and $is_widget->($parent);
+	$parent = Kephra::API::main_window() unless defined $parent and is_widget($parent);
 
 	my $self = $class->SUPER::new( $parent );
 	$self->{'sizer'} = Kephra::App::Sizer->new('vertical');
 	for my $item (@_) {
 		$self->adopt( @$item ) if ref $item eq 'ARRAY';
 		$item = $item->{'child'} if ref $item eq 'HASH';
-		next unless $is_widget->($item);
+		next unless is_widget($item);
 		$item->Reparent($self) unless $item->GetParent eq $self;
 	}
 }

File lib/Kephra/App/Part/Editor.pm

View file
  • Ignore whitespace
 use warnings;
 
 package Kephra::App::Part::Editor;
+
 use Kephra::API;
 use Kephra::App::Bar::Document;
-use Kephra::Document;
-use Kephra::DocumentStash;
+
 #my $_ref; # whole panel widget, parent of all this
 my %doc_bar;
 #my $active;
 		$doc->panel( Kephra::App::Panel->new( $main_doc_bar ) );
 		$doc->editor( Kephra::App::Editor->new( $doc->panel ) );
 		$doc->panel->append( \$doc->editor );
-		Kephra::DocumentStash::add_and_activate( $doc );
+		Kephra::API::Docs::add_and_activate( $doc );
 		$main_doc_bar->add_page($doc->panel, $doc->file_name, -1, 1);
 		Kephra::API::focus( $doc->editor );
 	}
 	my $main_doc_bar = active_docbar();
 	if ($main_doc_bar->GetPageCount > 1) {
 		$main_doc_bar->remove_page( $main_doc_bar->GetPageIndex( $doc->panel ) );
-		Kephra::DocumentStash::del($doc);
+		Kephra::API::Docs::del($doc);
 	} else {
 		$doc->editor->ClearAll;
 		$doc->assign_file_path('');
 }
 
 sub raise_document {
-	my $doc = Kephra::DocumentStash::doc_by_anything(shift);
+	my $doc = Kephra::API::Docs::doc_by_anything(shift);
 	active_docbar()->raise_page( $doc->{panel} ) if $doc;
 }
 

File lib/Kephra/App/Part/FileBrowser.pm

View file
  • Ignore whitespace
 use Kephra::API;
 use Kephra::File;
 
-Kephra::CommandList::register_cmd_namespace('filebrowser');
-Kephra::CommandList::register_cmd({
+Kephra::API::Command::register_namespace('filebrowser');
+Kephra::API::Command::register({
  '+-focus' =>{ sub=>'focus', label => ' ', keys => 'F2' },
 });
 

File lib/Kephra/App/Part/IOUnit.pm

View file
  • Ignore whitespace
 use Wx::AUI;
 use Wx::Perl::ProcessStream;
 use Kephra::API;
-use Kephra::KeyMap;
 
 package Kephra::App::Part::IOUnit;
 
 our @ISA = 'Wx::Panel';
 
-Kephra::CommandList::register_cmd_namespace('iounit');
-Kephra::KeyMap::register_map({'iounit'=>{'esc' => 1, 'window-fullscreen-toggle' => '' } });
+Kephra::API::Command::register_namespace('iounit');
+
+Kephra::API::KeyMap::register_map({'iounit'=>{'esc' => 1, 'window-fullscreen-toggle' => '' } });
 
 
 sub new {
 
 	Wx::Event::EVT_KEY_DOWN ($input, sub {
 		my ($input, $event) = @_;
-		my $key = Kephra::KeyMap::code_from_event($event);
+		my $key = Kephra::API::KeyMap::code_from_event($event);
 		Kephra::API::log("pressed key $key inside the IOUnit");
 
 		my $slot = $self->{'output_slots'}{ $self->{'active_slot_name'} };

File lib/Kephra/App/Sizer.pm

View file
  • Ignore whitespace
 use strict;
 use warnings;
 use Kephra::API;
-use Kephra::App::Util;
-
 
 package Kephra::App::Sizer;
-my ($is_widget, $is_sizer) = Kephra::App::Util::get('is_widget', 'is_sizer');
+
 use Scalar::Util qw(looks_like_number);
+use Kephra::App::Util qw(is_widget is_sizer);
 
 
 sub new {
 	}
 
 	my %item;
-	if    ($is_widget->($child) or $is_sizer->($child))       { $item{'child'} = $child }
+	if    (is_widget($child) or is_sizer($child))             { $item{'child'} = $child }
 	elsif (looks_like_number($child) and int $child == $child){ $item{'child'} = 'space'}
 	elsif (ref $child eq 'HASH'){ %item = %$child }           # already assembled
 	else  { return Kephra::Log::error("got no proper widget, but $child", 2) }
 sub get_position {                                        # number of that child
 	my ($self, $child) = @_;
 	my $pos = 0;
-	if ($is_widget->($child)){
+	if (is_widget($child)){
 		for ($self->bare_sizer->GetChildren){
 			return $pos if $_->IsWindow and $_->GetWindow eq $child;
 			$pos++;
 		}
 	}
-	elsif ($is_sizer->($child)){
+	elsif (is_sizer($child)){
 		for ($self->bare_sizer->GetChildren){
 			return $pos if $_->IsSizer and $_->GetSizer eq $child;
 			$pos++;

File lib/Kephra/App/ToolBar.pm

View file
  • Ignore whitespace
 use Wx;
 
 use Kephra::API;
-use Kephra::CommandList;
-use Kephra::Log;
 
 
 package Kephra::App::ToolBar;

File lib/Kephra/App/Window.pm

View file
  • Ignore whitespace
 our $_ref;
 my $title_end = "$Kephra::NAME $Kephra::VERSION";
 
-Kephra::CommandList::register_cmd({
+Kephra::API::Command::register({
  'window-fullscreen-toggle'=>{sub => '$win->toggle_fullscreen', label=>'Fullscreen', keys=>'F11'},
  'iounit-focus'            =>{sub =>'$win->{"part"}{"iounit"}->focus_on_input', label => ' ', keys => 'esc'},
 });
 sub set_title { $_ref->SetTitle( $_[1] ) }
 sub refresh_title {
 	my $self = shift;
-	my $doc = Kephra::DocumentStash::active_doc();
+	my $doc = Kephra::API::Docs::active_doc();
 	my $title = (ref $doc and $doc->file_name)
 		? $doc->file_name.' ('.$doc->file_path.')'
 		: Kephra::App::Part::Editor::active_title();

File lib/Kephra/Benchmark.pm

  • Ignore whitespace
-use strict;
-use warnings;
-require Benchmark;
-
-my @points_in_time;
-
-package Kephra::Benchmark;
-
-sub clock {
-}
-
-1;

File lib/Kephra/CommandList.pm

  • Ignore whitespace
-use strict;
-use warnings;
-use Kephra::API;
-
-package Kephra::CommandList;
-
-my %list;     # by ID
-my %keyproxy; # by keycode
-my %namespace;
-my %switch   = ( 'name' => {}, 'package' => {} );
-
-sub _raw { \%list }
-
-
-# register means: to be called before CommandList::init() - on compile/module block execution time
-sub register_switch_var {
-	my $var = shift;
-	my $calling_module = (caller)[0];
-	if (ref $var eq 'HASH'){
-		no strict 'refs';
-		#return Kephra::Log::error #("$- already registered as ".$switch{'name'}{$_}) if exists $switch{'name'}{$_};
-		for my $name (keys %$var){
-			$var->{$name} = $calling_module . '::' . $var->{$name}
-				if index($var->{$name}, '::') == -1 and $calling_module;
-			$switch{'name'}{$name} = $var->{$name}
-				if $var->{$name} and defined &{ $var->{$name} };
-		}
-	}
-	elsif (not ref $var and $var) {
-		$var = $calling_module . '::' . $var if index($var, '::') == -1;
-		$switch{'package'}{$calling_module} = $var if defined $calling_module;
-	}
-	else {
-		return Kephra::Log::warning("need a sub name string or of a var => sub hash");
-	}
-}
-
-sub register_cmd_namespace {
-	my $name = shift;
-	my $calling_module = (caller)[0];
-	return Kephra::Log::error("called without value from $calling_module") unless $name;
-	$namespace{ $calling_module } = $name;
-}
-
-sub register_cmd {
-	my $cmd = shift;
-	return Kephra::Log::error( '"$cmd" has to be a hash ref') unless ref $cmd eq ref {};
-	my $calling_module = (caller)[0];
-	my $cmd_namespace = $namespace{ $calling_module }; 
-	for my $ID (keys %$cmd) {
-		my $fullID = (substr($ID,0,1) eq '+' and $cmd_namespace)
-			? $cmd_namespace . substr $ID, 1
-			: $ID ;
-		Kephra::Log::warning("$cmd lacks command namespace to prefix"), next
-				if $fullID ne $ID and not $cmd_namespace;
-		Kephra::Log::warning( "$cmd already registered to do " .
-			cmd_property($fullID, 'sub') . " by " .
-			cmd_property($fullID, 'source')  ), next
-				if cmd_exists( $fullID );
-		#for (qw/sub options state event label help keys icon/){} filter input later
-		$list{$fullID}           = $cmd->{$ID};
-		$list{$fullID}{'source'} = $calling_module;
-	}
-}
-
-sub init {
-	for my $cmd (keys %list) {
-		my $data = $list{$cmd};
-		my $call = $data->{'sub'};
-		Kephra::Log::warning( "$cmd lacks sub value"), next unless $call;
-		# insert start (prefix) of the call, module name mostly
-		if (substr($call, 0, 1) eq '$'){
-			if (substr($call, 1, 1) eq '_'){
-				Kephra::Log::warning
-					( "$cmd lacks switch declared by ".$data->{'source'}), next
-						unless $switch{'package'}{ $data->{'source'} };
-				$call = $switch{'package'}{ $data->{'source'} }.'()'.substr($call, 2);
-			}
-			else {
-				my $vl = index($call,'->');
-				$call = $switch{'name'}{ substr($call, 0, $vl) }.'()'.
-						substr($call, $vl) ;
-			}
-		}
-		else {
-			$call = $data->{'source'}.'::'.$call if index($call,'::') == -1;
-		}
-		# adding tail (suffix) of the call, signature part
-		$call .= exists $data->{'parameter'} # just one parameter yet
-			? '(\''.$data->{'parameter'}.'\')'
-			: '()';
-		$data->{'coderef'} = eval "sub { $call }";
-		Kephra::KeyMap::register_keys( { $cmd => $data->{'keys'} } )
-			if defined $data->{'keys'} and $data->{'keys'};
-	}
-}
-sub compile_cmd {}
-
-sub run_cmd {
-	my $cmd = shift;
-	$cmd = [$cmd] unless ref $cmd eq ref [];
-	my $return;
-	for (@$cmd) { $return = $list{$_}{'coderef'}->() if exists $list{$_} }
-	$return;
-}
-sub run_cmd_by_keycode {
-	my ($code, $map) = @_;
-}
-
-sub cmd_exists          { 1 if defined $_[0]     and exists $list{ $_[0] }          }
-sub cmd_property_exists { 1 if cmd_exists($_[0]) and exists $list{ $_[0] }{ $_[1] } }
-sub cmd_add {}
-
-sub cmd_all_properties { 
-	if ( cmd_exists($_[0]) ) { $list{$_[0]} }
-	else                     {
-		Kephra::Log::warning('requested data of unknown command '.$_[0].' from '.(caller)[0]);
-	}
-}
-sub cmd_property       { $list{$_[0]}{$_[1]}         if cmd_property_exists(@_) }
-sub cmd_set_property   { $list{$_[0]}{$_[1]} = $_[2] if cmd_property_exists(@_) }
-
-
-1;
-
-__END__
-
-=head1 Command Definition
-
-cmd_ID => {
-	coderef   => compiled from sub, source and option, saves state
-	sub       => 'Kephra::File::new',
-	parameter => [],
-	source    => package that registered that cmd
-	state     => return value of the call or antother coderef
-	event     => '',
-	label     => 'New',
-	help      => '', # help text to be shown in statusbar or as popup
-	keys      => 'Ctrl + N',
-	icon      => '',
-	bitmap    => '',  #Wx::Bitmap Object
-}

File lib/Kephra/DocumentStash.pm

  • Ignore whitespace
-use strict;
-use warnings;
-
-use Kephra::CommandList;
-use Kephra::Document;
-
-package Kephra::DocumentStash;
-
-my %document;
-my $active;
-my $previous;
-
-sub previous_doc  { $previous }
-sub active_doc    { $active }
-sub active_editor { $active->editor }
-sub set_active_doc{
-	my $any = shift;
-	Kephra::Log::warning('need a parameter!') unless $any;
-	my $new_doc = doc_by_anything( $any ) ;
-	return unless defined $new_doc;
-	_activate($new_doc);
-	return 1;
-}
-sub _activate {
-	$previous = $active;
-	$active = shift;
-}
-sub add_and_activate {
-	my $doc = shift;
-	add($doc);
-	_activate($doc);
-}
-sub add {            # silently
-	my $doc = shift;
-	Kephra::Log::warning("add to me only docs, not $doc!") unless $doc->isa('Kephra::Document');
-	$document{$doc->editor} = $doc;
-}
-sub del {
-	my $doc = shift;
-	Kephra::Log::warning("add to me only docs, not $doc!") unless $doc->isa('Kephra::Document');
-	warn "DocStash:del: $doc was not in the stash!" unless $document{$doc->editor};
-	delete $document{$doc->editor};
-}
-
-
-sub doc_by_anything {
-	my $any = shift;
-	Kephra::Log::warning("need a parameter!") unless $any;
-	return     ref($any) eq ''                  ? doc_by_path ($any)
-			 : $any->isa('Wx::Panel')           ? doc_by_panel($any)
-			 : $any->isa('Kephra::App::Editor') ? doc_by_ed   ($any)
-			 : $any->isa('Kephra::Document')    ? $document{$any->editor} 
-			 :                                    undef;
-}
-sub doc_by_ed {
-	my $ed = shift;
-	Kephra::Log::warning("needs a Kephra::App::Editor, not $ed!")
-		unless $ed->isa('Kephra::App::Editor');
-	return $document{$ed};
-}
-sub doc_by_panel {
-	my $panel = shift;
-	Kephra::Log::warning("needs a Wx::Panel, not $panel!") unless $panel->isa('Wx::Panel');
-	for my $ed (keys %document) {
-		return $document{$ed} if $document{$ed}->panel and $document{$ed}->panel eq $panel;
-	}
-}
-sub doc_by_path {
-	my $file_path = shift;
-	Kephra::Log::warning("needs a file path as input!") unless $file_path and -e $file_path;
-	for my $ed (keys %document) {
-		return $document{$ed} if $document{$ed}->file_path eq $file_path;
-	}
-}
-sub all_doc { values %document }
-
-sub dump_all_ed { print "$_ + \n" for keys %document }
-
-sub file_loaded {
-	my $file_path = shift;
-	Kephra::Log::warning("needs a file path as input!") unless $file_path and -e $file_path;
-	for my $ed (keys %document) {
-		return 1 if $document{$ed}->file_path and $document{$ed}->file_path eq $file_path;
-	}
-}
-1;

File lib/Kephra/Edit.pm

View file
  • Ignore whitespace
 use warnings;
 
 use Wx;
+use Kephra::API;
 use Kephra::Config;
-use Kephra::CommandList;
 
 #package Kephra::Edit;
 
 package Kephra::App::Editor;
-Kephra::CommandList::register_cmd_namespace('edit');
-Kephra::CommandList::register_cmd({
+Kephra::API::Command::register_namespace('edit');
+Kephra::API::Command::register({
 	'+-undo'             =>{sub=>'$ed->Undo',             label=>'Undo',          keys=> 'ctrl+z'},
 	'+-redo'             =>{sub=>'$ed->Redo',             label=>'Redo',          keys=> 'ctrl+shift+z'},
 	'+-copy'             =>{sub=>'$ed->Copy',             label=>'Copy',          keys=> 'ctrl+c' },

File lib/Kephra/Edit/Comment.pm

View file
  • Ignore whitespace
 
 use Kephra::API;
 
-package Kephra::Edit::Comment;
+#package Kephra::Edit::Comment;
 package Kephra::App::Editor;
 
-Kephra::CommandList::register_cmd({
+Kephra::API::Command::register({
  '+-comment-toggle'=>{sub=>'$ed->toggle_comment', label=>'Toggle Comment', keys=>'alt+#' },
 });
 

File lib/Kephra/Edit/Format.pm

View file
  • Ignore whitespace
 use strict;
 use warnings;
 
+use Kephra::API;
 use Kephra::Config;
-use Kephra::CommandList;
 
 #package Kephra::Edit::Format;
 package Kephra::App::Editor;
 
-Kephra::CommandList::register_cmd({
+Kephra::API::Command::register({
  '+-goto-block-up'    =>{sub=>'$ed->ParaUp',                    label=>'Block Up',    keys=>'ctrl+up' },
  '+-goto-block-down'  =>{sub=>'$ed->ParaDown',                  label=>'Block Down',  keys=>'ctrl+down' },
  '+-select-block-up'  =>{sub=>'$ed->ParaUpExtend',              label=>'Block Up',    keys=>'ctrl+shift+up' },

File lib/Kephra/Edit/Search.pm

View file
  • Ignore whitespace
 use warnings;
 use Kephra::API;
 
-package Kephra::Edit::Search;
+#package Kephra::Edit::Search;
 package Kephra::App::Editor;
 
-Kephra::CommandList::register_cmd({
+Kephra::API::Command::register({
  '+-goto-char-left'   =>{sub=>'$ed->CharLeft',          label=>'Char Left',    keys=>'left' },
  '+-goto-char-right'  =>{sub=>'$ed->CharRight',         label=>'Char Right',   keys=>'right' },
  '+-select-char-left' =>{sub=>'$ed->CharLeftExtend',    label=>'Select Left',  keys=>'shift+left' },

File lib/Kephra/EventTable.pm

  • Ignore whitespace
-use strict;
-use warnings;
-use Kephra::API;
-
-package Kephra::EventTable;
-
-my %event;
-
-sub add_callback {}
-sub del_callback {}
-sub trigger_callback {}
-sub freeze_callback {}
-sub thaw_callback{}
-
-sub add_event {}
-sub del_event {}
-sub trigger_event {}
-sub freeze_event {}
-sub thaw_event{}
-
-sub global_halt {}
-sub global_restore {}
-
-
-1;

File lib/Kephra/File.pm

View file
  • Ignore whitespace
 
 package Kephra::File;
 
-Kephra::CommandList::register_cmd_namespace('file');
-Kephra::CommandList::register_cmd({
+Kephra::API::Command::register_namespace('file');
+Kephra::API::Command::register({
  '+-new'        =>{sub=> 'new',          label=> 'New',        keys=> 'ctrl+n'},
  '+-open'       =>{sub=> 'open',         label=> 'Open ...',   keys=> 'ctrl+o'},
  '+-reopen'     =>{sub=> 'reopen_active',label=> 'Reopen',     keys=> 'ctrl+shift+o'},

File lib/Kephra/Help.pm

View file
  • Ignore whitespace
 
 package Kephra::Help;
 
-Kephra::CommandList::register_cmd_namespace('help');
-Kephra::CommandList::register_cmd({
+Kephra::API::Command::register_namespace('help');
+Kephra::API::Command::register({
  '+-documentation'=>{sub=>'Kephra::App::Dialog::documentation',label=>'Documentation',keys=> 'F1'},
  '+-about'        =>{sub=>'Kephra::App::Dialog::about',        label=>'About...',     keys=> 'ctrl+alt+a'},
  '+-homepage'     =>{sub=>'lounch_url',                        label=>'Homepage',     parameter => 'http://kephra.sourceforge.net/site/en/home_news.shtml'},

File lib/Kephra/KeyMap.pm

  • Ignore whitespace
-use strict;
-use warnings;
-use Wx;
-use Kephra::API;
-
-package Kephra::KeyMap;
-
-my %definition;
-my %code;
-my %mod_key_value = ( shift => 1000, ctrl => 2000, alt  => 4000);
-my %key_value = (
-	left  => &Wx::WXK_LEFT,      right => &Wx::WXK_RIGHT,
-	up    => &Wx::WXK_UP,         down => &Wx::WXK_DOWN,
-	pageup=> &Wx::WXK_PAGEUP, pagedown => &Wx::WXK_PAGEDOWN,
-	home  => &Wx::WXK_HOME,        end => &Wx::WXK_END,
-	delete => &Wx::WXK_DELETE,  insert => &Wx::WXK_INSERT,
-	back  => &Wx::WXK_BACK,        tab => &Wx::WXK_TAB,
-	esc   => &Wx::WXK_ESCAPE,    
-	enter => &Wx::WXK_RETURN,    space => &Wx::WXK_SPACE,
-	F1 => &Wx::WXK_F1, F2 => &Wx::WXK_F2,  F3 => &Wx::WXK_F3,  F4 => &Wx::WXK_F4,
-	F5 => &Wx::WXK_F5, F6 => &Wx::WXK_F6,  F7 => &Wx::WXK_F7,  F8 => &Wx::WXK_F8,
-	F9 => &Wx::WXK_F9,F10 => &Wx::WXK_F10,F11 => &Wx::WXK_F11,F12 => &Wx::WXK_F12,
-	pound => 35, tilde => 92,
-	num_left  => &Wx::WXK_NUMPAD_LEFT,  num_right=> &Wx::WXK_NUMPAD_RIGHT,
-	num_up    => &Wx::WXK_NUMPAD_UP,    num_down => &Wx::WXK_NUMPAD_DOWN,
-	num_space => &Wx::WXK_NUMPAD_SPACE, num_tab  => &Wx::WXK_NUMPAD_TAB,
-	num_enter => &Wx::WXK_NUMPAD_ENTER, num_F1   => &Wx::WXK_NUMPAD_F1,
-);
-my $main_map = 'editor';
-
-sub apply {}
-sub build {}
-sub copy {}
-sub overlay {}
-sub register_map {
-}
-
-sub register_keys {
-	my ($keys, $map) = @_;
-	return Kephra::Log::warning ("got no hashref") unless ref $keys eq ref {};
-	$map = $main_map unless defined $map;
-	for my $cmd (keys %$keys) {
-		$definition{$map}{ $cmd } = $keys->{$cmd};
-		my $code = code_from_definition( $keys->{$cmd} );
-		unless (exists $code{$map}{ $code }) { $code{$map}{ $code } = $cmd }
-		else {
-			Kephra::Log::warning("$cmd tried to register the already taken keycode $code");
-		}
-	}
-}
-
-sub code_registered {
-	my ($code, $map) = @_;
-	Kephra::Log::warning ('got no key code') unless $code;
-	$map = $main_map unless defined $map;
-	return 1 if defined $code{$map}{$code} and $code{$map}{$code}
-}
-
-sub cmd_from_code {
-	my ($code, $map) = @_;
-	Kephra::Log::warning ('got no key code') unless $code;
-	$map = $main_map unless defined $map;
-	$code{$map}{$code};
-}
-
-sub code_from_definition {
-	my $def = shift;
-	$def =~ tr/ 	//d;
-	Kephra::Log::warning ('got no key definition') unless $def;
-
-	my @key = split '\+', $def;           # only + can combine key in definition
-	my $code = length($key[-1]) == 1 ? ord uc $key[-1] : $key_value{ $key[-1] };
-	Kephra::Log::warning ('don\'t know this key '.$key[-1]) unless $code;
-
-	$code += $mod_key_value{ shift(@key) } while @key > 1;
-	Kephra::Log::warning ("got unknown key definition $def") unless $code;
-	return $code;
-}
-
-sub code_from_event {
-	my $event = shift;
-	Kephra::Log::warning ("got no event, but $event")unless $event and $event->isa('Wx::Event');
-	my $code = $event->GetKeyCode;
-	$code += $mod_key_value{'shift'} if $event->ShiftDown;
-	$code += $mod_key_value{'ctrl'} if $event->ControlDown;
-	$code += $mod_key_value{'alt'} if $event->AltDown;
-	return $code;
-}
-
-sub react_on_event {
-	my ($event, $map) = @_;
-	Kephra::Log::warning ("got no event, but $event") unless $event and $event->isa('Wx::Event');
-	$map = $main_map unless defined $map;
-	my $key = code_from_event($event);
-	Kephra::API::log("pressed key $key inside the ".(caller)[0]);
-	if (code_registered($key)){
-			my $cmd = cmd_from_code($key);
-			Kephra::API::log("run command: $cmd");
-			Kephra::CommandList::run_cmd( $cmd );
-	}
-	else {$event->Skip}
-}
-
-1;

File lib/Kephra/PluginRegistrar.pm

  • Ignore whitespace
-use strict;
-use warnings;
-
-package Kephra::PluginRegistrar;
-
-# init the registered plugins
-sub start {}
-
-# register a plugin
-sub register {}
-sub unregister {}
-
-# load and unload a specific plugin
-sub load {}
-sub unload {}
-
-1;

File lib/Kephra/SandrumInterpreter.pm

  • Ignore whitespace
-use strict;
-use warnings;
-
-package Kephra::SandrumInterpreter;
-
-
-1;