fbfrog header translator
-
- Posts: 608
- Joined: Nov 28, 2012 1:27
- Location: CA, USA moving to WA, USA
- Contact:
Re: fbfrog header translator
Did the second branch get far enough along to be useful? (60 commits ahead/4 commits behind master - philosophical shift?)
Were there features that would/should be rolled into the master?
An immediate project of mine is using the Raspberry PI for several modest tasks in a much larger network and I want to write more directly to the core of the system in places. FB so far has been excellent for this, but there are so many base libraries to address.
I'm still learning fbfrog (so I can avoid learning more C). Zero interest in Python.
david
Were there features that would/should be rolled into the master?
An immediate project of mine is using the Raspberry PI for several modest tasks in a much larger network and I want to write more directly to the core of the system in places. FB so far has been excellent for this, but there are so many base libraries to address.
I'm still learning fbfrog (so I can avoid learning more C). Zero interest in Python.
david
Re: fbfrog header translator
No, it's unfinished, so not really useful. It's a mix of two ideas -
1) using libclang in fbfrog instead of a custom parser. Good, except it can't parse #define bodies, so it still needs some custom parsing for that.
2) making a "just-in-time bindgen" (for 1 target only instead of all targets). There is some better code at https://github.com/dkl/fbc/compare/master...dkl:bindgen for this approach. See also viewtopic.php?f=8&t=26175
1) using libclang in fbfrog instead of a custom parser. Good, except it can't parse #define bodies, so it still needs some custom parsing for that.
2) making a "just-in-time bindgen" (for 1 target only instead of all targets). There is some better code at https://github.com/dkl/fbc/compare/master...dkl:bindgen for this approach. See also viewtopic.php?f=8&t=26175
Re: fbfrog header translator
Mmm? I beg to differ. The amount of work it can save me is substantial and, very frequently, it only leaves me with trivial stuff to deal with. Makes porting some stuff a breeze. Thank you so much for this little 'useless' tool ;)dkl wrote:No, it's unfinished, so not really useful. It's a mix of two ideas - ...
-
- Posts: 608
- Joined: Nov 28, 2012 1:27
- Location: CA, USA moving to WA, USA
- Contact:
Re: fbfrog header translator
Is there a provision to comment a line in the '*.fbfrog' or '*.options' file?
This would be helpful.
One favorite option file can be copied across many translates with 'touchups' for specific files without having to search down that one single file that had the exception you need again.
david
This would be helpful.
One favorite option file can be copied across many translates with 'touchups' for specific files without having to search down that one single file that had the exception you need again.
david
Re: fbfrog header translator
Yea it allows # comments. The *.fbfrog files can also include others recursively, which can be useful to extract and reuse common parts.
-
- Posts: 608
- Joined: Nov 28, 2012 1:27
- Location: CA, USA moving to WA, USA
- Contact:
Re: fbfrog header translator
Thanks.
Are you pretty much done with this?
I'm working on rPI stuff right now.
Translates aren't too hard; I get them to work without that much difficulty.
I would have sets of questions and more if you were to be active on this.
If not, it certainly works well enough to save so much time. (With fbc so fast, trial and error makes everything so simple.)
Thank you for this program!
One question:
How should one deal with an FB reserved keyword defined in another library?
At the moment, the word is shell.
david
Are you pretty much done with this?
I'm working on rPI stuff right now.
Translates aren't too hard; I get them to work without that much difficulty.
I would have sets of questions and more if you were to be active on this.
If not, it certainly works well enough to save so much time. (With fbc so fast, trial and error makes everything so simple.)
Thank you for this program!
One question:
How should one deal with an FB reserved keyword defined in another library?
At the moment, the word is shell.
david
Re: fbfrog header translator
Yea go ahead, if I can help out a bit that's fine for me. I got no plans to make any big improvements though.
For symbol naming conflicts usually the solution is to do something like declare function shell_ alias "shell" .... There is an fbfrog option for that, -rename_ shell, or -renameproc shell foo if you prefer another name than shell_.
For symbol naming conflicts usually the solution is to do something like declare function shell_ alias "shell" .... There is an fbfrog option for that, -rename_ shell, or -renameproc shell foo if you prefer another name than shell_.
-
- Posts: 608
- Joined: Nov 28, 2012 1:27
- Location: CA, USA moving to WA, USA
- Contact:
Re: fbfrog header translator
Thank you.
No more for now.
No more for now.
Re: fbfrog header translator
I'm trying to make zstd.bi - new compression algorithm for curl - but translated header gives error:
...\FreeBASIC-1.07.1-win64\inc\zstd.bi(39) error 14: Expected identifier, found '(' in 'declare function ZSTD_compressBound(byval srcSize as uinteger) as uinteger'
translates to:
so - what right way to do it?
...\FreeBASIC-1.07.1-win64\inc\zstd.bi(39) error 14: Expected identifier, found '(' in 'declare function ZSTD_compressBound(byval srcSize as uinteger) as uinteger'
Code: Select all
/*====== Helper functions ======*/
#define ZSTD_COMPRESSBOUND(srcSize) ((srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0)) /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */
ZSTDLIB_API size_t ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case single-pass scenario */
ZSTDLIB_API unsigned ZSTD_isError(size_t code); /*!< tells if a `size_t` function result is an error code */
ZSTDLIB_API const char* ZSTD_getErrorName(size_t code); /*!< provides readable string from an error code */
ZSTDLIB_API int ZSTD_minCLevel(void); /*!< minimum negative compression level allowed */
ZSTDLIB_API int ZSTD_maxCLevel(void); /*!< maximum compression level available */
Code: Select all
#define ZSTD_COMPRESSBOUND(srcSize) (((srcSize) + ((srcSize) shr 8)) + iif((srcSize) < (128 shl 10), ((128 shl 10) - (srcSize)) shr 11, 0))
declare function ZSTD_compressBound(byval srcSize as uinteger) as uinteger
declare function ZSTD_isError(byval code as uinteger) as ulong
declare function ZSTD_getErrorName(byval code as uinteger) as const zstring ptr
declare function ZSTD_minCLevel() as long
declare function ZSTD_maxCLevel() as long
Re: fbfrog header translator
FreeBASIC language is non case sensitive, so 'ZSTD_COMPRESSBOUND' and 'ZSTD_compressBound' are the same symbol for it.
Re: fbfrog header translator
just rename #define ZSTD_COMPRESSBOUND(srcSize) to something like #define ZSTD_COMPRESSBOUND_(srcSize)
Re: fbfrog header translator
Thanks!
-
- Posts: 293
- Joined: Jul 15, 2021 7:23
- Location: Greece
- Contact:
Re: fbfrog header translator
does fbfrog translate C++ headers ?
can i use it to translate Qt6 ?
can i use it to translate Qt6 ?
Re: fbfrog header translator
Probably not, unfortunately. fbfrog has almost no C++ support. I'm not even sure whether FB itself has enough C++ support to be compatible to Qt or even the C++ standard library (lack of templates and multiple inheritance...).
-
- Posts: 293
- Joined: Jul 15, 2021 7:23
- Location: Greece
- Contact: