SlideShare a Scribd company logo
Ring Documentation, Release 1.5.4
28 IncLPJump x 18
29 POPExitMark
30 POPStep
31 NewLine 6
32 LoadFuncP test
33 Call 0
34 NoOperation
35 NewLine 8
36 PushV
37 FreeStack
38 ReturnNull
39 Func test
40 NewLine 9
41 FuncExE
42 PushC welcome
43 PushP 007D3670 0
44 PushV
45 SUM 0
46 Print
47 NewLine 10
48 PushPLocal o1 0
49 AssignmentPointer
50 New point
51 SetScope
52 PushV
53 BraceStart
54 LoadA x 0 58
55 AssignmentPointer
56 PushN 10.000000
57 BeforeEqual 0
58 SetProperty 0 106
59 FreeStack
60 LoadA y 0 64
61 AssignmentPointer
62 PushN 20.000000
63 BeforeEqual 0
64 SetProperty 0 141
65 FreeStack
66 LoadA z 0 70
67 AssignmentPointer
68 PushN 30.000000
69 BeforeEqual 0
70 SetProperty 0 176
71 FreeStack
72 LoadFunc ismethod
73 LoadA self 0
74 PushV
75 PushC braceend
76 Call
77 NoOperation
78 PushV
79 JumpZ 85
80 LoadFunc braceend
81 Call
82 NoOperation
83 PushV
84 FreeStack
85 BraceEnd
65.4. Printing Final Intermediate Code 735
Ring Documentation, Release 1.5.4
86 FreeStack
87 NewLine 11
88 FuncExE
89 PushPLocal o1 0
90 PushV
91 Print
92 NewLine 13
93 ReturnNull
94 Class point 007D8470
95 NewLabel
96 LoadA x 0
97 PushV
98 FreeStack
99 LoadA y 0
100 PushV
101 FreeStack
102 LoadA z 0
103 PushV
104 FreeStack
105 ReturnNull
106 LoadFunc ismethod
107 LoadA ring_gettemp_var 0
108 PushV
109 PushC setx
110 Call 0
111 NoOperation
112 PushV
113 JumpZ 132
114 NewLine 2
115 LoadA ring_gettemp_var 0
116 LoadMethod setx
117 LoadA ring_settemp_var 0
118 PushV
119 Call 0 1
120 AfterCallMethod
121 PushV
122 FreeStack
123 NewLine 3
124 LoadA ring_tempflag_var 0 128
125 AssignmentPointer
126 PushN 0.000000
127 BeforeEqual 0
128 Assignment 0 0
129 FreeStack
130 NewLine 4
131 Jump 140
132 NewLine 5
133 PushP 007D37D8 0 137
134 AssignmentPointer
135 PushN 1.000000
136 BeforeEqual 0
137 Assignment 0 0
138 FreeStack
139 NewLine 6
140 Return
141 LoadFunc ismethod
142 LoadA ring_gettemp_var 0
143 PushV
65.4. Printing Final Intermediate Code 736
Ring Documentation, Release 1.5.4
144 PushC sety
145 Call 0
146 NoOperation
147 PushV
148 JumpZ 167
149 NewLine 2
150 LoadA ring_gettemp_var 0
151 LoadMethod sety
152 LoadA ring_settemp_var 0
153 PushV
154 Call 0 1
155 AfterCallMethod
156 PushV
157 FreeStack
158 NewLine 3
159 LoadA ring_tempflag_var 0 163
160 AssignmentPointer
161 PushN 0.000000
162 BeforeEqual 0
163 Assignment 0 0
164 FreeStack
165 NewLine 4
166 Jump 175
167 NewLine 5
168 PushP 007D37D8 0 172
169 AssignmentPointer
170 PushN 1.000000
171 BeforeEqual 0
172 Assignment 0 0
173 FreeStack
174 NewLine 6
175 Return
176 LoadFunc ismethod
177 LoadA ring_gettemp_var 0
178 PushV
179 PushC setz
180 Call 0
181 NoOperation
182 PushV
183 JumpZ 202
184 NewLine 2
185 LoadA ring_gettemp_var 0
186 LoadMethod setz
187 LoadA ring_settemp_var 0
188 PushV
189 Call 0 1
190 AfterCallMethod
191 PushV
192 FreeStack
193 NewLine 3
194 LoadA ring_tempflag_var 0 198
195 AssignmentPointer
196 PushN 0.000000
197 BeforeEqual 0
198 Assignment 0 0
199 FreeStack
200 NewLine 4
201 Jump 210
65.4. Printing Final Intermediate Code 737
Ring Documentation, Release 1.5.4
202 NewLine 5
203 PushP 007D37D8 0 207
204 AssignmentPointer
205 PushN 1.000000
206 BeforeEqual 0
207 Assignment 0 0
208 FreeStack
209 NewLine 6
210 Return
===================================================
65.5 CGI Support
Command:
ring test.ring -cgi
65.6 No Run
Command:
ring test.ring -norun
65.7 Printing Instruction Operation Code
Command:
ring test.ring -ins
Output:
===================================================
Operation : ReturnNull
PC : 1
Line Number : 1 , File test.ring
SP (After) : 0 - FuncSP : 0
LineNumber 1
===================================================
.....
.....
.....
Tip: Output removed from the previous example because it’s very large!
65.8 Performance
Command:
65.5. CGI Support 738
Ring Documentation, Release 1.5.4
ring test.ring -performance
Output:
===================================================
Date : 2015/09/15 Time : 15:56:17
Clock : 0
===================================================
Hello World
1
2
3
4
5
6
7
8
9
10
welcome
x: 10.000000
y: 20.000000
z: 30.000000
===================================================
Date : 2015/09/15 Time : 15:56:17
Clock : 0
===================================================
65.9 Generate Object File
You can generate object file (.ringo) from your source code file (.ring) using -go option
Tip: You will get one object file to use for distributing/running your application which may contains one or many
ring source files that you can keep or distribute based on the application (commercial or open source).
Command:
ring test.ring -go
To run the compiled object file
ring test.ringo
65.9. Generate Object File 739
CHAPTER
SIXTYSIX
LOW LEVEL FUNCTIONS
In this chapter we will learn about the low level functions provided by Ring
• callgc()
• varptr()
• space()
• nullpointer()
• object2pointer()
• pointer2object()
• ptrcmp()
• ringvm_cfunctionslist()
• ringvm_functionslist()
• ringvm_classeslist()
• ringvm_packageslist()
• ringvm_memorylist()
• ringvm_calllist()
• ringvm_fileslist()
• ringvm_settrace()
• ringvm_tracedata()
• ringvm_traceevent()
• ringvm_tracefunc()
• ringvm_scopescount()
• ringvm_evalinscope()
• ringvm_passerror()
• ringvm_hideerrorMsg()
• ringvm_callfunc()
740
Ring Documentation, Release 1.5.4
66.1 callgc() function
Use this function to force calling the garbage collector during function execution when you use a loop that create temp.
variables that you don’t free using the assignment operation.
It’s very rare to need this function but it’s useful when you create something like event-loop for your game engine and
start creating lists on the fly when you call functions.
Example
While True
# process events
# call functions using temp. lists like myfunc(["temp list"])
# call the garbage collector
callgc()
End
Tip: In Ring the garbage collector works automatically in the end of function execution or when you use the assign-
ment statement.
66.2 varptr() function
Use the varptr() function when you need to pass a pointer to a C/C++ function.
Syntax:
varptr(cVariableName,cPointerType) —> Low Level Object (C Pointer)
example:
r = 10
z = 20
see r + nl
see varptr("r","int")
see varptr("z","int")
Output:
10
00E3C740
int
2
00E3BEC0
int
2
Note: the low level object is a list contains three items (The Pointer, The Type, The Status)
66.3 space() function
Use the space function to allocate a specific number of bytes in Memory.
66.1. callgc() function 741
Ring Documentation, Release 1.5.4
Syntax:
Space(nBytesCount) ---> String
Example:
mystring = space(200)
See "String Size : " + len(mystring) + nl
See "String : " + mystring + nl
See "String Pointer : "
See varptr("mystring","char *")
Output:
String Size : 200
String :
String Pointer : 00FF8FE8
char *
2
Note: You may need the space() and VarPtr() functions to pass buffers to C functions.
66.4 nullpointer() function
You may need to pass the NULL pointer to a C function that may expect a pointer as parameter and accept NULL
pointers for optional parameters.
Example:
The next example uses the SDL_BlitSurface() function from the LibSDL Library through RingSDL The function
accept SDL_Rect pointers in the second and the last parameter. Also the function accept NULL pointers, so we can
pass them using the NULLPointer() Function.
SDL_BlitSurface(text, nullpointer(), surface, nullpointer())
Note: The previous code doesn’t work alone, you need to learn how to use RingSDL first.
Tip: We can pass NULL as parameter instead of using NULLPointer()
66.5 object2pointer() function
Use this function to get a C pointer for Ring lists and objects
Syntax:
object2pointer(List|Object) --> Low Level Object ( C Pointer )
66.6 pointer2object() function
Use this function to get the Ring list and/or object from the low level object (C Pointer)
66.4. nullpointer() function 742
Ring Documentation, Release 1.5.4
Syntax:
pointer2object(Low Level Object) ---> List|Object
Example:
# Create the list
mylist = 1:5
# Create pointer to the list
x = object2pointer(mylist)
see x
see nl
# Add items to the list
mylist + "welcome"
# print the list items
y = pointer2object(x)
see y
Output:
0069A5D8
OBJECTPOINTER
0
1
2
3
4
5
welcome
Note: In Ring the assignment operator copy lists and objects by value, to copy by reference Just use the ob-
ject2pointer() and pointer2object() functions.
Tip: The object2pointer() and pointer2object() are used in the stdlib - Tree Class implementation to create a reference
for the parent node (object) in the child node (another object).
66.7 ptrcmp() function
We can compare between two pointers (C Objects) using the ptrcmp() function.
Syntax:
ptrcmp(oObject1,oObject2) ---> value = 1 if oObject1 = oObject2
value = 0 if oObject1 != oObject2
Example:
fp = fopen("ptrcmp.ring","r")
fp2 = fp
fp3 = fopen("ptrcmp.ring","r")
66.7. ptrcmp() function 743
Ring Documentation, Release 1.5.4
see ptrcmp(fp,fp2) + nl
see ptrcmp(fp,fp3) + nl
fclose(fp)
fclose(fp3)
Output:
1
0
66.8 ringvm_cfunctionslist() function
The Function return a list of functions written in C.
Syntax:
RingVM_CFunctionsList() ---> List
Example:
See RingVM_CFunctionsList()
66.9 ringvm_functionslist() function
The Function return a list of functions written in Ring.
Each List Member is a list contains the next items
• Function Name
• Program Counter (PC) - Function Position in Byte Code.
• Source Code File Name
• Private Flag (For Private Methods in Classes)
Syntax:
RingVM_FunctionsList() ---> List
Example:
test()
func test
see ringvm_functionslist()
Output:
test
8
B:/ring/tests/scripts/functionslist.ring
0
66.8. ringvm_cfunctionslist() function 744

