text
stringlengths 0
234
|
|---|
Buffer : Buffer_Ptr;
|
Argc : int;
|
Argv : access chars_ptr;
|
Unused_Argv_EOL : access chars_ptr) return Callback_Result
|
is
|
Raw_Arguments : chars_ptr_array (1 .. size_t (Argc))
|
with Address => (if Argv /= null then Argv.all'Address else System.Null_Address),
|
Import => True;
|
function Get_Argument (Index : Positive) return String
|
with Pre => Index <= Integer (Argc) or else
|
raise Constraint_Error with "Index" & Index'Image & " not in 1 .." & Argc'Image;
|
function Get_Argument (Index : Positive) return String is
|
(Value (Raw_Arguments (size_t (Index))));
|
Arguments : String_List (1 .. Raw_Arguments'Length);
|
begin
|
for Index in Arguments'Range loop
|
Arguments (Index) := SU.To_Unbounded_String (Get_Argument (Index));
|
end loop;
|
return Callback (Data.Plugin, Buffer, Arguments);
|
exception
|
when E : others =>
|
Print_Error (Data.Plugin, E);
|
return Error;
|
end Command_Callback;
|
function Command_Run_Callback
|
(Callback : On_Command_Run_Callback;
|
Data : Data_Ptr;
|
Buffer : Buffer_Ptr;
|
Command : chars_ptr) return Callback_Result is
|
begin
|
return Callback (Data.Plugin, Buffer, Value (Command));
|
exception
|
when E : others =>
|
Print_Error (Data.Plugin, E);
|
return Error;
|
end Command_Run_Callback;
|
function Completion_Callback
|
(Callback : On_Completion_Callback;
|
Data : Data_Ptr;
|
Item : chars_ptr;
|
Buffer : Buffer_Ptr;
|
Completion : Completion_Ptr) return Callback_Result is
|
begin
|
return Callback (Data.Plugin, Value (Item), Buffer, Completion);
|
exception
|
when E : others =>
|
Print_Error (Data.Plugin, E);
|
return Error;
|
end Completion_Callback;
|
function Modifier_Callback
|
(Callback : On_Modifier_Callback;
|
Data : Data_Ptr;
|
Modifier : chars_ptr;
|
Modifier_Data : chars_ptr;
|
Text : chars_ptr) return chars_ptr is
|
begin
|
return New_String
|
(Callback (Data.Plugin, Value (Modifier), Value (Modifier_Data), Value (Text)));
|
exception
|
when E : others =>
|
Print_Error (Data.Plugin, E);
|
return Text;
|
end Modifier_Callback;
|
----------------------------------------------------------------------------
|
function Get_Value (Plugin : Plugin_Ptr; Data : Hashtable_Ptr; Key : String) return String is
|
Result : constant chars_ptr := Plugin.Hashtable_Get (Data, Key & L1.NUL);
|
begin
|
if Result /= Null_Ptr then
|
return Value (Result);
|
else
|
raise Constraint_Error with "Key '" & Key & "' does not exist";
|
end if;
|
end Get_Value;
|
function Get_Value (Plugin : Plugin_Ptr; Data : Hashtable_Ptr; Key : String) return Integer is
|
(Integer'Value (Get_Value (Plugin, Data, Key)));
|
function Get_Value (Plugin : Plugin_Ptr; Data : Hashtable_Ptr; Key : String) return Boolean is
|
(Get_Value (Plugin, Data, Key) = 1);
|
function Get_Value
|
(Plugin : Plugin_Ptr;
|
Data : Hashtable_Ptr;
|
Key : String) return SU.Unbounded_String
|
is (SU.To_Unbounded_String (String'(Get_Value (Plugin, Data, Key))));
|
function Get_Value
|
(Plugin : Plugin_Ptr;
|
Data : Hashtable_Ptr;
|
Key : String) return Line_Buffer_Kind
|
is
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.