Beispiel #1
0
int
loadabell(int32_t index)
{
    int32_t j;

    abellopen();
    j = index-1;
    grow();
    cur->type = Abell;
    cur->index = index;
    seek(abelldb, j*sizeof(Abellrec), 0);
    Eread(abelldb, "abell", &cur->abell, sizeof(Abellrec));
    cur->abell.abell = Short(&cur->abell.abell);
    if(cur->abell.abell != index) {
        fprint(2, "bad format in abell catalog\n");
        exits("abell");
    }
    cur->abell.ra = Long(&cur->abell.ra);
    cur->abell.dec = Long(&cur->abell.dec);
    cur->abell.glat = Long(&cur->abell.glat);
    cur->abell.glong = Long(&cur->abell.glong);
    cur->abell.rad = Long(&cur->abell.rad);
    cur->abell.mag10 = Short(&cur->abell.mag10);
    cur->abell.pop = Short(&cur->abell.pop);
    cur->abell.dist = Short(&cur->abell.dist);
    return 1;
}
Beispiel #2
0
void
ngcopen(void)
{
    if(ngcdb == 0) {
        nameopen();
        ngcdb = eopen("ngc2000");
        ngctypedb = eopen("ngc2000type");
        Eread(ngctypedb, "ngctype", ngctype, sizeof ngctype);
        close(ngctypedb);
    }
}
Beispiel #3
0
void
mopen(void)
{
    int i;

    if(mindexdb == 0) {
        mindexdb = eopen("mindex");
        Eread(mindexdb, "mindex", mindex, sizeof mindex);
        close(mindexdb);
        for(i=0; i<NMrec; i++)
            mindex[i].ngc = Short(&mindex[i].ngc);
    }
}
Beispiel #4
0
void
constelopen(void)
{
    int i;

    if(condb == 0) {
        condb = eopen("con");
        conindexdb = eopen("conindex");
        Eread(conindexdb, "conindex", conindex, sizeof conindex);
        close(conindexdb);
        for(i=0; i<Ncon+1; i++)
            conindex[i] = Short((int16_t*)&conindex[i]);
    }
}
Beispiel #5
0
int
loadpatch(int32_t index)
{
    int i;

    patchopen();
    if(index<=0 || index>Npatch)
        return 0;
    grow();
    cur->type = Patch;
    cur->index = index;
    seek(patchdb, patchaddr[index-1], 0);
    cur->patch.nkey = (patchaddr[index]-patchaddr[index-1])/4;
    Eread(patchdb, "patch", cur->patch.key, cur->patch.nkey*4);
    for(i=0; i<cur->patch.nkey; i++)
        cur->patch.key[i] = Long(&cur->patch.key[i]);
    return 1;
}
Beispiel #6
0
void
nameopen(void)
{
    Biobuf b;
    int i;
    char *l, *p;

    if(namedb == 0) {
        namedb = eopen("name");
        Binit(&b, namedb, OREAD);
        for(i=0; i<NName; i++) {
            l = Brdline(&b, '\n');
            if(l == 0)
                break;
            p = strchr(l, '\t');
            if(p == 0) {
Badformat:
                Bprint(&bout, "warning: name.scat bad format; line %d\n", i+1);
                break;
            }
            *p++ = 0;
            strcpy(name[i].name, l);
            if(strncmp(p, "ngc", 3) == 0)
                name[i].ngc = atoi(p+3);
            else if(strncmp(p, "ic", 2) == 0)
                name[i].ngc = atoi(p+2)+NNGC;
            else if(strncmp(p, "sao", 3) == 0)
                name[i].sao = atoi(p+3);
            else if(strncmp(p, "abell", 5) == 0)
                name[i].abell = atoi(p+5);
            else
                goto Badformat;
        }
        if(i == NName)
            Bprint(&bout, "warning: too many names in name.scat (max %d); extra ignored\n", NName);
        close(namedb);

        bayerdb = eopen("bayer");
        Eread(bayerdb, "bayer", bayer, sizeof bayer);
        close(bayerdb);
        for(i=0; i<NBayer; i++)
            bayer[i].sao = Long(&bayer[i].sao);
    }
}
static int
__read_on_ctx(eventer_t e, realtime_recv_ctx_t *ctx, int *newmask) {
  int len, mask;
  while(ctx->bytes_read < ctx->bytes_expected) {
    len = Eread(ctx->buffer + ctx->bytes_read,
                ctx->bytes_expected - ctx->bytes_read);
    if(len < 0) {
      *newmask = mask;
      return -1;
    }
    /* if we get 0 inside SSL, and there was a real error, we
     * will actually get a -1 here.
     * if(len == 0) return ctx->bytes_read;
     */
    ctx->bytes_read += len;
  }
  assert(ctx->bytes_read == ctx->bytes_expected);
  return ctx->bytes_read;
}
Beispiel #8
0
int
loadsao(int index)
{
    if(index<=0 || index>NSAO)
        return 0;
    saoopen();
    grow();
    cur->type = SAO;
    cur->index = index;
    seek(saodb, (index-1)*sizeof(SAOrec), 0);
    Eread(saodb, "sao", &cur->sao, sizeof(SAOrec));
    cur->sao.ra = Long(&cur->sao.ra);
    cur->sao.dec = Long(&cur->sao.dec);
    cur->sao.dra = Long(&cur->sao.dra);
    cur->sao.ddec = Long(&cur->sao.ddec);
    cur->sao.mag = Short(&cur->sao.mag);
    cur->sao.mpg = Short(&cur->sao.mpg);
    cur->sao.hd = Long(&cur->sao.hd);
    return 1;
}