IUP

Check-in [50934cffb1]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:CHICKEN bindings for the IupMglPlot controls
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk | v1.3.0
Files: files | file ages | folders
SHA1: 50934cffb1368db52b1d7722faa9564a00101ba8
User & Date: murphy 2015-05-01 23:42:40.100
Context
2015-05-01
23:47
Updated CHICKEN release information file check-in: 99bb51e7de user: murphy tags: trunk
23:42
CHICKEN bindings for the IupMglPlot controls check-in: 50934cffb1 user: murphy tags: trunk, v1.3.0
23:28
Corrected type of dpi parameter for mglplot-paint-to from int to double check-in: 2b332f9c40 user: murphy tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Added chicken/iup-mglplot.scm.


































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
;; -*- mode: Scheme; tab-width: 2; -*- ;;

;; {{{ Data types

(foreign-declare
	"#include <iup.h>\n"
	"#include <iup_mglplot.h>\n")
	
(include "iup-types.scm")

;; }}}

;; {{{ MglPlot controls

(define mglplot
  (make-constructor-procedure
  	(foreign-lambda nonnull-ihandle "IupMglPlot")))

(define mgllabel
  (make-constructor-procedure
  	(foreign-lambda nonnull-ihandle "IupMglLabel" c-string)
		#:apply-args (optional-args [title #f])))

;; }}}

;; {{{ Plotting functions

(define call-with-mglplot
  (letrec ([mglplot-begin (foreign-lambda void "IupMglPlotBegin" nonnull-ihandle int)]
           [mglplot-end (foreign-lambda void "IupMglPlotEnd" nonnull-ihandle)])
    (lambda (handle proc #!key [dimension 2])
      (dynamic-wind
       (lambda ()
         (mglplot-begin handle dimension))
       (lambda ()
         (proc handle))
       (lambda ()
         (mglplot-end handle))))))

(define mglplot-add!
  (letrec ([append/1d (foreign-lambda void "IupMglPlotAdd1D" nonnull-ihandle c-string double)]
					 [append/2d (foreign-lambda void "IupMglPlotAdd2D" nonnull-ihandle double double)]
					 [append/3d (foreign-lambda void "IupMglPlotAdd3D" nonnull-ihandle double double double)]
           [insert/1d (foreign-lambda* void ([nonnull-ihandle handle] [int index] [int sample_index] [c-string x] [double y]) "IupMglPlotInsert1D(handle, index, sample_index, (const char **) &x, &y, 1);")]
           [insert/2d (foreign-lambda* void ([nonnull-ihandle handle] [int index] [int sample_index] [double x] [double y]) "IupMglPlotInsert2D(handle, index, sample_index, &x, &y, 1);")]
           [insert/3d (foreign-lambda* void ([nonnull-ihandle handle] [int index] [int sample_index] [double x] [double y] [double z]) "IupMglPlotInsert3D(handle, index, sample_index, &x, &y, &z, 1);")]
           [current-index (lambda (handle) (string->number (attribute handle 'current)))])
    (lambda (handle x y #!optional [z #f] [sample-index #f] [index #f])
      (cond
			 [z
				(if sample-index
						(insert/3d handle (or index (current-index handle)) sample-index x y z)
						(append/3d handle x y z))]
			 [(string? x)
				(if sample-index
						(insert/1d handle (or index (current-index handle)) sample-index x y)
						(append/1d handle x y))]
			 [else
				(if sample-index
						(insert/2d handle (or index (current-index handle)) sample-index x y)
						(append/2d handle x y))]))))

(define mglplot-x/y/z->pixel-x/y
	(letrec ([transform (foreign-lambda void "IupMglPlotTransform" nonnull-ihandle double double double (c-pointer int) (c-pointer int))])
		(lambda (handle mglplot-x mglplot-y #!optional [mglplot-z 0.0])
			(let-location ([pixel-x int 0] [pixel-y int 0])
				(transform handle mglplot-x mglplot-y mglplot-z (location pixel-x) (location pixel-y))
				(values pixel-x pixel-y)))))

(define mglplot-paint-to
	(letrec ([paint-to (foreign-lambda void "IupMglPlotPaintTo" nonnull-ihandle nonnull-c-string int int double nonnull-c-string)])
		(lambda (handle format file #!optional [width 0] [height 0] [dpi 0.0])
			(paint-to handle format width height dpi file))))

;; }}}

;; {{{ Library setup

(foreign-code "IupMglPlotOpen();")

;; }}}
Changes to chicken/iup.meta.
1
2
3
4
5
6
7
8
;; -*- mode: Scheme; -*-
((category ui)
 (license "BSD")
 (author "Thomas Chust")
 (synopsis "Bindings to the IUP GUI library")
 (doc-from-wiki)
 (needs srfi-42)
 (files "iup.scm" "iup-types.scm" "iup-base.scm" "iup-controls.scm" "iup-dialogs.scm" "iup-glcanvas.scm" "iup-pplot.scm" "iup-plot.scm" "iup-scintilla.scm" "iup-web.scm" "iup-dynamic.scm" "iup.setup" "iup.meta" "iup.release-info"))







|
1
2
3
4
5
6
7
8
;; -*- mode: Scheme; -*-
((category ui)
 (license "BSD")
 (author "Thomas Chust")
 (synopsis "Bindings to the IUP GUI library")
 (doc-from-wiki)
 (needs srfi-42)
 (files "iup.scm" "iup-types.scm" "iup-base.scm" "iup-controls.scm" "iup-dialogs.scm" "iup-glcanvas.scm" "iup-plot.scm" "iup-mglplot.scm" "iup-pplot.scm" "iup-scintilla.scm" "iup-web.scm" "iup-dynamic.scm" "iup.setup" "iup.meta" "iup.release-info"))
Changes to chicken/iup.scm.
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98


























99
100
101
102
103
104
105
		 call-with-glcanvas glcanvas-is-current?
		 glcanvas-palette-set! glcanvas-font-set!)
		(import
		  scheme chicken foreign
			iup-base)
		(include "iup-glcanvas.scm"))])

(cond-expand
 [disable-iup-pplot]
 [else
	(module iup-pplot
		(pplot
		 call-with-pplot pplot-add!
		 pplot-x/y->pixel-x/y
		 pplot-paint-to)
		(import
		  scheme chicken foreign
			iup-base)
		(include "iup-pplot.scm"))])

(cond-expand
 [disable-iup-plot]
 [else
	(module iup-plot
		(plot
		 call-with-plot plot-add!
		 plot-x/y->pixel-x/y
		 plot-paint-to)
		(import
		  scheme chicken foreign
			iup-base)
		(include "iup-plot.scm"))])



























(cond-expand
 [disable-iup-scintilla]
 [else
	(module iup-scintilla
		(scintilla)
		(import
		  scheme chicken foreign







<
<
<
<
<
<
<
<
<
<
<
<
<













>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







66
67
68
69
70
71
72













73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
		 call-with-glcanvas glcanvas-is-current?
		 glcanvas-palette-set! glcanvas-font-set!)
		(import
		  scheme chicken foreign
			iup-base)
		(include "iup-glcanvas.scm"))])














(cond-expand
 [disable-iup-plot]
 [else
	(module iup-plot
		(plot
		 call-with-plot plot-add!
		 plot-x/y->pixel-x/y
		 plot-paint-to)
		(import
		  scheme chicken foreign
			iup-base)
		(include "iup-plot.scm"))])

(cond-expand
 [disable-iup-mglplot]
 [else
	(module iup-mglplot
		(mglplot mgllabel
		 call-with-mglplot mglplot-add!
		 mglplot-x/y/z->pixel-x/y
		 mglplot-paint-to)
		(import
		  scheme chicken foreign
			iup-base)
		(include "iup-mglplot.scm"))])

(cond-expand
 [disable-iup-pplot]
 [else
	(module iup-pplot
		(pplot
		 call-with-pplot pplot-add!
		 pplot-x/y->pixel-x/y
		 pplot-paint-to)
		(import
		  scheme chicken foreign
			iup-base)
		(include "iup-pplot.scm"))])

(cond-expand
 [disable-iup-scintilla]
 [else
	(module iup-scintilla
		(scintilla)
		(import
		  scheme chicken foreign
Changes to chicken/iup.setup.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20










21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50










51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78










79
80
81
82
83
84
85
;; -*- mode: Scheme; tab-width: 2; -*- ;;

(define modules
	`(-j iup
		-j iup-base -j iup-controls -j iup-dialogs
		,@(cond-expand
			 [disable-iup-glcanvas
				'()]
			 [else
				'(-j iup-glcanvas)])
		,@(cond-expand
			 [disable-iup-pplot
				'()]
			 [else
				'(-j iup-pplot)])
		,@(cond-expand
			 [disable-iup-plot
				'()]
			 [else
				'(-j iup-plot)])










		,@(cond-expand
			 [disable-iup-scintilla
				'()]
			 [else
				'(-j iup-scintilla)])
		,@(cond-expand
			 [disable-iup-web
				'()]
			 [else
				'(-j iup-web)])))

(define import-libraries
	`("iup.import.so"
		"iup-base.import.so" "iup-controls.import.so" "iup-dialogs.import.so"
		,@(cond-expand
			 [disable-iup-glcanvas
				'()]
			 [else
				'("iup-glcanvas.import.so")])
		,@(cond-expand
			 [disable-iup-pplot
				'()]
			 [else
				'("iup-pplot.import.so")])
		,@(cond-expand
			 [disable-iup-plot
				'()]
			 [else
				'("iup-plot.import.so")])
		,@(cond-expand










			 [disable-iup-scintilla
				'()]
			 [else
				'("iup-scintilla.import.so")])
		,@(cond-expand
			 [disable-iup-web
				'()]
			 [else
				'("iup-web.import.so")])))

(define native-libraries
	`("-lcallback"
		"-liup" "-liupim" "-liupimglib" "-liupcontrols"
		,@(cond-expand
			 [disable-iup-glcanvas
				'()]
			 [else
				'("-liupgl")])
		,@(cond-expand
			 [disable-iup-pplot
				'()]
			 [else
				'("-liup_pplot")])
		,@(cond-expand
			 [disable-iup-plot
				'()]
			 [else
				'("-liup_plot")])










		,@(cond-expand
			 [disable-iup-scintilla
				'()]
			 [else
				'("-liup_scintilla")])
		,@(cond-expand
			 [disable-iup-web











<
<
<
<
<




>
>
>
>
>
>
>
>
>
>




















<
<
<
<
<





>
>
>
>
>
>
>
>
>
>



















<
<
<
<
<




>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11





12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45





46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79





80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
;; -*- mode: Scheme; tab-width: 2; -*- ;;

(define modules
	`(-j iup
		-j iup-base -j iup-controls -j iup-dialogs
		,@(cond-expand
			 [disable-iup-glcanvas
				'()]
			 [else
				'(-j iup-glcanvas)])
		,@(cond-expand





			 [disable-iup-plot
				'()]
			 [else
				'(-j iup-plot)])
		,@(cond-expand
			 [disable-iup-mglplot
				'()]
			 [else
				'(-j iup-mglplot)])
		,@(cond-expand
			 [disable-iup-pplot
				'()]
			 [else
				'(-j iup-pplot)])
		,@(cond-expand
			 [disable-iup-scintilla
				'()]
			 [else
				'(-j iup-scintilla)])
		,@(cond-expand
			 [disable-iup-web
				'()]
			 [else
				'(-j iup-web)])))

(define import-libraries
	`("iup.import.so"
		"iup-base.import.so" "iup-controls.import.so" "iup-dialogs.import.so"
		,@(cond-expand
			 [disable-iup-glcanvas
				'()]
			 [else
				'("iup-glcanvas.import.so")])
		,@(cond-expand





			 [disable-iup-plot
				'()]
			 [else
				'("iup-plot.import.so")])
		,@(cond-expand
			 [disable-iup-mglplot
				'()]
			 [else
				'("iup-mglplot.import.so")])
		,@(cond-expand
			 [disable-iup-pplot
				'()]
			 [else
				'("iup-pplot.import.so")])
		,@(cond-expand
			 [disable-iup-scintilla
				'()]
			 [else
				'("iup-scintilla.import.so")])
		,@(cond-expand
			 [disable-iup-web
				'()]
			 [else
				'("iup-web.import.so")])))

(define native-libraries
	`("-lcallback"
		"-liup" "-liupim" "-liupimglib" "-liupcontrols"
		,@(cond-expand
			 [disable-iup-glcanvas
				'()]
			 [else
				'("-liupgl")])
		,@(cond-expand





			 [disable-iup-plot
				'()]
			 [else
				'("-liup_plot")])
		,@(cond-expand
			 [disable-iup-mglplot
				'()]
			 [else
				'("-liup_mglplot")])
		,@(cond-expand
			 [disable-iup-pplot
				'()]
			 [else
				'("-liup_pplot")])
		,@(cond-expand
			 [disable-iup-scintilla
				'()]
			 [else
				'("-liup_scintilla")])
		,@(cond-expand
			 [disable-iup-web
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109








110
111
112
113
114
115
116
(compile -s -O2 -d0 "iup-dialogs.import.scm")

(cond-expand
 [disable-iup-glcanvas]
 [else
	(compile -s -O2 -d0 "iup-glcanvas.import.scm")])
(cond-expand
 [disable-iup-pplot]
 [else
	(compile -s -O2 -d0 "iup-pplot.import.scm")])
(cond-expand
 [disable-iup-plot]
 [else
	(compile -s -O2 -d0 "iup-plot.import.scm")])
(cond-expand








 [disable-iup-scintilla]
 [else
	(compile -s -O2 -d0 "iup-scintilla.import.scm")])
(cond-expand
 [disable-iup-web]
 [else
	(compile -s -O2 -d0 "iup-web.import.scm")])







<
<
<
<




>
>
>
>
>
>
>
>







110
111
112
113
114
115
116




117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
(compile -s -O2 -d0 "iup-dialogs.import.scm")

(cond-expand
 [disable-iup-glcanvas]
 [else
	(compile -s -O2 -d0 "iup-glcanvas.import.scm")])
(cond-expand




 [disable-iup-plot]
 [else
	(compile -s -O2 -d0 "iup-plot.import.scm")])
(cond-expand
 [disable-iup-mglplot]
 [else
	(compile -s -O2 -d0 "iup-mglplot.import.scm")])
(cond-expand
 [disable-iup-pplot]
 [else
	(compile -s -O2 -d0 "iup-pplot.import.scm")])
(cond-expand
 [disable-iup-scintilla]
 [else
	(compile -s -O2 -d0 "iup-scintilla.import.scm")])
(cond-expand
 [disable-iup-web]
 [else
	(compile -s -O2 -d0 "iup-web.import.scm")])