Autor Beitrag
HHDS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Win 98, Win XP Home
Delphi 7 Personal
BeitragVerfasst: Di 13.05.08 11:16 
Tach,

Ich bin gerade dabei, eine Programmierumgebung in Delphi 7 zu programmieren. Jetzt ist das Problem, dass ich keine Ahnung habe, wie man die Funktionen definiert.

Ein Beispiel:

Die "ShowMessage" - Funktion (in Delphi) soll der (in TRC++) "MsgBox()" -entsprechen. Jetzt ist die Frage, wie man das macht? Kann mir Jemand helfen? :(

Fragen über Fragen. Bitte schnellstmöglich auf Antwort (möglichst keine Gegenfragen) :)

Moderiert von user profile iconNarses: 2. Frage entfernt
Moderiert von user profile iconUGrohne: Topic aus Gemeinschaftsprojekte verschoben am Di 13.05.2008 um 12:53
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 13.05.08 11:23 
Gegenfrage: Hast Du die Suche genutzt??? :mrgreen:

Ferner: Eine Frage pro Thread :mahn:

Zu den Antworten:

1. Wrapper-Funktionen schreiben

2. CreateProcess; oder Wrapper dafür ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Di 13.05.08 11:30 
Also ich hab keine Ahnung, wie man einen Compiler baut. Aber wenn der Code einfach nur interpretiert werden soll, dann würde ich das so machen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
var
  sbrace, ebrace: Integer;
  i: Integer;
  argument: string;
begin
i := 1;
while i <= Length(Memo1.Text) do
begin
  try
    if UpperCase(Copy(Memo1.Text, i, Length('MsgBox'))) = 'MSGBOX' then    // mit Case-InSensitive
    begin
      i := i + Length('MsgBox');
      while Memo1.Text[i] <> '(' do
        i := i + 1;
      sBrace := i;
      while Memo1.Text[i] <> ')' do
        i := i + 1;
      eBrace := i;
      argument := Copy(Memo1.Text, sBrace + 1, eBrace - sBrace - 1);
      ShowMessage(argument);
    end;
  except
    exit;
  end;
  i := i + 1;   // Inc(i);
end;
end;


Zum Beispiel bei

ausblenden Quelltext
1:
MsGbOx    (Hallo Welt!)					


oder

ausblenden Quelltext
1:
MSGBOX(Hallo Welt!)					


oder

ausblenden Quelltext
1:
2:
3:
MsgBox

(Hallo Welt!)


wird "Hallo Welt!" ausgegeben.

//EDIT: Mich wundert es, dass noch niemand das Topic verschoben hat. :?


Zuletzt bearbeitet von Jakob_Ullmann am Di 13.05.08 11:58, insgesamt 2-mal bearbeitet
HHDS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Win 98, Win XP Home
Delphi 7 Personal
BeitragVerfasst: Di 13.05.08 11:36 
Hy danke, mit so schneller antwort hätte ich jetzt nicht gerechnet aber gut.
Anders: Könnte mal jemand ein Tut zum CreateProcess schreiben? Danke schonmal im vorraus

Moderiert von user profile iconNarses: Bezug zur 2. Frage entfernt
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 13.05.08 11:38 
Such hier im Forum mal nach Suche in der Entwickler-Ecke TDOSCOMMAND, das ist ein Wrapper dafür ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
HHDS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Win 98, Win XP Home
Delphi 7 Personal
BeitragVerfasst: Mi 14.05.08 09:53 
Ja gut und wie soll ich das jetzt insgesamt machen? Ich meine soll ich jetzt ein Textbox - Steuerelement nehmen bzw RichEdit, den Delphicode dort eingeben, ein Button-Element ziehen, der dann den TRC++ Code compilert und dann ausgibt????
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mi 14.05.08 11:12 
Jup, grob gesagt ja ...

