Update of /project/rdnzl/cvsroot/RDNZL/examples In directory common-lisp:/tmp/cvs-serv4420/examples
Modified Files: AproposGui.cs apropos.lisp apropos2.lisp deliver-acl.lisp deliver-ccl.lisp deliver-lw.lisp messagebox.lisp url.lisp Log Message: 0.9.0 release
--- /project/rdnzl/cvsroot/RDNZL/examples/AproposGui.cs 2005/01/03 00:55:44 1.1.1.1 +++ /project/rdnzl/cvsroot/RDNZL/examples/AproposGui.cs 2006/02/01 01:00:57 1.2 @@ -1,108 +1,108 @@ -// $Header: /project/rdnzl/cvsroot/RDNZL/examples/AproposGui.cs,v 1.1.1.1 2005/01/03 00:55:44 eweitz Exp $ - -// Copyright (c) 2004-2005, Dr. Edmund Weitz. All rights reserved. - -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: - -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. - -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials -// provided with the distribution. - -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED -// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// compile this with: -// csc.exe /target:library AproposGui.cs -// and put the resulting DLL into your Lisp's application folder - -using System; -using System.Collections; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Windows.Forms; - -namespace AproposGUI { - public class AproposControl : System.Windows.Forms.UserControl { - public System.Windows.Forms.TextBox textBox; - public System.Windows.Forms.TextBox listBox; - private System.Windows.Forms.Label label; - public System.Windows.Forms.Label title; - private delegate string callback(string input); - - private System.ComponentModel.Container components = null; - - public AproposControl() { - InitializeComponent(); - } - - protected override void Dispose(bool disposing) { - if (disposing) { - if (components != null) - components.Dispose(); - } - base.Dispose(disposing); - } - - private void InitializeComponent() { - this.textBox = new System.Windows.Forms.TextBox(); - this.listBox = new System.Windows.Forms.TextBox(); - this.label = new System.Windows.Forms.Label(); - this.title = new System.Windows.Forms.Label(); - this.SuspendLayout(); - - this.textBox.Location = new System.Drawing.Point(16, 344); - this.textBox.Name = "textBox"; - this.textBox.Size = new System.Drawing.Size(584, 20); - this.textBox.TabIndex = 0; - this.textBox.Text = ""; - - this.listBox.Location = new System.Drawing.Point(16, 56); - this.listBox.Multiline = true; - this.listBox.Name = "listBox"; - this.listBox.ReadOnly = true; - this.listBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.listBox.Size = new System.Drawing.Size(584, 248); - this.listBox.TabIndex = 1; - this.listBox.Text = ""; - - this.label.Location = new System.Drawing.Point(24, 312); - this.label.Name = "label"; - this.label.Size = new System.Drawing.Size(576, 23); - this.label.TabIndex = 2; - this.label.Text = "Enter text below and press RETURN"; - this.label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - - this.title.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); - this.title.Location = new System.Drawing.Point(24, 16); - this.title.Name = "title"; - this.title.Size = new System.Drawing.Size(568, 24); - this.title.TabIndex = 3; - this.title.Text = "RDNZL Apropos Demo"; - this.title.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - - this.Controls.Add(this.title); - this.Controls.Add(this.label); - this.Controls.Add(this.listBox); - this.Controls.Add(this.textBox); - this.Name = "MainControl"; - this.Size = new System.Drawing.Size(616, 384); - this.ResumeLayout(false); - } - } -} +// $Header: /project/rdnzl/cvsroot/RDNZL/examples/AproposGui.cs,v 1.2 2006/02/01 01:00:57 eweitz Exp $ + +// Copyright (c) 2004-2006, Dr. Edmund Weitz. All rights reserved. + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: + +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. + +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials +// provided with the distribution. + +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED +// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// compile this with: +// csc.exe /target:library AproposGui.cs +// and put the resulting DLL into your Lisp's application folder + +using System; +using System.Collections; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Windows.Forms; + +namespace AproposGUI { + public class AproposControl : System.Windows.Forms.UserControl { + public System.Windows.Forms.TextBox textBox; + public System.Windows.Forms.TextBox listBox; + private System.Windows.Forms.Label label; + public System.Windows.Forms.Label title; + private delegate string callback(string input); + + private System.ComponentModel.Container components = null; + + public AproposControl() { + InitializeComponent(); + } + + protected override void Dispose(bool disposing) { + if (disposing) { + if (components != null) + components.Dispose(); + } + base.Dispose(disposing); + } + + private void InitializeComponent() { + this.textBox = new System.Windows.Forms.TextBox(); + this.listBox = new System.Windows.Forms.TextBox(); + this.label = new System.Windows.Forms.Label(); + this.title = new System.Windows.Forms.Label(); + this.SuspendLayout(); + + this.textBox.Location = new System.Drawing.Point(16, 344); + this.textBox.Name = "textBox"; + this.textBox.Size = new System.Drawing.Size(584, 20); + this.textBox.TabIndex = 0; + this.textBox.Text = ""; + + this.listBox.Location = new System.Drawing.Point(16, 56); + this.listBox.Multiline = true; + this.listBox.Name = "listBox"; + this.listBox.ReadOnly = true; + this.listBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.listBox.Size = new System.Drawing.Size(584, 248); + this.listBox.TabIndex = 1; + this.listBox.Text = ""; + + this.label.Location = new System.Drawing.Point(24, 312); + this.label.Name = "label"; + this.label.Size = new System.Drawing.Size(576, 23); + this.label.TabIndex = 2; + this.label.Text = "Enter text below and press RETURN"; + this.label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + + this.title.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); + this.title.Location = new System.Drawing.Point(24, 16); + this.title.Name = "title"; + this.title.Size = new System.Drawing.Size(568, 24); + this.title.TabIndex = 3; + this.title.Text = "RDNZL Apropos Demo"; + this.title.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + + this.Controls.Add(this.title); + this.Controls.Add(this.label); + this.Controls.Add(this.listBox); + this.Controls.Add(this.textBox); + this.Name = "MainControl"; + this.Size = new System.Drawing.Size(616, 384); + this.ResumeLayout(false); + } + } +} --- /project/rdnzl/cvsroot/RDNZL/examples/apropos.lisp 2005/01/03 00:55:43 1.1.1.1 +++ /project/rdnzl/cvsroot/RDNZL/examples/apropos.lisp 2006/02/01 01:00:57 1.2 @@ -1,90 +1,88 @@ -;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: RDNZL; Base: 10 -*- -;;; $Header: /project/rdnzl/cvsroot/RDNZL/examples/apropos.lisp,v 1.1.1.1 2005/01/03 00:55:43 eweitz Exp $ - -;;; Copyright (c) 2004-2005, Dr. Edmund Weitz. All rights reserved. - -;;; Redistribution and use in source and binary forms, with or without -;;; modification, are permitted provided that the following conditions -;;; are met: - -;;; * Redistributions of source code must retain the above copyright -;;; notice, this list of conditions and the following disclaimer. - -;;; * Redistributions in binary form must reproduce the above -;;; copyright notice, this list of conditions and the following -;;; disclaimer in the documentation and/or other materials -;;; provided with the distribution. - -;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED -;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -(in-package :cl-user) - -(use-package :rdnzl) - -(enable-rdnzl-syntax) - -(import-types "System.Windows.Forms" - "Application" "DockStyle" "Form" "MessageBox" "KeyPressEventHandler" "TextBox") - -(import-types "AproposGUI" - "AproposControl") - -(use-namespace "System.Windows.Forms") -(use-namespace "AproposGUI") - -(defun copy-to-clipboard (text-box) - (let ((selection-start [%SelectionStart text-box]) - (selection-length [%SelectionLength text-box]) - (text-length [%Length (box [%Text text-box])])) - (setf [%SelectionStart text-box] 0 - [%SelectionLength text-box] text-length) - [Copy text-box] - (setf [%SelectionStart text-box] selection-start - [%SelectionLength text-box] selection-length))) - -(let (message-shown) - (defun fill-list-box (object event) - (when (char= [%KeyChar event] #\Return) - (cast object "TextBox") - (let* ((input-string [%Text object]) - (input-length (length input-string))) - (when (plusp input-length) - (let ((apropos-text - (with-output-to-string (*standard-output*) - (apropos input-string))) - (list-box [$listBox (cast [%Parent object] "AproposControl")])) - #+:cormanlisp (setq apropos-text (lf-to-crlf apropos-text)) - (setf [%Text list-box] apropos-text) - (copy-to-clipboard list-box) - (unless message-shown - [MessageBox.Show "The output of APROPOS has been copied to the clipboard." - "RDNZL"] - (setq message-shown t))) - (setf [%SelectionStart object] 0 - [%SelectionLength object] input-length)))))) - -(defun run-apropos-form () - (let* ((control (new "AproposControl")) - (form (new "Form"))) - (setf [%Dock control] [$DockStyle.Fill] - [%ClientSize form] [%ClientSize control] - [%Text form] "RDNZL Apropos Demo" - [%Text [$title control]] - (format nil "RDNZL Apropos Demo (~A)" - (lisp-implementation-type))) - [+KeyPress [$textBox control] - (new "KeyPressEventHandler" #'fill-list-box)] - [Add [%Controls form] control] - [Application.Run form])) - +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: RDNZL; Base: 10 -*- +;;; $Header: /project/rdnzl/cvsroot/RDNZL/examples/apropos.lisp,v 1.2 2006/02/01 01:00:57 eweitz Exp $ + +;;; Copyright (c) 2004-2006, Dr. Edmund Weitz. All rights reserved. + +;;; Redistribution and use in source and binary forms, with or without +;;; modification, are permitted provided that the following conditions +;;; are met: + +;;; * Redistributions of source code must retain the above copyright +;;; notice, this list of conditions and the following disclaimer. + +;;; * Redistributions in binary form must reproduce the above +;;; copyright notice, this list of conditions and the following +;;; disclaimer in the documentation and/or other materials +;;; provided with the distribution. + +;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED +;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +(in-package :rdnzl-user) + +(enable-rdnzl-syntax) + +(import-types "System.Windows.Forms" + "Application" "DockStyle" "Form" "MessageBox" "KeyPressEventHandler" "TextBox") + +(import-types "AproposGUI" + "AproposControl") + +(use-namespace "System.Windows.Forms") +(use-namespace "AproposGUI") + +(defun copy-to-clipboard (text-box) + (let ((selection-start [%SelectionStart text-box]) + (selection-length [%SelectionLength text-box]) + (text-length [%Length (box [%Text text-box])])) + (setf [%SelectionStart text-box] 0 + [%SelectionLength text-box] text-length) + [Copy text-box] + (setf [%SelectionStart text-box] selection-start + [%SelectionLength text-box] selection-length))) + +(let (message-shown) + (defun fill-list-box (object event) + (when (char= [%KeyChar event] #\Return) + (cast object "TextBox") + (let* ((input-string [%Text object]) + (input-length (length input-string))) + (when (plusp input-length) + (let ((apropos-text + (with-output-to-string (*standard-output*) + (apropos input-string))) + (list-box [$listBox (cast [%Parent object] "AproposControl")])) + #+:cormanlisp (setq apropos-text (lf-to-crlf apropos-text)) + (setf [%Text list-box] apropos-text) + (copy-to-clipboard list-box) + (unless message-shown + [MessageBox.Show "The output of APROPOS has been copied to the clipboard." + "RDNZL"] + (setq message-shown t))) + (setf [%SelectionStart object] 0 + [%SelectionLength object] input-length)))))) + +(defun run-apropos-form () + (let* ((control (new "AproposControl")) + (form (new "Form"))) + (setf [%Dock control] [$DockStyle.Fill] + [%ClientSize form] [%ClientSize control] + [%Text form] "RDNZL Apropos Demo" + [%Text [$title control]] + (format nil "RDNZL Apropos Demo (~A)" + (lisp-implementation-type))) + [+KeyPress [$textBox control] + (new "KeyPressEventHandler" #'fill-list-box)] + [Add [%Controls form] control] + [Application.Run form])) + (disable-rdnzl-syntax) \ No newline at end of file --- /project/rdnzl/cvsroot/RDNZL/examples/apropos2.lisp 2005/01/03 00:55:43 1.1.1.1 +++ /project/rdnzl/cvsroot/RDNZL/examples/apropos2.lisp 2006/02/01 01:00:57 1.2 @@ -1,201 +1,199 @@ -;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: RDNZL; Base: 10 -*- -;;; $Header: /project/rdnzl/cvsroot/RDNZL/examples/apropos2.lisp,v 1.1.1.1 2005/01/03 00:55:43 eweitz Exp $ - -;;; Copyright (c) 2004-2005, Dr. Edmund Weitz. All rights reserved. - -;;; Redistribution and use in source and binary forms, with or without -;;; modification, are permitted provided that the following conditions -;;; are met: - -;;; * Redistributions of source code must retain the above copyright -;;; notice, this list of conditions and the following disclaimer. - -;;; * Redistributions in binary form must reproduce the above -;;; copyright notice, this list of conditions and the following -;;; disclaimer in the documentation and/or other materials -;;; provided with the distribution. - -;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED -;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -;;; same as apropos.lisp but using "direct calls" - -(in-package :cl-user) - -(use-package :rdnzl) - -(eval-when (:compile-toplevel :load-toplevel :execute) - ;; wrapped in EVAL-WHEN because these must be available when the - ;; direct calls are defined - (import-types "System.Windows.Forms" - "Application" "Control" "Control+ControlCollection" "DockStyle" "Form" - "MessageBox" "KeyPressEventArgs" "KeyPressEventHandler" "TextBox") - - (import-types "AproposGUI" - "AproposControl") - - (use-namespace "System.Windows.Forms") - (use-namespace "AproposGUI")) - -;; an instance property -(define-rdnzl-call controls - (:member-kind :property) - ((control "Control"))) - -;; we can't use the standard name here because LENGTH is an external -;; symbol of the COMMON-LISP package -(define-rdnzl-call string-length - (:member-kind :property - :dotnet-name "Length") - ((string "System.String"))) - -(define-rdnzl-call text - (:member-kind :property) - ((control "Control"))) - -;; a setter function for an instance property -(define-rdnzl-call (setf text) - (:member-kind :property) - ((control "Control"))) - -(define-rdnzl-call (setf dock) - (:member-kind :property) - ((control "Control"))) - -(define-rdnzl-call client-size - (:member-kind :property) - ((control "Control"))) - -(define-rdnzl-call (setf client-size) - (:member-kind :property) - ((control "Control"))) - -(define-rdnzl-call selection-start - (:member-kind :property) - ((text-box "TextBox"))) - -(define-rdnzl-call (setf selection-start) - (:member-kind :property) - ((text-box "TextBox"))) - -(define-rdnzl-call selection-length - (:member-kind :property) - ((text-box "TextBox"))) - -(define-rdnzl-call (setf selection-length) - (:member-kind :property) - ((text-box "TextBox"))) - -(define-rdnzl-call parent - (:member-kind :property) - ((string "TextBox"))) - -;; an instance method -(define-rdnzl-call copy - () - ((text-box "TextBox"))) - -(define-rdnzl-call key-char - (:member-kind :property) - ((event "KeyPressEventArgs"))) - -;; an instance field (which should have been called "Title" instead of -;; "title") -(define-rdnzl-call title - (:member-kind :field - :dotnet-name "title") - ((control "AproposControl"))) - -(define-rdnzl-call list-box - (:member-kind :field - :dotnet-name "listBox") - ((control "AproposControl"))) - -(define-rdnzl-call text-box - (:member-kind :field - :dotnet-name "textBox") - ((control "AproposControl"))) - -(define-rdnzl-call add - () - ((collection "Control+ControlCollection") - (control "Control"))) - -;; a static method of the .NET type MessageBox -(define-rdnzl-call show - (:type-name "MessageBox") - ((text "System.String") - (caption "System.String"))) - -(define-rdnzl-call run-form - (:type-name "Application" - ;; renamed because deliver-xx.lisp already contains a RUN - ;; function - :dotnet-name "Run") - ((form "Form"))) - -;; a static field of the .NET type DockStyle (which is an enumeration) -(define-rdnzl-call dock-style/fill - (:member-kind :field - :dotnet-name "Fill" - :type-name "DockStyle") - ()) - -(define-rdnzl-call add-key-press - (:dotnet-name "add_KeyPress") - ((text-box "TextBox") - (handler "KeyPressEventHandler"))) - -(defun copy-to-clipboard (text-box) - (let ((selection-start (selection-start text-box)) - (selection-length (selection-length text-box)) - (text-length (string-length (box (text text-box))))) - (setf (selection-start text-box) 0 - (selection-length text-box) text-length) - (copy text-box) - (setf (selection-start text-box) selection-start - (selection-length text-box) selection-length))) - -(let (message-shown) - (defun fill-list-box (object event) - (when (char= (key-char event) #\Return) - (cast object "TextBox") - (let* ((input-string (text object)) - (input-length (length input-string))) - (when (plusp input-length) - (let ((apropos-text - (with-output-to-string (*standard-output*) - (apropos input-string))) - (list-box (list-box (cast (parent object) "AproposControl")))) - #+:cormanlisp (setq apropos-text (lf-to-crlf apropos-text)) - (setf (text list-box) apropos-text) - (copy-to-clipboard list-box) - (unless message-shown - (show "The output of APROPOS has been copied to the clipboard." - "RDNZL") - (setq message-shown t))) - (setf (selection-start object) 0 - (selection-length object) input-length)))))) - -(defun run-apropos-form () - (let* ((control (new "AproposControl")) - (form (new "Form"))) - (setf (dock control) (dock-style/fill) - (client-size form) (client-size control) - (text form) "RDNZL Apropos Demo" - (text (title control)) - (format nil "RDNZL Apropos Demo (~A)" - (lisp-implementation-type))) - (add-key-press (text-box control) - (new "KeyPressEventHandler" #'fill-list-box)) - (add (controls form) control) +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: RDNZL; Base: 10 -*- +;;; $Header: /project/rdnzl/cvsroot/RDNZL/examples/apropos2.lisp,v 1.2 2006/02/01 01:00:57 eweitz Exp $ + +;;; Copyright (c) 2004-2006, Dr. Edmund Weitz. All rights reserved. + +;;; Redistribution and use in source and binary forms, with or without +;;; modification, are permitted provided that the following conditions +;;; are met: + +;;; * Redistributions of source code must retain the above copyright +;;; notice, this list of conditions and the following disclaimer. + +;;; * Redistributions in binary form must reproduce the above +;;; copyright notice, this list of conditions and the following +;;; disclaimer in the documentation and/or other materials +;;; provided with the distribution. + +;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED +;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; same as apropos.lisp but using "direct calls" + +(in-package :rdnzl-user) + +(eval-when (:compile-toplevel :load-toplevel :execute) + ;; wrapped in EVAL-WHEN because these must be available when the + ;; direct calls are defined + (import-types "System.Windows.Forms" + "Application" "Control" "Control+ControlCollection" "DockStyle" "Form" + "MessageBox" "KeyPressEventArgs" "KeyPressEventHandler" "TextBox") + + (import-types "AproposGUI" + "AproposControl") + + (use-namespace "System.Windows.Forms") + (use-namespace "AproposGUI")) + +;; an instance property +(define-rdnzl-call controls + (:member-kind :property) + ((control "Control"))) + +;; we can't use the standard name here because LENGTH is an external +;; symbol of the COMMON-LISP package +(define-rdnzl-call string-length + (:member-kind :property + :dotnet-name "Length") + ((string "System.String"))) + +(define-rdnzl-call text + (:member-kind :property) + ((control "Control"))) + +;; a setter function for an instance property +(define-rdnzl-call (setf text) + (:member-kind :property) + ((control "Control"))) + +(define-rdnzl-call (setf dock) + (:member-kind :property) + ((control "Control"))) + +(define-rdnzl-call client-size + (:member-kind :property) + ((control "Control"))) + +(define-rdnzl-call (setf client-size) + (:member-kind :property) + ((control "Control"))) + +(define-rdnzl-call selection-start + (:member-kind :property) + ((text-box "TextBox"))) + +(define-rdnzl-call (setf selection-start) + (:member-kind :property) + ((text-box "TextBox"))) + +(define-rdnzl-call selection-length + (:member-kind :property) + ((text-box "TextBox"))) + +(define-rdnzl-call (setf selection-length) + (:member-kind :property) + ((text-box "TextBox"))) + +(define-rdnzl-call parent + (:member-kind :property) + ((string "TextBox"))) + +;; an instance method +(define-rdnzl-call copy + () + ((text-box "TextBox"))) + +(define-rdnzl-call key-char + (:member-kind :property) + ((event "KeyPressEventArgs"))) + +;; an instance field (which should have been called "Title" instead of +;; "title") +(define-rdnzl-call title + (:member-kind :field + :dotnet-name "title") + ((control "AproposControl"))) + +(define-rdnzl-call list-box + (:member-kind :field + :dotnet-name "listBox") + ((control "AproposControl"))) + +(define-rdnzl-call text-box + (:member-kind :field + :dotnet-name "textBox") + ((control "AproposControl"))) + +(define-rdnzl-call add + () + ((collection "Control+ControlCollection") + (control "Control"))) + +;; a static method of the .NET type MessageBox +(define-rdnzl-call show + (:type-name "MessageBox") + ((text "System.String") + (caption "System.String"))) + +(define-rdnzl-call run-form + (:type-name "Application" + ;; renamed because deliver-xx.lisp already contains a RUN + ;; function + :dotnet-name "Run") + ((form "Form"))) + +;; a static field of the .NET type DockStyle (which is an enumeration) +(define-rdnzl-call dock-style/fill + (:member-kind :field + :dotnet-name "Fill" + :type-name "DockStyle") + ()) + +(define-rdnzl-call add-key-press + (:dotnet-name "add_KeyPress") + ((text-box "TextBox") + (handler "KeyPressEventHandler"))) + +(defun copy-to-clipboard (text-box) + (let ((selection-start (selection-start text-box)) + (selection-length (selection-length text-box)) + (text-length (string-length (box (text text-box))))) + (setf (selection-start text-box) 0 + (selection-length text-box) text-length) + (copy text-box) + (setf (selection-start text-box) selection-start + (selection-length text-box) selection-length))) + +(let (message-shown) + (defun fill-list-box (object event) + (when (char= (key-char event) #\Return) + (cast object "TextBox") + (let* ((input-string (text object)) + (input-length (length input-string))) + (when (plusp input-length) + (let ((apropos-text + (with-output-to-string (*standard-output*) + (apropos input-string))) + (list-box (list-box (cast (parent object) "AproposControl")))) + #+:cormanlisp (setq apropos-text (lf-to-crlf apropos-text)) + (setf (text list-box) apropos-text) + (copy-to-clipboard list-box) + (unless message-shown + (show "The output of APROPOS has been copied to the clipboard." + "RDNZL") + (setq message-shown t))) + (setf (selection-start object) 0 + (selection-length object) input-length)))))) + +(defun run-apropos-form () + (let* ((control (new "AproposControl")) + (form (new "Form"))) + (setf (dock control) (dock-style/fill) + (client-size form) (client-size control) + (text form) "RDNZL Apropos Demo" + (text (title control)) + (format nil "RDNZL Apropos Demo (~A)" + (lisp-implementation-type))) + (add-key-press (text-box control) + (new "KeyPressEventHandler" #'fill-list-box))
[3 lines skipped] --- /project/rdnzl/cvsroot/RDNZL/examples/deliver-acl.lisp 2005/01/03 00:55:44 1.1.1.1 +++ /project/rdnzl/cvsroot/RDNZL/examples/deliver-acl.lisp 2006/02/01 01:00:57 1.2 @@ -1,70 +1,70 @@ -;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: RDNZL; Base: 10 -*- -;;; $Header: /project/rdnzl/cvsroot/RDNZL/examples/deliver-acl.lisp,v 1.1.1.1 2005/01/03 00:55:44 eweitz Exp $ - -;;; Copyright (c) 2004-2005, Charles A. Cox. All rights reserved. - -;;; Redistribution and use in source and binary forms, with or without -;;; modification, are permitted provided that the following conditions -;;; are met: - -;;; * Redistributions of source code must retain the above copyright -;;; notice, this list of conditions and the following disclaimer. - -;;; * Redistributions in binary form must reproduce the above -;;; copyright notice, this list of conditions and the following -;;; disclaimer in the documentation and/or other materials -;;; provided with the distribution. - -;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED -;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -;;; Example: How to deliver a RDNZL application with AllegroCL - -(in-package :cl-user) - -(eval-when (:compile-toplevel :load-toplevel :execute) - (require :res)) - -(defparameter *rdnzl-directory* - ;; assume this file is in examples/ subdirectory - (merge-pathnames #p".." - (make-pathname :name nil - :type nil - :version nil - :defaults *load-truename*))) - -;; make sure RDNZL is loaded so that we can compile apropos.lisp -;; (better to use provide/require for this?) -(unless (find-package ':rdnzl) - (load (merge-pathnames #p"load.lisp" *rdnzl-directory*))) - -(let ((*default-pathname-defaults* *rdnzl-directory*)) - (generate-application - "apropos" ; application name - (merge-pathnames #p"examples/apropos/") ; application directory - ;; list of files to load in the image being built - (list (merge-pathnames #p"load.lisp") - (merge-pathnames (compile-file #p"examples/apropos.lisp"))) - ;; extra files used at runtime - :application-files (list (merge-pathnames #p"rdnzl.dll") - (merge-pathnames #p"examples/AproposGui.dll")) - :discard-compiler t - :allow-existing-directory t - :post-load-form '(rdnzl:shutdown-rdnzl) - :restart-app-function '(lambda () - (rdnzl:init-rdnzl) - (run-apropos-form) - (exit))) - - (win:set-default-command-line-arguments #p"examples/apropos/apropos.exe" - ;; suppress console - '("+c"))) +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: RDNZL; Base: 10 -*- +;;; $Header: /project/rdnzl/cvsroot/RDNZL/examples/deliver-acl.lisp,v 1.2 2006/02/01 01:00:57 eweitz Exp $ + +;;; Copyright (c) 2004-2006, Charles A. Cox. All rights reserved. + +;;; Redistribution and use in source and binary forms, with or without +;;; modification, are permitted provided that the following conditions +;;; are met: + +;;; * Redistributions of source code must retain the above copyright +;;; notice, this list of conditions and the following disclaimer. + +;;; * Redistributions in binary form must reproduce the above +;;; copyright notice, this list of conditions and the following +;;; disclaimer in the documentation and/or other materials +;;; provided with the distribution. + +;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED +;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Example: How to deliver a RDNZL application with AllegroCL + +(in-package :cl-user) + +(eval-when (:compile-toplevel :load-toplevel :execute) + (require :res)) + +(defparameter *rdnzl-directory* + ;; assume this file is in examples/ subdirectory + (merge-pathnames #p".." + (make-pathname :name nil + :type nil + :version nil + :defaults *load-truename*))) + +;; make sure RDNZL is loaded so that we can compile apropos.lisp +;; (better to use provide/require for this?) +(unless (find-package ':rdnzl) + (load (merge-pathnames #p"load.lisp" *rdnzl-directory*))) + +(let ((*default-pathname-defaults* *rdnzl-directory*)) + (generate-application + "apropos" ; application name + (merge-pathnames #p"examples/apropos/") ; application directory + ;; list of files to load in the image being built + (list (merge-pathnames #p"load.lisp") + (merge-pathnames (compile-file #p"examples/apropos.lisp"))) + ;; extra files used at runtime + :application-files (list (merge-pathnames #p"rdnzl.dll") + (merge-pathnames #p"examples/AproposGui.dll")) + :discard-compiler t + :allow-existing-directory t + :post-load-form '(rdnzl:shutdown-rdnzl) + :restart-app-function '(lambda () + (rdnzl:init-rdnzl) + (run-apropos-form) + (exit))) + + (win:set-default-command-line-arguments #p"examples/apropos/apropos.exe" + ;; suppress console + '("+c"))) --- /project/rdnzl/cvsroot/RDNZL/examples/deliver-ccl.lisp 2005/01/03 00:55:44 1.1.1.1 +++ /project/rdnzl/cvsroot/RDNZL/examples/deliver-ccl.lisp 2006/02/01 01:00:57 1.2 @@ -1,83 +1,83 @@ -;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: RDNZL; Base: 10 -*- -;;; $Header: /project/rdnzl/cvsroot/RDNZL/examples/deliver-ccl.lisp,v 1.1.1.1 2005/01/03 00:55:44 eweitz Exp $ - -;;; Copyright (c) 2004-2005, Dr. Edmund Weitz. All rights reserved. - -;;; Redistribution and use in source and binary forms, with or without -;;; modification, are permitted provided that the following conditions -;;; are met: - -;;; * Redistributions of source code must retain the above copyright -;;; notice, this list of conditions and the following disclaimer. - -;;; * Redistributions in binary form must reproduce the above -;;; copyright notice, this list of conditions and the following -;;; disclaimer in the documentation and/or other materials -;;; provided with the distribution. - -;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED -;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -;;; Example: How to deliver a RDNZL application with Corman Common Lisp - -;;; Usage: Start clconsole.exe and from there -;;; (LOAD "/path/to/RDNZL/examples/deliver-ccl.lisp") - -(in-package :cl-user) - -(defun copy-file (from to) - (let ((element-type '(unsigned-byte 8))) - (with-open-file (in from - :element-type element-type) - (with-open-file (out to - :direction :output - :if-exists :supersede - :element-type element-type) - (loop for byte = (read-byte in nil nil) - while byte - do (write-byte byte out)))))) - -(defparameter *rdnzl-directory* - ;; assume this file is in examples/ subdirectory - (make-pathname :name nil - :type nil - :version nil - :directory (butlast (pathname-directory *load-truename*)) - :defaults *load-truename*)) - -(setf (ccl:current-directory) *rdnzl-directory*) - -(load "load.lisp") -(load "examples/apropos.lisp") - -(defun main () - (rdnzl:init-rdnzl) - (run-apropos-form) - (shutdown-rdnzl)) - -(rdnzl:shutdown-rdnzl) - -(let ((target-dir - (merge-pathnames "examples/apropos/" *rdnzl-directory*))) - (defun target-path (file-name) - (merge-pathnames file-name target-dir))) - -(copy-file "RDNZL.dll" (ensure-directories-exist - (target-path "RDNZL.dll"))) -(copy-file "examples/AproposGUI.dll" (target-path "AproposGUI.dll")) -(copy-file (concatenate 'string ccl:*cormanlisp-server-directory* "\msvcr70.dll") - (target-path "msvcr70.dll")) - -(ccl:save-application (namestring (target-path "apropos.exe")) - #'main - :console nil +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: RDNZL; Base: 10 -*- +;;; $Header: /project/rdnzl/cvsroot/RDNZL/examples/deliver-ccl.lisp,v 1.2 2006/02/01 01:00:57 eweitz Exp $ + +;;; Copyright (c) 2004-2006, Dr. Edmund Weitz. All rights reserved. + +;;; Redistribution and use in source and binary forms, with or without +;;; modification, are permitted provided that the following conditions +;;; are met: + +;;; * Redistributions of source code must retain the above copyright +;;; notice, this list of conditions and the following disclaimer. + +;;; * Redistributions in binary form must reproduce the above +;;; copyright notice, this list of conditions and the following +;;; disclaimer in the documentation and/or other materials +;;; provided with the distribution. + +;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED +;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Example: How to deliver a RDNZL application with Corman Common Lisp + +;;; Usage: Start clconsole.exe and from there +;;; (LOAD "/path/to/RDNZL/examples/deliver-ccl.lisp") + +(in-package :cl-user) + +(defun copy-file (from to) + (let ((element-type '(unsigned-byte 8))) + (with-open-file (in from + :element-type element-type) + (with-open-file (out to + :direction :output + :if-exists :supersede + :element-type element-type) + (loop for byte = (read-byte in nil nil) + while byte + do (write-byte byte out)))))) + +(defparameter *rdnzl-directory* + ;; assume this file is in examples/ subdirectory + (make-pathname :name nil + :type nil + :version nil + :directory (butlast (pathname-directory *load-truename*)) + :defaults *load-truename*)) + +(setf (ccl:current-directory) *rdnzl-directory*) + +(load "load.lisp") +(load "examples/apropos.lisp") + +(defun main () + (rdnzl:init-rdnzl) + (run-apropos-form) + (shutdown-rdnzl)) + +(rdnzl:shutdown-rdnzl) + +(let ((target-dir + (merge-pathnames "examples/apropos/" *rdnzl-directory*))) + (defun target-path (file-name) + (merge-pathnames file-name target-dir))) + +(copy-file "RDNZL.dll" (ensure-directories-exist + (target-path "RDNZL.dll"))) +(copy-file "examples/AproposGUI.dll" (target-path "AproposGUI.dll")) +(copy-file (concatenate 'string ccl:*cormanlisp-server-directory* "\msvcr70.dll") + (target-path "msvcr70.dll")) + +(ccl:save-application (namestring (target-path "apropos.exe")) + #'main + :console nil :static t) \ No newline at end of file --- /project/rdnzl/cvsroot/RDNZL/examples/deliver-lw.lisp 2005/07/08 18:45:40 1.2 +++ /project/rdnzl/cvsroot/RDNZL/examples/deliver-lw.lisp 2006/02/01 01:00:57 1.3 @@ -1,97 +1,97 @@ -;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: RDNZL; Base: 10 -*- -;;; $Header: /project/rdnzl/cvsroot/RDNZL/examples/deliver-lw.lisp,v 1.2 2005/07/08 18:45:40 eweitz Exp $ - -;;; Copyright (c) 2004-2005, Dr. Edmund Weitz. All rights reserved. - -;;; Redistribution and use in source and binary forms, with or without -;;; modification, are permitted provided that the following conditions -;;; are met: - -;;; * Redistributions of source code must retain the above copyright -;;; notice, this list of conditions and the following disclaimer. - -;;; * Redistributions in binary form must reproduce the above -;;; copyright notice, this list of conditions and the following -;;; disclaimer in the documentation and/or other materials -;;; provided with the distribution. - -;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED -;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -;;; Example: How to deliver a RDNZL application with LispWorks - -;;; Usage: Open up a console window and execute somthing like this: -;;; "C:\Program Files\LispWorks\lispworks-4450.exe" -init "C:\path\to\RDNZL\examples\deliver-lw.lisp" - -(in-package :cl-user) - -(defun copy-file (from to) - (let ((element-type '(unsigned-byte 8)) - (buffer-size 8192)) - (with-open-file (in from - :element-type element-type) - (with-open-file (out to - :direction :output - :if-exists :supersede - :element-type element-type) - (let ((buf (make-array buffer-size - :element-type element-type))) - (loop - (let ((pos (read-sequence buf in))) - (when (zerop pos) (return)) - (write-sequence buf out :end pos)))))))) -(compile 'copy-file) - -(defparameter *rdnzl-directory* - ;; assume this file is in examples/ subdirectory - (merge-pathnames #p".." - (make-pathname :name nil - :type nil - :version nil - :defaults *load-truename*))) - -(hcl:change-directory *rdnzl-directory*) -(load "load.lisp") -(load (compile-file "examples/apropos.lisp")) - -(defun run () - (rdnzl:init-rdnzl) - (run-apropos-form) - 0) -(compile 'run) - -(rdnzl:shutdown-rdnzl) - -(defparameter *target-directory* - (merge-pathnames "examples/apropos/" *rdnzl-directory*)) - -(defun target-path (file-name) - (merge-pathnames file-name *target-directory*)) -(compile 'target-path) - -(copy-file "RDNZL.dll" (ensure-directories-exist - (target-path "RDNZL.dll"))) -(copy-file "examples/AproposGUI.dll" (target-path "AproposGUI.dll")) - -(hcl:change-directory *target-directory*) - -(lw:deliver #'run "apropos" - ;; we could use 5 here but then APROPOS wouldn't make much - ;; sense... :) - 4 - :compact t - :redefine-compiler-p nil - :keep-symbol-names '(rdnzl::LispCallback rdnzl::ReleaseDelegateAdapter) - :keep-lisp-reader t - :console :input) - +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: RDNZL; Base: 10 -*- +;;; $Header: /project/rdnzl/cvsroot/RDNZL/examples/deliver-lw.lisp,v 1.3 2006/02/01 01:00:57 eweitz Exp $ + +;;; Copyright (c) 2004-2006, Dr. Edmund Weitz. All rights reserved. + +;;; Redistribution and use in source and binary forms, with or without +;;; modification, are permitted provided that the following conditions +;;; are met: + +;;; * Redistributions of source code must retain the above copyright +;;; notice, this list of conditions and the following disclaimer. + +;;; * Redistributions in binary form must reproduce the above +;;; copyright notice, this list of conditions and the following +;;; disclaimer in the documentation and/or other materials +;;; provided with the distribution. + +;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED +;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Example: How to deliver a RDNZL application with LispWorks + +;;; Usage: Open up a console window and execute somthing like this: +;;; "C:\Program Files\LispWorks\lispworks-4450.exe" -init "C:\path\to\RDNZL\examples\deliver-lw.lisp" + +(in-package :cl-user) + +(defun copy-file (from to) + (let ((element-type '(unsigned-byte 8)) + (buffer-size 8192)) + (with-open-file (in from + :element-type element-type) + (with-open-file (out to + :direction :output + :if-exists :supersede + :element-type element-type) + (let ((buf (make-array buffer-size + :element-type element-type))) + (loop + (let ((pos (read-sequence buf in))) + (when (zerop pos) (return)) + (write-sequence buf out :end pos)))))))) +(compile 'copy-file) + +(defparameter *rdnzl-directory* + ;; assume this file is in examples/ subdirectory + (merge-pathnames #p".." + (make-pathname :name nil + :type nil + :version nil + :defaults *load-truename*))) + +(hcl:change-directory *rdnzl-directory*) +(load "load.lisp") +(load (compile-file "examples/apropos.lisp")) + +(defun run () + (rdnzl:init-rdnzl) + (run-apropos-form) + 0) +(compile 'run) + +(rdnzl:shutdown-rdnzl) + +(defparameter *target-directory* + (merge-pathnames "examples/apropos/" *rdnzl-directory*)) + +(defun target-path (file-name) + (merge-pathnames file-name *target-directory*)) +(compile 'target-path) + +(copy-file "RDNZL.dll" (ensure-directories-exist + (target-path "RDNZL.dll"))) +(copy-file "examples/AproposGUI.dll" (target-path "AproposGUI.dll")) + +(hcl:change-directory *target-directory*) + +(lw:deliver #'run "apropos" + ;; we could use 5 here but then APROPOS wouldn't make much + ;; sense... :) + 4 + :compact t + :redefine-compiler-p nil + :keep-symbol-names '(rdnzl::LispCallback rdnzl::ReleaseDelegateAdapter) + :keep-lisp-reader t + :console :input) + (quit) \ No newline at end of file --- /project/rdnzl/cvsroot/RDNZL/examples/messagebox.lisp 2005/01/03 00:55:44 1.1.1.1 +++ /project/rdnzl/cvsroot/RDNZL/examples/messagebox.lisp 2006/02/01 01:00:57 1.2 @@ -1,47 +1,45 @@ -;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: RDNZL; Base: 10 -*- -;;; $Header: /project/rdnzl/cvsroot/RDNZL/examples/messagebox.lisp,v 1.1.1.1 2005/01/03 00:55:44 eweitz Exp $ - -;;; Copyright (c) 2004-2005, Dr. Edmund Weitz. All rights reserved. - -;;; Redistribution and use in source and binary forms, with or without -;;; modification, are permitted provided that the following conditions -;;; are met: - -;;; * Redistributions of source code must retain the above copyright -;;; notice, this list of conditions and the following disclaimer. - -;;; * Redistributions in binary form must reproduce the above -;;; copyright notice, this list of conditions and the following -;;; disclaimer in the documentation and/or other materials -;;; provided with the distribution. - -;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED -;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -(in-package :cl-user) - -(use-package :rdnzl) - -(enable-rdnzl-syntax) - -(import-types "System.Windows.Forms" - "MessageBox" "MessageBoxButtons" "DialogResult") - -(use-namespace "System.Windows.Forms") - -(defun message-box (text &optional (caption "RDNZL")) - [Equals [MessageBox.Show text caption - ;; we want the message box to have "OK" and "Cancel" buttons - [$MessageBoxButtons.OKCancel]] - [$DialogResult.OK]]) - -(disable-rdnzl-syntax) +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: RDNZL; Base: 10 -*- +;;; $Header: /project/rdnzl/cvsroot/RDNZL/examples/messagebox.lisp,v 1.2 2006/02/01 01:00:57 eweitz Exp $ + +;;; Copyright (c) 2004-2006, Dr. Edmund Weitz. All rights reserved. + +;;; Redistribution and use in source and binary forms, with or without +;;; modification, are permitted provided that the following conditions +;;; are met: + +;;; * Redistributions of source code must retain the above copyright +;;; notice, this list of conditions and the following disclaimer. + +;;; * Redistributions in binary form must reproduce the above +;;; copyright notice, this list of conditions and the following +;;; disclaimer in the documentation and/or other materials +;;; provided with the distribution. + +;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED +;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +(in-package :rdnzl-user) + +(enable-rdnzl-syntax) + +(import-types "System.Windows.Forms" + "MessageBox" "MessageBoxButtons" "DialogResult") + +(use-namespace "System.Windows.Forms") + +(defun message-box (text &optional (caption "RDNZL")) + [Equals [MessageBox.Show text caption + ;; we want the message box to have "OK" and "Cancel" buttons + [$MessageBoxButtons.OKCancel]] + [$DialogResult.OK]]) + +(disable-rdnzl-syntax) --- /project/rdnzl/cvsroot/RDNZL/examples/url.lisp 2005/01/03 00:55:44 1.1.1.1 +++ /project/rdnzl/cvsroot/RDNZL/examples/url.lisp 2006/02/01 01:00:57 1.2 @@ -1,49 +1,47 @@ -;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: RDNZL; Base: 10 -*- -;;; $Header: /project/rdnzl/cvsroot/RDNZL/examples/url.lisp,v 1.1.1.1 2005/01/03 00:55:44 eweitz Exp $ - -;;; Copyright (c) 2004-2005, Dr. Edmund Weitz. All rights reserved. - -;;; Redistribution and use in source and binary forms, with or without -;;; modification, are permitted provided that the following conditions -;;; are met: - -;;; * Redistributions of source code must retain the above copyright -;;; notice, this list of conditions and the following disclaimer. - -;;; * Redistributions in binary form must reproduce the above -;;; copyright notice, this list of conditions and the following -;;; disclaimer in the documentation and/or other materials -;;; provided with the distribution. - -;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED -;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -(in-package :cl-user) - -(use-package :rdnzl) - -(enable-rdnzl-syntax) - -(import-types "System" "Net.WebClient" "Net.WebException") - -(use-namespace "System.Net") - -(defun download-url (url) - (rdnzl-handler-case - (let ((web-client (new "WebClient"))) - [GetString (new "System.Text.ASCIIEncoding") - [DownloadData web-client url]]) - ("WebException" (e) - (warn "Ooops, probably a typo: ~A" [%Message e]) - nil))) - +;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: RDNZL; Base: 10 -*- +;;; $Header: /project/rdnzl/cvsroot/RDNZL/examples/url.lisp,v 1.2 2006/02/01 01:00:57 eweitz Exp $ + +;;; Copyright (c) 2004-2006, Dr. Edmund Weitz. All rights reserved. + +;;; Redistribution and use in source and binary forms, with or without +;;; modification, are permitted provided that the following conditions +;;; are met: + +;;; * Redistributions of source code must retain the above copyright +;;; notice, this list of conditions and the following disclaimer. + +;;; * Redistributions in binary form must reproduce the above +;;; copyright notice, this list of conditions and the following +;;; disclaimer in the documentation and/or other materials +;;; provided with the distribution. + +;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED +;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +(in-package :rdnzl-user) + +(enable-rdnzl-syntax) + +(import-types "System" "Net.WebClient" "Net.WebException") + +(use-namespace "System.Net") + +(defun download-url (url) + (rdnzl-handler-case + (let ((web-client (new "WebClient"))) + [GetString (new "System.Text.ASCIIEncoding") + [DownloadData web-client url]]) + ("WebException" (e) + (warn "Ooops, probably a typo: ~A" [%Message e]) + nil))) + (disable-rdnzl-syntax) \ No newline at end of file