[Chicken-users] using macros at runtime

2009-01-06 Thread Heinrich Taube
im using chicken 3.0.0 . I  have a file with some define-macro in it  
like this:


(define-macro (send place . args)
 (expand-send place args))

I include that file in my main file ChickenBridge.scm

(include mymacros.scm)
(declare
(unit cm)
(run-time-macros)
(uses extras )
(usual-integrations)
(export
... send
))


I csc main main file and build my exictuable

csc -c++ -embedded -t ChickenBridge.scm


now when i start my executable my functions work but the send maco  
isnt defined:


(send mp:tuning 3)
Error: unbound variable: send


ive also tried

(define-for-syntax (send place . args)
 (expand-send place args))

but that doesnt work either. Im not sure what im doing wrong, im  
pretty sure I had this working at some point!  Any help would be  
greatly appreciated. I read the faq but i cant get define-syntax to  
work either.



--rick



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] eval from string with long strings.

2008-09-03 Thread Heinrich Taube
hi my c++ app statically links to libchicken 3.0.0 and i start a  
chicken session like this:

  HeapSize: 100
  StackSize: 64000

now, if i send chicken a long string to eval i get the error

Error: not enough room for result string

and my app crashes, which is really bad since editing windows with  
unsaved work and everthing else dies.


is there a way to tell chicken to allocate more room without such a  
hard constraint? the string in sending to chicken (via  
eval_from_string) contains an expression (define foo '())   
where  is longish (35000 chars) but lisp should be able to deal  
with this i think.


whats strange is that if i start CSI in the terminal and simply paste  
the expr into csi it handles it.


any help on how to stop the crashing greatly appreciated.



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] ANNOUNCE: Grace 1.0.2

2008-08-25 Thread Heinrich Taube
I'm happy to announce the availability of Grace 1.0.2, a Graphical,  
Realtime, Algorithmic Composition Environment.  Grace is built using  
the JUCE cross-platform tool kit and includes Chicken Scheme as its  
extension language.  Grace runs on Windows, OSX and Linux,  sources  
and prebuilt binaries for Windows and OSX are available on the release  
page:


http://camil.music.uiuc.edu/Software/grace

Main points for this release:

Csound port for working with Csound5
	Midi Port supports sequence capturing and the ablity to import,  
export, edit and play back the sequence.


To learn more about Grace see the on-line documentation or start the  
app and try the tutorials available in the Help menu.


Rick Taube
Assoc. Professor, Composition
Chair, Composition-Theory Division
School of Music, University of Illinois
1114 W. Nevada, Urbana, IL 61801 USA
Net: [EMAIL PROTECTED]
Fax: 1 217 244 7767
Vox: 1 217 244 2684







___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] length of string in C code

2008-04-28 Thread Heinrich Taube
Hello,can someone please tell me how to turn something that is  
C_Stringp into either (1) A NULL terminated C string or (2) A buffer  
of chars plus the number of chars in the buffer?  from what i can tell  
by the docs it seems that a C_string is not null terminated. i could  
deal with that except i dont know how to determine its length.



if ( C_truep(C_blockp(w))  C_truep( C_Stringp( w ) )) {
  int len = ???
  char* buf = ???
}


thanks for any help,
--rick



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] how to access all error info in with-exception-handler?

2008-03-28 Thread Heinrich Taube
I have an error handler that traps errors under callbacks using with- 
exception-handler. its wroking quite well except that I dont know how  
to get all the error information to print out. for example if i eval  
an unbound symbol in the REPL the message includes the name of the  
offending symbol:


#;50 baz
Error: unbound variable: baz

now, when i trap the same error in an environmentn with my error  
handler all i seem to get is the first part of the string, ie the  
message without the symbol name:


 Error: unbound variable

my question is: how can i get a string that  will contain what error  
messages normally show in the repl??


here what my with-exception-handler looks like (its only part of the  
macroexpantion  so not everytnig is shown, just pretend print-error  
calls display, etc:)


