Comments (20)
Fine with me if this is done automatically during import from SOFA.
from erfa.
While I agree this would be better, I'm concerned that it generates a substantive incompatibility with SOFA. That is, instead of a global find-and-replace from "iau" to "era", this requires actually changing code that uses SOFA to add prefixes when they weren't present before.
If we do want to go ahead with it, though, I agree with @timj that it absolutely has to be automatic.
from erfa.
This shell script does the job amazingly well.
for i in $(awk '/#define/ {print $2}' erfam.h); do
sed "s/\b$i\b/ERFA_$i/g" -i *.c *.h
done
I have to tweak it a little bit because:
- It doesn't work with the macros with arguments
- It adds ERFA_ to ERFAMHDEF
But it's a good starting point
from erfa.
By the way, SOFA should do the same in sofam.h
from erfa.
I'm not saying it's not possible/reasonably easy to make the change, but rather than it takes us a step further from SOFA, which we've said we're trying to avoid beyond what we've been required to do by the SOFA board. But perhaps we should hear from some of the parties that plan on switching from SOFA to ERFA...
And @sergiopasra - I agree it would be better if SOFA did this, but I highly doubt that will happen as they are highly conservative when it comes to any changes in SOFA (@scottransom might know better, though?)
from erfa.
What I'm proposing is basically the same than renaming the functions from iau to era. This is not altering the algorithms in any way and improves the library (seriously, #define DC?).
You say that SOFA ks very conservative (I would use a different word here) but that doesn't mean that we have to be conservative. We wouldn't have this library, or astropy, if we were conservative.
from erfa.
# Translate all the macros except ERFAMHDEF
# Macros with arguments will not match the sed pattern
for i in $(awk '$0~/#define/ && $0!~/ERFAMHDEF/ {print $2}' erfam.h); do
sed "s/\b$i\b/ERFA_$i/g" -i *.c *.h
done
# The macros with arguments are upper-cased
for i in dint dnint dsign; do
sed "s/\b\($i\)\b/ERFA_\U\1/g" -i *.c *.h
done
from erfa.
@eteq I am on the fence about this. I've used these macros for years and years and never actually had a problem. On the other hand it does seem wrong to not have a prefix. When AST adopted the macros it did add a prefix (so you will see AST__DR2D
). I tentatively am in favor of doing it with automation. It does mean that people will not be confused if they add sofam.h
and erfam.h
at the same time...(well, they will be confused, but the compiler won't get upset).
I guarantee that SOFA will never add a prefix. I may even have asked back in 2008 but I can't dig it out of email now. SLALIB has done this since the late 1990s and SOFA are not going to break their public interface by adding a prefix.
from erfa.
Hmm, I do see your points @sergiopasra and @timj. And it's probably true that it only really has to be done once when some package switches from SOFA to ERFA and never again, really.
@taldcroft, @olebole, or @astrofrog, do you have any opinions here? We probably should decide on this before we release v1.0, as it would require a v2.0 shortly afterwards if we change it...
from erfa.
I'd add a prefix in ERFA.
In my opinion, we should not care too much about SOFA here (as long as ERFA can be created programmatically from their sources): I see now SOFA more a reference implementation of IAU algorithms without a use for the end user: once ERFA is out, there is no longer the need to use SOFA at all.
from erfa.
I don't have any objections to this PR since it sets a bit of precedent for other enhancements.
from erfa.
Just in case...
from erfa.
@olebole you are correct that basically the sole purpsose of SOFA is as a reference implementation of IAU algorithms. I has a lot of discussion with the other board members about this when I became a member (because I don't really agree with it). I think the most important thing for ERFA is that new versions of SOFA (and there will be another one soon with some bug fixes) can be auto-magically (or semi-) incorporated to become new versions of ERFA.
from erfa.
Alright, sounds like the consensus is that we should include the prefixes, so let's do it. (we can close this issue once erfa-fetch
has been updated and the changes propogated to the main erfa repo).
from erfa.
Yes, in #13 we have to decide how we are doing it though. Localized to erfam.h
or changes to every C file.
from erfa.
@timj - right, but I just closed that given that it needs to be done in erfa-fetch
first (as you said). I'm just leaving the note hear so we know when it's safe to close this issue.
from erfa.
@eteq Sorry. I hadn't seen your follow up to #13 when I responded.
from erfa.
Ah - simultaneous posting, I think :)
from erfa.
Were you planning on implementing the autogeneration scheme in liberfa/erfa-fetch, @sergiopasra? Once we have that I think we are ready for release. Or are we still waiting for resolution on erfam.h
macros vs. every C file, @timj or @sergiopasra? Either way seems fine to me (whichever is easier to implement in erfa-fetch...)
from erfa.
Let me try a little
from erfa.
Related Issues (20)
- Upload releases after 1.4 to Zenodo HOT 4
- Wrong version taken for SONAME HOT 6
- Decide if the leap second wrapper is the long-term API
- Make a way to use local device's leap second information
- ERFA 1.7 still has version number 1.6!? HOT 2
- Fix README.rst -- update release info HOT 6
- Porting ERFA to different languages - licensing HOT 17
- starpm does not work for moderate proper motion/no parallax case HOT 1
- Update to match SOFA 20200721
- Unexpected result from d2dtf() very near day boundary in UTC HOT 9
- Have links in docs/README to other languages?
- change in header files to make things better for C++? HOT 4
- Update to SOFA 17a HOT 2
- Should macros in erfam.h be considered part of the API? HOT 1
- Auto-update zenodo HOT 1
- why use fmod in calculating Fundamental arguments in eraNut80?
- Wrong result from d2dtf() in pre-1972 UTC
- d2dtf(), dtf2d(), utctai(), dat(): Inexact table and method of detecting jump HOT 13
- proposal: use integer times internally HOT 8
- Single-precision floating-point level rounding errors when using pmsafe HOT 44
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from erfa.