Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,4 @@
|
|||
Define varA.i = 5, varB.i = 0, *myInteger.Integer
|
||||
|
||||
*myInteger = @varA ;set pointer to address of an integer variable
|
||||
varB = *myInteger\i + 3 ;set variable to the 3 + value of dereferenced pointer, i.e varB = 8
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Define varC.i = 12
|
||||
*myInteger = @varC
|
||||
|
|
@ -0,0 +1 @@
|
|||
*myInteger = #Null ;or anything evaluating to zero
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
Dim myArray(10)
|
||||
*myInteger = myArray()
|
||||
;Or alternatively:
|
||||
*myInteger = @myArray(0)
|
||||
;any specific element
|
||||
*myInteger = @myArray(4) ;element 4
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
*myInteger + 3 * SizeOf(Integer) ;pointer now points to myArray(3)
|
||||
*myInteger - 2 * SizeOf(Integer) ;pointer now points to myArray(1)
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
Structure employee
|
||||
id.i
|
||||
name.s
|
||||
jobs.s[20] ;array of job descriptions
|
||||
EndStructure
|
||||
|
||||
Dim employees.employee(10) ;an array of employee's
|
||||
|
||||
;set a string pointer to the 6th job of the 4th employee
|
||||
*myString.String = @employees(3) + OffsetOf(employee\jobs) + 5 * SizeOf(String)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
*pointer = @varA
|
||||
*pointer = @myFunction()
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
; Getting the address of a lable in the code
|
||||
text$="'Lab' is at address "+Str(?lab)
|
||||
MessageRequester("Info",text$)
|
||||
|
||||
; Using lables to calculate size
|
||||
text$="Size of the datasetion is "+Str(?lab2-?lab)+" bytes."
|
||||
MessageRequester("Info",text$)
|
||||
|
||||
; Using above to copy specific datas
|
||||
Define individes=(?lab2-?lab1)/SizeOf(Integer)
|
||||
Dim Stuff(individes-1) ; As PureBasic uses 0-based arrays
|
||||
CopyMemory(?lab1,@Stuff(),?lab2-?lab1)
|
||||
|
||||
DataSection
|
||||
lab:
|
||||
Data.s "Foo", "Fuu"
|
||||
lab1:
|
||||
Data.i 3,1,4,5,9,2,1,6
|
||||
lab2:
|
||||
EndDataSection
|
||||
Loading…
Add table
Add a link
Reference in a new issue