IPB

Willkommen, Gast ( Anmelden | Registrierung )

 
Reply to this topicStart new topic
> Plugins mit Free-Pascal erstellen
meybohm
Beitrag 16.03.2004 - 10:28
Beitrag #1


is getting harder


Gruppe: User
Beiträge: 12
Mitglied seit: 31.10.2001
Mitglieds-Nr.: 6



QUELLTEXT
{
delete_html_tags.pas


Dieses Plugin löscht alle HTML-Tags innerhalb des geöffneten
Proton-Dokuments bzw. innerhalb des markierten Textes.


Beispielplugin
Proton Plugins mit dem Free Pascal Compiler erstellen.
Zum kompilieren folgenden Befehl aufrufen:
c:ppbinwin32ppc386 -Sd delete_html_tags.pas


Hinweis:
Um Proton als Free-Pascal IDE zu nutzen, einfach
folgenden Shortcut in den Programmeinstellungen
definieren:
command.com /k c:ppbinwin32ppc386 -Sd %A%
}


library delete_html_tags;


uses
 regexpr;


const KEINE_RUECKGABE=0;
     RUECKGABE_ERSETZT_MARKIERUNG = 1;
     RUECKGABE_ERSETZT_EDITORTEXT = 2;


var RUECKGABETYP:integer;


function pluginStart(text:pchar; selstart,sellength:integer) : pchar;  export;stdcall;
var
  r : tregexprengine;
  i,len : longint;
  s:string;
begin
r:=GenerateRegExprEngine('<[^>]+>',[]);
SetString(s,text,strlen(text));
if (sellength=0) then
 RUECKGABETYP:=RUECKGABE_ERSETZT_EDITORTEXT
else
    begin
 s:=copy(s,selstart+1,sellength);
 RUECKGABETYP:=RUECKGABE_ERSETZT_MARKIERUNG;
    end;
while RegExprPos(r,pchar(s),i,len) do
    begin
 delete(s,i+1,len);
    end;
DestroyregExprEngine(r);
pluginStart := pchar(s);
end;


function pluginRueckgabetyp:Integer;export;stdcall;
begin
 pluginRueckgabetyp :=RUECKGABETYP;
end;

function pluginInterfaceVersion: integer; export;stdcall;
begin
 pluginInterfaceVersion := 1;
end;

exports
pluginRueckgabetyp,
pluginStart,
pluginInterfaceVersion;


end.
Go to the top of the page
 
+Quote Post
meybohm
Beitrag 16.03.2004 - 16:36
Beitrag #2


is getting harder


Gruppe: User
Beiträge: 12
Mitglied seit: 31.10.2001
Mitglieds-Nr.: 6



QUELLTEXT
library base64_encode;

uses classes, base64, sysutils;


const KEINE_RUECKGABE=0;
     RUECKGABE_ERSETZT_MARKIERUNG = 1;
     RUECKGABE_ERSETZT_EDITORTEXT = 2;

var RUECKGABETYP:integer;

function pluginStart(text:pchar; selstart,sellength:integer) : pchar;  export;stdcall;
var
  b64enc:TBase64EncodingStream;
  BaseStream: TMemoryStream;
begin
BaseStream := TMemoryStream.Create;
b64enc:=TBase64EncodingStream.Create(BaseStream);
if (sellength>0) then
    begin
 RUECKGABETYP:=RUECKGABE_ERSETZT_MARKIERUNG;
 b64enc.write((text+selstart)^,sellength);
    end
else
    begin
 RUECKGABETYP:=RUECKGABE_ERSETZT_EDITORTEXT;
 b64enc.write(text^,strlen(text));
    end;
