summaryrefslogtreecommitdiff
path: root/ipl/packs/loadfuncpp/iexample.icn
blob: 1d615f3106eb76e106688b1f9513aec30332bee1 (plain)
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

link loadfuncpp

global integertobytes, bytestointeger, base64, base64tostring, base64tointeger

procedure main()
	integertobytes := loadfuncpp("iexample.so", "integertobytes", 1)
	bytestointeger := loadfuncpp("iexample.so", "bytestointeger", 1)
	base64 := loadfuncpp("iexample.so", "base64", 1)
	base64tostring := loadfuncpp("iexample.so", "base64tostring", 1)
	base64tointeger := loadfuncpp("iexample.so", "base64tointeger", 1)

	#test1()
	test2()
	#test3()
end

procedure test3()
	while write(base64tointeger(base64(integer(read()))))
end

procedure test2()
	while write(base64tostring(base64(read())))
end

procedure test1()
	i := 16rBEADEDCEDEDBEEFEDCEDEDBEADEDBEEFED
	
	s := "\x00" || integertobytes(i)
	ii := bytestointeger(s)
	ss := integertobytes(ii)
	
	write( image(s) )
	write( image(ss) )
	write(i)
	write(ii)
end