September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,5 +0,0 @@
|
|||
import std.compiler;
|
||||
static if (version_major < 2 || version_minor > 7) {
|
||||
// this prevents further compilation
|
||||
static assert (false, "I can't cope with this compiler version");
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
version(D_Version2) {
|
||||
|
||||
static if( __traits(compiles,abs(bloop)) ) {
|
||||
|
||||
typeof(abs(bloop)) computeAbsBloop() {
|
||||
return abs(bloop);
|
||||
}
|
||||
|
||||
}
|
||||
} else static assert(0, "Requires D version 2");
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
static if ( is(typeof(abs(bloop))) ) {
|
||||
typeof(abs(bloop)) computeAbsBloop() {
|
||||
return abs(bloop);
|
||||
}
|
||||
}
|
||||
17
Task/Introspection/FreeBASIC/introspection-1.freebasic
Normal file
17
Task/Introspection/FreeBASIC/introspection-1.freebasic
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
#If __FB_VERSION__ < "1.06.0"
|
||||
#Error "Compiler version is too old - needs to be 1.06.0 or later"
|
||||
#EndIf
|
||||
|
||||
Dim bloop As Integer = -15
|
||||
#IfDef bloop
|
||||
#IfDef Abs
|
||||
Print "Abs(bloop) = "; Abs(bloop)
|
||||
#Else
|
||||
Print "Abs is not available"
|
||||
#EndIf
|
||||
#Else
|
||||
Print "bloop does not exist"
|
||||
#EndIf
|
||||
Sleep
|
||||
17
Task/Introspection/FreeBASIC/introspection-2.freebasic
Normal file
17
Task/Introspection/FreeBASIC/introspection-2.freebasic
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
#If __FB_VERSION__ < "1.05.0" '' version 1.05.0 is now OK
|
||||
#Error "Compiler version is too old - needs to be 1.05.0 or later"
|
||||
#EndIf
|
||||
|
||||
Dim bloop As Integer = -15
|
||||
#IfDef bloop
|
||||
#IfDef Abs
|
||||
Print "Abs(bloop) = "; Abs(bloop)
|
||||
#Else
|
||||
Print "Abs is not available"
|
||||
#EndIf
|
||||
#Else
|
||||
Print "bloop does not exist"
|
||||
#EndIf
|
||||
Sleep
|
||||
12
Task/Introspection/FreeBASIC/introspection-3.freebasic
Normal file
12
Task/Introspection/FreeBASIC/introspection-3.freebasic
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#Undef Abs '' undefine Abs keyword
|
||||
Dim bloop As Integer = -15
|
||||
#IfDef bloop
|
||||
#IfDef Abs
|
||||
Print "Abs(bloop) = "; Abs(bloop)
|
||||
#Else
|
||||
Print "Abs is not available"
|
||||
#EndIf
|
||||
#Else
|
||||
Print "bloop does not exist"
|
||||
#EndIf
|
||||
Sleep
|
||||
12
Task/Introspection/FreeBASIC/introspection-4.freebasic
Normal file
12
Task/Introspection/FreeBASIC/introspection-4.freebasic
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#Undef Abs '' undefine Abs keyword
|
||||
'Dim bloop As Integer = -15 '' bloop declaration commented out
|
||||
#IfDef bloop
|
||||
#IfDef Abs
|
||||
Print "Abs(bloop) = "; Abs(bloop)
|
||||
#Else
|
||||
Print "Abs is not available"
|
||||
#EndIf
|
||||
#Else
|
||||
Print "bloop does not exist"
|
||||
#EndIf
|
||||
Sleep
|
||||
40
Task/Introspection/Kotlin/introspection.kotlin
Normal file
40
Task/Introspection/Kotlin/introspection.kotlin
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
// version 1.0.6 (intro.kt)
|
||||
|
||||
import java.lang.reflect.Method
|
||||
|
||||
val bloop = -3
|
||||
val i = 4
|
||||
val j = 5
|
||||
val k = 6
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
// get version of JVM
|
||||
val version = System.getProperty("java.version")
|
||||
if (version >= "1.6") println("The current JVM version is $version")
|
||||
else println("Must use version 1.6 or later")
|
||||
|
||||
// check that 'bloop' and 'Math.abs' are available
|
||||
// note that the class created by the Kotlin compiler for top level declarations will be called 'IntroKt'
|
||||
val topLevel = Class.forName("IntroKt")
|
||||
val math = Class.forName("java.lang.Math")
|
||||
val abs = math.getDeclaredMethod("abs", Int::class.java)
|
||||
val methods = topLevel.getDeclaredMethods()
|
||||
for (method in methods) {
|
||||
// note that the read-only Kotlin property 'bloop' is converted to the static method 'getBloop' in Java
|
||||
if (method.name == "getBloop" && method.returnType == Int::class.java) {
|
||||
println("\nabs(bloop) = ${abs.invoke(null, method.invoke(null))}")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// now get the number of global integer variables and their sum
|
||||
var count = 0
|
||||
var sum = 0
|
||||
for (method in methods) {
|
||||
if (method.returnType == Int::class.java) {
|
||||
count++
|
||||
sum += method.invoke(null) as Int
|
||||
}
|
||||
}
|
||||
println("\nThere are $count global integer variables and their sum is $sum")
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
/*output from parse version (almost all REXX versions) */
|
||||
/* theREXXinterpreterName level mm Mon yyyy */
|
||||
|
||||
/*output from parse version (almost all REXX versions) */
|
||||
/* theREXXinterpreterName level mm Mon yyyy */
|
||||
parse version . level .
|
||||
if level<4 then exit
|
||||
if level<4 then exit
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
parse version x 1 whatLang level mm mon yyyy .
|
||||
if level<4 then do
|
||||
say
|
||||
say 'version' level "is too old!"
|
||||
say x /*this displays everything.*/
|
||||
exit /*or maybe: EXIT 13 */
|
||||
end
|
||||
parse version x 1 whatLang level dd mon yyyy .
|
||||
if level<4 then do
|
||||
say
|
||||
say 'version' level "is too old!"
|
||||
say x /*this displays everything.*/
|
||||
exit /*or maybe: EXIT 13 */
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
if symbol('bloop')=='VAR' then say 'the "bloop" variable exists.'
|
||||
else say 'the "bloop" variable doesn''t exist.'
|
||||
if symbol('bloop')=='VAR' then say 'the "bloop" variable exists.'
|
||||
else say 'the "bloop" variable doesn''t exist.'
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
bloop=47
|
||||
if symbol('bloop')=='VAR' then say 'the "bloop" variable exists.'
|
||||
else say 'the "bloop" variable doesn''t exist.'
|
||||
if symbol('bloop')=='VAR' then say 'the "bloop" variable exists.'
|
||||
else say 'the "bloop" variable doesn''t exist.'
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
if testxyz() then say 'function XYZ not found.'
|
||||
else say 'function XYZ was found.'
|
||||
if testxyz() then say 'function XYZ not found.'
|
||||
else say 'function XYZ was found.'
|
||||
exit
|
||||
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
testxyz: signal on syntax
|
||||
call XYZ
|
||||
return 0
|
||||
|
||||
syntax: return 1
|
||||
call XYZ
|
||||
return 0
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
syntax: return 1
|
||||
|
|
|
|||
4
Task/Introspection/Zkl/introspection-1.zkl
Normal file
4
Task/Introspection/Zkl/introspection-1.zkl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
Language.version //-->L(1,12,8,"2014-04-01")
|
||||
if (Language.version[1] < 10) System.exit("Too old");
|
||||
var bloop=-123;
|
||||
if ((1).resolve("abs",1) and resolve("bloop",8)) bloop.abs().println()
|
||||
5
Task/Introspection/Zkl/introspection-2.zkl
Normal file
5
Task/Introspection/Zkl/introspection-2.zkl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
var n=3, x=1.0, a=5, z="zoo";
|
||||
self.vars; --> L(L("a",5),L("n",3),L("x",1),L("z","zoo"))
|
||||
sum:=self.vars.reduce(fcn(p,[(nm,v)],r){
|
||||
if((1).isType(v)){r.inc();p+v;} else p},0,num:=Ref(0));
|
||||
println("Num int vars = ",num.value,". Sum = ",sum);
|
||||
Loading…
Add table
Add a link
Reference in a new issue