Skip to content

Commit be14266

Browse files
committed
common functions changed to public for use in sub-packages.
1 parent f2522ac commit be14266

File tree

6 files changed

+47
-47
lines changed

6 files changed

+47
-47
lines changed

iup-pplot/pplot.go

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Copyright (C) 2011 by Jeremy Cowgar <[email protected]>
33
4-
This file is part of go-iup.
4+
This file is part of go-
55
66
go-iup is free software: you can redistribute it and/or modify
77
it under the terms of the GNU Lesser General Public License as
@@ -14,7 +14,7 @@
1414
GNU General Public License for more details.
1515
1616
You should have received a copy of the GNU Lesser General Public
17-
License along with go-iup. If not, see <http://www.gnu.org/licenses/>.
17+
License along with go- If not, see <http://www.gnu.org/licenses/>.
1818
*/
1919

2020
package pplot
@@ -87,49 +87,49 @@ func PlotInsertStr(ih *Ihandle, index, sample_index int, x string, y float64) {
8787

8888
/*
8989
// Differs from IupPlotInsertPoints as `count' is determined automatically in this case
90-
func PlotInsertPoints(ih *iup.Ihandle, index, sample_index int, x, y []float64) {
90+
func PlotInsertPoints(ih *Ihandle, index, sample_index int, x, y []float64) {
9191
count := len(x)
92-
cX := float64ArrayToC(x)
93-
cY := float64ArrayToC(y)
92+
cX := Float64ArrayToC(x)
93+
cY := Float64ArrayToC(y)
9494
9595
C.IupPlotInsertPoints(ih.C(), C.int(index), C.int(sample_index), &cX[0], &cY[0],
9696
C.int(count))
9797
}
9898
9999
// Differs from IupPlotInsertPoints as `count' is determined automatically in this case
100-
func PlotInsertStrPoints(ih *iup.Ihandle, index, sample_index int, x []string, y []float64) {
100+
func PlotInsertStrPoints(ih *Ihandle, index, sample_index int, x []string, y []float64) {
101101
count := len(x)
102102
103-
cX := stringArrayToC(x)
104-
defer freeCStringArray(cX)
103+
cX := StringArrayToC(x)
104+
defer FreeCStringArray(cX)
105105
106-
cY := float64ArrayToC(y)
106+
cY := Float64ArrayToC(y)
107107
108108
C.IupPlotInsertStrPoints(ih.C(), C.int(index), C.int(sample_index), &cX[0], &cY[0], C.int(count))
109109
}
110110
111111
// Differs from IupPlotInsertPoints as `count' is determined automatically in this case
112-
func PlotAddPoints(ih *iup.Ihandle, index int, x, y []float64) {
112+
func PlotAddPoints(ih *Ihandle, index int, x, y []float64) {
113113
count := len(x)
114-
cX := float64ArrayToC(x)
115-
cY := float64ArrayToC(y)
114+
cX := Float64ArrayToC(x)
115+
cY := Float64ArrayToC(y)
116116
117117
C.IupPlotAddPoints(ih.C(), C.int(index), &cX[0], &cY[0], C.int(count))
118118
}
119119
120120
// Differs from IupPlotInsertPoints as `count' is determined automatically in this case
121-
func PlotAddStrPoints(ih *iup.Ihandle, index int, x []string, y []float64) {
121+
func PlotAddStrPoints(ih *Ihandle, index int, x []string, y []float64) {
122122
count := len(x)
123123
124-
cX := stringArrayToC(x)
125-
defer freeCStringArray(cX)
124+
cX := StringArrayToC(x)
125+
defer FreeCStringArray(cX)
126126
127-
cY := float64ArrayToC(y)
127+
cY := Float64ArrayToC(y)
128128
129129
C.IupPlotAddStrPoints(ih.C(), C.int(index), &cX[0], &cY[0], C.int(count))
130130
}
131131
132-
func PlotTransform(ih *iup.Ihandle, x, y float64) (int, int) {
132+
func PlotTransform(ih *Ihandle, x, y float64) (int, int) {
133133
cIX := new(C.int)
134134
cIY := new(C.int)
135135

iup/common.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (ih *Ihandle) C() *C.Ihandle {
4444
return (*C.Ihandle)(ih)
4545
}
4646

47-
func iHandleArrayToC(ihs []*Ihandle) []*C.Ihandle {
47+
func IHandleArrayToC(ihs []*Ihandle) []*C.Ihandle {
4848
max := len(ihs)
4949
result := make([]*C.Ihandle, max+1)
5050

@@ -56,7 +56,7 @@ func iHandleArrayToC(ihs []*Ihandle) []*C.Ihandle {
5656
return result
5757
}
5858

59-
func stringArrayToC(strs []string) []*C.char {
59+
func StringArrayToC(strs []string) []*C.char {
6060
max := len(strs)
6161
result := make([]*C.char, max+1)
6262

@@ -68,15 +68,15 @@ func stringArrayToC(strs []string) []*C.char {
6868
return result
6969
}
7070

71-
func freeCStringArray(strs []*C.char) {
71+
func FreeCStringArray(strs []*C.char) {
7272
for _, v := range strs {
7373
if v != nil {
7474
C.free(unsafe.Pointer(v))
7575
}
7676
}
7777
}
7878

79-
func float64ArrayToC(nums []float64) []C.float {
79+
func Float64ArrayToC(nums []float64) []C.float {
8080
result := make([]C.float, len(nums))
8181

8282
for k, v := range nums {
@@ -86,7 +86,7 @@ func float64ArrayToC(nums []float64) []C.float {
8686
return result
8787
}
8888

89-
func byteArrayToCUCharArray(content []byte) []C.uchar {
89+
func ByteArrayToCUCharArray(content []byte) []C.uchar {
9090
cContent := make([]C.uchar, len(content))
9191
for i, v := range content {
9292
cContent[i] = (C.uchar)(v)
@@ -96,7 +96,7 @@ func byteArrayToCUCharArray(content []byte) []C.uchar {
9696
return cContent
9797
}
9898

99-
func intArrayToC(nums []int) []C.int {
99+
func IntArrayToC(nums []int) []C.int {
100100
result := make([]C.int, len(nums))
101101

102102
for k, v := range nums {

iup/controls.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ func tabsv(ihs []*C.Ihandle) *Ihandle {
205205
}
206206

207207
func Tabs(args ...*Ihandle) *Ihandle {
208-
return tabsv(iHandleArrayToC(args))
208+
return tabsv(IHandleArrayToC(args))
209209
}
210210

211211
func Tabsv(args []*Ihandle, opts ...interface{}) *Ihandle {
212-
ih := tabsv(iHandleArrayToC(args))
212+
ih := tabsv(IHandleArrayToC(args))
213213

214214
for _, o := range opts {
215215
switch v := o.(type) {

iup/dialog.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ func ListDialog(typ int, title string, list []string, opt, max_col, max_lin int,
198198
cTitle := C.CString(title)
199199
defer C.free(unsafe.Pointer(cTitle))
200200

201-
cList := stringArrayToC(list)
202-
defer freeCStringArray(cList)
201+
cList := StringArrayToC(list)
202+
defer FreeCStringArray(cList)
203203

204-
cMarks := intArrayToC(marks)
204+
cMarks := IntArrayToC(marks)
205205

206206
result := C.IupListDialog(C.int(typ), cTitle, C.int(len(list)), &cList[0], C.int(opt), C.int(max_col),
207207
C.int(max_lin), &cMarks[0])

iup/layout.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ func Createv(classname string, args []string) *Ihandle {
3737
cClassname := C.CString(classname)
3838
defer C.free(unsafe.Pointer(cClassname))
3939

40-
cArgs := stringArrayToC(args)
41-
defer freeCStringArray(cArgs)
40+
cArgs := StringArrayToC(args)
41+
defer FreeCStringArray(cArgs)
4242

4343
return (*Ihandle)(C.IupCreatev(cClassname, (*unsafe.Pointer)(unsafe.Pointer(&cArgs[0]))))
4444
}
@@ -47,8 +47,8 @@ func Createp(classname string, args ...string) *Ihandle {
4747
cClassname := C.CString(classname)
4848
defer C.free(unsafe.Pointer(cClassname))
4949

50-
cArgs := stringArrayToC(args)
51-
defer freeCStringArray(cArgs)
50+
cArgs := StringArrayToC(args)
51+
defer FreeCStringArray(cArgs)
5252

5353
return (*Ihandle)(C.IupCreatev(cClassname, (*unsafe.Pointer)(unsafe.Pointer(&cArgs[0]))))
5454
}
@@ -125,35 +125,35 @@ func hboxv(ihs []*C.Ihandle) *Ihandle {
125125
}
126126

127127
func Hbox(args ...*Ihandle) *Ihandle {
128-
return hboxv(iHandleArrayToC(args))
128+
return hboxv(IHandleArrayToC(args))
129129
}
130130

131131
func Hboxv(args []*Ihandle) *Ihandle {
132-
return hboxv(iHandleArrayToC(args))
132+
return hboxv(IHandleArrayToC(args))
133133
}
134134

135135
func vboxv(ihs []*C.Ihandle) *Ihandle {
136136
return (*Ihandle)(C.IupVboxv(&ihs[0]))
137137
}
138138

139139
func Vbox(args ...*Ihandle) *Ihandle {
140-
return vboxv(iHandleArrayToC(args))
140+
return vboxv(IHandleArrayToC(args))
141141
}
142142

143143
func Vboxv(args []*Ihandle) *Ihandle {
144-
return vboxv(iHandleArrayToC(args))
144+
return vboxv(IHandleArrayToC(args))
145145
}
146146

147147
func zboxv(ihs []*C.Ihandle) *Ihandle {
148148
return (*Ihandle)(C.IupZboxv(&ihs[0]))
149149
}
150150

151151
func Zbox(args ...*Ihandle) *Ihandle {
152-
return zboxv(iHandleArrayToC(args))
152+
return zboxv(IHandleArrayToC(args))
153153
}
154154

155155
func Zboxv(args []*Ihandle) *Ihandle {
156-
return zboxv(iHandleArrayToC(args))
156+
return zboxv(IHandleArrayToC(args))
157157
}
158158

159159
func Radio(child *Ihandle) *Ihandle {
@@ -165,23 +165,23 @@ func normalizerv(ihs []*C.Ihandle) *Ihandle {
165165
}
166166

167167
func Normalizer(args ...*Ihandle) *Ihandle {
168-
return normalizerv(iHandleArrayToC(args))
168+
return normalizerv(IHandleArrayToC(args))
169169
}
170170

171171
func Normalizerv(args []*Ihandle) *Ihandle {
172-
return normalizerv(iHandleArrayToC(args))
172+
return normalizerv(IHandleArrayToC(args))
173173
}
174174

175175
func cboxv(ihs []*C.Ihandle) *Ihandle {
176176
return (*Ihandle)(C.IupCboxv(&ihs[0]))
177177
}
178178

179179
func Cbox(args ...*Ihandle) *Ihandle {
180-
return cboxv(iHandleArrayToC(args))
180+
return cboxv(IHandleArrayToC(args))
181181
}
182182

183183
func Cboxv(args []*Ihandle) *Ihandle {
184-
return cboxv(iHandleArrayToC(args))
184+
return cboxv(IHandleArrayToC(args))
185185
}
186186

187187
func Sbox(child *Ihandle) *Ihandle {

iup/resources.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,19 @@ func UnMapFont(driverfont string) string {
5656
*******************************************************************************/
5757

5858
func Image(width, height int, pixels []byte) *Ihandle {
59-
cPixels := byteArrayToCUCharArray(pixels)
59+
cPixels := ByteArrayToCUCharArray(pixels)
6060

6161
return (*Ihandle)(C.IupImage(C.int(width), C.int(height), &cPixels[0]))
6262
}
6363

6464
func ImageRGB(width, height int, pixels []byte) *Ihandle {
65-
cPixels := byteArrayToCUCharArray(pixels)
65+
cPixels := ByteArrayToCUCharArray(pixels)
6666

6767
return (*Ihandle)(C.IupImageRGB(C.int(width), C.int(height), &cPixels[0]))
6868
}
6969

7070
func ImageRGBA(width, height int, pixels []byte) *Ihandle {
71-
cPixels := byteArrayToCUCharArray(pixels)
71+
cPixels := ByteArrayToCUCharArray(pixels)
7272

7373
return (*Ihandle)(C.IupImageRGBA(C.int(width), C.int(height), &cPixels[0]))
7474
}
@@ -155,11 +155,11 @@ func menuv(ihs []*C.Ihandle) *Ihandle {
155155
}
156156

157157
func Menu(args ...*Ihandle) *Ihandle {
158-
return menuv(iHandleArrayToC(args))
158+
return menuv(IHandleArrayToC(args))
159159
}
160160

161161
func Menuv(args []*Ihandle, opts ...interface{}) *Ihandle {
162-
ih := menuv(iHandleArrayToC(args))
162+
ih := menuv(IHandleArrayToC(args))
163163

164164
for _, o := range opts {
165165
switch v := o.(type) {

0 commit comments

Comments
 (0)