writing fortran config file - fortran

I would like to know if there is a way to write namelist in a programmatic way ?
I would like to write differente part of namelist giving name parameter and value
does someone already do that ?
Regards

Related

from proto2 debugString to json

I'm new to protocol buffers, and I' m having some hard time parsing the human readable output from proto2 (DebugString function, ref here) to a structured data.
In fact, at first, I tried to do this recursively and then i though about using the debugString() function that I can use. What I want is a simple structured output (json) that contain fieldnames and their values, but proto2 doesn't have a json output or coverter... (correct me if i' m wrong) and I'm working with cpp
Is there any other way to do this work without manually handling it? Do you know any library that is doing that?
thank you

Creating an OCAML function to output a code file?

I'm looking to create a function to output a code file (looking to output a C++ file if possible) with OCAML.
Is there a way to easily do this or is using the open_out function with providing the code to write to the output file the only way possible to do this?
Thanks
You could also use Out_channel from Core
https://dev.realworldocaml.org/imperative-programming.html

File parser (C++) - enum variables to xml/json file - is there any already made, or should I write one

As a part of bigger program I need a program (C++ language) that will parse the header file.
It should create xml/json file with only enum variables from passed header file. It would be great if it will support problematic enums like:
enum{
var1 = core::SOME_VAR,
var2,
var3
}enumName;
where core class/struct can be in included file which is in another folder.
But, to simplify the problem, it can simply ignore problematic enums.
I don't want to write such parser by myslef until it won't be really necessary. So I started to look for one in internet. I found http://gccxml.github.io/ - I could work with that, but:
If there is any inlcuded file that he can't read (e.g. because it's in another folder), or any other 'compilation' problem then it don't give any output file. I tried to set some flags in this program so it give any output, but it didn't work.
It generates sooo much unnecessary xml code...
I didn't found any other program that would suit me.
So my questions: If You know that parser that I mentioned earlier - is there any way to set it so it will match my needs? Or maybe You could point me any good parser for that problem? Or I should write one by myself

Find a value in webpage source code (Fortran)

how can i extract numerical data from a webpage source code that is embedded in a text file using fortran? (e.g https://www.google.com/finance?q=NYSE:KO) My aim is to retrieve the stock price through the source code. Any help will be appreciated!
Thanks in advance.
Do you really want to do that in Fortran? Fortran is not very well suited for string manipulation (in my opinion)!
I would recommend to get and process the HTML in another language (e.g. Python), and write in the data in a structured way that Fortran can directly read. You could call that script / program from Fortran using the statement
call system('command')

How to fix file path case?

I have a set of local paths, and some of them are capitalized (C:\SOMEDIR\SOMEFILE.TXT). I need to convert them to their real names (as shown in Explorer). Suggest a way plz.
Pass your file path to FindFirstFile, the resulting WIN32_FIND_DATA.cFileName will be in the correct case as read from the file system.
Are you looking for that: short names vs. long name?
Note that Explorer applies some tricky conversions to the file names. You easiest shot is to test it all and make your own function for the purpose.
Otherwise, you can try to access via OLE the Explorer's functions to list files in directory. But that is VERY painful and error prone to code. (Why I guess MS has given up in the end and provided the functions I have linked to above in Win2K).
I suppose you could always use OpenFile to get a handle, and then use the method here to get the filename from that handle. I haven't tried it, but it seems likely to give the "explorer name"
Obtaining a File Name From a File Handle
I don't know of any direct API call to do this in a single line.