Im Grunde Zeilenweise (je nach dem) analysieren, was da steht, und daraus dann den entsprechenden Code erzeugen, den Du anschließend dann compilierst.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
HHDS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Win 98, Win XP Home
Delphi 7 Personal
BeitragVerfasst: Do 15.05.08 07:59 
Gut... Dann hätte ich jetzt meine vorletzte Frage. Wenn jetzt das ganze Zeug compiliert wird (TRC++) sollte ich dann da ein leeres Formular erstellen, der dann alle Objekte in diesem Fenster anzeigt. Tut mir leid für die ganzen Fragen, aber...
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Do 15.05.08 08:49 
Erläuter diese Frage mal etwas näher? Was willst Du mit dem Form denn machen?

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
HHDS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Win 98, Win XP Home
Delphi 7 Personal
BeitragVerfasst: Do 15.05.08 11:42 
Also... Wenn ich jetzt das TRC++ Programm testen will, soll ein neues Fenster erscheinen, in dem dann z.B. ein Auto fährt und ein Baum sich bewegt und all das in diesem leeren Form angezeigt werden soll
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Do 15.05.08 13:47 
Dann solltest Du dieses neue Fenster mit TRC++ erzeugen; ggf. als ne Art Rahmenprogramm gleich, wo dann nur noch der eigene Source zu ergänzt wird.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
HHDS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Win 98, Win XP Home
Delphi 7 Personal
BeitragVerfasst: Fr 16.05.08 09:43 
Ok fassen wir nocheinmal zusammen: Für die exe-generierung den CreateProcess, Formular erzeugen mit TRC++, Code Zeile für Zeile analysieren. Zu dem letzteren hab ich die Frage, in der Theorie wüsste ich es, aber in der Praxis nicht. Wie kann/soll ich den Code analysieren? Wäre vermutlich miene letzte Frage
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Fr 16.05.08 14:05 
Es wäre meiner Meinung nach sinnvoller, den Code Befehl für Befehl zu analysieren, weil ein Befehl kann ja auch mehrere Zeilen einnehmen bzw. zwei Befehle auf einer Zeile.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Fr 16.05.08 14:53 
Für das Analysieren nutzt man meistens Suche in: Delphi-Forum, Delphi-Library PARSER. Einfache Varianten kann man aber auch durchaus mit Copy und Pos schreiben. Kommt ein bisschen auf die zu analysierende Sprache drauf an ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Fr 16.05.08 15:10 
Eine auch wohl eher unsaubere Variante wäre vielleicht noch, mit Delphi ein Programm compilieren zu lassen. Das führt dann den Code eines Memos aus. Und dann erstellt das TRC++ einfach diese Datei, bloß halt das die Stelle, wo der Inhalt des Memos steht, durch den Code ersetzt wird.
mrretsnif
Hält's aus hier
Beiträge: 2



BeitragVerfasst: So 18.05.08 14:35 
Da wir schon bei diesem Thema mit dem "Rahmenprogramm" sind. Ich bin gerade dabei etwas ähnliches zu machen. Meine Frage wäre, wie man das mit dem Rahemnprogramm macht. Vielleicht kann mir jemand den Quelltext ggf. eine Anleitung posten (Ich frag es trotzdem, auch wenn ich dieses Thema nicht eröffnet habe...)
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 18.05.08 14:37 
Ein Rahmenprogramm kannst Du dir so ähnlich vorstellen, wie das, was Dir die Delphi-IDE präsentiert, wenn Du Datei --> Neu --> Anwendung auswählst.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
HHDS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Win 98, Win XP Home
Delphi 7 Personal
BeitragVerfasst: Mo 02.06.08 18:22 
Juut immernoch eine Frage, soll ich jetzt die Funktionen (Delphi) für jede eine eigene Unit erstellen und sie sann irgendwie mit der Memo1 verknüpfen oder direkt in den Memo1 quellcode einfügen???
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 02.06.08 20:26 
Was meinst Du da jetzt genau? Wie Du deinen Delphi-Source gliedern sollst, oder meinst Du die spätere Code-Erzeugung des Rahmen-Programms?

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
HHDS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Win 98, Win XP Home
Delphi 7 Personal
BeitragVerfasst: Di 03.06.08 17:58 
Also ich meinte das so, wenn man in den das Memo dann TRC++ eingibt, kann man ja nicht einfach ein halbfertiges Programm geben mit einem einfachen Texteditor, sondern eher eine gute Programmierumgebung. So, da müssen ja in das Delphi-source ja irgendwie die Funktionen definiert werden. Soll ich da jetzt für jede Funktion (z.B. MsgBox, oder string_integer) in TRC++ je eine Delphiunit proggen oder einfach in die Memo-prozedur schreiben oder doch per dll???