void init0(void) { Osenv *o; up->nerrlab = 0; print("before spllo"); spllo(); print("Sun Sparc %s\n", sparam->name); print("bank 0: %ldM 1: %ldM\n", bank[0], bank[1]); print("frame buffer id %lux slot %ld %s\n",conf.monitor,fbslot,fbstr); if(waserror()) panic("init0"); /* * These are o.k. because rootinit is null. * Then early kproc's will have a root and dot. */ o = up->env; o->pgrp->slash = namec("#/", Atodir, 0, 0); cnameclose(o->pgrp->slash->name); o->pgrp->slash->name = newcname("/"); o->pgrp->dot = cclone(o->pgrp->slash); chandevinit(); poperror(); disinit("/osinit.dis"); }
int lindist(int sequence, struct linprm *lin, struct disprm *dis, int ndpmax) { static const char *function = "lindist"; int status; struct wcserr **err; if (lin == 0x0) return LINERR_NULL_POINTER; err = &(lin->err); if (sequence == 1) { if (lin->m_dispre) { disfree(lin->m_dispre); free(lin->m_dispre); } lin->dispre = dis; lin->m_flag = LINSET; lin->m_dispre = dis; } else if (sequence == 2) { if (lin->m_disseq) { disfree(lin->m_disseq); free(lin->m_disseq); } lin->disseq = dis; lin->m_flag = LINSET; lin->m_disseq = dis; } else { return wcserr_set(WCSERR_SET(LINERR_DISTORT_INIT), "Invalid sequence (%d)", sequence); } if (dis) { if ((status = disinit(1, lin->naxis, dis, ndpmax))) { return wcserr_set(LIN_ERRMSG(lin_diserr[status])); } } return 0; }
void init0(void) { Osenv *o; int i; char buf[2*KNAMELEN]; up->nerrlab = 0; spllo(); if(waserror()) panic("init0"); /* * These are o.k. because rootinit is null. * Then early kproc's will have a root and dot. */ o = up->env; o->pgrp->slash = namec("#/", Atodir, 0, 0); cnameclose(o->pgrp->slash->name); o->pgrp->slash->name = newcname("/"); o->pgrp->dot = cclone(o->pgrp->slash); chandevinit(); if(!waserror()){ ksetenv("cputype", "power", 0); snprint(buf, sizeof(buf), "power %s", conffile); ksetenv("terminal", buf, 0); poperror(); } for(i = 0; i < nconf; i++) if(confname[i][0] != '*'){ if(!waserror()){ ksetenv(confname[i], confval[i], 0); poperror(); } } poperror(); disinit("/osinit.dis"); }
void init0(void) { Osenv *o; char buf[2*KNAMELEN]; up->nerrlab = 0; //print("Starting init0()\n"); spllo(); if(waserror()) panic("init0 %r"); /* These are o.k. because rootinit is null. * Then early kproc's will have a root and dot. */ o = up->env; o->pgrp->slash = namec("#/", Atodir, 0, 0); cnameclose(o->pgrp->slash->name); o->pgrp->slash->name = newcname("/"); o->pgrp->dot = cclone(o->pgrp->slash); chandevinit(); if(!waserror()){ ksetenv("cputype", "arm", 0); snprint(buf, sizeof(buf), "arm %s", conffile); ksetenv("terminal", buf, 0); snprint(buf, sizeof(buf), "%s", getethermac()); ksetenv("ethermac", buf, 0); poperror(); } poperror(); disinit("/osinit.dis"); }
int lininit(int alloc, int naxis, struct linprm *lin, int ndpmax) { static const char *function = "lininit"; int i, j; double *pc; struct wcserr **err; if (lin == 0x0) return LINERR_NULL_POINTER; /* Initialize error message handling. */ err = &(lin->err); if (lin->flag != -1) { if (lin->err) free(lin->err); } lin->err = 0x0; /* Initialize memory management. */ if (lin->flag == -1 || lin->m_flag != LINSET) { if (lin->flag == -1) { lin->dispre = 0x0; lin->disseq = 0x0; lin->tmpcrd = 0x0; } lin->m_flag = 0; lin->m_naxis = 0; lin->m_crpix = 0x0; lin->m_pc = 0x0; lin->m_cdelt = 0x0; lin->m_dispre = 0x0; lin->m_disseq = 0x0; } if (naxis < 0) { return wcserr_set(WCSERR_SET(LINERR_MEMORY), "naxis must not be negative (got %d)", naxis); } /* Allocate memory for arrays if required. */ if (alloc || lin->crpix == 0x0 || lin->pc == 0x0 || lin->cdelt == 0x0) { /* Was sufficient allocated previously? */ if (lin->m_flag == LINSET && lin->m_naxis < naxis) { /* No, free it. */ linfree(lin); } if (alloc || lin->crpix == 0x0) { if (lin->m_crpix) { /* In case the caller fiddled with it. */ lin->crpix = lin->m_crpix; } else { if ((lin->crpix = calloc(naxis, sizeof(double))) == 0x0) { return wcserr_set(LIN_ERRMSG(LINERR_MEMORY)); } lin->m_flag = LINSET; lin->m_naxis = naxis; lin->m_crpix = lin->crpix; } } if (alloc || lin->pc == 0x0) { if (lin->m_pc) { /* In case the caller fiddled with it. */ lin->pc = lin->m_pc; } else { if ((lin->pc = calloc(naxis*naxis, sizeof(double))) == 0x0) { linfree(lin); return wcserr_set(LIN_ERRMSG(LINERR_MEMORY)); } lin->m_flag = LINSET; lin->m_naxis = naxis; lin->m_pc = lin->pc; } } if (alloc || lin->cdelt == 0x0) { if (lin->m_cdelt) { /* In case the caller fiddled with it. */ lin->cdelt = lin->m_cdelt; } else { if ((lin->cdelt = calloc(naxis, sizeof(double))) == 0x0) { linfree(lin); return wcserr_set(LIN_ERRMSG(LINERR_MEMORY)); } lin->m_flag = LINSET; lin->m_naxis = naxis; lin->m_cdelt = lin->cdelt; } } } /* Reinitialize disprm structs if we are managing them. */ if (lin->m_dispre) { disinit(1, naxis, lin->dispre, ndpmax); } if (lin->m_disseq) { disinit(1, naxis, lin->disseq, ndpmax); } /* Free memory allocated by linset(). */ if (lin->flag == LINSET) { if (lin->piximg) free(lin->piximg); if (lin->imgpix) free(lin->imgpix); if (lin->tmpcrd) free(lin->tmpcrd); } lin->piximg = 0x0; lin->imgpix = 0x0; lin->i_naxis = 0; lin->unity = 0; lin->affine = 0; lin->simple = 0; lin->tmpcrd = 0x0; lin->flag = 0; lin->naxis = naxis; /* CRPIXja defaults to 0.0. */ for (j = 0; j < naxis; j++) { lin->crpix[j] = 0.0; } /* PCi_ja defaults to the unit matrix. */ pc = lin->pc; for (i = 0; i < naxis; i++) { for (j = 0; j < naxis; j++) { if (j == i) { *pc = 1.0; } else { *pc = 0.0; } pc++; } } /* CDELTia defaults to 1.0. */ for (i = 0; i < naxis; i++) { lin->cdelt[i] = 1.0; } return 0; }