September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
60
Task/Null-object/ARM-Assembly/null-object.arm
Normal file
60
Task/Null-object/ARM-Assembly/null-object.arm
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/* ARM assembly Raspberry PI */
|
||||
/* program nullobj.s */
|
||||
|
||||
/* Constantes */
|
||||
.equ STDIN, 0 @ Linux input console
|
||||
.equ STDOUT, 1 @ Linux output console
|
||||
.equ EXIT, 1 @ Linux syscall
|
||||
.equ READ, 3 @ Linux syscall
|
||||
.equ WRITE, 4 @ Linux syscall
|
||||
|
||||
/* Initialized data */
|
||||
.data
|
||||
szCarriageReturn: .asciz "\n"
|
||||
szMessResult: .asciz "Value is null.\n" @ message result
|
||||
|
||||
iPtrObjet: .int 0 @ objet pointer
|
||||
|
||||
/* UnInitialized data */
|
||||
.bss
|
||||
|
||||
/* code section */
|
||||
.text
|
||||
.global main
|
||||
main: @ entry of program
|
||||
|
||||
ldr r0,iAdriPtrObjet @ load pointer address
|
||||
ldr r0,[r0] @ load pointer value
|
||||
cmp r0,#0 @ is null ?
|
||||
ldreq r0,iAdrszMessResult @ yes -> display message
|
||||
bleq affichageMess
|
||||
|
||||
|
||||
100: @ standard end of the program
|
||||
mov r0, #0 @ return code
|
||||
pop {fp,lr} @ restaur 2 registers
|
||||
mov r7, #EXIT @ request to exit program
|
||||
svc 0 @ perform the system call
|
||||
|
||||
iAdrszMessResult: .int szMessResult
|
||||
iAdrszCarriageReturn: .int szCarriageReturn
|
||||
iAdriPtrObjet: .int iPtrObjet
|
||||
/******************************************************************/
|
||||
/* display text with size calculation */
|
||||
/******************************************************************/
|
||||
/* r0 contains the address of the message */
|
||||
affichageMess:
|
||||
push {r0,r1,r2,r7,lr} @ save registres
|
||||
mov r2,#0 @ counter length
|
||||
1: @ loop length calculation
|
||||
ldrb r1,[r0,r2] @ read octet start position + index
|
||||
cmp r1,#0 @ if 0 its over
|
||||
addne r2,r2,#1 @ else add 1 in the length
|
||||
bne 1b @ and loop
|
||||
@ so here r2 contains the length of the message
|
||||
mov r1,r0 @ address message in r1
|
||||
mov r0,#STDOUT @ code to write to the standard output Linux
|
||||
mov r7, #WRITE @ code call system "write"
|
||||
svc #0 @ call systeme
|
||||
pop {r0,r1,r2,r7,lr} @ restaur des 2 registres */
|
||||
bx lr @ return
|
||||
12
Task/Null-object/Neko/null-object.neko
Normal file
12
Task/Null-object/Neko/null-object.neko
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
<doc>
|
||||
<p>Neko uses <i>null</i> for undefined variables,
|
||||
and also as a programmer accessible value.</p>
|
||||
<p>The <i>null</i> value can be treated as a boolean value with the
|
||||
builtin $istrue, and tests as false.</p>
|
||||
</doc>
|
||||
*/
|
||||
|
||||
var n = null
|
||||
if n == null $print("n is null\n")
|
||||
if $not($istrue(n)) $print("and tests as boolean false\n")
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
var s: string = nil
|
||||
let s: pointer = nil
|
||||
|
||||
var ns: string not nil = nil # Compile time error
|
||||
{.experimental: "notnil".}
|
||||
let ns: pointer not nil = nil # Compile time error
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
var opt : Int? = nil // use "nil" to represent no value
|
||||
opt = 5 // or simply assign a value to the optional type
|
||||
let maybeInt: Int? = nil
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
if let v = opt {
|
||||
println("There is some value: \(v)")
|
||||
if maybeInt == nil {
|
||||
print("variable is nil")
|
||||
} else {
|
||||
println("There is no value")
|
||||
print("variable has some value")
|
||||
}
|
||||
|
|
|
|||
5
Task/Null-object/Swift/null-object-3.swift
Normal file
5
Task/Null-object/Swift/null-object-3.swift
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
if let certainlyInt = maybeInt {
|
||||
print("variable has value \(certainlyInt)")
|
||||
} else {
|
||||
print("variable is nil")
|
||||
}
|
||||
14
Task/Null-object/VBA/null-object.vba
Normal file
14
Task/Null-object/VBA/null-object.vba
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
Public Sub Main()
|
||||
Dim c As VBA.Collection
|
||||
|
||||
' initial state: Nothing
|
||||
Debug.Print c Is Nothing
|
||||
|
||||
' create an instance
|
||||
Set c = New VBA.Collection
|
||||
Debug.Print Not c Is Nothing
|
||||
|
||||
' release the instance
|
||||
Set c = Nothing
|
||||
Debug.Print c Is Nothing
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue