////////////////////////////////////////////////////////////////////// // // // jdevEvalModify.pas: Evaulate / Modify dialog (ala Delphi) // // This is basically a nicer interface to the expression parser // // and DWARF variable database. // // // // The contents of this file are subject to the Bottled Light // // Public License Version 1.0 (the "License"); you may not use this // // file except in compliance with the License. You may obtain a // // copy of the License at http://www.bottledlight.com/BLPL/ // // // // Software distributed under the License is distributed on an // // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or // // implied. See the License for the specific language governing // // rights and limitations under the License. // // // // The Original Code is the Mappy VM User Interface, released // // April 1st, 2003. The Initial Developer of the Original Code is // // Bottled Light, Inc. Portions created by Bottled Light, Inc. are // // Copyright (C) 2001-2003 Bottled Light, Inc. All Rights Reserved. // // // // Author(s): // // Michael Noland (joat), michael@bottledlight.com // // // // Changelog: // // 1.0: First public release (April 1st, 2003) // // // // Notes: // // None at present. // // // ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// unit jdevEvalModify; ///////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// interface //////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, dwarfUtils, nexus, dbgExpressions, console, AddressSpace; ////////////////////////////////////////////////////////////////////// type TjdevModify = class(TForm) lExpression: TLabel; lResult: TLabel; source: TComboBox; results: TMemo; bListAll: TButton; bClear: TButton; procedure ListAllVariables(Sender: TObject); procedure ClearResults(Sender: TObject); procedure FormHide(Sender: TObject); procedure FormCreate(Sender: TObject); procedure sourceKeyPress(Sender: TObject; var Key: Char); procedure FormDeactivate(Sender: TObject); private { Private declarations } public end; ////////////////////////////////////////////////////////////////////// var jdevModify: TjdevModify; ////////////////////////////////////////////////////////////////////// implementation /////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// {$R *.DFM} ////////////////////////////////////////////////////////////////////// procedure TjdevModify.sourceKeyPress(Sender: TObject; var Key: Char); var disp: string; res: integer; begin if key in [#10, #13] then begin results.clear; res := EvaluateExpression(source.Text); if uint32(res) > 100000 then disp := '%s is $%.8x' else disp := '%s is %d'; // results.Lines.Add(dwarfLookupVal(source.Text)); results.Lines.Add(Format(disp, [source.Text, res])); end; end; ////////////////////////////////////////////////////////////////////// procedure TjdevModify.ListAllVariables(Sender: TObject); var lines: TStringList; begin results.clear; lines := TStringList.Create; WalkVariables(lines); results.Lines.AddStrings(lines); lines.Free; end; ////////////////////////////////////////////////////////////////////// procedure TjdevModify.ClearResults(Sender: TObject); begin results.Clear; end; ////////////////////////////////////////////////////////////////////// procedure TjdevModify.FormHide(Sender: TObject); begin results.clear; end; ////////////////////////////////////////////////////////////////////// procedure TjdevModify.FormCreate(Sender: TObject); begin HelpContext := LinkHelp('expressions.html'); end; ////////////////////////////////////////////////////////////////////// procedure TjdevModify.FormDeactivate(Sender: TObject); begin // Close; end; ////////////////////////////////////////////////////////////////////// end. //////////////////////////////////////////////////////////////////////