Port lalapps_heterodyne_pulsar to using only LALFrame for frame I/O
Currently lalapps_heterodyne_pulsar
requires the FrameL library explicitly for some frame I/O. It would be good to port this code over to only use LALFrame, so that it can use either FrameL or FrameCPP under the hood. This would also remove an explicit dependency on FrameL.
If I compile the code with the FrameL headers removed:
diff --git a/lalapps/src/pulsar/HeterodyneSearch/heterodyne_pulsar.h b/lalapps/src/pulsar/HeterodyneSearch/heterodyne_pulsar.h
index 18c1d1db23..f06019b946 100644
--- a/lalapps/src/pulsar/HeterodyneSearch/heterodyne_pulsar.h
+++ b/lalapps/src/pulsar/HeterodyneSearch/heterodyne_pulsar.h
@@ -73,10 +73,6 @@
/* lalapps header */
#include <LALAppsVCSInfo.h>
-/* frame headers */
-#include <FrIO.h>
-#include <FrameL.h>
-
#ifdef __cplusplus
extern "C" {
#endif
I get the following errors:
heterodyne_pulsar.c: In function ‘get_frame_data’:
heterodyne_pulsar.c:1588:3: error: unknown type name ‘FrFile’; did you mean ‘LALFrFile’?
1588 | FrFile *frfile=NULL;
| ^~~~~~
| LALFrFile
heterodyne_pulsar.c:1589:3: error: unknown type name ‘FrVect’; did you mean ‘crect’?
1589 | FrVect *frvect=NULL;
| ^~~~~~
| crect
heterodyne_pulsar.c:1595:16: error: implicit declaration of function ‘FrFileINew’ [-Werror=implicit-function-declaration]
1595 | if((frfile = FrFileINew(framefile)) == NULL)
| ^~~~~~~~~~
heterodyne_pulsar.c:1595:16: error: nested extern declaration of ‘FrFileINew’ [-Werror=nested-externs]
heterodyne_pulsar.c:1595:14: error: assignment to ‘int *’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
1595 | if((frfile = FrFileINew(framefile)) == NULL)
| ^
heterodyne_pulsar.c:1606:16: error: implicit declaration of function ‘FrFileIGetV’ [-Werror=implicit-function-declaration]
1606 | if((frvect = FrFileIGetV(frfile, channel, ttime, (REAL8)duration))==NULL){
| ^~~~~~~~~~~
heterodyne_pulsar.c:1606:16: error: nested extern declaration of ‘FrFileIGetV’ [-Werror=nested-externs]
heterodyne_pulsar.c:1606:14: error: assignment to ‘int *’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
1606 | if((frvect = FrFileIGetV(frfile, channel, ttime, (REAL8)duration))==NULL){
| ^
heterodyne_pulsar.c:1607:5: error: implicit declaration of function ‘FrFileIEnd’ [-Werror=implicit-function-declaration]
1607 | FrFileIEnd(frfile);
| ^~~~~~~~~~
heterodyne_pulsar.c:1607:5: error: nested extern declaration of ‘FrFileIEnd’ [-Werror=nested-externs]
heterodyne_pulsar.c:1614:12: error: request for member ‘next’ in something not a structure or union
1614 | if(frvect->next){
| ^~
heterodyne_pulsar.c:1618:5: error: implicit declaration of function ‘FrVectFree’ [-Werror=implicit-function-declaration]
1618 | FrVectFree(frvect);
| ^~~~~~~~~~
heterodyne_pulsar.c:1618:5: error: nested extern declaration of ‘FrVectFree’ [-Werror=nested-externs]
heterodyne_pulsar.c:1625:13: error: request for member ‘type’ in something not a structure or union
1625 | if( frvect->type == FR_VECT_4R ){ /* data is float */
| ^~
heterodyne_pulsar.c:1625:23: error: ‘FR_VECT_4R’ undeclared (first use in this function)
1625 | if( frvect->type == FR_VECT_4R ){ /* data is float */
| ^~~~~~~~~~
heterodyne_pulsar.c:1625:23: note: each undeclared identifier is reported only once for each function it appears in
In file included from heterodyne_pulsar.h:35,
from heterodyne_pulsar.c:44:
heterodyne_pulsar.c:1627:20: error: request for member ‘dataF’ in something not a structure or union
1627 | if(isnan(frvect->dataF[0]) != 0){
| ^~
heterodyne_pulsar.c:1635:56: error: request for member ‘dataF’ in something not a structure or union
1635 | dblseries->data->data[i] = scalefac*(REAL8)frvect->dataF[i];
| ^~
heterodyne_pulsar.c:1637:18: error: request for member ‘type’ in something not a structure or union
1637 | else if( frvect->type == FR_VECT_8R ){ /* data is double */
| ^~
heterodyne_pulsar.c:1637:28: error: ‘FR_VECT_8R’ undeclared (first use in this function)
1637 | else if( frvect->type == FR_VECT_8R ){ /* data is double */
| ^~~~~~~~~~
In file included from heterodyne_pulsar.h:35,
from heterodyne_pulsar.c:44:
heterodyne_pulsar.c:1639:20: error: request for member ‘dataD’ in something not a structure or union
1639 | if(isnan(frvect->dataD[0]) != 0){
| ^~
heterodyne_pulsar.c:1647:56: error: request for member ‘dataD’ in something not a structure or union
1647 | dblseries->data->data[i] = scalefac*(REAL8)frvect->dataD[i];
| ^~
Hopefully LALFrame provides drop-in replacements for the above FrameL functions and types.