This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

guile-bindings for curses



Here is how far i've yet got with wrapping ncurses for guile.
( gzipped and uuencoded , would have been 1000 lines already)
It's very bugprone yet.

It compiles and links to a new guile executable with curses features,
(-lncurses -lguile -l<whatever guile was built with>). I think that's not
what most would like. How does one provide a modular version of it?

It  doesn't work with the latest snaps, I added some simple test script that 
crashes guile when using the latest versions.


begin 664 ncguile.c.gz
M'XL(")WVT34``VYC9W5I;&4N8P#E7/MOVS@2_OG\5Q!=H.L$:M/MWN$>V7;1
MIFF1:YH628OB?C)HB;9UD46O'G&\1?[WF^&0%/6P)5M.-X<MBI@:\N-\,WP_
MI,'@Z)"]N_C"WGTZ9VF63R9L*K*4S40B&#L\&@Q^"&,_R@/!?HG"\30/(_%T
M]M*1*M'1=%:6^GF2BK0L2[,`LD#9()+QE"W#>)3QZ?%@,+@Z^8"/SU-_SH9?
MSR[>?/S*#@^.!R8(\N<0SX:0$,0F_6C.DVLCA#2C-/Q=9"HF"(6).#H,8Q(N
M$@RAV&/J#V*4<)1F/!.H4QFM\IK+\22/4X7$`.@%9_V;3R8B83F8QQ:9'*=L
MN)!)QN3XO\+/T@.VG(7^#.,9#X(P"V7,(Y;(/`MC@&0SGC$.SATPQ@1/PVC%
M_$2`\H!-$CEG,;G.(IZRLY2%&5O(-`W'D6"99!.93`5+Y03%"107(C%#H!K(
M)4/J`(K33/#``T8B!L5")683[H<1\`(=R",6(A#!K\KL&QD&C'P^RE8+,0IC
MT#Q$L?%ZJF2IGU@Q26.Q-`6D?6O^V"1I/EZ3I)PN$$FW=/G"J1.6QH('!=9&
MS&_J>3J1C3H=1E%-DX@#)2MY(4P;Q<L8"C,1DT2DLW(NBVI,D\5-C&2^"+#&
MEA4E(DCXLL9U2?)HK8'+N;P1:R.A'D-52M;&0T7;%'\M5FO*1&2\01Q+\#=?
M-<1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G7*MA:
M>_0IOH+H<"N&SKL5A((=['$PYJ$5A:?*U%-`H(,.FYZ"[8B(4D<=\C9I98?4
M]J150>Q3JU^AW5+;Y\L.C$QJ%6I-K\\%J=`HW-Y*\'2-6@B&6M/K\RF%T.'V
MD4T?\=#8IA\Z,/,M,[]+>CJB(`2%6S%XHJ``&&CUKSH`4,E5J+VEJAUX:JDJ
MV-[/JV(CA`IV0=#FLP'14T><D)&#@Z=VG-E-M9V]>FKUM-XU52@=;M6EMRX=
M3'O[TOM;V^K!G9]M]>#>X;9Z<`-O6SVXS;.M'MQLV4J/V2&AUJ`?VFLX;CU0
M3<!0:RTP:V^"Z(?6&;Y>65&_1F&/_=-B[M3;]F_$.)].\?L*<2:2"?<!&4C\
M2H,_XS#HJ>]6R02_#R`GZF&"_=`2+TE'^'VL`WQQZ0>]T'GWYO7H\W\^G>+"
MN^'+94?38#RRBO!+9`@XN_A\>OGVU<GI\6"`GP&#!:I:EX5Q#(O&.3>?<V*'
M?B13L,VCUX"2*2S_Z+[W(3S<T)H-;)K+((^$>N4_Y)'^#$3*EC*/`C:5]'$U
M]5&%QJ6?6I_B]P]FT$39D/0H!<IIH'M`I#:P0#RL@[.1TN!F@N2-7:;P[.<A
9Z+L0L;@!=\,\P)^)@-X+^Q^$3\$'*$X`````
`
end




I couldn't decide yet how to handle chtypes, These are formally 32 bit
ints, whose lowest bits represent a character, whereas the high ones
form a bitmask encoding the video attributes assigned to the character cell,
like reverse, blink, underline and the like. Anyone know an elegant way to
handle this? Should the chtype be wrapped like a normal int and then processed
further in scheme code, or should the wrapper code already know about it?



;;;;;;;;;;;;;;;;demoscript;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(initscr)    ;enters curses-mode
(cbreak)     ;one character at time 
(keypad stdscr #t) ;decodes keypad events
(noecho)     ;no echo
(nonl)       ;prevents newline translation

;;this loop receives one character from the keyboard and prints its 
;;ascii value on the screen each turn, til C-d is pressed.
;;then guile's interactive line mode is entered. 
;;the misbehaviour in the new versions appears after wgetch returns 
;;and before doupdate is called to paint the altered screen.
;;if the script is loaded from the interactive guile prompt instead
;;of the command line, guile doesn't crash, but not execute the script
;;correctly either. 

(do ((c 0 (wgetch stdscr)))
    ((= c 4) (endwin))
  (wclear stdscr)
  (wmove stdscr 0 0)
  (waddnstr stdscr (number->string c) -1)
  (wnoutrefresh stdscr)(doupdate)
  )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,,,,,,,

Klaus Schilling