SlideShare a Scribd company logo
Ring Documentation, Release 1.10
],
:ubunturingfolderfiles = [
],
:fedoraringfolderfiles = [
],
:macosringfolderfiles = [
],
:run = "ring main.ring",
:windowsrun = "",
:linuxrun = "",
:macosrun = "",
:ubunturun = "",
:fedorarun = "",
:setup = "",
:windowssetup = "",
:linuxsetup = "",
:macossetup = "",
:ubuntusetup = "",
:fedorasetup = "",
:remove = "",
:windowsremove = "",
:linuxremove = "",
:macosremove = "",
:ubunturemove = "",
:fedoraremove = ""
]
78.11 The Package Description File
The package description file contains the package information defined in the list aPackageInfo
Attribute Description
Name Package Name
Description Package Desciption
Folder The Folder Name (Will be created in ring/ringpm/packages)
Developer The Package Developer Name
Email The Package Developer Email
License The Package License
Version The Current Version of the Package (Latest Release)
RingVersion The Required Ring Language Version (Minimum Version)
Versions List of different versions provided by different branches in the GitHub project
Libs List of dependencies (Defined by name, version & GitHub user name)
Files List of files (will be installed in ring/ringpm/packages/[Folder]
RingFolderFiles List of files (will be installed in ring folder)
WindowsFiles Like (Files) but for Microsoft Windows Only
LinuxFiles Like (Files) but for Linux Only
MacOSFiles Like (Files) but for macOS Only
UbuntuFiles Like (Files) but for Ubuntu Only
FedoraFiles Like (Files) but for Fedora Only
Continued on next page
78.11. The Package Description File 878
Ring Documentation, Release 1.10
Table 78.1 – continued from previous page
Attribute Description
WindowsRingFolderFiles Like (RingFolderFiles) but for Microsoft Windows Only
LinuxRingFolderFiles Like (RingFolderFiles) but for Linux Only
MacOSRingFolderFiles Like (RingFolderFiles) but for macOS Only
UbuntuRingFolderFiles Like (RingFolderFiles) but for Ubuntu Only
FedoraRingFolderFiles Like (RingFolderFiles) but for Fedora Only
Run System Command (Command prompt or Terminal) to run the package
WindowsRun Like (Run) but for Microsoft Windows Only
LinuxRun Like (Run) but for Linux Only
MacOSRun Like (Run) but for macOS Only
UbuntuRun Like (Run) but for Ubuntu Only
FedoraRun Like (Run) but for Fedora Only
Setup System Command (Command prompt or Terminal) after downloading the package files
WindowsSetup Like (Setup) but for Microsoft Windows Only
LinuxSetup Like (Setup) but for Linux Only
MacOSSetup Like (Setup) but for macOS Only
UbuntuSetup Like (Setup) but for Ubuntu Only
FedoraSetup Like (Setup) but for Fedora Only
Remove System Command (Command prompt or Terminal) before removing the package files
WindowsRemove Like (Remove) but for Microsoft Windows Only
LinuxRemove Like (Remove) but for Linux Only
MacOSRemove Like (Remove) but for macOS Only
UbuntuRemove Like (Remove) but for Ubuntu Only
FedoraRemove Like (Remove) but for Fedora Only
78.12 Create Package in the Current Folder
To create a package for an application that already exists, go to the application folder then type
ringpm package
This will create the package definition file (package.ring) and will add all of the application files to the package
definition.
Each RingPM package contains the package definition file (package.ring)
The package definition file is a list that describe the package information and files.
Example :
The package definition file for the Ring Notepad package
aPackageInfo = [
:name = "The RingNotepad Package",
:description = "Our RingNotepad package using the Ring programming language",
:folder = "ringnotepad",
:developer = "Mahmoud Fayed",
:email = "msfclipper@yahoo.com",
:license = "MIT License",
:version = "1.0.0",
:ringversion = "1.10",
:versions = [
[
78.12. Create Package in the Current Folder 879
Ring Documentation, Release 1.10
:version = "1.0.0",
:branch = "master"
]
],
:libs = [
[
:name = "stdlib",
:version = "1.0",
:providerusername = ""
],
[
:name = "ringqt",
:version = "1.0",
:providerusername = ""
],
[
:name = "findinfiles",
:version = "1.0",
:providerusername = ""
],
[
:name = "formdesigner",
:version = "1.0",
:providerusername = ""
],
[
:name = "libdepwin_apache",
:version = "1.0",
:providerusername = ""
]
],
:files = [
"main.ring",
"README.md"
],
:ringfolderfiles = [
"applications/rnote/batch/killwebserver.bat",
"applications/rnote/batch/run.bat",
"applications/rnote/batch/run2.bat",
"applications/rnote/image/back.jpg",
"applications/rnote/image/back2.jpg",
"applications/rnote/image/close.png",
"applications/rnote/image/colors.png",
"applications/rnote/image/copy.png",
"applications/rnote/image/cut.png",
"applications/rnote/image/debug.png",
"applications/rnote/image/font.png",
"applications/rnote/image/formdesigner.png",
"applications/rnote/image/new.png",
"applications/rnote/image/notepad.png",
"applications/rnote/image/open.png",
"applications/rnote/image/paste.png",
"applications/rnote/image/print.png",
"applications/rnote/image/project.png",
"applications/rnote/image/richtext.png",
"applications/rnote/image/run.png",
"applications/rnote/image/rungui.png",
"applications/rnote/image/save.png",
78.12. Create Package in the Current Folder 880
Ring Documentation, Release 1.10
"applications/rnote/image/saveas.png",
"applications/rnote/image/search.png",
"applications/rnote/image/source.png",
"applications/rnote/image/undo.png",
"applications/rnote/image/web.png",
"applications/rnote/README.md",
"applications/rnote/rnote.ring",
"applications/rnote/rnoteactivefile.ring",
"applications/rnote/rnoteactivefolder.ring",
"applications/rnote/rnoteautocomplete.ring",
"applications/rnote/rnotebase.ring",
"applications/rnote/rnotecontroller.ring",
"applications/rnote/rnotedistribute.ring",
"applications/rnote/rnoteeditmenu.ring",
"applications/rnote/rnoteeditorevents.ring",
"applications/rnote/rnotefilemenu.ring",
"applications/rnote/rnotefiles.ring",
"applications/rnote/rnotefilestabs.ring",
"applications/rnote/rnotefind.ring",
"applications/rnote/rnotefindinfiles.ring",
"applications/rnote/rnoteformdesigner.ring",
"applications/rnote/rnotegoto.ring",
"applications/rnote/rnotehelp.ring",
"applications/rnote/rnotelists.ring",
"applications/rnote/rnotemainfiletoolbar.ring",
"applications/rnote/rnotemainwindow.ring",
"applications/rnote/rnotemode.ring",
"applications/rnote/rnoteoutputwindow.ring",
"applications/rnote/rnoteprogrammenu.ring",
"applications/rnote/rnoterun.ring",
"applications/rnote/rnotesettings.ring",
"applications/rnote/rnotestyle.ring",
"applications/rnote/rnotetabwidth.ring",
"applications/rnote/rnotetools.ring",
"applications/rnote/rnotetreeviewevents.ring",
"applications/rnote/rnoteviewmenu.ring",
"applications/rnote/rnotewebbrowser.ring"
],
:run = "ring main.ring"
]
78.13 The RingPM Registry File
The RingPM Registry is a local copy of all registred packages.
aPackagesRegistry = [
[ :name = "ringpresentation",
:description = "Powerpoint presentation for the Ring programming language",
:ProviderUserName = "ringpackages"
]
# ...
]
Each package is defined using a list that determine
• Package Name
78.13. The RingPM Registry File 881
Ring Documentation, Release 1.10
• Package Description
• Provider User Name (GitHub User Name)
We can register new packages by updating the registry file then sending a Pull Request
URL : https://github.com/ring-lang/ring/blob/master/ringpm/registry/registry.ring
78.13. The RingPM Registry File 882
CHAPTER
SEVENTYNINE
LOW LEVEL FUNCTIONS
In this chapter we will learn about the low level functions provided by Ring
• callgc()
• varptr()
• space()
• nullpointer()
• object2pointer()
• pointer2object()
• ispointer()
• 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()
• ringvm_see()
• ringvm_give()
883
Ring Documentation, Release 1.10
• ringvm_info()
79.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.
79.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)
79.1. callgc() function 884
Ring Documentation, Release 1.10
79.3 space() function
Use the space function to allocate a specific number of bytes in Memory.
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.
79.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()
79.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 )
79.3. space() function 885
Ring Documentation, Release 1.10
79.6 pointer2object() function
Use this function to get the Ring list and/or object from the low level object (C Pointer)
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).
79.7 ispointer() function
Check if the parameter is a pointer (C Object) or not.
Syntax:
IsPointer(vPara) ---> True|False
Example :
79.6. pointer2object() function 886
Ring Documentation, Release 1.10
fp = fopen(filename(),"r")
? type(fp)
? ispointer(fp)
Output :
file
1
79.8 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")
see ptrcmp(fp,fp2) + nl
see ptrcmp(fp,fp3) + nl
fclose(fp)
fclose(fp3)
Output:
1
0
79.9 ringvm_cfunctionslist() function
The Function return a list of functions written in C.
Syntax:
RingVM_CFunctionsList() ---> List
Example:
See RingVM_CFunctionsList()
79.10 ringvm_functionslist() function
The Function return a list of functions written in Ring.
Each List Member is a list contains the next items
79.8. ptrcmp() function 887

