svlad

Check-in [8136db8529]
Login

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

Overview
Comment:Changed plot app to enable turtle mode.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:8136db8529a47f1f14a8c91224b9f40f8eae5105
User & Date: Hry 2012-09-01 21:27:26
Context
2012-09-01
22:04
First working turtle mode for plot. Leaf check-in: ec96a535f1 user: Hry tags: trunk
21:27
Changed plot app to enable turtle mode. check-in: 8136db8529 user: Hry tags: trunk
2012-06-04
22:25
Added grafikon from Margarita suite. check-in: 31fdc1d58d user: severak tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to plot.bas.

6
7
8
9
10
11
12














13
14
15
16
17
18
19
..
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
  dim x as integer
  dim y as integer
  x=lua_tointeger(L,1)
  y=lua_tointeger(L,2)
  pset (x,y)
  plotpoint=0  
end function















function plotcolor cdecl (byval L as lua_State ptr) as integer
  dim r as integer
  dim g as integer
  dim b as integer
  r=lua_tointeger(L,1)
  g=lua_tointeger(L,2)
................................................................................
  sleep
  plotpause=0
end function

function plotprint cdecl (byval L as lua_State ptr) as integer
  dim as zstring ptr text
  text=lua_tostring(L,1)
  print *text
  plotprint=0
end function

function plotinput cdecl (byval L as lua_State ptr) as integer
  dim text as string
  Line Input text
  lua_pushlstring(L,text,Len(text))
  plotinput=1
end function

















































WindowTitle "Plot"
Screenres 640,480,32
dim L as lua_State ptr
dim f as string




print "Enter name of file:"
Line Input f
cls

' create a lua state
L = lua_open( )
' load the base lua library (needed for 'print')
luaL_openlibs( L )
' register the function to be called from lua as MinMax
lua_register( L, "point", @plotpoint )

lua_register( L, "color", @plotcolor )
lua_register( L, "cls", @plotcls )
lua_register( L, "pause", @plotpause )
lua_register( L, "write", @plotprint )
lua_register( L, "read", @plotinput )









' execute the lua script from a file
luaL_dofile( L, f )
' release the lua state
lua_close( L )
print "Ended"
sleep







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







 







|





|




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





>
>
>
|
|
|
>






>





>
>
>
>
>
>
>
>
>






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
..
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
101
102
103
104
105
106
107
108
109
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
  dim x as integer
  dim y as integer
  x=lua_tointeger(L,1)
  y=lua_tointeger(L,2)
  pset (x,y)
  plotpoint=0  
end function

function plotline cdecl (byval L as lua_State ptr) as integer
  dim ax as integer
  dim ay as integer
  dim bx as integer
  dim by as integer
  ax=lua_tointeger(L,1)
  ay=lua_tointeger(L,2)
  bx=lua_tointeger(L,3)
  by=lua_tointeger(L,4)
  line (ax,ay)-(bx,by)
  plotline=0  
end function


function plotcolor cdecl (byval L as lua_State ptr) as integer
  dim r as integer
  dim g as integer
  dim b as integer
  r=lua_tointeger(L,1)
  g=lua_tointeger(L,2)
................................................................................
  sleep
  plotpause=0
end function

function plotprint cdecl (byval L as lua_State ptr) as integer
  dim as zstring ptr text
  text=lua_tostring(L,1)
  print *text;
  plotprint=0
end function

function plotinput cdecl (byval L as lua_State ptr) as integer
  dim text as string
  Line Input ; text
  lua_pushlstring(L,text,Len(text))
  plotinput=1
end function

function curses_getkey cdecl (byval L as lua_State ptr) as integer
	lua_pushnumber(L,getkey)
	curses_getkey=1
end function

function curses_locate cdecl (byval L as lua_State ptr) as integer
	dim x as integer
	dim y as integer
	dim show as integer
	x=lua_tointeger(L,1)
	y=lua_tointeger(L,2)
	show=lua_toboolean(L,3)
	locate x,y,show
	curses_locate=0
end function

function curses_sleep cdecl (byval L as lua_State ptr) as integer
	dim ms as integer
	ms=lua_tointeger(L,1)
	sleep ms
	curses_sleep=0
end function

function curses_csrlin cdecl (byval L as lua_State ptr) as integer
	lua_pushnumber(L,csrlin)
	curses_csrlin=1
end function

function curses_pos cdecl (byval L as lua_State ptr) as integer
	lua_pushnumber(L,pos)
	curses_pos=1
end function

function plotwintitle cdecl (byval L as lua_State ptr) as integer	
  dim as zstring ptr titulek
  titulek=lua_tostring(L,1)
  WindowTitle *titulek
	plotwintitle=0
end function

function curses_getwidth cdecl (byval L as lua_State ptr) as integer
  Dim As Integer w
  w = Width
  lua_pushnumber(L,HiWord(w))
  lua_pushnumber(L,LoWord(w))
  curses_getwidth=2
end function

WindowTitle "Plot"
Screenres 640,480,32
dim L as lua_State ptr
dim f as string

If Right(COMMAND$(0),8)<>"plot.exe" Then
  f="plot.lua"
Else
  print "Enter name of file:"
  Line Input f
  cls
End If
' create a lua state
L = lua_open( )
' load the base lua library (needed for 'print')
luaL_openlibs( L )
' register the function to be called from lua as MinMax
lua_register( L, "point", @plotpoint )
lua_register( L, "line", @plotline )
lua_register( L, "color", @plotcolor )
lua_register( L, "cls", @plotcls )
lua_register( L, "pause", @plotpause )
lua_register( L, "write", @plotprint )
lua_register( L, "read", @plotinput )
lua_register( L, "getkey", @curses_getkey )
lua_register( L, "locate", @curses_locate )
lua_register( L, "sleep", @curses_sleep )
lua_register( L, "csrlin", @curses_csrlin )
lua_register( L, "pos", @curses_pos )
lua_register( L, "wintitle", @plotwintitle )
lua_register( L, "getwidth", @curses_getwidth )

'
' execute the lua script from a file
luaL_dofile( L, f )
' release the lua state
lua_close( L )
print "Ended"
sleep

Changes to plot.exe.

cannot compute difference between binary files