AutoHotkey Community

It is currently May 26th, 2012, 9:43 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: September 30th, 2008, 2:08 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
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 December 10th, 2008, 12:33 am, edited 7 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2008, 3:24 am 
cool!!!

someone could do the same with haskell..


Report this post
Top
  
Reply with quote  
 Post subject: Version 0.2
PostPosted: December 9th, 2008, 11:10 pm 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
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 December 10th, 2008, 12:25 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
PostPosted: December 10th, 2008, 12:20 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
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


Report this post
Top
 Profile  
Reply with quote  
PostPosted: December 10th, 2008, 12:23 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, Stigg and 13 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group