More Related Content

What's hot (20)

PDF
The Ring programming language version 1.8 book - Part 31 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.9 book - Part 57 of 210
Mahmoud Samir Fayed
 
PDF
Sun raysetup
Portal Oliveira
 
PDF
Ubuntu Practice and Configuration
Manoj Sahu
 
PDF
Intro to OTP in Elixir
Jesse Anderson
 
PDF
제 8회 엑셈 수요 세미나 자료 연구컨텐츠팀
EXEM
 
PDF
SecureSocial - Authentication for Play Framework
jaliss
 
PPTX
Intro to Redis
Boulder Java User's Group
 
KEY
1eu introduction
James Wang
 
PDF
Something about Golang
Anton Arhipov
 
PDF
[131]해커의 관점에서 바라보기
NAVER D2
 
PDF
The Ring programming language version 1.7 book - Part 12 of 196
Mahmoud Samir Fayed
 
PDF
Cassandra Community Webinar | Introduction to Apache Cassandra 1.2
DataStax
 
PDF
The Ring programming language version 1.6 book - Part 11 of 189
Mahmoud Samir Fayed
 
PDF
Python于Web 2.0网站的应用 - QCon Beijing 2010
Qiangning Hong
 
PDF
The Ring programming language version 1.5.1 book - Part 44 of 180
Mahmoud Samir Fayed
 
