Commits

Herbert Breunung committed 84c8ffb

added macro API

  • Participants
  • Parent commits 320b6b3

Comments (0)

Files changed (4)

File lib/Kephra/API.pm

-
 use strict;
 use warnings;
 use Carp;
 use Kephra::API::Docs;
 use Kephra::API::Event;
 use Kephra::API::KeyMap;
-use Kephra::API::Plugin;
-use Kephra::API::Sandrum;
+#use Kephra::API::Macro;
+#use Kephra::API::Plugin;
+#use Kephra::API::Sandrum;
 use Kephra::App::Focus;
 use Kephra::App::Window;
 use Kephra::Config;
+use Kephra::File;
 use Kephra::Help;
 use Kephra::Log;
-use Kephra::Worker;
+#use Kephra::Worker;
 
 
 package Kephra::API;

File lib/Kephra/API.pm~

-
-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

 		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;
+			$var->{$name} = $calling_module.'::'.$var->{$name} if index($var->{$name},'::') == -1;
 			$switch{'name'}{$name} = $var->{$name}
 				if $var->{$name} and defined &{ $var->{$name} };
 		}

File lib/Kephra/API/Macro.pm

+use strict;
+use warnings;
+
+package Kephra::API::Macro;
+
+
+1;