AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ahkecl : Embedded common lisp in ahk

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
tinku99



Joined: 03 Aug 2007
Posts: 399
Location: Houston, TX

PostPosted: Tue Sep 30, 2008 2:08 am    Post subject: ahkecl : Embedded common lisp in ahk Reply with quote

AhkEcl http://www.autohotkey.net/~tinku99/ahkecl.ahk
Download: http://www.autohotkey.net/~tinku99/index.html

About
* Embeddable Common Lisp in Autohotkey v0.2 beta
*
* Idea from Dustin Long: http://www.progmatism.com/hacks/eclgui/index.php
*
* Requires Autohotkey v1.0.47 or above.
*
* Home page: http://www.autohotkey.com/forum/viewtopic.php?p=222792
*
* Embeddable Common Lisp : http://ecls.sourceforge.net/
*
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



Code:

* 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.
******
*/


Last edited by tinku99 on Wed Dec 10, 2008 12:33 am; edited 7 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Guest






PostPosted: Sun Oct 26, 2008 3:24 am    Post subject: Reply with quote

cool!!!

someone could do the same with haskell..
Back to top
tinku99



Joined: 03 Aug 2007
Posts: 399
Location: Houston, TX

PostPosted: Tue Dec 09, 2008 11:10 pm    Post subject: Version 0.2 Reply with quote

Version 0.2

ecl dll included
ecl with thread support

example: ecl pointer access from ahk

Code:
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: http://www.autohotkey.net/~tinku99/license.ahk


Last edited by tinku99 on Wed Dec 10, 2008 12:25 am; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tinku99



Joined: 03 Aug 2007
Posts: 399
Location: Houston, TX

PostPosted: Wed Dec 10, 2008 12:20 am    Post subject: ahk style dynamic variables in lisp Reply with quote

ahk-style dynamic variables in lisp
this is one of my favorite features of ahk.

Code:
 (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

http://www.autohotkey.net/~tinku99/license.ahk
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tinku99



Joined: 03 Aug 2007
Posts: 399
Location: Houston, TX

PostPosted: Wed Dec 10, 2008 12:23 am    Post subject: lisp string access from ahk Reply with quote

lisp string access from ahk

Code:

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: http://www.autohotkey.net/~tinku99/license.ahk
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group