More Related Content

What's hot (20)

PDF
Finch + Finagle OAuth2
Vladimir Kostyukov
Ā 
PDF
Un dsl pour ma base de donnƩes
Romain Lecomte
Ā 
PDF
The Ring programming language version 1.8 book - Part 86 of 202
Mahmoud Samir Fayed
Ā 
PDF
Async Microservices with Twitter's Finagle
Vladimir Kostyukov
Ā 
DOCX
C++ file
Mukund Trivedi
Ā 
PDF
The Ring programming language version 1.9 book - Part 90 of 210
Mahmoud Samir Fayed
Ā 
PDF
Bartosz Milewski, ā€œRe-discovering Monads in C++ā€
Platonov Sergey
Ā 
PDF
The Ring programming language version 1.2 book - Part 57 of 84
Mahmoud Samir Fayed
Ā 
KEY
Python Yield
yangjuven
Ā 
PDF
C++ practical
Rahul juneja
Ā 
PDF
The Ring programming language version 1.5.1 book - Part 74 of 180
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.6 book - Part 81 of 189
Mahmoud Samir Fayed
Ā 
PPTX
Score (smart contract for icon)
Doyun Hwang
Ā 
DOCX
Programs
kulwinderbawa007
Ā 
PDF
Javascript compilation execution
Fanis Prodromou
Ā 
PDF
Apache PIG - User Defined Functions
Christoph Bauer
Ā 
PDF
Alexey Tsoy Meta Programming in C++ 16.11.17
LogeekNightUkraine
Ā 
ZIP
Intro to Pig UDF
Chris Wilkes
Ā 
PDF
RESTful API using scalaz (3)
Yeshwanth Kumar
Ā 
PDF
Python meetup: coroutines, event loops, and non-blocking I/O
Buzzcapture
Ā 
Finch + Finagle OAuth2
Vladimir Kostyukov
Ā 
Un dsl pour ma base de donnƩes
Romain Lecomte
Ā 
The Ring programming language version 1.8 book - Part 86 of 202
Mahmoud Samir Fayed
Ā 
Async Microservices with Twitter's Finagle
Vladimir Kostyukov
Ā 
C++ file
Mukund Trivedi
Ā 
The Ring programming language version 1.9 book - Part 90 of 210
Mahmoud Samir Fayed
Ā 
Bartosz Milewski, ā€œRe-discovering Monads in C++ā€
Platonov Sergey
Ā 
The Ring programming language version 1.2 book - Part 57 of 84
Mahmoud Samir Fayed
Ā 
Python Yield
yangjuven
Ā 
C++ practical
Rahul juneja
Ā 
The Ring programming language version 1.5.1 book - Part 74 of 180
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.6 book - Part 81 of 189
Mahmoud Samir Fayed
Ā 
Score (smart contract for icon)
Doyun Hwang
Ā 
Programs
kulwinderbawa007
Ā 
Javascript compilation execution
Fanis Prodromou
Ā 
Apache PIG - User Defined Functions
Christoph Bauer
Ā 
Alexey Tsoy Meta Programming in C++ 16.11.17
LogeekNightUkraine
Ā 
Intro to Pig UDF
Chris Wilkes
Ā 
RESTful API using scalaz (3)
Yeshwanth Kumar
Ā 
Python meetup: coroutines, event loops, and non-blocking I/O
Buzzcapture
Ā 

