#include <pslib.h>
#include <ippdb.h>
#include <stdlib.h>

int main ()
{
    {
        psDB            *dbh;
        psF32           temp01;
        psF32           humi01;
        psF32           temp02;
        psF32           humi02;
        psF32           temp03;
        psF32           humi03;
        psF32           pressure;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!weatherPop(dbh, &temp01, &humi01, &temp02, &humi02, &temp03, &humi03, &pressure)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            filter[256];
        psF64           trans;
        psS32           nstars;
        psF64           ra;
        psF64           decl;
        psF32           exptime;
        psF64           sky_bright;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!skyp_transparencyPop(dbh, (char **)&filter, &trans, &nstars, &ra, &decl, &exptime, &sky_bright)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            disperser_id[256];
        psF32           atmcomp1;
        psF32           atmcomp2;
        psF32           atmcomp3;
        psS32           nstars;
        psF64           ra;
        psF64           decl;
        psF32           exptime;
        psF64           sky_bright;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!skyp_absorptionPop(dbh, (char **)&disperser_id, &atmcomp1, &atmcomp2, &atmcomp3, &nstars, &ra, &decl, &exptime, &sky_bright)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            disperser_id[256];
        psF32           atmcomp1;
        psF32           atmcomp2;
        psF32           atmcomp3;
        psF32           continuum;
        psF32           exptime;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!skyp_emissionPop(dbh, (char **)&disperser_id, &atmcomp1, &atmcomp2, &atmcomp3, &continuum, &exptime)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        psF32           sigmax;
        psF32           sigmay;
        psF32           fwhm;
        psF64           ra;
        psF64           decl;
        psF32           expttime;
        char            telescope_id[256];

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!dimmPop(dbh, &sigmax, &sigmay, &fwhm, &ra, &decl, &expttime, (char **)&telescope_id)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        psF64           sky_bright;
        psF64           sky_var;
        psF64           ra;
        psF64           decl;
        psF32           fov_x;
        psF32           fov_y;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!skyp_irPop(dbh, &sky_bright, &sky_var, &ra, &decl, &fov_x, &fov_y)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        psF32           az;
        bool            open;
        bool            light;
        bool            track;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!domePop(dbh, &az, &open, &light, &track)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            guide[256];
        psF32           alt;
        psF32           az;
        psF64           ra;
        psF64           decl;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!telescopePop(dbh, (char **)&guide, &alt, &az, &ra, &decl)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            exp_id[256];
        char            camera[256];
        char            telescope[256];
        char            exp_type[256];
        char            uri[256];

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!summitExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, (char **)&uri)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            exp_id[256];
        char            camera[256];
        char            telescope[256];
        char            exp_type[256];
        psS32           imfiles;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!pzPendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            exp_id[256];
        psS32           bytes;
        char            md5sum[256];
        char            class[256];
        char            class_id[256];
        char            uri[256];

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!pzPendingImfilePop(dbh, (char **)&exp_id, &bytes, (char **)&md5sum, (char **)&class, (char **)&class_id, (char **)&uri)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            exp_id[256];
        char            camera[256];
        char            telescope[256];
        char            exp_type[256];
        psS32           imfiles;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!newExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            exp_id[256];
        char            class[256];
        char            class_id[256];
        char            uri[256];

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!newImfilePop(dbh, (char **)&exp_id, (char **)&class, (char **)&class_id, (char **)&uri)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            exp_id[256];
        char            camera[256];
        char            telescope[256];
        char            exp_type[256];
        psS32           imfiles;
        char            filter[256];
        char            stats[256];

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!rawDetrendExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            exp_id[256];
        char            camera[256];
        char            telescope[256];
        char            exp_type[256];
        psS32           imfiles;
        char            filter[256];
        char            stats[256];

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!rawScienceExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            exp_id[256];
        char            class_id[256];
        char            uri[256];
        char            stats[256];

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!rawImfilePop(dbh, (char **)&exp_id, (char **)&class_id, (char **)&uri, (char **)&stats)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            exp_id[256];
        char            camera[256];
        char            telescope[256];
        char            exp_type[256];
        psS32           imfiles;
        char            filter[256];
        char            stats[256];
        char            recipe[256];
        psS32           p1_version;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!p1PendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats, (char **)&recipe, &p1_version)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            exp_id[256];
        char            camera[256];
        char            telescope[256];
        char            exp_type[256];
        psS32           imfiles;
        char            filter[256];
        char            stats[256];
        char            recipe[256];
        psS32           p1_version;
        psS32           p2_version;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!p2PendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats, (char **)&recipe, &p1_version, &p2_version)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            exp_id[256];
        char            class_id[256];
        char            uri[256];
        char            stats[256];
        char            recipe[256];
        psS32           p1_version;
        psS32           p2_version;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!p2PendingImfilePop(dbh, (char **)&exp_id, (char **)&class_id, (char **)&uri, (char **)&stats, (char **)&recipe, &p1_version, &p2_version)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            exp_id[256];
        char            camera[256];
        char            telescope[256];
        char            exp_type[256];
        psS32           imfiles;
        char            filter[256];
        char            stats[256];
        char            recipe[256];
        psS32           p1_version;
        psS32           p2_version;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!p2DoneExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats, (char **)&recipe, &p1_version, &p2_version)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            exp_id[256];
        char            class_id[256];
        char            uri[256];
        char            stats[256];
        char            recipe[256];
        psS32           p1_version;
        psS32           p2_version;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!p2DoneImfilePop(dbh, (char **)&exp_id, (char **)&class_id, (char **)&uri, (char **)&stats, (char **)&recipe, &p1_version, &p2_version)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            exp_id[256];
        char            camera[256];
        char            exp_type[256];
        psS32           imfiles;
        char            filter[256];
        char            stats[256];
        char            recipe[256];
        psS32           p2_version;
        psS32           p3_version;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!p3PendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats, (char **)&recipe, &p2_version, &p3_version)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        char            det_type[256];

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!detRunPop(dbh, (char **)&det_type)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        psS32           det_id;
        psS32           iteration;
        char            exp_id[256];
        char            camera[256];
        char            telescope[256];
        char            exp_type[256];
        psS32           imfiles;
        char            filter[256];
        char            stats[256];

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!detInputExpPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        psS32           det_id;
        char            exp_id[256];
        char            class_id[256];
        char            uri[256];
        char            stats[256];
        char            recipe[256];

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!detProcessedImfilePop(dbh, &det_id, (char **)&exp_id, (char **)&class_id, (char **)&uri, (char **)&stats, (char **)&recipe)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        psS32           det_id;
        psS32           iteration;
        char            class_id[256];
        char            uri[256];
        char            stats[256];
        char            recipe[256];

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!detStackedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, (char **)&stats, (char **)&recipe)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        psS32           det_id;
        psS32           iteration;
        char            class_id[256];
        char            uri[256];
        char            stats[256];
        char            recipe[256];

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!detNormalizedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, (char **)&stats, (char **)&recipe)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        psS32           det_id;
        psS32           iteration;
        char            comment[256];

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!detMasterFramePop(dbh, &det_id, &iteration, (char **)&comment)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        psS32           det_id;
        char            class_id[256];
        char            uri[256];
        char            stats[256];
        char            recipe[256];

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!detMasterImfilePop(dbh, &det_id, (char **)&class_id, (char **)&uri, (char **)&stats, (char **)&recipe)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        psS32           det_id;
        psS32           iteration;
        char            exp_id[256];
        char            class_id[256];
        char            stats[256];
        char            recipe[256];

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!detResidImfileAnalysisPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&class_id, (char **)&stats, (char **)&recipe)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    {
        psDB            *dbh;
        psS32           det_id;
        psS32           iteration;
        char            exp_id[256];
        char            stats[256];
        char            recipe[256];
        bool            accept;

        dbh = psDBInit("localhost", "test", NULL, "test");
        if (!dbh) {
            exit(EXIT_FAILURE);
        }

        if (!detResidExpAnalysisPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&stats, (char **)&recipe, &accept)) { 
            exit(EXIT_FAILURE);
        }

        psDBCleanup(dbh);
    }

    exit(EXIT_SUCCESS);
}
