Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

ahkecl : Embedded common lisp in ahk


  • Please log in to reply
4 replies to this topic
tinku99
  • Members
  • 560 posts
  • Last active: Feb 08 2015 12:54 AM
  • Joined: 03 Aug 2007
AhkEcl https://ahknet.autoh...ku99/ahkecl.ahk
Download: https://ahknet.autoh...ku99/index.html

About
* Embeddable Common Lisp in Autohotkey v0.2 beta
*
* Idea from Dustin Long: <!-- m -->http://www.progmatis...clgui/index.php<!-- m -->
*
* Requires Autohotkey v1.0.47 or above.
*
* Home page: <!-- m -->http://www.autohotke...ic.php?p=222792<!-- m -->
*
* Embeddable Common Lisp : <!-- m -->http://ecls.sourceforge.net/<!-- m -->
*
Features
1. multithreading through ecl
2. modify ecl structures from ahk, brings better pointer access to ecl
3. work with arrays

TODO
1. call ahk callback functions from ecl
2. errors from ecl are silently ignored, should set errorlevel to ecl errors

ChangeLog

v0.2
- recompiled ecl to support threads
- example access to ecl pointers from ahk



* License
*	Copyright (c) 2008 tinku99 of AutoHotKey forums
*	
*	Permission is hereby granted, free of charge, to any person obtaining a copy
*	of this software and associated documentation files (the "Software"), to deal
*	in the Software without restriction, including without limitation the rights
*	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
*	copies of the Software, and to permit persons to whom the Software is
*	furnished to do so, subject to the following conditions:
*	
*	The above copyright notice and this permission notice shall be included in
*	all copies or substantial portions of the Software.
*	
*	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
*	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
*	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
*	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
*	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
*	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
*	THE SOFTWARE.
******
*/


  • Guests
  • Last active:
  • Joined: --
cool!!!

someone could do the same with haskell..

tinku99
  • Members
  • 560 posts
  • Last active: Feb 08 2015 12:54 AM
  • Joined: 03 Aug 2007
Version 0.2

ecl dll included
ecl with thread support

example: ecl pointer access from ahk

initPointer:
gosub bootECL
gosub uffi
gosub pointer
  Return

pointer:
sexp = 
(C
  (progn 
    (setf eclVar (allocate-foreign-object :int))
      (setf (deref-pointer eclVar :int) 6)
	(pointer-address eclVar))
 )	
 
eclPointer := EclEval(sexp)
eclVar := numget(eclPointer+0, 0)

numput(5, eclPointer+0)
EclVarChanged := EclEval("(deref-pointer eclVar :int)")
ListVars
gosub EclRepl
; (free-foreign-object intp)) 
return

#Include ahkecl.ahk    
#Include uffi.ahk
;; EclEval(sexp)
;; F1:: reload
;; F2:: ;; start Ecl REPL
;; F4:: ;; exitapp

license: https://ahknet.autoh...u99/license.ahk

tinku99
  • Members
  • 560 posts
  • Last active: Feb 08 2015 12:54 AM
  • Joined: 03 Aug 2007
ahk-style dynamic variables in lisp
this is one of my favorite features of ahk.

(defmacro set-string (string value) 
  `(setf 
    ,(read-from-string string) 
    ,value))
(defmacro set-symbol-string (symbol string value) 
  `(setf ,(read-from-string 
	   (concatenate 'string 
			(symbol-name symbol) 
			string))
	 ,value))

(defmacro set-symbol-number (symbol number value) 
  `(setf ,(read-from-string 
	   (concatenate 'string 
			(symbol-name symbol) 
			(format nil "~a" number)))
	 ,value))  
  
  (defmacro set-symbols (symbol symbol2 value) 
  `(setf ,(read-from-string 
	   (concatenate 'string 
			(symbol-name symbol) 
			(symbol-name symbol2)))
	 ,value))

(defmacro combine-symbols (x y) 
    `(intern ,(concatenate 'string
			   (symbol-name x)
			   (symbol-name y))))


 (set-string "dynamic-variable" "value") dynamic-variable
 (set-symbol-string array "a" "array-value") arraya
 (set-symbol-number array 1 "array-value") array1
 (set-symbols array b "arrayb example")  arrayb
https://ahknet.autoh...u99/license.ahk

tinku99
  • Members
  • 560 posts
  • Last active: Feb 08 2015 12:54 AM
  • Joined: 03 Aug 2007
lisp string access from ahk

ArrayInit:
gosub bootECL
gosub uffi
gosub cstring
gosub EclRepl
Return

cstring:
sexp = 
(C
  (progn 
(setf x "ecl string")
(si::pointer x))
)	

eclPointer := EclEval(sexp)
cstringP := numget(eclPointer+16, 0)
cstring = 
loop, 10
{
  cstring%A_Index% := chr(numget(cstringP + 0, A_Index - 1, "Char"))
  cstring := cstring . cstring%A_Index%
}
ListVars
return


#Include ahkecl.ahk    
#Include uffi.ahk
;; EclEval(sexp)
;; F1:: reload
;; F2:: ;; start Ecl REPL
;; F4:: ;; exitapp    

; eltType := numget(clPointer+0, 20, "UChar")
; offset := numget(clPointer+0, 21, "UChar")
license: https://ahknet.autoh...u99/license.ahk