Similar to The Ring programming language version 1.5.4 book - Part 77 of 185 (20)

PDF
The Ring programming language version 1.5.1 book - Part 73 of 180
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.2 book - Part 56 of 84
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.5.2 book - Part 74 of 181
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.4 book - Part 21 of 30
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.3 book - Part 59 of 88
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.9 book - Part 88 of 210
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.6 book - Part 79 of 189
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.5.2 book - Part 75 of 181
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.7 book - Part 91 of 196
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 89 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.5.3 book - Part 188 of 194
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.7 book - Part 81 of 196
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 101 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.5.1 book - Part 12 of 180
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.7 book - Part 16 of 196
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.7 book - Part 83 of 196
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.8 book - Part 84 of 202
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.3 book - Part 84 of 88
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.6 book - Part 15 of 189
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.6 book - Part 184 of 189
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.5.1 book - Part 73 of 180
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.2 book - Part 56 of 84
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.5.2 book - Part 74 of 181
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.4 book - Part 21 of 30
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.3 book - Part 59 of 88
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.9 book - Part 88 of 210
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.6 book - Part 79 of 189
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.5.2 book - Part 75 of 181
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.7 book - Part 91 of 196
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 89 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.5.3 book - Part 188 of 194
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.7 book - Part 81 of 196
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 101 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.5.1 book - Part 12 of 180
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.7 book - Part 16 of 196
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.7 book - Part 83 of 196
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.8 book - Part 84 of 202
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.3 book - Part 84 of 88
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.6 book - Part 15 of 189
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.6 book - Part 184 of 189
Mahmoud Samir Fayed
Ā 
Ad