(call-with-current-continuation
(lambda (%%stopproc%%)
  (with-exception-handler
(lambda (err112)
  (print-error
(sprintf
   Error: ~A~%
  ((condition-property-accessor 'exn 'message) err112)
 ))
  (%%stopproc%% -2))
(lambda ()
  (if (= v108 v109) (begin (%%stopproc%% -1)))
  (print hiho)
  (set! v108 (+ v108 1))
  wait111


thansk for any info,
--rick


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] eval of (0) crashes app

2008-03-26 Thread Heinrich Taube

Have you run CHICKEN_run once before this call happens?



yes, an thak you for the reply! i call CHICKEN_run(NULL) just after  
CHICKEN_initialize(...);

here is my init sequence in case you see anything:

i also get a crash if i type something like (car {1 2 3}) im not sure  
why some types of errors are cause but others crash.



-

  GracePreferences* prefs=GracePreferences::getInstance();
  int hsize=prefs-getSchemeHeapSize();
  int ssize=prefs-getSchemeStackSize();

  res = CHICKEN_initialize(hsize, ssize, 0, (void*)C_grace_toplevel);
  if (res==0) {
reportChickenError( T( Error: Chicken failed to initialize. 
\n) );

return false;
  }

  res = CHICKEN_run(NULL);
  if (res==0) {
reportChickenError( T( Error: Chicken failed to initialize. 
\n) );

return false;
  }

  res = CHICKEN_eval_string_to_string( (char*)(chicken-version),
   buffer, 8192);
  if (res0)
text = text + T(, version ) + String(buffer).unquoted();
  text += T(\n(c) 2000-2007 Felix L. Winkelmann\n);
  console-postConsoleTextMessage(text);
  memset(buffer, 0,8192);
  if (res==0) {
reportChickenError( T( Error: Chicken failed to initialize. 
\n) );

return false;
  }
  CHICKEN_eval_string((require-extension srfi-18), r);
  CHICKEN_eval_string((require-extension srfi-1), r);
  CHICKEN_eval_string((define *grace-std-out* (make-output-port  
print-message (lambda () #f))), NULL);
  res = CHICKEN_eval_string((current-output-port *grace-std-out*),  
NULL);

  if ( res==0 )
reportChickenError();

  res = CHICKEN_eval_string((define *grace-err-out* (make-output- 
port print-error (lambda () #f))), NULL);

  if ( res==0 )
reportChickenError();

  res = CHICKEN_eval_string((current-error-port *grace-err-out*),  
NULL);

  if ( res==0 )
reportChickenError();


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] eval of (0) crashes app

2008-03-25 Thread Heinrich Taube
Hi in csi when i eval bogus funcall like (foo) and (0) then i get  
error messages as I would expect:


#;1 (foo)
Error: unbound variable: foo
Call history:
syntax  (foo)
eval(foo)   --
#;1 (0)
Error: call of non-procedure: 0
Call history:
syntax  (0)
eval(0) --
#;1

but if i do the same in my app via CHICKEN_eval_string_to_string then  
the (foo) case gets caught but the (0) case crashes my app :/


calling eval node 2, input '(0)'
[1]+  Bus error   exec build/Release/Grace.app/Contents/ 
MacOS/grace



i know from tracing that this call never returns:

 res = CHICKEN_eval_string_to_string( (char *)expr.toUTF8(),
   schemeThread-evalBuffer,
   8192);

does anyone have an idea about what might make the (foo) error get  
trapped but (0) crash the app?



thanks for any hints!

best, rick

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] macroexpansion and csc

2008-03-21 Thread Heinrich Taube
hi There is something about macro expansion and csc that i dont  
understand. I have a macro with-optkeys that calls expand-optkeys to  
compute a form.  I define the macro and the expansion function  
together in my main file main.scm , and then  i actually USE the  
macro to define functions in an api file that gets included, lets call  
it myfuncs.scm:


--
;; main.scm

(define-macro (with-optkeys spec . body)
 (expand-optkeys (car spec) (cdr spec) body))

(define (expand-optkeys args vars body)
  `(let (...) ,@body))

(include myfuncs.scm)

--
;; myfuncs.scm

(define (foo . input)
 (with-optkeys (input  (x #t) (y -99) z)
   (list x y z)))
---


Now when I try to generate my cpp program it bombs

csc -c++ -embedded -t main.scm


Error: during expansion of (with-optkeys ...) - unbound variable:  
expand-optkeys




How do i get the (define expand-optkeys ...) to be defined so that my  
api functions can expand to it when i generate my cpp program?




(if i move the contents of main.scm to the top of myfuncs.scm and then  
LOAD myfuncse into csi then the api functions defined therein work.)







___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Error building universal on 10.5

2008-02-29 Thread Heinrich Taube
dont know if this will help but i do this when i build universal on  
10.5.1:


export MACOSX_DEPLOYMENT_TARGET=10.4
make PLATFORM=macosx ARCH=universal

On Feb 29, 2008, at 6:30 PM, Greg wrote:

Hi, I tried building chicken 3.0.0 from source on Mac OS X 10.5.2  
using the following command:



make PLATFORM=macosx ARCH=universal



And got the following error:

gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk - 
dynamiclib -compatibility_version 1 -current_version 1.0 - 
install_name libchicken.dylib  \
	  -o libchicken.dylib library.o eval.o extras.o lolevel.o utils.o  
tcp.o srfi-1.o srfi-4.o srfi-13.o srfi-14.o srfi-18.o posixunix.o  
regex.o regex-extras.o scheduler.o profiler.o stub.o match.o  
runtime.o pcre/pcre_compile.o pcre/pcre_config.o pcre/ 
pcre_dfa_exec.o pcre/pcre_exec.o pcre/pcre_fullinfo.o pcre/ 
pcre_get.o pcre/pcre_globals.o pcre/pcre_info.o pcre/ 
pcre_maketables.o pcre/pcre_newline.o pcre/pcre_ord2utf8.o pcre/ 
pcre_refcount.o pcre/pcre_study.o pcre/pcre_tables.o pcre/ 
pcre_try_flipped.o pcre/pcre_ucp_searchfuncs.o pcre/ 
pcre_valid_utf8.o pcre/pcre_version.o pcre/pcre_xclass.o pcre/ 
pcre_chartables.o apply-hack.universal.o -lm

ld: library not found for -ldylib1.10.5.o
collect2: ld returned 1 exit status
ld: library not found for -ldylib1.10.5.o
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/Bl/BlVb4pxXGg8tGWkxFze1+U+ 
++TI/-Tmp-//ccVnFkTU.out (No such file or directory)

make[1]: *** [libchicken.dylib] Error 1
make: *** [all] Error 2


Help?

Thanks,

- Greg


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] expected initializer before 'C_aligned'

2008-02-26 Thread Heinrich Taube
../../src/ChickenBridge.cpp:281: error: expected initializer before  
'C_aligned'
../../src/ChickenBridge.cpp:282: error: expected initializer before  
'C_aligned'


[...]



sorry i hit send before i pasted this in. this is line 281 and 282 in  
the file


static C_char C_TLS li0[] C_aligned={C_lihdr(0,0,23), 
40,102,95,50,52,50,56,32,115,116,114,49,50,32,46,32,97,114,103,115,49,51,41,0,0,0,0,0,0,0 
};
static C_char C_TLS li1[] C_aligned={C_lihdr(0,0,12), 
40,102,95,50,52,49,55,32,107,49,54,41,0,0,0,0};



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] C_truep( C_fixnump( w ))

2008-02-25 Thread Heinrich Taube

thank you both very much. just to be sure:

(1) should i be using a C_truep() around C_immediatep() like the other  
predicate tests or is this ok:


if ( C_immediatep(w) ) {
   if ( C_truep(C_fixnump(w)) ) {
  ...
  }

   else if  ( C_truep(C_blockp(w))  C_truep( C_flonump( w ) )) {


(2) how can i test for strictly #f #t boolean value inside the  
immedatep clause?



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] C_truep( C_fixnump( w ))

2008-02-24 Thread Heinrich Taube
hmmm it has nothing to do with the C_truep( C_fixnump( w )) test --  
even if the else clause is empty it still crashes if the data are NOT  
floats.
im sure this must be something stupid but i dont understand why it  
crashes if its not float data



#
#include Csound.h
void cs_event (int type, int len, C_word lyst) {
//  MYFLT buf[len];
  printf(IN CS_EVENT, BEFORE LOOP LEN=%d\n, len);
  int i=0;
  for (; C_SCHEME_END_OF_LIST != lyst; lyst = C_u_i_cdr( lyst ) ) {
if (i==len) break;
C_word w = C_u_i_car( lyst );
if (C_truep( C_flonump( w ) )) {
  printf(FLO: buf[%d]=%f\n, i++, (float)C_flonum_magnitude( w ));
}
else {
}
  }
// ((GraceApp *)GraceApp::getInstance())-getCsoundPort()- 
sendEvent(typ, len, buf);

}

#

(define (cs:i . args)
  (if (not (null? args))
  ((foreign-lambda void cs_event int int scheme-object)
   1
   (length args)
   args))
  (values))

---

(cs:i 1.0 0.0 1.0 60.0 1000.0)

IN CS_EVENT, BEFORE LOOP LEN=5
FLO: buf[0]=1.00
FLO: buf[1]=0.00
FLO: buf[2]=1.00
FLO: buf[3]=60.00
FLO: buf[4]=1000.00


(cs:i 1 0 1 60 1000)

CRASH


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Grace 1.0.1 for windows and OSX universal

2008-02-07 Thread Heinrich Taube



Ugh.  Try doing the following before running make:

export MACOSX_DEPLOYMENT_TARGET=10.4

and let me know if it works.  I don't know if you have to `make  
clean` first.


Just a note to say that release 1.0.1 of Grace with Chicken 3.0.0 now  
includes a Windows build and the OSX build is universal (thanks to  
Zbigniew).


http://sourceforge.net/project/showfiles.php?group_id=9766package_id=260559


I wont keep pestering the list with announcements!

To build a universal chicken on Leopard that also runs on Tiger you do:

export MACOSX_DEPLOYMENT_TARGET=10.4
make PLATFORM=macosx ARCH=universal


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] static lib of chicken for windows?

2008-01-30 Thread Heinrich Taube
does anyone have a win32 static lib of chicken 3.0 that they would be  
willing to email me? I only have limited access to a windows machine  
that doesnt have mingw or cygwin compilers installed, just the  
microsoft one.

thanks, rick


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Grace 1.0.0 now available for OSX and Linux

2008-01-25 Thread Heinrich Taube
A binary, drag 'n drop release of Grace 1.0.0 is now available for OSX  
and Linux.


http://sourceforge.net/project/showfiles.php?group_id=9766package_id=260559

Grace stand for Graphical Realtime Algorithmic Composition
Environment.  The application is implemented in JUCE and contains
Chicken Scheme as its extension language.  You generate sound by
defining algorithms (in Scheme or an infix language called SAL)
and running them in real time to generate sound.  Grace contains a
mutipurpose Console window, an emacs-like code editor with evaluation
services, syntax highlighting and symbol documentation lookup,
configureable MIDI In and Out ports, MIDI input callbacks in Scheme
and the beginnings of a general purpose data plotter. For information
about the application see the documentation under the Help menu.

Grace 1.0.0:

 o Realtime music scheduler implemented in JUCE threads
 o Chicken Scheme extension languange (3.0.0rc1)
 o Code editor with syntax highlighting, Scheme and SAL evaluation
services, s-expression cursor motion, COMMAND-D documentation
lookup for symbols asociated with Grace, SAL or R5RS Scheme and
many Emacs key bindings (Emacs Mode)
 o MIDI In and Out Ports with configuration diaogs
 o Setting MIDI input hooks in Scheme
 o Channel instrument assigments
 o Microtonal MIDI output
 o Complete implementation of SAL syntax
 o Low-level MidiMessage accessors in Scheme

For information about the Grace Scheme binding see

   http://pinhead.music.uiuc.edu/~hkt/grace/doc/scheme.html

For information about Chicken Scheme see

   http://www.call-with-current-continuation.org/

For information about JUCE see

   http://www.rawmaterialsoftware.com/juce/


Rick Taube
Todd Ingalls


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] chicken 3.0.0rc1 on linux

2008-01-25 Thread Heinrich Taube
aha thank you! somhow i had an (old) libchicken.so installed in /usr/ 
lib. deleting this resolved the problem


On Jan 25, 2008, at 1:26 AM, felix winkelmann wrote:


On Jan 24, 2008 9:45 PM, Rick Taube [EMAIL PROTECTED] wrote:

hi ive compiled and isntalled chicken 3.0.0rc1 on my fedora box but
it cant link to the library.
this compiles and links fine on darwin with the same chicken install



Do you have an old library installed somewhere? C_decode_literal
is new and apparently can't be found in the libchicken you are
linking with. Perhaps you can override the linker path with -Lpath.


cheers,
felix



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Re: repository branching

2008-01-19 Thread Heinrich Taube
Hi -- the latest svn chicken doesnt build on Leopard (im trying to  
build a universal chicken)


zippy:chicken hkt$ uname -a
Darwin zippy.local 9.1.0 Darwin Kernel Version 9.1.0: Wed Oct 31  
17:46:22 PDT 2007; root:xnu-1228.0.2~1/RELEASE_I386 i386


zippy:chicken hkt$ gcc --version
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There  
is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR  
PURPOSE.


zippy:chicken hkt$ make PLATFORM=macosx ARCH=universal

[...]

gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk - 
dynamiclib -compatibility_version 1 -current_version 1.0 -install_name  
libchicken.dylib  \
	  -o libchicken.dylib library.o eval.o extras.o lolevel.o utils.o  
tcp.o srfi-1.o srfi-4.o srfi-13.o srfi-14.o srfi-18.o posixunix.o  
regex.o regex-extras.o scheduler.o profiler.o stub.o match.o runtime.o  
pcre/pcre_compile.o pcre/pcre_config.o pcre/pcre_dfa_exec.o pcre/ 
pcre_exec.o pcre/pcre_fullinfo.o pcre/pcre_get.o pcre/pcre_globals.o  
pcre/pcre_info.o pcre/pcre_maketables.o pcre/pcre_newline.o pcre/ 
pcre_ord2utf8.o pcre/pcre_refcount.o pcre/pcre_study.o pcre/ 
pcre_tables.o pcre/pcre_try_flipped.o pcre/pcre_ucp_searchfuncs.o pcre/ 
pcre_valid_utf8.o pcre/pcre_version.o pcre/pcre_xclass.o pcre/ 
pcre_chartables.o apply-hack.universal.o -lm

ld: library not found for -ldylib1.10.5.o
collect2: ld returned 1 exit status
ld: library not found for -ldylib1.10.5.o
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/yF/yFkQsvbjHiq9kq0G8XULGU++ 
+TI/-Tmp-//ccV73tgd.out (No such file or directory)

make[1]: *** [libchicken.dylib] Error 1
make: *** [all] Error 2


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] libchicken universal support added

2008-01-18 Thread Heinrich Taube
this is great! thanks so much. dont know if felix gives out Rooster  
badges, but you clearly qualify ;)





On Jan 17, 2008, at 10:25 PM, Zbigniew wrote:


Hi there,

I added universal binary support to Chicken.

make PLATFORM=macosx ARCH=universal

Eggs built with chicken-setup will automatically be universal.

On Jan 15, 2008 4:06 PM, Heinrich Taube [EMAIL PROTECTED] wrote:

hi, since chicken compiles on osx ppc and intel is it possible to
compile it as a universal lib? Im getting ready to ship chicken in an
osx app bundle and this would save some release headaches.
best,rick



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] libchicken universal?

2008-01-15 Thread Heinrich Taube
hi, since chicken compiles on osx ppc and intel is it possible to  
compile it as a universal lib? Im getting ready to ship chicken in an  
osx app bundle and this would save some release headaches.

best,rick


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users