Host introspection: Difference between revisions

m
(Equivalence statement is obsolete in Fortran 2018, so the version is one liner using the ISHFT intrinsic.)
m (→‎{{header|Wren}}: Minor tidy)
 
(One intermediate revision by one other user not shown)
Line 373:
 
=={{header|Fortran}}==
{{works with|Fortran|90 and later< 2018}}
<syntaxhighlight lang="fortran"> integer :: i
character(len=1) :: c(20)
Line 1,428:
{{trans|C}}
As this information cannot be reliably obtained via Wren CLI, we instead embed a Wren script in a C application and ask the host program to get it for us.
<syntaxhighlight lang="ecmascriptwren">/* host_introspectionHost_introspection.wren */
 
class C {
Line 1,518:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "host_introspectionHost_introspection.wren";
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
9,476

edits