static void DoSrvCreatePulse(SrvJob *job_in) { int status; SrvCreatePulseJob *job = (SrvCreatePulseJob *)job_in; char *job_text = malloc(100); sprintf(job_text,"Creating pulse for %s shot %d",((SrvCreatePulseJob *)job)->tree,((SrvCreatePulseJob *)job)->shot); current_job_text = job_text; status = TreeCreateTreeFiles(job->tree,job->shot,-1); SendReply(job_in,SrvJobFINISHED,status,0,0); }
int _TreeCreatePulseFile(void *dbid, int shotid, int numnids_in, int *nids_in) { PINO_DATABASE *dblist = (PINO_DATABASE *)dbid; int status = 1; int retstatus; int num; int nids[256]; int i; int j; int shot; int source_shot; /* Make sure tree is open */ if ((status = _TreeIsOpen(dblist)) != TreeOPEN) return status; source_shot = dblist->shotid; if (numnids_in == 0) { void *ctx = 0; nids[0]=0; for (num = 1; num < 256 && (_TreeFindNodeWild(dbid, "***", &nids[num], &ctx,(1 << TreeUSAGE_SUBTREE)) & 1); num++); TreeFindTagEnd(&ctx); } else { num = 0; for (i = 0; i < numnids_in; i++) { for (j = 0; j < num; j++) if (nids[j] == nids_in[i]) break; if (j == num) nids[num++] = nids_in[i]; } } if (dblist->remote) return CreatePulseFileRemote(dblist, shotid, nids, num); if (shotid) shot = shotid; else shot = TreeGetCurrentShotId(dblist->experiment); retstatus = status; if (status & 1) { for (i = 0; i < num && (retstatus & 1); i++) { int skip=0; char name[13]; if (nids[i]) { int flags; NCI_ITM itmlst[] = {{sizeof(name)-1, NciNODE_NAME, 0, 0}, {4, NciGET_FLAGS,&flags,0},{0, NciEND_OF_LIST, 0, 0}}; itmlst[0].pointer = name; status = _TreeGetNci(dbid, nids[i], itmlst); if (numnids_in == 0) skip = (flags & NciM_INCLUDE_IN_PULSE) == 0; name[12] = 0; for (j=11;j>0;j--) if (name[j] == 0x20) name[j] = '\0'; } else { strcpy(name,dblist->experiment); } if (status & 1 && !(skip)) status = TreeCreateTreeFiles(name, shot, source_shot); if (!(status & 1) && (i==0)) retstatus = status; } } return retstatus; }