PDF
Remote Notifications
Josef Cacek
 
PDF
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
EXEM
 
PDF
Pdr ppt
sid1232086
 
PDF
Python concurrency: libraries overview
Andrii Mishkovskyi
 
The Ring programming language version 1.8 book - Part 31 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 57 of 210
Mahmoud Samir Fayed
 
Sun raysetup
Portal Oliveira
 
Ubuntu Practice and Configuration
Manoj Sahu
 
Intro to OTP in Elixir
Jesse Anderson
 
제 8회 엑셈 수요 세미나 자료 연구컨텐츠팀
EXEM
 
SecureSocial - Authentication for Play Framework
jaliss
 
1eu introduction
James Wang
 
Something about Golang
Anton Arhipov
 
[131]해커의 관점에서 바라보기
NAVER D2
 
The Ring programming language version 1.7 book - Part 12 of 196
Mahmoud Samir Fayed
 
Cassandra Community Webinar | Introduction to Apache Cassandra 1.2
DataStax
 
The Ring programming language version 1.6 book - Part 11 of 189
Mahmoud Samir Fayed
 
Python于Web 2.0网站的应用 - QCon Beijing 2010
Qiangning Hong
 
The Ring programming language version 1.5.1 book - Part 44 of 180
Mahmoud Samir Fayed
 
Remote Notifications
Josef Cacek
 
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
EXEM
 
Pdr ppt
sid1232086
 
Python concurrency: libraries overview
Andrii Mishkovskyi
 

Similar to The Ring programming language version 1.10 book - Part 92 of 212 (20)

PDF
The Ring programming language version 1.10 book - Part 90 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.9 book - Part 90 of 210
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 9 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.9 book - Part 89 of 210
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 82 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 195 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.3 book - Part 8 of 88
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.4.1 book - Part 31 of 31
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 18 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.3 book - Part 14 of 184
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.9 book - Part 20 of 210
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 5 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.3 book - Part 15 of 184
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 14 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 182 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 91 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 181 of 181
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 85 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.4 book - Part 3 of 30
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 13 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 90 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 90 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 9 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 89 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 82 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 195 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 8 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 31 of 31
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 18 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 14 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 20 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 5 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 15 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 14 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 182 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 91 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 181 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 85 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.4 book - Part 3 of 30
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 13 of 181
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)

PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 

