Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
22
Task/Introspection/D/introspection.d
Normal file
22
Task/Introspection/D/introspection.d
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import std.compiler, std.math;
|
||||
|
||||
void main() {
|
||||
// Compile-time constants of the compiler version:
|
||||
static if (version_major < 2 && version_minor > 50) {
|
||||
// this prevents further compilation
|
||||
static assert(false, "I can't cope with this compiler version");
|
||||
} else {
|
||||
pragma(msg, "The compiler version is acceptable.");
|
||||
}
|
||||
|
||||
immutable bloop = 10;
|
||||
|
||||
// To check if something compiles:
|
||||
//static if (__traits(compiles, bloop.abs)) {
|
||||
static if (__traits(compiles, abs(bloop))) {
|
||||
pragma(msg, "The expression is compilable.");
|
||||
auto x = bloop.abs;
|
||||
} else {
|
||||
pragma(msg, "The expression can't be compiled.");
|
||||
}
|
||||
}
|
||||
20
Task/Introspection/Erlang/introspection.erl
Normal file
20
Task/Introspection/Erlang/introspection.erl
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
-module( introspection ).
|
||||
|
||||
-export( [task/0] ).
|
||||
|
||||
task() ->
|
||||
exit_if_too_old( erlang:system_info(otp_release) ),
|
||||
Bloop = lists:keyfind( bloop, 1, ?MODULE:module_info(functions) ),
|
||||
Abs = lists:keyfind( abs, 1, erlang:module_info(exports) ),
|
||||
io:fwrite( "abs( bloop ) => ~p~n", [call_abs_with_bloop(Abs, Bloop)] ),
|
||||
io:fwrite( "Number of modules: ~p~n", [erlang:length(code:all_loaded())] ).
|
||||
|
||||
|
||||
|
||||
bloop() -> -1.
|
||||
|
||||
call_abs_with_bloop( {abs, 1}, {bloop, 0} ) -> erlang:abs( bloop() );
|
||||
call_abs_with_bloop( _Missing, _Not_here ) -> abs_and_bloop_missing.
|
||||
|
||||
exit_if_too_old( Release ) when Release < "R13A" -> erlang:exit( too_old_release );
|
||||
exit_if_too_old( _Release ) -> ok.
|
||||
33
Task/Introspection/Logtalk/introspection.logtalk
Normal file
33
Task/Introspection/Logtalk/introspection.logtalk
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
:- object(my_application).
|
||||
|
||||
:- initialization((
|
||||
check_logtalk_version,
|
||||
compute_predicate_if_available
|
||||
)).
|
||||
|
||||
check_logtalk_version :-
|
||||
% version data is available by consulting the "version_data" flag
|
||||
current_logtalk_flag(version_data, logtalk(Major,Minor,Patch,_)),
|
||||
( (Major,Minor,Patch) @< (3,0,0) ->
|
||||
write('Logtalk version is too old! Please upgrade to version 3.0.0 or later'), nl,
|
||||
halt
|
||||
; true
|
||||
).
|
||||
|
||||
% Logtalk is not a functional language and thus doesn't support user-defined functions; we
|
||||
% use instead a predicate, abs/2, with a return argument to implement the abs/1 function
|
||||
compute_predicate_if_available :-
|
||||
( % check that the variable "bloop" is defined within this object
|
||||
current_predicate(bloop/1),
|
||||
% assume that the abs/2 predicate, if available, comes from a "utilities" object
|
||||
utilities::current_predicate(abs/2) ->
|
||||
bloop(Value),
|
||||
utilities::abs(Value, Result),
|
||||
write('Function value: '), write(Result), nl
|
||||
; write('Could not compute function!'), nl
|
||||
).
|
||||
|
||||
% our "bloop" variable value as per task description
|
||||
bloop(-1).
|
||||
|
||||
:- end_object.
|
||||
25
Task/Introspection/NetRexx/introspection.netrexx
Normal file
25
Task/Introspection/NetRexx/introspection.netrexx
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref symbols binary
|
||||
|
||||
runSample(arg)
|
||||
return
|
||||
|
||||
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
method runSample(arg) private static
|
||||
parse arg minVersion .
|
||||
if minVersion = '' then minVersion = 2.0
|
||||
parse version lang ver bdate
|
||||
if ver < minVersion then do
|
||||
say -
|
||||
lang 'version' ver -
|
||||
'[Build date:' bdate']' -
|
||||
'is less than' minVersion.format(null, 2)'; exiting...'
|
||||
exit
|
||||
end
|
||||
else do
|
||||
say -
|
||||
lang 'version' ver -
|
||||
'[Build date:' bdate']' -
|
||||
'meets minimum requirements of' minVersion.format(null, 2)
|
||||
end
|
||||
return
|
||||
2
Task/Introspection/PowerBASIC/introspection.powerbasic
Normal file
2
Task/Introspection/PowerBASIC/introspection.powerbasic
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#COMPILER PBWIN 9
|
||||
#COMPILER PBWIN, PBCC 5
|
||||
1
Task/Introspection/VBA/introspection.vba
Normal file
1
Task/Introspection/VBA/introspection.vba
Normal file
|
|
@ -0,0 +1 @@
|
|||
If Application.Version < 15 Then Exit Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue