Grib_api options in f90 - fortran

As we know if I want to get the levelType of each message in a grib file.
I could use this below in f90:
grib_get(igrib(i), 'levelType', ltype)
But when fail it will cause a eccodes error and can't gei the value. As the document of grib_api on the site of ECMWF. I found an option 'f' to force the execution not to fail on error and write 'not_found' string to ltype paramters. My quastion is how can i usethis force option in f90?

Related

Can I capture simulator output to console in my testbench?

I have a testbench to test my VHDL device (DUT), but part of the DUT debug output is an ASSERT/REPORT message to the console, which I would like to check for correctness but I can't change the DUT. The only way I can think of is to post-process the output log file.
Is there any way of capturing the console output in the testbench, so I can check the DUT output directly?
I do this as part of the testbench. However, rather than Assert, I use OSVVM alerts, log, and print. OSVVM is both at osvvm.org and github.
Rather than Assert, I use AffirmIf for self-checking/result checking. I use AlertIf for parameter checking.
Step 1 is get OSVVM. Once you have the code, compile it using the script. In either Mentor or Aldec, run the script by doing:
vlib osvvm
vmap osvvm osvvm
do $PATH_TO_OSVVM/osvvm.do $PATH_TO_OSVVM
Use VHDL-2008 and include all of OSVVM in your program by doing:
library osvvm;
context osvvm.OsvvmContext;
Then rather than:
assert Data /= expected report "..." severity error;
Do:
AffirmIf(Data = Expected, "...") ;
Both assert and AffirmIf/AlertIf print. However, the advantage to AffirmIf/AlertIf is that internally it keeps a count of the errors and you can get a pass fail at the end of your test by doing:
ReportAlerts;
The next advantage of OSVVM AffirmIf/AlertIf/Log/Print is that if you want the results in a file, you simply do:
TranscriptOpen("./results/Test1.txt");
If you want to both print to the screen and a file, also do:
SetTranscriptMirror(TRUE);
That ought get you started. I will leave the rest to the user guides. Start by looking at both the AlertLog package user guide and the transcript package user guide.

JCL Error trying z/OS JSON parser programming example

I tried copying the c++ example as mentioned here -
https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.ieac100/ieac1-cwe-json-prog.htm
However, I am getting the following JCL error when running on my system :
IEF344I XC1CPLLE COMPILE SYSLIB - ALLOCATION FAILED DUE TO DATA FACILITY SYSTEM ERROR
IGD17045I SPACE NOT SPECIFIED FOR ALLOCATION OF DATA SET
SIEAHDR.H
IEF272I XC1CPLLE COMPILE - STEP WAS NOT EXECUTED.
Here is a copy of my modified program :
https://gist.github.com/4349183c3ec6d223a0073b87b9c2da8b
The JCL to which you provide a link contains a JCL error. The SYSLIB DD of the COMPILE step has no DISP and thus defaults to DISP=(NEW,DELETE,DELETE). A status of NEW requires space allocation and none is provided, so you get the error in your question. To fix this particular problem, I suggest coding DISP=SHR on the SYSLIB DD in the COMPILE step.
I recommend talking to your support staff about standard compile procedures, as most shops implement their own.

How to get metadata without -g

I'm trying to write a LLVM function pass to do some instrumentation.
Therefore, I I need to get
filename in which the function is declared
the line numbers (begin and end) of the source file in which the function is decalred.
I already found and tried getMetadata("dbg") but I do not want to use the compiler flag -g.
Is there another way to get these information?
Well... the debug metadata is emitted when debug info generation is enabled. You may want to reduce the amount of debug information generated with -gline-tables-only

Getting rid of FFmpeg non-existng PPS error

I am using ffmpeg to decode videos. I am aware that the error I am getting is due to the frame/sliceHeader is decoded and the Picture Parameter Set information is not there. I am just curious if anyone knows a way to get rid of this error? My video is successfully decoding but in the debugger this error makes the metadata hard to read.
The error is :
non existing PPS 0 referenced
decode_slice_header error
no frame!
******** My code is in C ******
Check the FFmpeg logging facilities - you can use av_log_set_callback to provide your own logging callback and either just ignore everything, or filter by log level, it is up to you.
In my case of use, i was able to still receive critical errors, but no longer decoder errors with following parameters:
ffmpeg -loglevel panic
Here is a snippet of documentation of available loglevels:
-loglevel [repeat+]loglevel | -v [repeat+]loglevel
Set the logging level used by the library. Adding "repeat+" indicates that repeated log output should not be compressed to the first line and the "Last message repeated n times" line will be omitted. "repeat" can also be used alone. If "repeat" is used alone, and with no prior loglevel set, the default loglevel will be used. If multiple loglevel parameters are given, using ’repeat’ will not change the loglevel. loglevel is a string or a number containing one of the following values:
‘quiet, -8’
Show nothing at all; be silent.
‘panic, 0’
Only show fatal errors which could lead the process to crash, such as and assert failure. This is not currently used for anything.
‘fatal, 8’
Only show fatal errors. These are errors after which the process absolutely cannot continue after.
‘error, 16’
Show all errors, including ones which can be recovered from.
‘warning, 24’
Show all warnings and errors. Any message related to possibly incorrect or unexpected events will be shown.
‘info, 32’
Show informative messages during processing. This is in addition to warnings and errors. This is the default value.
‘verbose, 40’
Same as info, except more verbose.
‘debug, 48’
Show everything, including debugging information.
‘trace, 56’
For me, my solution turned out to be :
Hope it helps anyone using ffmpeg in c!
av_log_set_level(AV_LOG_QUIET);

SWI-Prolog C++ interface

I get an error while trying to load a DLL generated with swipl-ld in prolog
the predicate that throws the exception is this
initialization(shlib:use_foreign_library('C:/Users/valquiria.duarte/Desktop/dlog-server-0.3-beta-source/dlog-server/output/hash_swi.dll', install)),
and the exception is this one
ERROR: '$open_shared_object'/3: %1 is not a valid Win32 application.
According to this note at ComputerHope, Windows may report this error when the file is missing (or corrupt). It appears the filepath is fully specified in the the call to use_foreign_library, but it's worth double-checking that the path is correct about where the DLL is located.
It seems a little odd that you reported the parametric form of the ERROR message, where %1 is a placeholder for the actual filename. If that was how the error appeared on your computer, it suggests there is some failure to parse the exception details as they were thrown up the handler-chain.
If the message does contain the actual path and filename, then you should confirm their accuracy and the file's existence on the given path. It seems you have correctly called use-foreign_library using SWI-Prolog's preferred syntax of forward slashes in the filepath to separate directories. However it is the Window's operating system (more specifically the system-dependent implementation of dlopen()) that generates the error, and the resulting error message I would expect to contain a filepath and filename that contain backslashes.