More from Mahmoud Samir Fayed (20)

PDF
The Ring programming language version 1.10 book - Part 212 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 211 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 210 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 208 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 207 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 205 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 206 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 204 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 203 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 202 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 201 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 200 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 199 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 198 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 197 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 196 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 195 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 194 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 193 of 212
Mahmoud Samir Fayed
Ā 
PDF
The Ring programming language version 1.10 book - Part 192 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 212 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 211 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 210 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 208 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 207 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 205 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 206 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 204 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 203 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 202 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 201 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 200 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 199 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 198 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 197 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 196 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 195 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 194 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 193 of 212
Mahmoud Samir Fayed
Ā 
The Ring programming language version 1.10 book - Part 192 of 212
Mahmoud Samir Fayed
Ā 
Ad

Recently uploaded (20)

PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
Ā 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
Ā 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
Ā 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
Ā 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
Ā 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
Ā 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
Ā 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
Ā 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
Ā 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
Ā 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
Ā 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
Ā 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
Ā 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
Ā 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
Ā 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
Ā 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
Ā 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
Ā 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
Ā 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
Ā 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
Ā 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
Ā 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
Ā 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
Ā 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
Ā 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
Ā 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
Ā 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
Ā 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
Ā 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
Ā 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
Ā 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
Ā 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
Ā 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
Ā 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
Ā 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
Ā 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
Ā 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
Ā 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
Ā 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
Ā 