while (b64enc.size mod 3)<>0 do
    b64enc.write(#0,1);
b64enc.free;
pluginStart := pchar(BaseStream.memory);
end;

function pluginRueckgabetyp:Integer;export;stdcall;
begin
 pluginRueckgabetyp :=RUECKGABETYP;
end;

function pluginInterfaceVersion: integer; export;stdcall;
begin
 pluginInterfaceVersion := 1;
end;

exports
pluginRueckgabetyp,
pluginStart,
pluginInterfaceVersion;

end.
Go to the top of the page
 
+Quote Post
meybohm
Beitrag 16.03.2004 - 16:38
Beitrag #3


is getting harder


Gruppe: User
Beiträge: 12
Mitglied seit: 31.10.2001
Mitglieds-Nr.: 6



QUELLTEXT
library base64_decode;

uses classes, base64, sysutils;

const KEINE_RUECKGABE=0;
     RUECKGABE_ERSETZT_MARKIERUNG = 1;
     RUECKGABE_ERSETZT_EDITORTEXT = 2;

var RUECKGABETYP:integer;

function pluginStart(text:pchar; selstart,sellength:integer) : pchar;  export;stdcall;
var
  b64dec:TBase64DecodingStream;
  input: TMemoryStream;
  s:string;
  isend:boolean;
begin
Input := TMemoryStream.Create;
if (sellength>0) then
    begin
 input.write((text+selstart)^,sellength);
 RUECKGABETYP:=RUECKGABE_ERSETZT_MARKIERUNG;
    end
else
    begin
 input.write(text^,strlen(text));
 RUECKGABETYP:=RUECKGABE_ERSETZT_EDITORTEXT;
    end;
input.seek(0,soFromBeginning);
b64dec:=TBase64DecodingStream.Create(input);
 IsEnd := False;
 while not IsEnd do
   try
     s:=s+Chr(b64dec.ReadByte);
   except
     on e: EStreamError do IsEnd := True;
   end;
pluginStart := pchar(s);
input.free;
b64dec.free;
end;

function pluginRueckgabetyp:Integer;export;stdcall;
begin
 pluginRueckgabetyp :=RUECKGABETYP;
end;

function pluginInterfaceVersion: integer; export;stdcall;
begin
 pluginInterfaceVersion := 1;
end;

exports
pluginRueckgabetyp,
pluginStart,
pluginInterfaceVersion;

end.
Go to the top of the page
 
+Quote Post
meybohm
Beitrag 21.03.2004 - 11:04
Beitrag #4


is getting harder


Gruppe: User
Beiträge: 12
Mitglied seit: 31.10.2001
Mitglieds-Nr.: 6



QUELLTEXT
{
html__generate_bullet_list.pas

Dieses Plugin erstellt aus dem markierten Zeilen bzw. aus dem
Proton-Dokument eine HTML-Bulletliste

<ul>
<li>line[0..n]</li>
</ul>

Beispielplugin
Proton Plugins mit dem Free Pascal Compiler erstellen.
Zum kompilieren folgenden Befehl aufrufen:
c:ppbinwin32ppc386 -Sd delete_html_tags.pas

Hinweis:
Um Proton als Free-Pascal IDE zu nutzen, einfach
folgenden Shortcut in den Programmeinstellungen
definieren:
command.com /k c:ppbinwin32ppc386 -Sd %A%
}

library html__generate_bullet_list;
uses classes;

const KEINE_RUECKGABE=0;
     RUECKGABE_ERSETZT_MARKIERUNG = 1;
     RUECKGABE_ERSETZT_EDITORTEXT = 2;

var RUECKGABETYP:integer;

function pluginStart(text:pchar; selstart,sellength:integer) : pchar;  export;stdcall;
var
  s:string;
  list:TStrings;
  i:integer;
begin
SetString(s,text,strlen(text));
if (sellength=0) then
 RUECKGABETYP:=RUECKGABE_ERSETZT_EDITORTEXT
else
    begin
 s:=copy(s,selstart+1,sellength);
 RUECKGABETYP:=RUECKGABE_ERSETZT_MARKIERUNG;
    end;
list:=TStringlist.create;
list.text:=s;
for i:=0 to list.count-1 do
    begin
 list[i]:='<li>'+list[i]+'</li>';
    end;
pluginStart := pchar('<ul>'+#10+list.text+#10+'</ul>');
end;

function pluginRueckgabetyp:Integer;export;stdcall;
begin
 pluginRueckgabetyp :=RUECKGABETYP;
end;

function pluginInterfaceVersion: integer; export;stdcall;
begin
 pluginInterfaceVersion := 1;
end;

exports
pluginRueckgabetyp,
pluginStart,
pluginInterfaceVersion;

end.
Go to the top of the page
 
+Quote Post
Google Bot
Beitrag
Beitrag #


Google Ads









Go to the top of the page
 
Quote Post

Reply to this topicStart new topic
1 Besucher lesen dieses Thema (Gäste: 1 | Anonyme Besucher: 0)
0 Mitglieder:

 



RSS Vereinfachte Darstellung Aktuelles Datum: 28.03.2024 - 13:42

taschenkalender
expertise-panel IPS Driver Error

IPS Driver Error

There appears to be an error with the database.
You can try to refresh the page by clicking here