The Ring programming language version 1.10 book - Part 92 of 212

  • 1. Ring Documentation, Release 1.10 ], :ubunturingfolderfiles = [ ], :fedoraringfolderfiles = [ ], :macosringfolderfiles = [ ], :run = "ring main.ring", :windowsrun = "", :linuxrun = "", :macosrun = "", :ubunturun = "", :fedorarun = "", :setup = "", :windowssetup = "", :linuxsetup = "", :macossetup = "", :ubuntusetup = "", :fedorasetup = "", :remove = "", :windowsremove = "", :linuxremove = "", :macosremove = "", :ubunturemove = "", :fedoraremove = "" ] 78.11 The Package Description File The package description file contains the package information defined in the list aPackageInfo Attribute Description Name Package Name Description Package Desciption Folder The Folder Name (Will be created in ring/ringpm/packages) Developer The Package Developer Name Email The Package Developer Email License The Package License Version The Current Version of the Package (Latest Release) RingVersion The Required Ring Language Version (Minimum Version) Versions List of different versions provided by different branches in the GitHub project Libs List of dependencies (Defined by name, version & GitHub user name) Files List of files (will be installed in ring/ringpm/packages/[Folder] RingFolderFiles List of files (will be installed in ring folder) WindowsFiles Like (Files) but for Microsoft Windows Only LinuxFiles Like (Files) but for Linux Only MacOSFiles Like (Files) but for macOS Only UbuntuFiles Like (Files) but for Ubuntu Only FedoraFiles Like (Files) but for Fedora Only Continued on next page 78.11. The Package Description File 878
  • 2. Ring Documentation, Release 1.10 Table 78.1 – continued from previous page Attribute Description WindowsRingFolderFiles Like (RingFolderFiles) but for Microsoft Windows Only LinuxRingFolderFiles Like (RingFolderFiles) but for Linux Only MacOSRingFolderFiles Like (RingFolderFiles) but for macOS Only UbuntuRingFolderFiles Like (RingFolderFiles) but for Ubuntu Only FedoraRingFolderFiles Like (RingFolderFiles) but for Fedora Only Run System Command (Command prompt or Terminal) to run the package WindowsRun Like (Run) but for Microsoft Windows Only LinuxRun Like (Run) but for Linux Only MacOSRun Like (Run) but for macOS Only UbuntuRun Like (Run) but for Ubuntu Only FedoraRun Like (Run) but for Fedora Only Setup System Command (Command prompt or Terminal) after downloading the package files WindowsSetup Like (Setup) but for Microsoft Windows Only LinuxSetup Like (Setup) but for Linux Only MacOSSetup Like (Setup) but for macOS Only UbuntuSetup Like (Setup) but for Ubuntu Only FedoraSetup Like (Setup) but for Fedora Only Remove System Command (Command prompt or Terminal) before removing the package files WindowsRemove Like (Remove) but for Microsoft Windows Only LinuxRemove Like (Remove) but for Linux Only MacOSRemove Like (Remove) but for macOS Only UbuntuRemove Like (Remove) but for Ubuntu Only FedoraRemove Like (Remove) but for Fedora Only 78.12 Create Package in the Current Folder To create a package for an application that already exists, go to the application folder then type ringpm package This will create the package definition file (package.ring) and will add all of the application files to the package definition. Each RingPM package contains the package definition file (package.ring) The package definition file is a list that describe the package information and files. Example : The package definition file for the Ring Notepad package aPackageInfo = [ :name = "The RingNotepad Package", :description = "Our RingNotepad package using the Ring programming language", :folder = "ringnotepad", :developer = "Mahmoud Fayed", :email = "[email protected]", :license = "MIT License", :version = "1.0.0", :ringversion = "1.10", :versions = [ [ 78.12. Create Package in the Current Folder 879
  • 3. Ring Documentation, Release 1.10 :version = "1.0.0", :branch = "master" ] ], :libs = [ [ :name = "stdlib", :version = "1.0", :providerusername = "" ], [ :name = "ringqt", :version = "1.0", :providerusername = "" ], [ :name = "findinfiles", :version = "1.0", :providerusername = "" ], [ :name = "formdesigner", :version = "1.0", :providerusername = "" ], [ :name = "libdepwin_apache", :version = "1.0", :providerusername = "" ] ], :files = [ "main.ring", "README.md" ], :ringfolderfiles = [ "applications/rnote/batch/killwebserver.bat", "applications/rnote/batch/run.bat", "applications/rnote/batch/run2.bat", "applications/rnote/image/back.jpg", "applications/rnote/image/back2.jpg", "applications/rnote/image/close.png", "applications/rnote/image/colors.png", "applications/rnote/image/copy.png", "applications/rnote/image/cut.png", "applications/rnote/image/debug.png", "applications/rnote/image/font.png", "applications/rnote/image/formdesigner.png", "applications/rnote/image/new.png", "applications/rnote/image/notepad.png", "applications/rnote/image/open.png", "applications/rnote/image/paste.png", "applications/rnote/image/print.png", "applications/rnote/image/project.png", "applications/rnote/image/richtext.png", "applications/rnote/image/run.png", "applications/rnote/image/rungui.png", "applications/rnote/image/save.png", 78.12. Create Package in the Current Folder 880
  • 4. Ring Documentation, Release 1.10 "applications/rnote/image/saveas.png", "applications/rnote/image/search.png", "applications/rnote/image/source.png", "applications/rnote/image/undo.png", "applications/rnote/image/web.png", "applications/rnote/README.md", "applications/rnote/rnote.ring", "applications/rnote/rnoteactivefile.ring", "applications/rnote/rnoteactivefolder.ring", "applications/rnote/rnoteautocomplete.ring", "applications/rnote/rnotebase.ring", "applications/rnote/rnotecontroller.ring", "applications/rnote/rnotedistribute.ring", "applications/rnote/rnoteeditmenu.ring", "applications/rnote/rnoteeditorevents.ring", "applications/rnote/rnotefilemenu.ring", "applications/rnote/rnotefiles.ring", "applications/rnote/rnotefilestabs.ring", "applications/rnote/rnotefind.ring", "applications/rnote/rnotefindinfiles.ring", "applications/rnote/rnoteformdesigner.ring", "applications/rnote/rnotegoto.ring", "applications/rnote/rnotehelp.ring", "applications/rnote/rnotelists.ring", "applications/rnote/rnotemainfiletoolbar.ring", "applications/rnote/rnotemainwindow.ring", "applications/rnote/rnotemode.ring", "applications/rnote/rnoteoutputwindow.ring", "applications/rnote/rnoteprogrammenu.ring", "applications/rnote/rnoterun.ring", "applications/rnote/rnotesettings.ring", "applications/rnote/rnotestyle.ring", "applications/rnote/rnotetabwidth.ring", "applications/rnote/rnotetools.ring", "applications/rnote/rnotetreeviewevents.ring", "applications/rnote/rnoteviewmenu.ring", "applications/rnote/rnotewebbrowser.ring" ], :run = "ring main.ring" ] 78.13 The RingPM Registry File The RingPM Registry is a local copy of all registred packages. aPackagesRegistry = [ [ :name = "ringpresentation", :description = "Powerpoint presentation for the Ring programming language", :ProviderUserName = "ringpackages" ] # ... ] Each package is defined using a list that determine • Package Name 78.13. The RingPM Registry File 881
  • 5. Ring Documentation, Release 1.10 • Package Description • Provider User Name (GitHub User Name) We can register new packages by updating the registry file then sending a Pull Request URL : https://github.com/ring-lang/ring/blob/master/ringpm/registry/registry.ring 78.13. The RingPM Registry File 882
  • 6. CHAPTER SEVENTYNINE LOW LEVEL FUNCTIONS In this chapter we will learn about the low level functions provided by Ring • callgc() • varptr() • space() • nullpointer() • object2pointer() • pointer2object() • ispointer() • 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() • ringvm_see() • ringvm_give() 883
  • 7. Ring Documentation, Release 1.10 • ringvm_info() 79.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. 79.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) 79.1. callgc() function 884
  • 8. Ring Documentation, Release 1.10 79.3 space() function Use the space function to allocate a specific number of bytes in Memory. 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. 79.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() 79.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 ) 79.3. space() function 885
  • 9. Ring Documentation, Release 1.10 79.6 pointer2object() function Use this function to get the Ring list and/or object from the low level object (C Pointer) 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). 79.7 ispointer() function Check if the parameter is a pointer (C Object) or not. Syntax: IsPointer(vPara) ---> True|False Example : 79.6. pointer2object() function 886
  • 10. Ring Documentation, Release 1.10 fp = fopen(filename(),"r") ? type(fp) ? ispointer(fp) Output : file 1 79.8 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") see ptrcmp(fp,fp2) + nl see ptrcmp(fp,fp3) + nl fclose(fp) fclose(fp3) Output: 1 0 79.9 ringvm_cfunctionslist() function The Function return a list of functions written in C. Syntax: RingVM_CFunctionsList() ---> List Example: See RingVM_CFunctionsList() 79.10 ringvm_functionslist() function The Function return a list of functions written in Ring. Each List Member is a list contains the next items 79.8. ptrcmp() function 887