Skip to content
Snippets Groups Projects
main.c 18 KiB
Newer Older
  • Learn to ignore specific revisions
  • Ron's avatar
    Ron committed
    /* Copyright (c) Anglo-Australian Telescope Board, 1999.
       Not to be used for commercial purposes without AATB permission. */
    
    
    
    JAB's avatar
    JAB committed
    #include "DitsFix.h"
    #include "Sdp.h"
    #include "Git.h"
    #include "dul_err.h"
    
    Ron's avatar
    Ron committed
    #include "drs_err.h" 
    
    Ron's avatar
    Ron committed
    
    /* globals */
    
    Ron's avatar
    Ron committed
    /* string containing drexec version */
    
    char versionStr[128];
    
    
    Ron's avatar
    Ron committed
    /* externals */
    extern void combine_image_(DitsArgType*,StatusType*);
    extern void combine_spectra_(DitsArgType*,StatusType*);
    
    Ron's avatar
    Ron committed
    /* extern void flx_calib_(DitsArgType*,StatusType*); */
    /* extern void gen_calib_(DitsArgType*,StatusType*); */
    
    Ron's avatar
    Ron committed
    extern void cmfim_gfibpos_(DitsArgType*,StatusType*);
    
    Ron's avatar
    Ron committed
    extern void plot_file_(DitsArgType*,StatusType*);
    
    Ron's avatar
    Ron committed
    extern void reduce_arc_(DitsArgType*,StatusType*);
    extern void reduce_bias_(DitsArgType*,StatusType*);
    
    Ron's avatar
    Ron committed
    extern void reduce_dark_(DitsArgType*,StatusType*);
    
    Ron's avatar
    Ron committed
    extern void reduce_fflat_(DitsArgType*,StatusType*);
    extern void reduce_lflat_(DitsArgType*,StatusType*);
    
    extern void reduce_fflx_(DitsArgType*,StatusType*);
    
    Ron's avatar
    Ron committed
    extern void reduce_object_(DitsArgType*,StatusType*);
    extern void reduce_sky_(DitsArgType*,StatusType*);
    extern void splice_aaomega_(DitsArgType*,StatusType*);
    
    extern void detect_cosmic_streaks_(DitsArgType*,StatusType*);
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
    /* forward declarations */
    
    static void combineImageAction(StatusType*);
    static void combineSpectraAction(StatusType*);
    
    Ron's avatar
    Ron committed
    /* static void flxCalibAction(StatusType*); */
    /* static void genCalibAction(StatusType*); */
    
    Ron's avatar
    Ron committed
    static void find2dfFibresAction(StatusType*);
    
    Ron's avatar
    Ron committed
    static void plotAction(StatusType*);
    
    Ron's avatar
    Ron committed
    static void reduceArcAction(StatusType*);
    static void reduceBiasAction(StatusType*);
    
    Ron's avatar
    Ron committed
    static void reduceDarkAction(StatusType*);
    
    Ron's avatar
    Ron committed
    static void reduceFFlatAction(StatusType*);
    static void reduceLFlatAction(StatusType*);
    
    static void reduceFFluxAction(StatusType*);
    
    Ron's avatar
    Ron committed
    static void reduceObjAction(StatusType*);
    static void reduceSkyAction(StatusType*);
    static void spliceAction(StatusType*);
    
    static void detectCosmicStreaksAction(StatusType*);
    
    static void exitAction(StatusType*);
    
    static void testAction(StatusType*);
    static void testKick(StatusType*);
    void SetPgplotRequest(char key, float x, float y);
    void GetPgplotRequest(char* key, float* x, float* y);
    
    Ron's avatar
    Ron committed
    
    
    Tony Farrell's avatar
    Tony Farrell committed
    
    
    Ron's avatar
    Ron committed
    /*---------------------------------------------------------------------------*/
    
    Ron's avatar
    Ron committed
    
    int main(int argc,char** argv)
    /*
    
    Ron's avatar
    Ron committed
     * Execution of drexec server DRAMA task begins here.
    
    Ron's avatar
    Ron committed
     *
    
    Ron's avatar
    Ron committed
     * This task acts as an action server for 2dfdr. drcontrol acts as the client
     * DRAMA task sending this task requests for 2dfdr processing.
    
    Ron's avatar
    Ron committed
     *
    
    Ron's avatar
    Ron committed
     * N.B. This task BREAKS one of the cardinal rules of DRAMA -
     *      1. Tasks accepting and servicing actions shall reschedule immediately
     *         thereby being ready for any new actions (or kicks).
     *      Notice the DRAMA actions served by this task are quite CPU intensive,
     *      and the program does NOT reschedule until they complete.
    
    Ron's avatar
    Ron committed
     */
    
    JAB's avatar
    JAB committed
    {
    
        StatusType status = DITS__OK;
        char taskName[40];
    
    
    Ron's avatar
    Ron committed
        /* this task executes following DRAMA actions */
    
    Ron's avatar
    Ron committed
        DitsActionDetailsType actions[] = {
    
    	{ combineImageAction,  plotKick,0,0,0,0,"COMBINE_IMAGE"},
    	{ combineSpectraAction,plotKick,0,0,0,0,"COMBINE_SPECTRA"},
    
    Ron's avatar
    Ron committed
    /*	{ flxCalibAction,      0,0,0,0,0,"FLX_CALIB"}, */
    /*	{ genCalibAction,      0,0,0,0,0,"GEN_CALIB"}, */
    
    	{ find2dfFibresAction, plotKick,0,0,0,0,"GFIBPOS"},
    
    	{ reduceArcAction,     plotKick,0,0,0,0,"REDUCE_ARC"},
    	{ reduceBiasAction,    plotKick,0,0,0,0,"REDUCE_BIAS"},
    	{ reduceDarkAction,    plotKick,0,0,0,0,"REDUCE_DARK"},
    	{ reduceFFlatAction,   plotKick,0,0,0,0,"REDUCE_FFLAT"},
    	{ reduceLFlatAction,   plotKick,0,0,0,0,"REDUCE_LFLAT"},
    
    	{ reduceFFluxAction,   plotKick,0,0,0,0,"REDUCE_FFLX"},
    
    	{ reduceObjAction,     plotKick,0,0,0,0,"REDUCE_OBJECT"},
    	{ reduceSkyAction,     plotKick,0,0,0,0,"REDUCE_SKY"},
    	{ spliceAction,        plotKick,0,0,0,0,"SPLICE"},
    
    	{ detectCosmicStreaksAction,plotKick,0,0,0,0,"DETECT_CSTRKS"},
    
            { testAction,          plotKick, 0, 0, 0, 0, "TEST"}
    
    Ron's avatar
    Ron committed
        };
    
    JAB's avatar
    JAB committed
    
    
    Ron's avatar
    Ron committed
        /* The task name is normally given in argv[1]. Multiple copies of the
           task can  be started using different task names. A default name is
           used if one is not given. */
        strcpy(taskName,(argc > 1) ? argv[1] : "DREXEC");
     
    
    Ron's avatar
    Ron committed
        /* initialise DRAMA
           DITS_M_NOEXHAND => we will install exit handler */
        DitsAppInit(taskName,300000,DITS_M_NOEXHAND,0,&status);
    
    JAB's avatar
    JAB committed
    
    
    Ron's avatar
    Ron committed
        /* define supported actions */
        DitsPutActions(DitsNumber(actions),actions,&status);  
    
    JAB's avatar
    JAB committed
    
    
    Ron's avatar
    Ron committed
        /* enter DRAMA main loop
           This returns when action returns DITS_REQ_EXIT */
        DitsMainLoop(&status);
    
    JAB's avatar
    JAB committed
    
    
    Ron's avatar
    Ron committed
         /* here returned from DRAMA main loop, shutdown DRAMA and exit */
    
    Ron's avatar
    Ron committed
        return DitsStop(taskName,&status);
    
    JAB's avatar
    JAB committed
    }
    
    
    Ron's avatar
    Ron committed
    /*---------------------------------------------------------------------------*/
    
    Ron's avatar
    Ron committed
    void combineImageAction(
    
    Ron's avatar
    Ron committed
        StatusType* pStatus)
    
    Ron's avatar
    Ron committed
     * Handler for "COMBINE_IMAGE" DRAMA action.
    
    JAB's avatar
    JAB committed
    {
    
    Ron's avatar
    Ron committed
        DitsArgType args;
    
    
    Ron's avatar
    Ron committed
        if (*pStatus != DITS__OK) return;
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* get our SDS argument structure */
    
    Ron's avatar
    Ron committed
        args = DitsGetArgument();
    
    
        /* for debug print our argument structure on stdout
        SdsList(args,pStatus); */
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* call Fortran COMBINE_IMAGE() */
    
    Ron's avatar
    Ron committed
        combine_image_(&args,pStatus);
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        DitsPutRequest(DITS_REQ_END,pStatus);
    
    Ron's avatar
    Ron committed
    }
    
    JAB's avatar
    JAB committed
    
    
    Ron's avatar
    Ron committed
    /*---------------------------------------------------------------------------*/
    
    Ron's avatar
    Ron committed
    void combineSpectraAction(
    
    Ron's avatar
    Ron committed
        StatusType* pStatus)
    
    Ron's avatar
    Ron committed
     * Handler for "COMBINE_SPECTRA" DRAMA action.
    
    JAB's avatar
    JAB committed
    {
    
    Ron's avatar
    Ron committed
        DitsArgType args;
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        if (*pStatus != DITS__OK) return;
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* get our SDS argument structure */
        args = DitsGetArgument();
    
    Ron's avatar
    Ron committed
    
    
        /* for debug print our argument structure on stdout 
        SdsList(args,pStatus);*/
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* call Fortran COMBINE_SPECTRA() */
    
    Ron's avatar
    Ron committed
        combine_spectra_(&args,pStatus);
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        DitsPutRequest(DITS_REQ_END,pStatus);
    
    Ron's avatar
    Ron committed
    }
    
    JAB's avatar
    JAB committed
    
    
    Ron's avatar
    Ron committed
    /*---------------------------------------------------------------------------*/
    
    JAB's avatar
    JAB committed
    
    
    Ron's avatar
    Ron committed
    void flxCalibAction(
    
    Ron's avatar
    Ron committed
        StatusType* pStatus)
    
    Ron's avatar
    Ron committed
    /*
    
    Ron's avatar
    Ron committed
     * Handler for "FLX_CALIB" DRAMA action.
    
    Ron's avatar
    Ron committed
     *
     * This action is not currently working. See flux_cal.f.
    
    Ron's avatar
    Ron committed
     */
    
    JAB's avatar
    JAB committed
    {
    
    Ron's avatar
    Ron committed
        DitsArgType args;
    /*    SdsIdType localArgs; */
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        if (*pStatus != DITS__OK) return;
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* get our SDS argument structure */
        args = DitsGetArgument();
    
    Ron's avatar
    Ron committed
    
    
        /* for debug print our argument structure on stdout
        SdsList(args,pStatus); */
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* make copy so it can be changed (external SDS -> internal) */
     /*    SdsCopy(args,&localArgs,pStatus); */
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* call Fortran and ???() */
    
    Ron's avatar
    Ron committed
    /*    flx_calib_(&args,pStatus); */
    
        /* delete local SDS copy */
    
    Ron's avatar
    Ron committed
    /*    SdsDelete(localArgs,pStatus); */
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        DitsPutRequest(DITS_REQ_END,pStatus);
    
    JAB's avatar
    JAB committed
    }
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
    /*---------------------------------------------------------------------------*/
    
    JAB's avatar
    JAB committed
    
    
    Ron's avatar
    Ron committed
    void genCalibAction(
    
    Ron's avatar
    Ron committed
        StatusType* pStatus)
    
    Ron's avatar
    Ron committed
    /*
    
    Ron's avatar
    Ron committed
     * Handler for "GEN_CALIB" DRAMA action.
    
    Ron's avatar
    Ron committed
     *
     * This action is not currently working. See flux_cal.f.
    
    Ron's avatar
    Ron committed
     */
    {
    
    Ron's avatar
    Ron committed
        DitsArgType args;
    /*    SdsIdType localArgs; */
    
    
    Ron's avatar
    Ron committed
        if (*pStatus != DITS__OK) return;
    
    JAB's avatar
    JAB committed
    
    
    Ron's avatar
    Ron committed
        /* get our SDS argument structure */
        args = DitsGetArgument();
    
    
        /* for debug print our argument structure on stdout 
        SdsList(args,pStatus);*/
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* make copy so it can be changed (external SDS -> internal) */
     /*    SdsCopy(args,&localArgs,pStatus); */
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* call Fortran and ???() */
    
    Ron's avatar
    Ron committed
    /*    gen_calib_(&args,pStatus); */
    
        /* delete local SDS copy */
    
    Ron's avatar
    Ron committed
    /*    SdsDelete(localArgs,pStatus); */
    
        DitsPutRequest(DITS_REQ_END,pStatus);
    
    Ron's avatar
    Ron committed
    }
    
    JAB's avatar
    JAB committed
    
    
    Ron's avatar
    Ron committed
    /*---------------------------------------------------------------------------*/
    
    JAB's avatar
    JAB committed
    
    
    Ron's avatar
    Ron committed
    void find2dfFibresAction(
    
    Ron's avatar
    Ron committed
        StatusType* pStatus)
    
    Ron's avatar
    Ron committed
    /*
    
    Ron's avatar
    Ron committed
     * Handler for "GFIBPOS" (find 2df fibre positions) DRAMA action.
    
    Ron's avatar
    Ron committed
     *
     * This action is not currently working. See find_fib_2df.f.
    
    Ron's avatar
    Ron committed
     */
    
    JAB's avatar
    JAB committed
    {
    
    Ron's avatar
    Ron committed
        DitsArgType args;
    
    JAB's avatar
    JAB committed
    
    
    Ron's avatar
    Ron committed
        if (*pStatus != DITS__OK) return;
    
    JAB's avatar
    JAB committed
    
    
    Ron's avatar
    Ron committed
        /* get our SDS argument structure */
        args = DitsGetArgument();
    
    JAB's avatar
    JAB committed
    
    
        /* for debug print our argument structure on stdout 
        SdsList(args,pStatus);*/
    
    JAB's avatar
    JAB committed
    
    
    
    Ron's avatar
    Ron committed
        /* call Fortran CMFIM_GFIBPOS() */
    
    Ron's avatar
    Ron committed
    /*    cmfim_gfibpos_(&args,pStatus); */
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        DitsPutRequest(DITS_REQ_END,pStatus);
    
    JAB's avatar
    JAB committed
    }
    
    
    Ron's avatar
    Ron committed
    /*---------------------------------------------------------------------------*/
    
    JAB's avatar
    JAB committed
    
    
    Ron's avatar
    Ron committed
    void plotAction(
    
    Ron's avatar
    Ron committed
        StatusType* pStatus)
    /*
    
    Ron's avatar
    Ron committed
     * Handler for "PLOT" DRAMA action.
    
    Ron's avatar
    Ron committed
     */
    {
        DitsArgType args;
    
        SdsIdType inpArgs, outArgs;
        SdsIdType id2;
    
    
    Ron's avatar
    Ron committed
    
        if (*pStatus != DITS__OK) return;
    
    
        /* Get our input SDS argument structure */
        /* Note: This is an external SDS object and cannot be modified*/
    
    Ron's avatar
    Ron committed
        args = DitsGetArgument();
    
    
        SdsCopy(args,&inpArgs,pStatus);
        
        /* Create a return sds object that can be written to*/
        SdsNew(0,"retArgs",0,NULL,SDS_STRUCT,0,NULL,&outArgs,pStatus);
    
    Ron's avatar
    Ron committed
    
    
        /* call the Fortran subroutine PLOT2() */
        plot2_(&inpArgs,&outArgs,pStatus);
    
    Ron's avatar
    Ron committed
    
    
        /* Set the return SDS object to be outArgs*/
        DitsPutArgument (outArgs,DITS_ARG_DELETE, pStatus);
     
    
    Ron's avatar
    Ron committed
        DitsPutRequest(DITS_REQ_END,pStatus);
    
    Ron's avatar
    Ron committed
    }
    
    /*---------------------------------------------------------------------------*/
    
    
    void plotKick(
        StatusType *pStatus)
    /*
     * Handler for kicking the "Plot" DRAMA action.
     */
    {
        DitsArgType args;
        char key;
        char Buffer[10];
        float x,y;
    
        if (*pStatus != DITS__OK) return;
    
        /* get our SDS argument structure */
        args = DitsGetArgument();
        
        /* Obtain the KEY character and the X Y values*/    
           /* Note: ArgGetc(args,"KEY",&key,pStatus) doesn't appear to work so
                    we use ArgGetString instead                                */
        ArgGetString(args,"KEY",10,Buffer,pStatus);
        key=Buffer[0];
        ArgGetf(args,"X",&x,pStatus);
        ArgGetf(args,"Y",&y,pStatus);  
    
        /* Store these values with Pgplot Request Set Functions*/
        SetPgplotRequest(key,x,y);
    
        /* Now this is the bit I am not sure about but is supposed to unblock
           the DitsActionWait command */
        DitsPutRequest(DITS_REQ_STAGE,pStatus); 
    
    }
    
    /*---------------------------------------------------------------------------*/
    
    
    Ron's avatar
    Ron committed
    void reduceArcAction(
    
    Ron's avatar
    Ron committed
        StatusType* pStatus)
    /*
    
    Ron's avatar
    Ron committed
     * Handler for "REDUCE_ARC" DRAMA action.
    
    Ron's avatar
    Ron committed
     */
    {
        DitsArgType args;
    
    Ron's avatar
    Ron committed
        SdsIdType localArgs = 0;
        StatusType ignore = STATUS__OK;
    
    Ron's avatar
    Ron committed
    
        if (*pStatus != DITS__OK) return;
    
    
    Ron's avatar
    Ron committed
        /* get our SDS argument structure */
    
    Ron's avatar
    Ron committed
        args = DitsGetArgument();
    
    
        /* for debug print our argument structure on stdout
        SdsList(args,pStatus); */
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* make copy so it can be changed (external SDS -> internal) */
        SdsCopy(args,&localArgs,pStatus);
    
    
    Ron's avatar
    Ron committed
        /* call Fortran REDUCE_ARC() */
    
    Ron's avatar
    Ron committed
        reduce_arc_(&localArgs,pStatus);
    
    Ron's avatar
    Ron committed
        if (*pStatus!=DITS__OK) {
            ErsRep(0,pStatus,"%s","reduce arc error");
        }
    
    
        /* delete local SDS copy and free id */
        SdsDelete(localArgs,&ignore);
        SdsFreeId(localArgs,&ignore);
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        DitsPutRequest(DITS_REQ_END,pStatus);
    }
    
    /*---------------------------------------------------------------------------*/
    
    
    Ron's avatar
    Ron committed
    void reduceBiasAction(
    
    Ron's avatar
    Ron committed
        StatusType* pStatus)
    /*
    
    Ron's avatar
    Ron committed
     * Handler for "REDUCE_BIAS" DRAMA action.
    
    Ron's avatar
    Ron committed
     */
    {
        DitsArgType args;
    
        if (*pStatus != DITS__OK) return;
    
    
    Ron's avatar
    Ron committed
        /* get our SDS argument structure */
    
    Ron's avatar
    Ron committed
        args = DitsGetArgument();
    
    
        /* for debug print our argument structure on stdout
        SdsList(args,pStatus); */
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* call Fortran REDUCE_BIAS() */
    
    Ron's avatar
    Ron committed
        reduce_bias_(&args,pStatus);
    
    Ron's avatar
    Ron committed
        if (*pStatus!=DITS__OK) {
            ErsRep(0,pStatus,"%s","reduce bias error");
        }
    
    Ron's avatar
    Ron committed
    
        DitsPutRequest(DITS_REQ_END,pStatus);
    }
    
    /*---------------------------------------------------------------------------*/
    
    void reduceDarkAction(
        StatusType* pStatus)
    /*
     * Handler for "REDUCE_DARK" DRAMA action.
     */
    {
        DitsArgType args;
    
        if (*pStatus != DITS__OK) return;
    
        /* get our SDS argument structure */
        args = DitsGetArgument();
    
    
        /* for debug print our argument structure on stdout
        SdsList(args,pStatus); */
    
    Ron's avatar
    Ron committed
    
        /* call Fortran REDUCE_DARK() */
        reduce_dark_(&args,pStatus);
    
    Ron's avatar
    Ron committed
        if (*pStatus!=DITS__OK) {
            ErsRep(0,pStatus,"%s","reduce dark error");
        }
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        DitsPutRequest(DITS_REQ_END,pStatus);
    }
    
    /*---------------------------------------------------------------------------*/
    
    
    Ron's avatar
    Ron committed
    void reduceFFlatAction(
    
    Ron's avatar
    Ron committed
        StatusType* pStatus)
    /*
    
    Ron's avatar
    Ron committed
     * Handler for "REDUCE_FFLAT" DRAMA action.
    
    Ron's avatar
    Ron committed
     */
    {
        DitsArgType args;
    
    Ron's avatar
    Ron committed
        SdsIdType localArgs = 0;
        StatusType ignore = STATUS__OK;
    
    Ron's avatar
    Ron committed
    
        if (*pStatus != DITS__OK) return;
    
    
    Ron's avatar
    Ron committed
        /* get our SDS argument structure */
    
    Ron's avatar
    Ron committed
        args = DitsGetArgument();
    
    
        /* for debug print our argument structure on stdout
        SdsList(args,pStatus); */
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* make copy so it can be changed (external SDS -> internal) */
        SdsCopy(args,&localArgs,pStatus);
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* call Fortran REDUCE_FFLAT() */
    
    Ron's avatar
    Ron committed
        reduce_fflat_(&localArgs,pStatus);
    
    Ron's avatar
    Ron committed
        if (*pStatus!=DITS__OK) {
            ErsRep(0,pStatus,"%s","reduce flat error");
        }
    
    
        /* delete local SDS copy and free id */
        SdsDelete(localArgs,&ignore);
        SdsFreeId(localArgs,&ignore);
    
    Ron's avatar
    Ron committed
    
    
        DitsPutRequest(DITS_REQ_END,pStatus);
    }
    
    /*---------------------------------------------------------------------------*/
    
    
    Ron's avatar
    Ron committed
    void reduceLFlatAction(
    
        StatusType* pStatus)
    /*
    
    Ron's avatar
    Ron committed
     * Handler for "REDUCE_LFLAT" DRAMA action.
    
     */
    {
        DitsArgType args;
    
        if (*pStatus != DITS__OK) return;
    
    
    Ron's avatar
    Ron committed
        /* get our SDS argument structure */
    
        args = DitsGetArgument();
    
    
        /* for debug print our argument structure on stdout
        SdsList(args,pStatus); */
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* call Fortran REDUCE_LFLAT() */
    
    Ron's avatar
    Ron committed
        reduce_lflat_(&args,pStatus);
    
    Ron's avatar
    Ron committed
        if (*pStatus!=DITS__OK) {
            ErsRep(0,pStatus,"%s","reduce long flat error");
        }
    
    Ron's avatar
    Ron committed
    
    
        DitsPutRequest(DITS_REQ_END,pStatus);
    }
    
    
    /*---------------------------------------------------------------------------*/
    
    void reduceFFluxAction(
        StatusType* pStatus)
    /*
     * Handler for "REDUCE_FFLX" DRAMA action.
     */
    {
        DitsArgType args;
        SdsIdType localArgs = 0;
        StatusType ignore = STATUS__OK;
    
        if (*pStatus != DITS__OK) return;
    
        /* get our SDS argument structure */
        args = DitsGetArgument();
    
        /* for debug print our argument structure on stdout
        SdsList(args,pStatus); */
    
        /* make copy so it can be changed (external SDS -> internal) */
        SdsCopy(args,&localArgs,pStatus);
    
        /* call Fortran REDUCE_OBJECT() */
        reduce_fflx_(&localArgs,pStatus);
        if (*pStatus!=DITS__OK) {
            ErsRep(0,pStatus,"%s","reduce object error");
        }
    
        /* delete local SDS copy and free its id*/
        SdsDelete(localArgs,&ignore);
        SdsFreeId(localArgs,&ignore);
    
        DitsPutRequest(DITS_REQ_END,pStatus);
    }
    
    
    
    /*---------------------------------------------------------------------------*/
    
    
    Ron's avatar
    Ron committed
    void reduceObjAction(
    
        StatusType* pStatus)
    /*
    
    Ron's avatar
    Ron committed
     * Handler for "REDUCE_OBJECT" DRAMA action.
    
     */
    {
        DitsArgType args;
    
    Ron's avatar
    Ron committed
        SdsIdType localArgs = 0;
        StatusType ignore = STATUS__OK;
    
    
        if (*pStatus != DITS__OK) return;
    
    
    Ron's avatar
    Ron committed
        /* get our SDS argument structure */
    
        args = DitsGetArgument();
    
    
        /* for debug print our argument structure on stdout
        SdsList(args,pStatus); */
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* make copy so it can be changed (external SDS -> internal) */
        SdsCopy(args,&localArgs,pStatus);
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* call Fortran REDUCE_OBJECT() */
    
    Ron's avatar
    Ron committed
        reduce_object_(&localArgs,pStatus);
    
    Ron's avatar
    Ron committed
        if (*pStatus!=DITS__OK) {
            ErsRep(0,pStatus,"%s","reduce object error");
        }
    
    
        /* delete local SDS copy and free its id*/
        SdsDelete(localArgs,&ignore);
        SdsFreeId(localArgs,&ignore);
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        DitsPutRequest(DITS_REQ_END,pStatus);
    }
    
    /*---------------------------------------------------------------------------*/
    
    
    Ron's avatar
    Ron committed
    void reduceSkyAction(
    
    Ron's avatar
    Ron committed
        StatusType* pStatus)
    /*
    
    Ron's avatar
    Ron committed
     * Handler for "REDUCE_SKY" DRAMA action.
    
    Ron's avatar
    Ron committed
     */
    {
        DitsArgType args;
    
    Ron's avatar
    Ron committed
        SdsIdType localArgs = 0;
        StatusType ignore = STATUS__OK;
    
    Ron's avatar
    Ron committed
    
        if (*pStatus != DITS__OK) return;
    
    
    Ron's avatar
    Ron committed
        /* get our SDS argument structure */
    
    Ron's avatar
    Ron committed
        args = DitsGetArgument();
    
    
        /* for debug print our argument structure on stdout
        SdsList(args,pStatus); */
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* make copy so it can be changed (external SDS -> internal) */
        SdsCopy(args,&localArgs,pStatus);
    
    
    Ron's avatar
    Ron committed
        /* call Fortran REDUCE_SKY() */
    
    Ron's avatar
    Ron committed
        reduce_sky_(&localArgs,pStatus);
    
    Ron's avatar
    Ron committed
        if (*pStatus!=DITS__OK) {
            ErsRep(0,pStatus,"%s","reduce sky error");
        }
    
    
        /* delete local SDS copy and free its id*/
        SdsDelete(localArgs,&ignore);
        SdsFreeId(localArgs,&ignore);
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        DitsPutRequest(DITS_REQ_END,pStatus);
    }
    
    /*---------------------------------------------------------------------------*/
    
    
    Ron's avatar
    Ron committed
    void spliceAction(
    
    Ron's avatar
    Ron committed
        StatusType* pStatus)
    /*
    
    Ron's avatar
    Ron committed
     * Handler for "SPLICE" DRAMA action.
    
    Ron's avatar
    Ron committed
     */
    {
        DitsArgType args;
    
        if (*pStatus != DITS__OK) return;
    
        /* get our SDS argument structure */
        args = DitsGetArgument();
    
    
        /* for debug print our argument structure on stdout
        SdsList(args,pStatus); */
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        /* call Fortran SPLICE_AAOMEGA() */
    
    Ron's avatar
    Ron committed
        splice_aaomega_(&args,pStatus);
    
    Ron's avatar
    Ron committed
        if (*pStatus != DITS__OK) {
            ErsRep(0,pStatus,"%s","splice error");
        }
    
    Ron's avatar
    Ron committed
    
    
    Ron's avatar
    Ron committed
        DitsPutRequest(DITS_REQ_END,pStatus);
    }
    
    
    /*---------------------------------------------------------------------------*/
    
    void detectCosmicStreaksAction(
        StatusType* pStatus)
    /*
     * Handler for "DETECT_CSTRKS" DRAMA action.
     */
    {
        DitsArgType args;
        SdsIdType localArgs = 0;
        StatusType ignore = STATUS__OK;
    
        if (*pStatus != DITS__OK) return;
    
        /* get our SDS argument structure */
        args = DitsGetArgument();
    
        /* for debug print our argument structure on stdout
        SdsList(args,pStatus); */
    
        /* make copy so it can be changed (external SDS -> internal) */
        SdsCopy(args,&localArgs,pStatus);
    
        /* call Fortran DETECT_COSMIC_STREAKS()  */
        detect_cosmic_streaks_(&args,pStatus);
    
        if (*pStatus!=DITS__OK) {
            ErsRep(0,pStatus,"%s","cosmic streak detection error error");
        }
    
        /* delete local SDS copy and free its id*/
        SdsDelete(localArgs,&ignore);
        SdsFreeId(localArgs,&ignore);
    
        DitsPutRequest(DITS_REQ_END,pStatus);
    }
    
    
    
    Ron's avatar
    Ron committed
    /*---------------------------------------------------------------------------*/
    
    
    Ron's avatar
    Ron committed
    void exitAction(
    
    Ron's avatar
    Ron committed
        StatusType *pStatus)
    
    Ron's avatar
    Ron committed
    /*
     * Handler for "EXIT" DRAMA action.
     */
    
    JAB's avatar
    JAB committed
    {
    
    Ron's avatar
    Ron committed
        DitsPutRequest(DITS_REQ_EXIT,pStatus);
    
    JAB's avatar
    JAB committed
    }
    
    Ron's avatar
    Ron committed
    
    
    /*---------------------------------------------------------------------------*/
    
    void testAction(
        StatusType *pStatus)
    /*
     * Handler for "TEST" DRAMA action.
     */
    {
    
    Ron's avatar
    Ron committed
        printf("Test Drama Action Called\n");
        DitsPutRequest(DITS_REQ_MESSAGE,pStatus);
    
    Ron's avatar
    Ron committed
    
    /*---------------------------------------------------------------------------*/
    
    
    Ron's avatar
    Ron committed
     * Handler for "TESTKICK" DRAMA action.
    
    Ron's avatar
    Ron committed
        printf("Test Drama Kick Called\n");