The Ring programming language version 1.5.4 book - Part 77 of 185

  • 1. Ring Documentation, Release 1.5.4 28 IncLPJump x 18 29 POPExitMark 30 POPStep 31 NewLine 6 32 LoadFuncP test 33 Call 0 34 NoOperation 35 NewLine 8 36 PushV 37 FreeStack 38 ReturnNull 39 Func test 40 NewLine 9 41 FuncExE 42 PushC welcome 43 PushP 007D3670 0 44 PushV 45 SUM 0 46 Print 47 NewLine 10 48 PushPLocal o1 0 49 AssignmentPointer 50 New point 51 SetScope 52 PushV 53 BraceStart 54 LoadA x 0 58 55 AssignmentPointer 56 PushN 10.000000 57 BeforeEqual 0 58 SetProperty 0 106 59 FreeStack 60 LoadA y 0 64 61 AssignmentPointer 62 PushN 20.000000 63 BeforeEqual 0 64 SetProperty 0 141 65 FreeStack 66 LoadA z 0 70 67 AssignmentPointer 68 PushN 30.000000 69 BeforeEqual 0 70 SetProperty 0 176 71 FreeStack 72 LoadFunc ismethod 73 LoadA self 0 74 PushV 75 PushC braceend 76 Call 77 NoOperation 78 PushV 79 JumpZ 85 80 LoadFunc braceend 81 Call 82 NoOperation 83 PushV 84 FreeStack 85 BraceEnd 65.4. Printing Final Intermediate Code 735
  • 2. Ring Documentation, Release 1.5.4 86 FreeStack 87 NewLine 11 88 FuncExE 89 PushPLocal o1 0 90 PushV 91 Print 92 NewLine 13 93 ReturnNull 94 Class point 007D8470 95 NewLabel 96 LoadA x 0 97 PushV 98 FreeStack 99 LoadA y 0 100 PushV 101 FreeStack 102 LoadA z 0 103 PushV 104 FreeStack 105 ReturnNull 106 LoadFunc ismethod 107 LoadA ring_gettemp_var 0 108 PushV 109 PushC setx 110 Call 0 111 NoOperation 112 PushV 113 JumpZ 132 114 NewLine 2 115 LoadA ring_gettemp_var 0 116 LoadMethod setx 117 LoadA ring_settemp_var 0 118 PushV 119 Call 0 1 120 AfterCallMethod 121 PushV 122 FreeStack 123 NewLine 3 124 LoadA ring_tempflag_var 0 128 125 AssignmentPointer 126 PushN 0.000000 127 BeforeEqual 0 128 Assignment 0 0 129 FreeStack 130 NewLine 4 131 Jump 140 132 NewLine 5 133 PushP 007D37D8 0 137 134 AssignmentPointer 135 PushN 1.000000 136 BeforeEqual 0 137 Assignment 0 0 138 FreeStack 139 NewLine 6 140 Return 141 LoadFunc ismethod 142 LoadA ring_gettemp_var 0 143 PushV 65.4. Printing Final Intermediate Code 736
  • 3. Ring Documentation, Release 1.5.4 144 PushC sety 145 Call 0 146 NoOperation 147 PushV 148 JumpZ 167 149 NewLine 2 150 LoadA ring_gettemp_var 0 151 LoadMethod sety 152 LoadA ring_settemp_var 0 153 PushV 154 Call 0 1 155 AfterCallMethod 156 PushV 157 FreeStack 158 NewLine 3 159 LoadA ring_tempflag_var 0 163 160 AssignmentPointer 161 PushN 0.000000 162 BeforeEqual 0 163 Assignment 0 0 164 FreeStack 165 NewLine 4 166 Jump 175 167 NewLine 5 168 PushP 007D37D8 0 172 169 AssignmentPointer 170 PushN 1.000000 171 BeforeEqual 0 172 Assignment 0 0 173 FreeStack 174 NewLine 6 175 Return 176 LoadFunc ismethod 177 LoadA ring_gettemp_var 0 178 PushV 179 PushC setz 180 Call 0 181 NoOperation 182 PushV 183 JumpZ 202 184 NewLine 2 185 LoadA ring_gettemp_var 0 186 LoadMethod setz 187 LoadA ring_settemp_var 0 188 PushV 189 Call 0 1 190 AfterCallMethod 191 PushV 192 FreeStack 193 NewLine 3 194 LoadA ring_tempflag_var 0 198 195 AssignmentPointer 196 PushN 0.000000 197 BeforeEqual 0 198 Assignment 0 0 199 FreeStack 200 NewLine 4 201 Jump 210 65.4. Printing Final Intermediate Code 737
  • 4. Ring Documentation, Release 1.5.4 202 NewLine 5 203 PushP 007D37D8 0 207 204 AssignmentPointer 205 PushN 1.000000 206 BeforeEqual 0 207 Assignment 0 0 208 FreeStack 209 NewLine 6 210 Return =================================================== 65.5 CGI Support Command: ring test.ring -cgi 65.6 No Run Command: ring test.ring -norun 65.7 Printing Instruction Operation Code Command: ring test.ring -ins Output: =================================================== Operation : ReturnNull PC : 1 Line Number : 1 , File test.ring SP (After) : 0 - FuncSP : 0 LineNumber 1 =================================================== ..... ..... ..... Tip: Output removed from the previous example because it’s very large! 65.8 Performance Command: 65.5. CGI Support 738
  • 5. Ring Documentation, Release 1.5.4 ring test.ring -performance Output: =================================================== Date : 2015/09/15 Time : 15:56:17 Clock : 0 =================================================== Hello World 1 2 3 4 5 6 7 8 9 10 welcome x: 10.000000 y: 20.000000 z: 30.000000 =================================================== Date : 2015/09/15 Time : 15:56:17 Clock : 0 =================================================== 65.9 Generate Object File You can generate object file (.ringo) from your source code file (.ring) using -go option Tip: You will get one object file to use for distributing/running your application which may contains one or many ring source files that you can keep or distribute based on the application (commercial or open source). Command: ring test.ring -go To run the compiled object file ring test.ringo 65.9. Generate Object File 739
  • 6. CHAPTER SIXTYSIX LOW LEVEL FUNCTIONS In this chapter we will learn about the low level functions provided by Ring • callgc() • varptr() • space() • nullpointer() • object2pointer() • pointer2object() • ptrcmp() • ringvm_cfunctionslist() • ringvm_functionslist() • ringvm_classeslist() • ringvm_packageslist() • ringvm_memorylist() • ringvm_calllist() • ringvm_fileslist() • ringvm_settrace() • ringvm_tracedata() • ringvm_traceevent() • ringvm_tracefunc() • ringvm_scopescount() • ringvm_evalinscope() • ringvm_passerror() • ringvm_hideerrorMsg() • ringvm_callfunc() 740
  • 7. Ring Documentation, Release 1.5.4 66.1 callgc() function Use this function to force calling the garbage collector during function execution when you use a loop that create temp. variables that you don’t free using the assignment operation. It’s very rare to need this function but it’s useful when you create something like event-loop for your game engine and start creating lists on the fly when you call functions. Example While True # process events # call functions using temp. lists like myfunc(["temp list"]) # call the garbage collector callgc() End Tip: In Ring the garbage collector works automatically in the end of function execution or when you use the assign- ment statement. 66.2 varptr() function Use the varptr() function when you need to pass a pointer to a C/C++ function. Syntax: varptr(cVariableName,cPointerType) —> Low Level Object (C Pointer) example: r = 10 z = 20 see r + nl see varptr("r","int") see varptr("z","int") Output: 10 00E3C740 int 2 00E3BEC0 int 2 Note: the low level object is a list contains three items (The Pointer, The Type, The Status) 66.3 space() function Use the space function to allocate a specific number of bytes in Memory. 66.1. callgc() function 741
  • 8. Ring Documentation, Release 1.5.4 Syntax: Space(nBytesCount) ---> String Example: mystring = space(200) See "String Size : " + len(mystring) + nl See "String : " + mystring + nl See "String Pointer : " See varptr("mystring","char *") Output: String Size : 200 String : String Pointer : 00FF8FE8 char * 2 Note: You may need the space() and VarPtr() functions to pass buffers to C functions. 66.4 nullpointer() function You may need to pass the NULL pointer to a C function that may expect a pointer as parameter and accept NULL pointers for optional parameters. Example: The next example uses the SDL_BlitSurface() function from the LibSDL Library through RingSDL The function accept SDL_Rect pointers in the second and the last parameter. Also the function accept NULL pointers, so we can pass them using the NULLPointer() Function. SDL_BlitSurface(text, nullpointer(), surface, nullpointer()) Note: The previous code doesn’t work alone, you need to learn how to use RingSDL first. Tip: We can pass NULL as parameter instead of using NULLPointer() 66.5 object2pointer() function Use this function to get a C pointer for Ring lists and objects Syntax: object2pointer(List|Object) --> Low Level Object ( C Pointer ) 66.6 pointer2object() function Use this function to get the Ring list and/or object from the low level object (C Pointer) 66.4. nullpointer() function 742
  • 9. Ring Documentation, Release 1.5.4 Syntax: pointer2object(Low Level Object) ---> List|Object Example: # Create the list mylist = 1:5 # Create pointer to the list x = object2pointer(mylist) see x see nl # Add items to the list mylist + "welcome" # print the list items y = pointer2object(x) see y Output: 0069A5D8 OBJECTPOINTER 0 1 2 3 4 5 welcome Note: In Ring the assignment operator copy lists and objects by value, to copy by reference Just use the ob- ject2pointer() and pointer2object() functions. Tip: The object2pointer() and pointer2object() are used in the stdlib - Tree Class implementation to create a reference for the parent node (object) in the child node (another object). 66.7 ptrcmp() function We can compare between two pointers (C Objects) using the ptrcmp() function. Syntax: ptrcmp(oObject1,oObject2) ---> value = 1 if oObject1 = oObject2 value = 0 if oObject1 != oObject2 Example: fp = fopen("ptrcmp.ring","r") fp2 = fp fp3 = fopen("ptrcmp.ring","r") 66.7. ptrcmp() function 743
  • 10. Ring Documentation, Release 1.5.4 see ptrcmp(fp,fp2) + nl see ptrcmp(fp,fp3) + nl fclose(fp) fclose(fp3) Output: 1 0 66.8 ringvm_cfunctionslist() function The Function return a list of functions written in C. Syntax: RingVM_CFunctionsList() ---> List Example: See RingVM_CFunctionsList() 66.9 ringvm_functionslist() function The Function return a list of functions written in Ring. Each List Member is a list contains the next items • Function Name • Program Counter (PC) - Function Position in Byte Code. • Source Code File Name • Private Flag (For Private Methods in Classes) Syntax: RingVM_FunctionsList() ---> List Example: test() func test see ringvm_functionslist() Output: test 8 B:/ring/tests/scripts/functionslist.ring 0 66.8. ringvm_cfunctionslist() function 744