/************************************************************************** * * PrintMacro * * SYNOPSIS * void PrintMacro (MakeMacro *macro) * * PURPOSE * * * INPUT * * * EFFECTS * * * RETURN VALUE * * * BUGS * * * HISTORY * * * SEE ALSO * */ void PrintMacro (MakeMacro *macro) { NameType *name; name = (NameType*)LST_Head (¯o->Names); while (!LST_EndOfList (name)) { name = PrintName (name); } } /* PrintMacro */
static CONDITION getVisitRecord(PRIVATE_HANDLE * h, FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList, FIS_VISITRECORD * r, long *count) { CONDITION cond; TBL_CRITERIA criteria[2]; FIS_VISITRECORD *p; static TBL_FIELD fields[] = { {TBL_FIELD_STRING("VisUID", visit.VisUID)}, {TBL_FIELD_STRING("PatUID", visit.PatUID)}, {TBL_FIELD_STRING("RefPhyNam", visit.RefPhyNam)}, {NULL}, }; criteria[0].FieldName = criteria[1].FieldName = NULL; if (uid != NULL) { if (uid[0] != '\0') { if (criteriaType == FIS_K_PATIENT) { TBL_CRITERIA_LOAD_BYTE(criteria[0], "PatUID", uid, TBL_STRING, TBL_EQUAL); } else { TBL_CRITERIA_LOAD_BYTE(criteria[0], "VisUID", uid, TBL_STRING, TBL_EQUAL); } } } memset(&visit, 0, sizeof(visit)); visit.Type = FIS_K_VISIT; cond = TBL_Select(&h->visitHandle, criteria, fields, count, visitCallback, getList); if (cond != TBL_NORMAL) return 0; if (r != NULL) *r = visit; if (listFlag & FIS_K_VISIT_STUDYLIST) { if (getList != NULL) { p = LST_Head(&getList); (void) LST_Position(&getList, p); } else p = r; while (p != NULL) { p->StudyList = LST_Create(); cond = getStudyRecord(h, FIS_K_VISIT, p->VisUID, 0, p->StudyList, NULL, NULL); if (cond != FIS_NORMAL) return cond; if (getList != NULL) p = LST_Next(&getList); else p = NULL; } } return FIS_NORMAL; }
CONDITION DCM_ListToString(LST_HEAD * list, long offset, char **string) { GENERIC * g; char *c, *p; long length; *string = NULL; if (list == NULL) return DCM_NORMAL; g = LST_Head(&list); if (g == NULL) return DCM_NORMAL; (void) LST_Position(&list, g); length = 0; while (g != NULL) { c = ((char *) g) + offset; length += strlen(c) + 1; g = LST_Next(&list); } p = CTN_MALLOC(length); if (p == NULL) return COND_PushCondition(DCM_MALLOCFAILURE, DCM_Message(DCM_MALLOCFAILURE), length, "DCM_ListToString"); *string = p; g = LST_Head(&list); if (g == NULL) return COND_PushCondition(DCM_LISTFAILURE, DCM_Message(DCM_LISTFAILURE), "DCM_ListToString"); (void) LST_Position(&list, g); length = 0; while (g != NULL) { c = ((char *) g) + offset; length = strlen(c); (void) memcpy(p, c, length); p += length; *p++ = '\\'; g = LST_Next(&list); } *--p = '\0'; return DCM_NORMAL; }
/************************************************************************** * * FPrintMacro * * SYNOPSIS * int FPrintMacro (MakeMacro *macro, FILE *fp) * * PURPOSE * * * INPUT * * * EFFECTS * * * RETURN VALUE * * * BUGS * * * HISTORY * * * SEE ALSO * */ int FPrintMacro (MakeMacro *macro, FILE *fp) { NameType *name; name = (NameType*)LST_Head (¯o->Names); if (!FPrintName (name, fp)) { return FALSE; } return TRUE; } /* FPrintMacro */
/********************************* M A I N ********************************/ int main ( int argc, char **argv ) { char **newargs = NULL; LST_LIST *configlist; ConfigType *config; int status = TRUE; printf ("MakeScan (c) Echidna 1990\n"); if (!(argc == 2 && argv[1][0] == '?' && argv[1][1] == '\0')) { newargs = argparse (argc, argv, Template); } if (!newargs) { if (GlobalErrMsg) { printf ("%s\n", GlobalErrMsg); } printarghelp (Usage, Template); } else { DebugSwitch = (int )((long)newargs[ARG_DEBUG]); if ((configlist = ReadConfigurationFile (newargs[ARG_CONFIG]))) { if (DebugSwitch) { PrintConfigList (configlist); } if (newargs[ARG_RULE]) { strupr (newargs[ARG_RULE]); if (!(config = (ConfigType*)LST_FindName (configlist, newargs[ARG_RULE]))) { SetGlobalErr (ERR_GENERIC); GEprintf1 ("No such rule '%s'", newargs[ARG_RULE]); status = FALSE; } } else { config = (ConfigType*)LST_Head (configlist); } if (status) { if (!CreateFiles (config, newargs[ARG_MAKEFILE])) { status = FALSE; } } } else { status = FALSE; } if (GlobalErr) { printf ("%s\n", GlobalErrMsg); status = FALSE; } } return (status ? 0 : 20); }
/************************************************************************** * * PrintMacros * * SYNOPSIS * void PrintMacros (LST_LIST *mlist) * * PURPOSE * Print all the macros * * INPUT * * * EFFECTS * * * RETURN VALUE * * * BUGS * * * HISTORY * * * SEE ALSO * */ void PrintMacros (LST_LIST *mlist) { MakeMacro *macro; printf ("------Macros------\n"); macro = (MakeMacro*)LST_Head (mlist); while (!LST_EndOfList (macro)) { printf ("'%s' = ", LST_NodeName(macro)); StartFlag = FALSE; PrintMacro (macro); printf ("\n"); macro = (MakeMacro*)LST_Next (macro); } printf ("------End of Macros------\n"); } /* PrintMacros */
CONDITION SRV_RegisterSOPClass(const char *SOPClass, DUL_SC_ROLE role, DUL_ASSOCIATESERVICEPARAMETERS * params) { DUL_PRESENTATIONCONTEXTID contextID = 1; CTNBOOLEAN found = FALSE; CONDITION cond; DUL_PRESENTATIONCONTEXT* ctx; if (params->requestedPresentationContext == NULL) { params->requestedPresentationContext = LST_Create(); if (params->requestedPresentationContext == NULL) { return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE), "SRV_RegisterSOPClass"); } } ctx = LST_Head(¶ms->requestedPresentationContext); if (ctx != NULL) (void) LST_Position(¶ms->requestedPresentationContext, ctx); while (ctx != NULL) { contextID += 2; if (strcmp(SOPClass, ctx->abstractSyntax) == 0) return SRV_NORMAL; ctx = LST_Next(¶ms->requestedPresentationContext); } cond = DUL_MakePresentationCtx(&ctx, role, DUL_SC_ROLE_DEFAULT, contextID, 0, SOPClass, "", DICOM_TRANSFERLITTLEENDIAN, NULL); if (cond != DUL_NORMAL) { return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_RegisterSOPClass"); } cond = LST_Enqueue(¶ms->requestedPresentationContext, ctx); if (cond != LST_NORMAL) { return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE), "SRV_RegisterSOPClass"); } return SRV_NORMAL; }
CONDITION SRV_ProposeSOPClassWithXfer(const char*SOPClass, DUL_SC_ROLE role, char** xferSyntaxes, int xferSyntaxCount, int isStorageClass, DUL_ASSOCIATESERVICEPARAMETERS* params) { DUL_PRESENTATIONCONTEXTID contextID = 1; CONDITION cond; DUL_PRESENTATIONCONTEXT* ctx; char** xferSyntaxesLocal = 0; char* prefix = "PROPOSE/XFER"; int singleMode = 1; if (params->requestedPresentationContext == NULL) { params->requestedPresentationContext = LST_Create(); if (params->requestedPresentationContext == NULL) return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE), "SRV_ProposeSOPClassWithXfer"); } ctx = LST_Head(¶ms->requestedPresentationContext); if (ctx != NULL) (void) LST_Position(¶ms->requestedPresentationContext, ctx); while (ctx != NULL) { contextID += 2; if (strcmp(SOPClass, ctx->abstractSyntax) == 0) return SRV_NORMAL; ctx = LST_Next(¶ms->requestedPresentationContext); } if (xferSyntaxCount == 0) { if (isStorageClass) prefix = "PROPOSE/XFER/STORAGE"; xferSyntaxesLocal = mapProposedSOPToXferSyntax(SOPClass, prefix, &xferSyntaxCount, &singleMode); }else{ xferSyntaxesLocal = xferSyntaxes; singleMode = 1; } if (singleMode == 1) { cond = DUL_AddSinglePresentationCtx(params, role, DUL_SC_ROLE_DEFAULT, contextID, 0, SOPClass, xferSyntaxesLocal, xferSyntaxCount); }else{ cond = DUL_AddMultiplePresentationCtx(params, role, DUL_SC_ROLE_DEFAULT, contextID, 0, SOPClass, xferSyntaxesLocal, xferSyntaxCount); } if (xferSyntaxesLocal != xferSyntaxes) CTN_FREE(xferSyntaxesLocal); if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_ProposeSOPClassWithXfer"); if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_ProposeSOPClassWithXfer"); return SRV_NORMAL; }
static DUL_TRANSFERSYNTAX* matchProposedXferSyntax(DUL_PRESENTATIONCONTEXT* requestedCtx, const char* prefix, char** xferSyntaxes, int xferSyntaxCount) { char** xferSyntaxesLocal = 0; DUL_TRANSFERSYNTAX* transfer; int found = 0; int idx; if (xferSyntaxCount == 0) { char* paramValue; char paramName[1024] = ""; strcpy(paramName, prefix); strcat(paramName, "/"); strcat(paramName, requestedCtx->abstractSyntax); paramValue = UTL_GetConfigParameter(paramName); if (paramValue == NULL) paramValue = DICOM_TRANSFERLITTLEENDIAN; xferSyntaxesLocal = UTL_ExpandToPointerArray(paramValue, ";", &xferSyntaxCount); }else{ xferSyntaxesLocal = xferSyntaxes; } for (idx = 0; (idx < xferSyntaxCount) && !found; idx++) { transfer = (DUL_TRANSFERSYNTAX*)LST_Head(&requestedCtx->proposedTransferSyntax); (void) LST_Position(&requestedCtx->proposedTransferSyntax, transfer); while (transfer != NULL) { if (strcmp(transfer->transferSyntax, xferSyntaxesLocal[idx]) == 0) { found = 1; break; }else{ transfer = LST_Next(&requestedCtx->proposedTransferSyntax); } } } if (xferSyntaxesLocal != xferSyntaxes) CTN_FREE(xferSyntaxesLocal); return transfer; }
char* UTL_GetConfigParameter(const char* paramName) { CONDITION cond; char nameCopy[256]; CONFIG_ITEM* item; int idx; cond = UTL_ReadConfigFile( ); if (cond != UTL_NORMAL) return NULL; item = LST_Head(&UTL_configList); if (item == NULL) return NULL; (void) LST_Position(&UTL_configList, item); while(item != NULL) { if (strcmp(item->pName, paramName) == 0) return item->pValue; item = LST_Next(&UTL_configList); } strcpy(nameCopy, paramName); idx = strlen(nameCopy) - 1; while (idx > 0) { if (nameCopy[idx] == '/') { nameCopy[idx] = '\0'; idx = -1; break; } else { idx--; } } if (idx < 0) { return UTL_GetConfigParameter(nameCopy); } else { return NULL; } }
CONDITION SRV_AcceptSOPClass(DUL_PRESENTATIONCONTEXT * requestedCtx, DUL_SC_ROLE role, DUL_ASSOCIATESERVICEPARAMETERS * params, char** xferSyntaxes, int xferSyntaxCount, int isStorageClass) { CONDITION cond, rtnCond = SRV_NORMAL; DUL_PRESENTATIONCONTEXT* ctx; DUL_TRANSFERSYNTAX* transfer; char* prefix = "ACCEPT/XFER"; if (params->acceptedPresentationContext == NULL) { params->acceptedPresentationContext = LST_Create(); if (params->acceptedPresentationContext == NULL) return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE), "SRV_AcceptServiceClass"); } if (isStorageClass) prefix = "ACCEPT/XFER/STORAGE"; transfer = matchProposedXferSyntax(requestedCtx, prefix, xferSyntaxes, xferSyntaxCount); if (transfer == NULL) { DUL_TRANSFERSYNTAX* proposedXfer; proposedXfer = (DUL_TRANSFERSYNTAX*)LST_Head(&requestedCtx->proposedTransferSyntax); cond = DUL_MakePresentationCtx(&ctx, requestedCtx->proposedSCRole, DUL_SC_ROLE_DEFAULT, requestedCtx->presentationContextID, DUL_PRESENTATION_REJECT_ABSTRACT_SYNTAX, requestedCtx->abstractSyntax, proposedXfer->transferSyntax, proposedXfer->transferSyntax, NULL); if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_AcceptSOPClass"); (void) COND_PushCondition(SRV_UNSUPPORTEDSERVICE, SRV_Message(SRV_UNSUPPORTEDSERVICE), requestedCtx->abstractSyntax, "SRV_AcceptSOPClass"); rtnCond = COND_PushCondition(SRV_PRESENTATIONCTXREJECTED, SRV_Message(SRV_PRESENTATIONCTXREJECTED), requestedCtx->abstractSyntax, "SRV_AcceptSOPClass"); }else{ cond = DUL_MakePresentationCtx(&ctx, requestedCtx->proposedSCRole, role, requestedCtx->presentationContextID, DUL_PRESENTATION_ACCEPT, requestedCtx->abstractSyntax, transfer->transferSyntax, transfer->transferSyntax, NULL); if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_AcceptSOPClass"); } cond = LST_Enqueue(¶ms->acceptedPresentationContext, ctx); if (cond != LST_NORMAL) return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE), "SRV_AcceptSOPClass"); return rtnCond; }
/* findPresentationCtx ** ** Purpose: ** Find the presentation context in the service parameters using the ** context ID ** ** Parameter Dictionary: ** params Service parameters ** ctxid Context ID using which the presentation context ** is to be returned ** ** Return Values: ** Handle to the presentation context, if found, else NULL. ** ** Notes: ** ** Algorithm: ** Description of the algorithm (optional) and any other notes. */ static DUL_PRESENTATIONCONTEXT * findPresentationCtx(DUL_ASSOCIATESERVICEPARAMETERS * params, DUL_PRESENTATIONCONTEXTID ctxid) { DUL_PRESENTATIONCONTEXT * ctx; if (params->acceptedPresentationContext == NULL) return NULL; ctx = LST_Head(¶ms->acceptedPresentationContext); if (ctx == NULL) return NULL; (void) LST_Position(¶ms->acceptedPresentationContext, ctx); while (ctx != NULL) { if (ctx->presentationContextID == ctxid) /* context id found */ break; ctx = LST_Next(¶ms->acceptedPresentationContext); } return ctx; }
CONDITION extractTitles(LST_HEAD * src, char *group, LST_HEAD * dst) { DMAN_GROUPNAMES * s, *p; s = LST_Head(&src); if (s != NULL) (void) LST_Position(&src, s); while (s != NULL) { if (strcmp(s->GroupName, group) == 0) { p = malloc(sizeof(*p)); if (p == NULL) return 0; *p = *s; (void) LST_Enqueue(&dst, p); } s = LST_Next(&src); } return 1; }
/* harvestChildrenProcesses ** ** Purpose: ** The purpose of this function is to make sure that the exiting ** child processes do not become zombies. Secondly, we also remove ** the entry of the exiting process from the list we maintain. ** ** Parameter Dictionary: ** list Handle to the list of processes ** ** Return Values: ** APP_NORMAL ** ** Notes: ** ** Algorithm: ** Description of the algorithm (optional) and any other notes. */ static CONDITION harvestChildrenProcesses(LST_HEAD ** list) { #ifndef _MSC_VER int pid; int statusp; PROCESS_ELEMENT * e; /* Continue as long as status is available from any of the child proceses */ while ((pid = waitpid(-1, &statusp, WNOHANG)) > 0) { e = LST_Head(list); if (e != NULL) (void) LST_Position(list, e); while (e != NULL) { if (e->pid == pid) { printf("\n\n"); printf("***Child Exit Status*****************************\n"); printf("\tProcess ID #%d\n", pid); printf("\tCalling APP Title : %s\n", e->callingAPTitle); printf("\tCalled APP Title : %s\n", e->calledAPTitle); printf("\tExit status : %s\n", (statusp ? "ERROR" : "SUCCESS")); printf("*************************************************\n"); printf("\n\n"); (void) LST_Remove(list, LST_K_BEFORE); free(e); e = NULL; } else { e = LST_Next(list); } } } #endif return APP_NORMAL; }
/* nsetImageBoxCallback ** ** Purpose: ** Call back routine called by SRV_NSetResponse used to build the ** N-SET response message. ** ** Parameter Dictionary: ** nsetRequest Pointer to N-SET Request message ** nsetResponse Pointer to N-SET Response message ** ctx Pointer to context for this command. ** pc Presentation context that describes this SOP Class ** ** Return Values: ** SRV_NORMAL under error free conditions. ** ** SRV_CALLBACKABORTEDSERVICE ** SRV_NORMAL ** ** Algorithm: ** Description of the algorithm (optional) and any other notes. */ static CONDITION nsetImageBoxCallback(MSG_N_SET_REQ * nsetRequest, MSG_N_SET_RESP * nsetResponse, void *sendBack, DUL_PRESENTATIONCONTEXT * pc) { CONDITION cond; /* condition code returned by various * facilities */ int index; /* loop index */ char *flagNameList = NULL; /* holds attribute names that gave errors * during verification process */ BIB_NODE * bibNode; /* pointer to instance of Image Box */ char *fileName; /* filename holding attributes of image */ GQ_ELEM gqElement; /* The GQ element that is to be enqueued */ PRN_BASICIMAGEBOX bibAttrib, /* structure holding attributes of image box */ *bibPtr; /* pointer to the above structure */ CTNBOOLEAN flag = FALSE; /* to check if the image is present */ /* * For Image Position, we do a runtime check depending on the value of * Image Display Format specified by the Film Box attribute. */ /* Now define a table of all supported attributes */ static SUPPORTEDATTRIBUTES supportedAttributeList[] = { {PRN_BIB_K_IMAGEPOSITION, "BIB Image Position ", NULL, 0}, {PRN_BIB_K_IMAGEMODULE, "BIB Preformatted Image Sequence ", NULL, 0}, {PRN_BIB_K_POLARITY, "BIB Polarity ", bibPolarity, (int) DIM_OF(bibPolarity)}, {PRN_BIB_K_MAGNIFICATIONTYPE, "BIB Magnification type ", bibMagnificationType, (int) DIM_OF(bibMagnificationType)}, #ifdef ASG {PRN_BIB_K_SMOOTHINGTYPE, "BIB Smooothing Type ", bibSmoothingType, (int) DIM_OF(bibSmoothingType)}, {PRN_BIB_K_REQUESTEDIMAGESIZE, "BIB Requested Image Size ", bibRequestedImageSize, (int) DIM_OF(bibRequestedImageSize)} #endif }; /* we now build up the response message */ nsetResponse->type = MSG_K_N_SET_RESP; nsetResponse->messageIDRespondedTo = nsetRequest->messageID; strcpy(nsetResponse->classUID, nsetRequest->classUID); strcpy(nsetResponse->instanceUID, nsetRequest->instanceUID); /* default */ nsetResponse->dataSetType = DCM_CMDDATANULL; #ifdef ASG nsetResponse->dataSet = NULL; /* no data set is sent */ #endif bibPtr = &bibAttrib; bibPtr->bibAttributeFlag = 0x0; (void) strcpy(bibPtr->imageBoxSOPClassUID, nsetRequest->classUID); (void) strcpy(bibPtr->imageBoxSOPInstanceUID, nsetRequest->instanceUID); /* Parse the data set sent by the SCU */ cond = PRN_ParseObject(&nsetRequest->dataSet, PRN_K_BASICGREYSCALEIMAGEBOX, (void **) &bibPtr); if (cond != PRN_NORMAL) { cond = COND_PushCondition(APP_ERROR(APP_FAILURE), "PRN_ParseObject", "nsetImageBoxCallback"); updateOnProcessingFailure((void **) &nsetResponse, APP_ERROR(APP_FAILURE), "PRN_ParseObject", "nsetImageBoxCallback"); goto ERROR_RETURN; } /* PRN_DumpAttributes(bibPtr, stdout); */ cond = supportedAttributes(MSG_K_N_SET_REQ, bibPtr, supportedAttributeList, (int) DIM_OF(supportedAttributeList), &flagNameList, (void **) &nsetResponse); if (cond != APP_NORMAL) { switch (cond) { case APP_MISSINGREQUIREDATTRIBUTE: nsetResponse->status = MSG_K_MISSINGATTRIBUTE; break; case APP_UNSUPPORTEDMANDATORYATTRIBUTE: case APP_UNSUPPORTEDOPTIONALATTRIBUTE: nsetResponse->status = MSG_K_NOSUCHATTRIBUTE; break; case APP_UNSUPPORTEDATTRIBUTEVALUE: nsetResponse->status = MSG_K_INVALIDATTRIBUTEVALUE; break; } cond = COND_PushCondition(APP_ERROR(cond), flagNameList, "nsetImageBoxCallback"); goto ERROR_RETURN; } /* * Now we update the hierarchy. We note here that attributes are set for * the image boxes belonging to the current BASIC FILM BOX instance which * is given by bfbInstance */ bibNode = (BIB_NODE *) LST_Position(&bfbInstance->bibList, LST_Head(&bfbInstance->bibList)); if (bibNode == NULL) { cond = COND_PushCondition(APP_ERROR(APP_MISSINGIMAGES), "nsetImageBoxCallback"); updateOnProcessingFailure((void **) &nsetResponse, APP_ERROR(APP_MISSINGIMAGES), "nsetImageBoxCallback"); goto ERROR_RETURN; } flag = FALSE; /* * go thru the list of Image SOP instance UIDs maintained by the Film Box * instance */ for (index = 0; index < (int) LST_Count(&bfbInstance->bibList) && !flag; index++) { /* now see if the instance UID matches */ if (strcmp(nsetRequest->instanceUID, bibNode->bibInstanceUID) == 0) { flag = TRUE; } if (!flag) bibNode = (BIB_NODE *) LST_Next(&bfbInstance->bibList); } if (flag == FALSE) { cond = COND_PushCondition(APP_ERROR(APP_NOSUCHINSTANCE), nsetRequest->instanceUID, "nsetImageBoxCallback"); nsetResponse->status = MSG_K_NOSUCHOBJECTINSTANCE; goto ERROR_RETURN; } /* we now store the attributes of the image box */ /* * To avoid copying so much data, we just make a pointer point to the * dataSet */ bibNode->bibAttrib = nsetRequest->dataSet; nsetRequest->dataSet = NULL;/* remove the data set from the request * message */ /* * If the server's terminal has x-capability and wishes to enqueue the * image in the GQueue */ if (gqueueFlag) { gqElement.prnMessage = PRN_NEWIMAGEBOX; (void) strcpy(gqElement.instanceUID, bibNode->bibInstanceUID); /* get a new file name to store the object */ fileName = getNewFileName(); (void) strcpy(gqElement.objFile, fileName); /* now write the object into the file and enqueue it */ cond = DCM_WriteFile(&bibNode->bibAttrib, DCM_ORDERLITTLEENDIAN, fileName); if (cond != DCM_NORMAL) { unlink(gqElement.objFile); /* delete the file before exiting */ cond = COND_PushCondition(APP_ERROR(APP_FAILURE), "DCM_WriteFile", "nsetImageBoxCallback"); updateOnProcessingFailure((void **) &nsetResponse, APP_ERROR(APP_FAILURE), "DCM_WriteFile", "nsetImageBoxCallback"); goto ERROR_RETURN; } cond = GQ_Enqueue(gqID, (void *) &gqElement); if (cond != GQ_NORMAL) { unlink(gqElement.objFile); cond = COND_PushCondition(APP_ERROR(APP_FAILURE), "GQ_Enqueue", "nsetImageBoxCallback"); updateOnProcessingFailure((void **) &nsetResponse, APP_ERROR(APP_FAILURE), "GQ_Enqueue", "nsetImageBoxCallback"); goto ERROR_RETURN; } } /* send attributes back, but do not send back the image pixel data */ /* temporarily we reset the FLAG for the pixel data */ nsetResponse->dataSetType = DCM_CMDDATAOTHER; bibPtr->bibAttributeFlag ^= PRN_BIB_K_IMAGEMODULE; cond = PRN_BuildObject((void *) bibPtr, &nsetResponse->dataSet); if (cond != PRN_NORMAL) { cond = COND_PushCondition(APP_ERROR(APP_FAILURE), "PRN_BuildObject", "nsetImageBoxCallback"); updateOnProcessingFailure((void **) &nsetResponse, APP_ERROR(APP_FAILURE), "PRN_BuildObject", "nsetImageBoxCallback"); goto ERROR_RETURN; } /* set back the FLAG */ bibPtr->bibAttributeFlag |= PRN_BIB_K_IMAGEMODULE; /* everything is successful */ nsetResponse->status = MSG_K_SUCCESS; return SRV_NORMAL; ERROR_RETURN: COND_DumpConditions(); return SRV_CALLBACKABORTEDSERVICE; }
/************************************************************************** * * CreateFiles * * SYNOPSIS * int CreateFiles (LST_LIST *clist, char *filename) * * PURPOSE * Follow specified rule and create files. * * INPUT * * * EFFECTS * * * RETURN VALUE * * * BUGS * * * HISTORY * * * SEE ALSO * */ int CreateFiles (ConfigType *cf, char *filename) { LST_LIST *macrolist; LST_LIST *stacklist; StackType *stack; MakeMacro *macro; NameType *name; Statement *st; FILE *fp = NULL; int firstflag; int error = FALSE; int stacksize = 0; if (!filename) { filename = MAKEFILE; } macrolist = GetMakeMacros (filename); if (!macrolist) { return FALSE; } stacklist = LST_CreateList (NULL); if (!stacklist) { SetGlobalErr (ERR_OUT_OF_MEMORY); GEprintf ("OOM: couldn't allocate stack list"); return FALSE; } if (DebugSwitch) { PrintMacros (macrolist); } st = (Statement*)LST_Head (&cf->Statements); while (!LST_EndOfList (st)) { switch (st->Command) { case CMD_OPEN: if (fp) { fclose (fp); } fp = fopen (st->Arg1, "w"); if (!fp) { SetGlobalErr (ERR_GENERIC); GEprintf1 ("Couldn't open file '%s' for writing", st->Arg1); return FALSE; } break; case CMD_PRINT: if (!fp) { printf ("ERROR:'_Print' command issued with no file opened\n"); error = TRUE; break; } PrintEscString (LST_NodeName(st), fp); break; case CMD_NAMES: macro = (MakeMacro*)LST_FindName (macrolist, LST_NodeName(st)); if (!macro) { SetGlobalErr (ERR_GENERIC); GEprintf2 ("'%s' macro not found in file '%s'", LST_NodeName(st), filename); return FALSE; } if (!fp) { printf ("ERROR:'_Names' command issued with no file opened\n"); error = TRUE; break; } firstflag = TRUE; name = (NameType*)LST_Head (¯o->Names); while (!LST_EndOfList (name)) { if (firstflag && st->Arg1) { firstflag = FALSE; if (!ApplyRule (name, st->Arg1, fp)) { error = TRUE; } } else if (st->Arg2) { if (!ApplyRule (name, st->Arg2, fp)) { error = TRUE; } } while (!LST_EndOfList (name)) { if (name->Macro) { stack = (StackType*)LST_CreateNode (sizeof (StackType), NULL); if (!stack) { SetGlobalErr (ERR_OUT_OF_MEMORY); GEprintf ("OOM: couldn't allocate stack entry"); return FALSE; } stack->Father = name; LST_AddTail (stacklist, stack); stacksize++; name = (NameType*)LST_Head (&name->Macro->Names); } else if (name->Delim) { name = (NameType*)LST_Next (name); break; } else { name = (NameType*)LST_Next (name); while (stacksize && LST_EndOfList (name)) { stack = (StackType*)LST_RemTail (stacklist); if (stack) { name = (NameType*)LST_Next (stack->Father); LST_DeleteNode (stack); stacksize--; } } } } } if (st->Arg3) { PrintEscString (st->Arg3, fp); } break; case CMD_CLOSE: if (fp) { fclose (fp); fp = NULL; } break; } st = (Statement*)LST_Next (st); } return (error ? FALSE : TRUE); } /* CreateFiles */
int v_parseSequence(DCM_OBJECT ** object) { DCM_ELEMENT e; LST_HEAD *l; CONDITION cond; int index; SQ_TYPE type; SQ_REFPATIENTSOPINSTANCEUID *patient; SQ_REFSTUDYSOPINSTANCEUID *study; SQ_REQPROCEDURECODE *code; void *pointer; static DCM_MAP_SQ sequences[] = { {DCM_IDREFERENCEDPATIENTSEQ, SQ_K_REFPATIENTSOPINSTANCEUID, HIS_K_VISRPSEQUENCE}, {DCM_IDREFERENCEDSTUDYSEQ, SQ_K_REFSTUDYSOPINSTANCEUID, HIS_K_VISRSSEQUENCE}, {DCM_IDADMITDIAGCODESEQUENCE, SQ_K_ADMITDIAGNOSISCODE, HIS_K_VISADCSEQUENCE}, {DCM_VISDISCHARGEDIAGNOSISCODESEQ, SQ_K_DISCHARGEDIAGNOSISCODE, HIS_K_VISDDCSEQUENCE}, }; for (index = 0; index < (int) DIM_OF(sequences); index++) { e.tag = sequences[index].tag; cond = DCM_GetSequenceList(object, e.tag, &e.d.sq); if (cond != DCM_NORMAL) { if (cond != DCM_ELEMENTNOTFOUND) return -1; } else { cond = SQ_ParseSequence(&e, &type, &l); if (cond != SQ_NORMAL || type != sequences[index].type) return -2; p.Update_Flag |= sequences[index].his_field; pointer = LST_Head(&l); if (pointer != NULL) LST_Position(&l, pointer); while (pointer != NULL) { switch (sequences[index].tag) { case DCM_IDREFERENCEDPATIENTSEQ: patient = (SQ_REFPATIENTSOPINSTANCEUID *) pointer; strcpy(p.RPSequence[p.RPSequenceCount], patient->referencedSOPInstanceUID); ++p.RPSequenceCount; break; case DCM_IDREFERENCEDSTUDYSEQ: study = (SQ_REFSTUDYSOPINSTANCEUID *) pointer; strcpy(p.RSSequence[p.RSSequenceCount], study->referencedSOPInstanceUID); ++p.RSSequenceCount; break; case DCM_IDADMITDIAGCODESEQUENCE: code = (SQ_REQPROCEDURECODE *) pointer; strcpy(p.ADCSequence[p.ADCSequenceCount].CodeValue, code->codeValue); strcpy(p.ADCSequence[p.ADCSequenceCount]. CodingSchemeDesignator, code->codingSchemeDesignator); strcpy(p.ADCSequence[p.ADCSequenceCount].CodeMeaning, code->codeMeaning); p.ADCSequenceCount++; break; case DCM_VISDISCHARGEDIAGNOSISCODESEQ: code = (SQ_REQPROCEDURECODE *) pointer; strcpy(p.DDCSequence[p.DDCSequenceCount].CodeValue, code->codeValue); strcpy(p.DDCSequence[p.DDCSequenceCount]. CodingSchemeDesignator, code->codingSchemeDesignator); strcpy(p.DDCSequence[p.DDCSequenceCount].CodeMeaning, code->codeMeaning); p.DDCSequenceCount++; break; } pointer = LST_Next(&l); } } } return 0; /* e[0].tag = DCM_IDREFERENCEDPATIENTSEQ; e[1].tag = DCM_IDREFERENCEDSTUDYSEQ; for (index = 0; index < (int) DIM_OF(e); index++) { cond = DCM_GetSequenceList(object, e[index].tag, &e[index].d.sq); if (cond == DCM_ELEMENTNOTFOUND) continue; else if (cond != DCM_NORMAL) return -1; cond = SQ_ParseSequence(&e[index], &type, &l); if (cond != SQ_NORMAL) return -2; if (type == SQ_K_REFPATIENTSOPINSTANCEUID) { p.Update_Flag |= HIS_K_VISRPSEQUENCE; patient = LST_Head(&l); if (patient != NULL) LST_Position(&l, patient); while (patient != NULL) { strcpy(p.RPSequence[p.RPSequenceCount], patient->referencedSOPInstanceUID); ++p.RPSequenceCount; patient = LST_Next(&l); } } if (type == SQ_K_REFSTUDYSOPINSTANCEUID) { p.Update_Flag |= HIS_K_VISRSSEQUENCE; study = LST_Head(&l); if (study != NULL) LST_Position(&l, study); while (study != NULL) { strcpy(p.RSSequence[p.RSSequenceCount], study->referencedSOPInstanceUID); ++p.RSSequenceCount; study = LST_Next(&l); } } } return 0; */ }
static CONDITION getResultsRecord(PRIVATE_HANDLE * h, FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList, FIS_RESULTSRECORD * r, long *count) { CONDITION cond; TBL_CRITERIA criteria[2]; FIS_RESULTSRECORD *p; static TBL_FIELD fields[] = { {"ResUID", TBL_STRING, sizeof(results.ResUID), sizeof(results.ResUID), 0, (void *) &results.ResUID[0]}, {"StuInsUID", TBL_STRING, sizeof(results.StuInsUID), sizeof(results.StuInsUID), 0, (void *) &results.StuInsUID[0]}, {"ResID", TBL_STRING, sizeof(results.ResID), sizeof(results.ResID), 0, (void *) &results.ResID[0]}, {"Imp", TBL_TEXT, sizeof(results.Imp), sizeof(results.Imp), 0, (void *) &results.Imp[0]}, {"InsCreDat", TBL_STRING, sizeof(results.InsCreDat), sizeof(results.InsCreDat), 0, (void *) &results.InsCreDat[0]}, {"InsCreTim", TBL_STRING, sizeof(results.InsCreTim), sizeof(results.InsCreTim), 0, (void *) &results.InsCreTim[0]}, {"InsCreUID", TBL_STRING, sizeof(results.InsCreUID), sizeof(results.InsCreUID), 0, (void *) &results.InsCreUID}, {NULL} }; criteria[0].FieldName = criteria[1].FieldName = NULL; if (uid != NULL) { if (uid[0] != '\0') { if (criteriaType == FIS_K_STUDY) { TBL_CRITERIA_LOAD_BYTE(criteria[0], "StuInsUID", uid, TBL_STRING, TBL_EQUAL); } else { TBL_CRITERIA_LOAD_BYTE(criteria[0], "ResUID", uid, TBL_STRING, TBL_EQUAL); } } } (void) memset(&results, 0, sizeof(results)); results.Type = FIS_K_RESULTS; cond = TBL_Select(&h->resultsHandle, criteria, fields, count, resultsCallback, getList); if (cond != TBL_NORMAL) return FIS_GETFAILED; if (r != NULL) *r = results; if (listFlag & FIS_K_RESULTS_INTERPRETATIONLIST) { if (getList != NULL) { p = LST_Head(&getList); (void) LST_Position(&getList, p); } else p = r; while (p != NULL) { p->InterpretationList = LST_Create(); p->Flag |= FIS_K_RESULTS_INTERPRETATIONLIST; cond = getInterpretationRecord(h, FIS_K_RESULTS, p->ResUID, 0, p->InterpretationList, NULL, NULL); if (cond != FIS_NORMAL) return cond; if (getList != NULL) p = LST_Next(&getList); else p = NULL; } } return FIS_NORMAL; }
static CONDITION getSCSeriesRecord(PRIVATE_HANDLE * h, FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList, FIS_SCSERIESRECORD * r, long *count) { CONDITION cond; TBL_CRITERIA criteria[2]; FIS_SCSERIESRECORD *p; static TBL_FIELD fields[] = { {TBL_FIELD_STRING("SerInsUID", scSeries.SerInsUID)}, {TBL_FIELD_STRING("StuComUID", scSeries.StuComUID)}, {TBL_FIELD_STRING("SerDat", scSeries.SerDat)}, {TBL_FIELD_STRING("SerTim", scSeries.SerTim)}, {TBL_FIELD_STRING("RetAETit", scSeries.RetAETit)}, {TBL_FIELD_STRING("StoMedFilSetID", scSeries.StoMedFilSetID)}, {TBL_FIELD_STRING("StoMedFilSetUID", scSeries.StoMedFilSetUID)}, {NULL}, }; criteria[0].FieldName = criteria[1].FieldName = NULL; if (uid != NULL) { if (uid[0] != '\0') { if (criteriaType == FIS_K_STUDYCOMPONENT) { TBL_CRITERIA_LOAD_BYTE(criteria[0], "StuComUID", uid, TBL_STRING, TBL_EQUAL); } else { TBL_CRITERIA_LOAD_BYTE(criteria[0], "SerInsUID", uid, TBL_STRING, TBL_EQUAL); } } } (void) memset(&scSeries, 0, sizeof(scSeries)); scSeries.Type = FIS_K_SCSERIES; cond = TBL_Select(&h->studyComponentSeriesHandle, criteria, fields, count, scSeriesCallback, getList); if (cond != TBL_NORMAL) return COND_PushCondition(FIS_COND(FIS_STUDYGETFAILED), "(FIS)getSCSeriesRecord"); if (r != NULL) *r = scSeries; if (listFlag & FIS_K_SCSERIES_IMAGELIST) { if (getList != NULL) { p = LST_Head(&getList); (void) LST_Position(&getList, p); } else p = r; while (p != NULL) { p->ImageList = LST_Create(); cond = getSCImageRecord(h, FIS_K_SCSERIES, p->SerInsUID, 0, p->ImageList, NULL, NULL); if (cond != FIS_NORMAL) return cond; if (getList != NULL) p = LST_Next(&getList); else p = NULL; } } return FIS_NORMAL; }
static void browseSelectionCB_scrolledList2( Widget wgt, XtPointer cd, XtPointer cb) { Widget UxWidget = wgt; XtPointer UxClientData = cd; XtPointer UxCallbackArg = cb; { /* * scrolledList2 * * * Purpose: * This subroutine examines the selected module, finds a * pointer * to the atrribute-list structure and loads the list of * attributes * in scrolledList3(window) * * * Parameter Dictinary: * cbs input, pointer to the * selected module structure * * * Return Value: * list of attributes loaded in scrolledList3 * * * Notes: * * * Algorithm: * Description of the algorithm (optional) and any * other notes. * * */ XmListCallbackStruct *cbs; char *modname; char buff[80]; int i; int cnt = 0; XmString *strlist; CONDITION cond; cbs = (XmListCallbackStruct *) UxCallbackArg; /* clear scrolledlist3 */ XtVaGetValues(scrolledList3, XmNitemCount, &cnt, XmNitems, &strlist, NULL); if (cnt != 0) { XmListDeleteAllItems(scrolledList3); /* lint -e64 */ XtFree(strlist); /* lint +e64 */ } if (strlen(XmTextGetString(text1)) != 0) XmTextSetString(text1, NULL); if (strlen(XmTextGetString(text2)) != 0) XmTextSetString(text2, NULL); /* if any previous module structure is open, free it */ if (ieModule != NULL) { cond = IE_Free((void **) &ieModule); if (cond != IE_NORMAL) { (void) COND_ExtractConditions(errorstackP); copyWtext(info); (void) COND_PopCondition(clearStack); free(info); } } free(ieModule); /* load scrolledList3 with attributeList */ ieModule = LST_Head(&mod_head); (void) LST_Position(&mod_head, ieModule); for (i = 2; i <= cbs->item_position; i++) ieModule = LST_Next(&mod_head); cond = IE_ExamineModule(&queryObject, ieIE->ieType, ieModule->moduleType, &ieModule); if (cond != IE_NORMAL) { (void) COND_ExtractConditions(errorstackP); copyWtext(info); (void) COND_PopCondition(clearStack); free(info); } attr_head = ieModule->attributeList; MUT_LoadList(scrolledList3, ieModule->attributeList, formatattrieList, buff); } }
CONDITION serviceRequests(DUL_NETWORKKEY ** network, DUL_ASSOCIATIONKEY ** association, DUL_ASSOCIATESERVICEPARAMETERS * service) { CONDITION cond; DUL_PRESENTATIONCONTEXT * ctx; DUL_PRESENTATIONCONTEXTID ctxID; void *message; MSG_TYPE messageType; CTNBOOLEAN networkLink = TRUE, commandServiced; DMAN_HANDLE * handle; DMAN_STORAGEACCESS storage; DMAN_FISACCESS fisAccess; cond = DMAN_Open(controlDatabase, service->callingAPTitle, service->calledAPTitle, &handle); if (cond == DMAN_NORMAL) { cond = DMAN_LookupStorage(&handle, service->calledAPTitle, &storage); } if (cond == DMAN_NORMAL) cond = IDB_Open(storage.DbKey, &IDBHandle); if (!CTN_ERROR(cond)) { cond = DMAN_LookupFISAccess(&handle, service->calledAPTitle, &fisAccess); if (!CTN_ERROR(cond)) cond = FIS_Open(fisAccess.DbKey, &fisHandle); } while ((networkLink == TRUE) && !CTN_ERROR(cond)) { cond = SRV_ReceiveCommand(association, service, DUL_BLOCK, 0, &ctxID, NULL, &messageType, &message); if (cond == SRV_PEERREQUESTEDRELEASE) { networkLink = FALSE; (void) DUL_AcknowledgeRelease(association); (void) DUL_DropAssociation(association); } else if (cond == SRV_PEERABORTEDASSOCIATION) { networkLink = FALSE; (void) DUL_DropAssociation(association); } else if (cond != SRV_NORMAL) { (void) DUL_DropAssociation(association); COND_DumpConditions(); cond = 2; } else { ctx = LST_Head(&service->acceptedPresentationContext); if (ctx != NULL) (void) LST_Position(&service->acceptedPresentationContext, ctx); commandServiced = FALSE; while (ctx != NULL && !commandServiced) { if (ctx->presentationContextID == ctxID) { if (commandServiced) { if (!silent) fprintf(stderr, "Context ID Repeat in serviceRequests (%d)\n", ctxID); } else { cond = serviceThisCommand(network, association, ctx, messageType, &message, service, &handle); if (cond == SRV_OPERATIONCANCELLED) { if (!silent) printf("Operation cancelled\n"); (void) COND_PopCondition(TRUE); } else if (cond != SRV_NORMAL) COND_DumpConditions(); commandServiced = TRUE; } } ctx = LST_Next(&service->acceptedPresentationContext); } if (!commandServiced) { fprintf(stderr, "In serviceRequests, context ID %d not found\n", ctxID); (void) DUL_DropAssociation(association); networkLink = FALSE; } } } (void) DMAN_Close(&handle); (void) IDB_Close(&IDBHandle); return cond; }
static CONDITION getPatientRecord(PRIVATE_HANDLE * h, FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList, FIS_PATIENTRECORD * r, long *count) { CONDITION cond; TBL_CRITERIA criteria[2]; FIS_PATIENTRECORD * p; static TBL_FIELD fields[] = { {"PatID", TBL_STRING, sizeof(patient.PatID), sizeof(patient.PatID), 0, (void *) &patient.PatID[0]}, {"PatUID", TBL_STRING, sizeof(patient.PatUID), sizeof(patient.PatUID), 0, (void *) &patient.PatUID[0]}, {"PatNam", TBL_STRING, sizeof(patient.PatNam), sizeof(patient.PatNam), 0, (void *) &patient.PatNam[0]}, {"PatSex", TBL_STRING, sizeof(patient.PatSex), sizeof(patient.PatSex), 0, (void *) &patient.PatSex[0]}, {"PatBirDat", TBL_SIGNED4, sizeof(patientBD), sizeof(patientBD), 0, (void *) &patientBD}, {NULL}, }; criteria[0].FieldName = criteria[1].FieldName = NULL; if (uid != NULL) { if (uid[0] != '\0') { TBL_CRITERIA_LOAD_BYTE(criteria[0], "PatUID", uid, TBL_STRING, TBL_EQUAL); } } memset(&patient, 0, sizeof(patient)); patient.Type = FIS_K_PATIENT; cond = TBL_Select(&h->patientHandle, criteria, fields, count, patientCallback, getList); if (cond != TBL_NORMAL) return COND_PushCondition(FIS_COND(FIS_PATIENTGETFAILED), "(FIS)getPatientRecord"); if (r != NULL) *r = patient; if (listFlag & FIS_K_PAT_STUDYLIST) { if (getList != NULL) { p = LST_Head(&getList); (void) LST_Position(&getList, p); } else p = r; while (p != NULL) { p->StudyList = LST_Create(); p->Flag |= FIS_K_PAT_STUDYLIST; cond = getStudyRecord(h, FIS_K_PATIENT, p->PatUID, 0, p->StudyList, NULL, NULL); if (cond != FIS_NORMAL) return cond; if (getList != NULL) p = LST_Next(&getList); else p = NULL; } } /* if (listFlag & FIS_K_PAT_VISITLIST) { if (getList != NULL) { p = LST_Head(&getList); (void) LST_Position(&getList, p); } else p = r; while (p != NULL) { p->VisitList = LST_Create(); p->Flag |= FIS_K_PAT_VISITLIST; cond = getVisitRecord(h, FIS_K_PATIENT, p->PatUID, 0, p->VisitList, NULL, NULL); if (cond != FIS_NORMAL) return cond; if (getList != NULL) p = LST_Next(&getList); else p = NULL; } } */ return FIS_NORMAL; }
CONDITION nextAssociationRequest(char *node, DUL_NETWORKKEY ** network, DUL_ASSOCIATESERVICEPARAMETERS * service, unsigned long maxPDU, CTNBOOLEAN forgiveFlag, DUL_ASSOCIATIONKEY ** association, PROCESS_ELEMENT * processElement) { CTNBOOLEAN drop, acceptFlag, acceptPresentationContext, readAccess = FALSE, writeAccess = FALSE; CONDITION cond, rtnCond = APP_NORMAL; DUL_PRESENTATIONCONTEXT * requestedCtx; int classCount; DUL_SC_ROLE scRole; DUL_ABORTITEMS abortItems; DMAN_HANDLE * manageHandle; DMAN_APPLICATIONENTITY ae; cond = DMAN_Open(controlDatabase, "", "", &manageHandle); if (cond != DMAN_NORMAL) { rtnCond = COND_PushCondition(APP_ERROR(APP_ASSOCIATIONRQFAILED)); goto Exit; } (void) memset(service, 0, sizeof(*service)); service->maxPDU = maxPDU; strcpy(service->calledImplementationClassUID, MIR_IMPLEMENTATIONCLASSUID); strcpy(service->calledImplementationVersionName, MIR_IMPLEMENTATIONVERSIONNAME); cond = DUL_ReceiveAssociationRQ(network, DUL_BLOCK, service, association); if (cond != DUL_NORMAL) { rtnCond = COND_PushCondition(APP_ERROR(APP_ASSOCIATIONRQFAILED)); goto Exit; } acceptFlag = TRUE; drop = FALSE; memset(processElement, 0, sizeof(*processElement)); strcpy(processElement->callingAPTitle, service->callingAPTitle); strcpy(processElement->calledAPTitle, service->calledAPTitle); cond = DMAN_LookupApplication(&manageHandle, service->callingAPTitle, &ae); if (cond == DMAN_NORMAL && (ae.Flag & DMAN_K_APPLICATION_ORGANIZATION)) strcpy(processElement->organization, ae.Organization); if (acceptFlag) { cond = associationCheck(node, service, &manageHandle, forgiveFlag, &abortItems); if (CTN_ERROR(cond)) { acceptFlag = FALSE; fprintf(stderr, "Incorrect Association Request\n"); (void) DUL_RejectAssociationRQ(association, &abortItems); rtnCond = COND_PushCondition(APP_ERROR(APP_ASSOCIATIONRQFAILED)); } else if (!CTN_SUCCESS(cond)) { COND_DumpConditions(); } if (acceptFlag) { cond = DMAN_StorageAccess(&manageHandle, service->callingAPTitle, service->calledAPTitle, &readAccess, &writeAccess); if (cond != DMAN_NORMAL) { readAccess = writeAccess = FALSE; COND_DumpConditions(); } } } if (acceptFlag) { if (verboseDUL) DUL_DumpParams(service); requestedCtx = LST_Head(&service->requestedPresentationContext); if (requestedCtx != NULL) (void) LST_Position(&service->requestedPresentationContext, requestedCtx); classCount = 0; while (requestedCtx != NULL) { ACCESS_MAP *p; int i, grantedAccess; acceptPresentationContext = FALSE; for (p = map, i = 0; i < DIM_OF(map) && !acceptPresentationContext; i++) { if (strcmp(p->SOPClassUID, requestedCtx->abstractSyntax) == 0) acceptPresentationContext = TRUE; else p++; } if (acceptPresentationContext) { if ((p->accessRights & ACCESS_WRITE)) { if (!writeAccess) acceptPresentationContext = FALSE; } if ((p->accessRights & ACCESS_READ)) { if (!readAccess) acceptPresentationContext = FALSE; } } if (acceptPresentationContext) { switch (requestedCtx->proposedSCRole) { case DUL_SC_ROLE_DEFAULT: scRole = DUL_SC_ROLE_DEFAULT; break; case DUL_SC_ROLE_SCU: acceptPresentationContext = FALSE; break; case DUL_SC_ROLE_SCP: scRole = DUL_SC_ROLE_SCP; break; case DUL_SC_ROLE_SCUSCP: scRole = DUL_SC_ROLE_SCUSCP; break; default: acceptPresentationContext = FALSE; break; } } if (acceptPresentationContext) { cond = SRV_AcceptServiceClass(requestedCtx, scRole, service); if (cond == SRV_NORMAL) { classCount++; } else { printf("SRV Facility rejected SOP Class: %s\n", requestedCtx->abstractSyntax); COND_DumpConditions(); } } else { if (!silent) printf("Simple server rejects: %s\n", requestedCtx->abstractSyntax); cond = SRV_RejectServiceClass(requestedCtx, DUL_PRESENTATION_REJECT_USER, service); if (cond != SRV_NORMAL) { drop = TRUE; } } requestedCtx = LST_Next(&service->requestedPresentationContext); } if (!silent) printf("Supported classes: %d\n", classCount); if (drop) { (void) DUL_DropAssociation(association); rtnCond = COND_PushCondition(APP_ERROR(APP_ASSOCIATIONRQFAILED)); } else { /* The acknowledgment is done by the person who called this function. ** We don't do it here any more. */ } } Exit: (void) DMAN_Close(&manageHandle); return rtnCond; }
CONDITION SRV_AcceptServiceClass(DUL_PRESENTATIONCONTEXT * requestedCtx, DUL_SC_ROLE role, DUL_ASSOCIATESERVICEPARAMETERS * params) { int index; CTNBOOLEAN abstractFound = FALSE; CONDITION cond, rtnCond = SRV_NORMAL; DUL_PRESENTATIONCONTEXT * ctx; DUL_TRANSFERSYNTAX * transfer; if (params->acceptedPresentationContext == NULL) { params->acceptedPresentationContext = LST_Create(); if (params->acceptedPresentationContext == NULL) return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE), "SRV_AcceptServiceClass"); } for (index = 0; index < (int) DIM_OF(syntaxList) && !abstractFound; index++) { if (strcmp(requestedCtx->abstractSyntax, syntaxList[index]) == 0) abstractFound = TRUE; } if (abstractFound){ char* xferSyntaxes[] = { DICOM_TRANSFERLITTLEENDIAN }; transfer = matchProposedXferSyntax(requestedCtx, "ACCEPT/XFER", xferSyntaxes, 1); if (transfer == NULL) { cond = DUL_MakePresentationCtx(&ctx, requestedCtx->proposedSCRole, DUL_SC_ROLE_DEFAULT, requestedCtx->presentationContextID, DUL_PRESENTATION_REJECT_TRANSFER_SYNTAX, requestedCtx->abstractSyntax, DICOM_TRANSFERLITTLEENDIAN, DICOM_TRANSFERLITTLEENDIAN, NULL); if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_AcceptServiceClass"); (void) COND_PushCondition(SRV_UNSUPPORTEDSERVICE, SRV_Message(SRV_UNSUPPORTEDSERVICE), requestedCtx->abstractSyntax, "SRV_AcceptServiceClass"); rtnCond = COND_PushCondition(SRV_PRESENTATIONCTXREJECTED, SRV_Message(SRV_PRESENTATIONCTXREJECTED), requestedCtx->abstractSyntax, "SRV_AcceptServiceClass"); } else { cond = DUL_MakePresentationCtx(&ctx, requestedCtx->proposedSCRole, role, requestedCtx->presentationContextID, DUL_PRESENTATION_ACCEPT, requestedCtx->abstractSyntax, transfer->transferSyntax, transfer->transferSyntax, NULL); if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_AcceptServiceClass"); } #if 0 if ((transfer = LST_Head(&requestedCtx->proposedTransferSyntax)) == NULL) return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE), "SRV_AcceptServiceClass"); (void) LST_Position(&requestedCtx->proposedTransferSyntax, transfer); while (!transferFound && (transfer != NULL)) { if (strcmp(transfer->transferSyntax, DICOM_TRANSFERLITTLEENDIAN) == 0){ transferFound = TRUE; }else{ transfer = LST_Next(&requestedCtx->proposedTransferSyntax); } } if (transferFound) { cond = DUL_MakePresentationCtx(&ctx, requestedCtx->proposedSCRole, role, requestedCtx->presentationContextID, DUL_PRESENTATION_ACCEPT, requestedCtx->abstractSyntax, DICOM_TRANSFERLITTLEENDIAN, DICOM_TRANSFERLITTLEENDIAN, NULL); if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_AcceptServiceClass"); }else{ cond = DUL_MakePresentationCtx(&ctx, requestedCtx->proposedSCRole, DUL_SC_ROLE_DEFAULT, requestedCtx->presentationContextID, DUL_PRESENTATION_REJECT_TRANSFER_SYNTAX, requestedCtx->abstractSyntax, DICOM_TRANSFERLITTLEENDIAN, DICOM_TRANSFERLITTLEENDIAN, NULL); if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_AcceptServiceClass"); (void) COND_PushCondition(SRV_UNSUPPORTEDTRANSFERSYNTAX, SRV_Message(SRV_UNSUPPORTEDTRANSFERSYNTAX), requestedCtx->abstractSyntax, "SRV_AcceptServiceClass"); rtnCond = COND_PushCondition(SRV_PRESENTATIONCTXREJECTED, SRV_Message(SRV_PRESENTATIONCTXREJECTED), requestedCtx->abstractSyntax, "SRV_AcceptServiceClass"); } #endif }else{ cond = DUL_MakePresentationCtx(&ctx, requestedCtx->proposedSCRole, DUL_SC_ROLE_DEFAULT, requestedCtx->presentationContextID, DUL_PRESENTATION_REJECT_ABSTRACT_SYNTAX, requestedCtx->abstractSyntax, DICOM_TRANSFERLITTLEENDIAN, DICOM_TRANSFERLITTLEENDIAN, NULL); if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_AcceptServiceClass"); (void) COND_PushCondition(SRV_UNSUPPORTEDSERVICE, SRV_Message(SRV_UNSUPPORTEDSERVICE), requestedCtx->abstractSyntax, "SRV_AcceptServiceClass"); rtnCond = COND_PushCondition(SRV_PRESENTATIONCTXREJECTED, SRV_Message(SRV_PRESENTATIONCTXREJECTED), requestedCtx->abstractSyntax, "SRV_AcceptServiceClass"); } cond = LST_Enqueue(¶ms->acceptedPresentationContext, ctx); if (cond != LST_NORMAL) return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE), "SRV_AcceptServiceClass"); /* pdvList.count = 0; */ return rtnCond; }
static void browseSelectionCB_scrolledList1( Widget wgt, XtPointer cd, XtPointer cb) { Widget UxWidget = wgt; XtPointer UxClientData = cd; XtPointer UxCallbackArg = cb; { /* * scrolledList1 * * * Purpose: * This subrouitne examines the selected information * entity(IE), * finds a pointer to module-list structure and loads * the list of * modules in scrolledList2(window). * * * Parameter Dictionary: * cbs input, pointer to the * selected IE structure * * * Return Value: * list of modules loaded in the scrolledList2 * * * Notes: * * * Algorithm: * Description of the algorithm (optional) and any * other notes. * * */ XmListCallbackStruct *cbs; char *iename; int i; char buff[80]; CONDITION cond; int cnt3 = 0; XmString *strlist3; cbs = (XmListCallbackStruct *) UxCallbackArg; /* if selected a new item from List1(IE), then clear list3 */ XtVaGetValues(scrolledList2, XmNitemCount, &cnt3, XmNitems, &strlist3, NULL); if (cnt3 != 0) { XmListDeleteAllItems(scrolledList2); /* lint -e64 */ XtFree(strlist3); /* lint +e64 */ } XtVaGetValues(scrolledList3, XmNitemCount, &cnt3, XmNitems, &strlist3, NULL); if (cnt3 != 0) { XmListDeleteAllItems(scrolledList3); /* lint -e64 */ XtFree(strlist3); /* lint +e64 */ } /* clear any previosly open structure IE */ if (ieIE != NULL) { cond = IE_Free((void **) &ieIE); if (cond != IE_NORMAL) { (void) COND_ExtractConditions(errorstackP); copyWtext(info); (void) COND_PopCondition(clearStack); free(info); } } free(ieIE); /* clear text widgets */ if (strlen(XmTextGetString(text1)) != 0) XmTextSetString(text1, NULL); if (strlen(XmTextGetString(text2)) != 0) XmTextSetString(text2, NULL); /* pointer to the head-end of the list, ieList */ ieIE = LST_Head(&ie_head); /* makes current the node */ (void) LST_Position(&ie_head, ieIE); /* pointer to the next item */ for (i = 2; i <= cbs->item_position; i++) ieIE = LST_Next(&ie_head); cond = IE_ExamineInformationEntity(&queryObject, ieIE->ieType, &ieIE); if (cond != IE_NORMAL) { (void) COND_ExtractConditions(errorstackP); copyWtext(info); (void) COND_PopCondition(clearStack); free(info); } mod_head = ieIE->moduleList; MUT_LoadList(scrolledList2, ieIE->moduleList, formatmodieList, buff); } }
static void iterateThroughElements(DCM_OBJECT** obj, size_t NL) { CONDITION cond; DCM_ELEMENT *e; DCM_SEQUENCE_ITEM *sq; cond = DCM_GetFirstElement(obj, &e); if (cond != DCM_NORMAL) { COND_DumpConditions(); return; } if(e->representation == DCM_SQ){ indentXML(NL); startXMLTag(e, NL); printf("\n"); sq = (DCM_SEQUENCE_ITEM*)LST_Head(&e->d.sq); if (sq != NULL) (void)LST_Position(&e->d.sq, sq); while (sq != NULL) { iterateThroughElements(&sq->object, NL+1); sq = (DCM_SEQUENCE_ITEM*)LST_Next(&e->d.sq); } indentXML(NL); endXMLTag(e); printf("\n"); } else{ startXMLTag(e, NL); dumpElement(e); endXMLTag(e); printf("\n"); } while (cond == DCM_NORMAL) { cond = DCM_GetNextElement(obj, &e); if (cond == DCM_NORMAL) { if(e->representation == DCM_SQ){ indentXML(NL); startXMLTag(e, NL); printf("\n"); sq = (DCM_SEQUENCE_ITEM*)LST_Head(&e->d.sq); if (sq != NULL) (void)LST_Position(&e->d.sq, sq); while (sq != NULL) { iterateThroughElements(&sq->object, NL+1); sq = (DCM_SEQUENCE_ITEM*)LST_Next(&e->d.sq); } indentXML(NL); endXMLTag(e); printf("\n"); } else{ startXMLTag(e, NL); dumpElement(e); endXMLTag(e); printf("\n"); } } } if (cond != DCM_GETNEXTELEMENTCOMPLETE) { fprintf(stderr, "Unable to get all elements\n"); } }
static CONDITION selectStudyRecord(PRIVATE_HANDLE * h, FIS_CRITERIA_TYPE criteriaType, const char *criteriaString, long listFlag, LST_HEAD * getList, FIS_STUDYRECORD * r, long *count) { CONDITION cond = FIS_NORMAL; TBL_CRITERIA criteria[2]; char localString[1024]; FIS_STUDYRECORD *p; static TBL_FIELD fields[] = { {TBL_FIELD_STRING("PatUID", study.PatUID)}, {TBL_FIELD_STRING("StuInsUID", study.StuInsUID)}, {TBL_FIELD_STRING("VisUID", study.VisUID)}, {TBL_FIELD_STRING("AccNum", study.AccNum)}, {TBL_FIELD_STRING("StuID", study.StuID)}, {"SchStuStaDat", TBL_SIGNED4, sizeof(studyDate), sizeof(studyDate), 0, (void *) &studyDate}, {"SchStuStaTim", TBL_FLOAT4, sizeof(studyTime), sizeof(studyTime), 0, (void *) &studyTime}, {TBL_FIELD_STRING("SchStuLoc", study.SchStuLoc)}, {TBL_FIELD_STRING("ProDes", study.ProDes)}, {TBL_FIELD_STRING("StuStaID", study.StuStaID)}, {NULL}, }; criteria[0].FieldName = criteria[1].FieldName = NULL; strcpy(localString, criteriaString); switch (criteriaType) { case FIS_K_ACCESSION: TBL_CRITERIA_LOAD_BYTE(criteria[0], "AccNum", localString, TBL_STRING, TBL_EQUAL); break; default: cond = 0; /* Repair */ } if (cond != FIS_NORMAL) return cond; (void) memset(&study, 0, sizeof(study)); study.Type = FIS_K_STUDY; cond = TBL_Select(&h->studyHandle, criteria, fields, count, studyCallback, getList); if (cond != TBL_NORMAL) return COND_PushCondition(FIS_COND(FIS_STUDYGETFAILED), "(FIS)getStudyRecord"); if (r != NULL) *r = study; if (listFlag & FIS_K_STU_STUDYCOMPONENTLIST) { if (getList != NULL) { p = LST_Head(&getList); (void) LST_Position(&getList, p); } else p = r; while (p != NULL) { p->StudyComponentList = LST_Create(); p->Flag |= FIS_K_STU_STUDYCOMPONENTLIST; cond = getStudyComponentRecord(h, FIS_K_STUDY, p->StuInsUID, 0, p->StudyComponentList, NULL, NULL); if (cond != FIS_NORMAL) return cond; if (getList != NULL) p = LST_Next(&getList); else p = NULL; } } if (listFlag & FIS_K_STU_RESULTSLIST) { if (getList != NULL) { p = LST_Head(&getList); (void) LST_Position(&getList, p); } else p = r; while (p != NULL) { p->ResultsList = LST_Create(); p->Flag |= FIS_K_STU_RESULTSLIST; cond = getResultsRecord(h, FIS_K_STUDY, p->StuInsUID, 0, p->ResultsList, NULL, NULL); if (cond != FIS_NORMAL) return cond; if (getList != NULL) p = LST_Next(&getList); else p = NULL; } } return FIS_NORMAL; }
static CONDITION getStudyComponentRecord(PRIVATE_HANDLE * h, FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList, FIS_STUDYCOMPONENTRECORD * r, long *count) { CONDITION cond; TBL_CRITERIA criteria[2]; FIS_STUDYCOMPONENTRECORD *p; static TBL_FIELD fields[] = { {TBL_FIELD_STRING("StuComUID", studyComponent.StuComUID)}, {TBL_FIELD_STRING("StuInsUID", studyComponent.StuInsUID)}, {TBL_FIELD_STRING("Mod", studyComponent.Mod)}, {TBL_FIELD_STRING("StuDes", studyComponent.StuDes)}, {TBL_FIELD_STRING("ProCodVal", studyComponent.ProCodVal)}, {TBL_FIELD_STRING("ProCodSchDes", studyComponent.ProCodSchDes)}, {TBL_FIELD_STRING("ProCodMea", studyComponent.ProCodMea)}, {TBL_FIELD_STRING("StuComStaID", studyComponent.StuComStaID)}, {TBL_FIELD_STRING("StuID", studyComponent.StuID)}, {NULL}, }; criteria[0].FieldName = criteria[1].FieldName = NULL; if (uid != NULL) { if (uid[0] != '\0') { if (criteriaType == FIS_K_STUDY) { TBL_CRITERIA_LOAD_BYTE(criteria[0], "StuInsUID", uid, TBL_STRING, TBL_EQUAL); } else { TBL_CRITERIA_LOAD_BYTE(criteria[0], "StuComUID", uid, TBL_STRING, TBL_EQUAL); } } } (void) memset(&studyComponent, 0, sizeof(studyComponent)); studyComponent.Type = FIS_K_STUDYCOMPONENT; cond = TBL_Select(&h->studyComponentHandle, criteria, fields, count, studyComponentCallback, getList); if (cond != TBL_NORMAL) return COND_PushCondition(FIS_COND(FIS_STUDYGETFAILED), "(FIS)getStudyRecord"); if (r != NULL) *r = studyComponent; if (listFlag & FIS_K_STUDYCOMP_SERIESLIST) { if (getList != NULL) { p = LST_Head(&getList); (void) LST_Position(&getList, p); } else p = r; while (p != NULL) { p->SeriesList = LST_Create(); p->Flag |= FIS_K_STUDYCOMP_SERIESLIST; cond = getSCSeriesRecord(h, FIS_K_STUDYCOMPONENT, p->StuComUID, FIS_K_SCSERIES_IMAGELIST, p->SeriesList, NULL, NULL); if (cond != FIS_NORMAL) return cond; if (getList != NULL) p = LST_Next(&getList); else p = NULL; } } return FIS_NORMAL; }
int r_parseSequence(DCM_OBJECT ** object) { DCM_ELEMENT e; LST_HEAD *l; CONDITION cond; int index; SQ_TYPE type; SQ_REFINTERPRETATIONSOPINSTANCEUID *interp; SQ_REFSTUDYSOPINSTANCEUID *study; void *pointer; static DCM_MAP_SQ sequences[] = { {DCM_IDREFERENCEDSTUDYSEQ, SQ_K_REFSTUDYSOPINSTANCEUID, HIS_K_RESRSSEQUENCE}, {DCM_RESREFERENCEDINTERPSEQ, SQ_K_REFINTERPRETATIONSOPINSTANCEUID, HIS_K_RESRISEQUENCE}, }; for (index = 0; index < (int) DIM_OF(sequences); index++) { e.tag = sequences[index].tag; cond = DCM_GetSequenceList(object, e.tag, &e.d.sq); if (cond != DCM_NORMAL) { if (cond != DCM_ELEMENTNOTFOUND) return -1; } else { cond = SQ_ParseSequence(&e, &type, &l); if (cond != SQ_NORMAL || type != sequences[index].type) return -2; p.Update_Flag |= sequences[index].his_field; pointer = LST_Head(&l); if (pointer != NULL) LST_Position(&l, pointer); while (pointer != NULL) { switch (sequences[index].tag) { case DCM_IDREFERENCEDSTUDYSEQ: study = (SQ_REFSTUDYSOPINSTANCEUID *) pointer; strcpy(p.RSSequence[p.RSSequenceCount], study->referencedSOPInstanceUID); ++p.RSSequenceCount; break; case DCM_RESREFERENCEDINTERPSEQ: interp = (SQ_REFINTERPRETATIONSOPINSTANCEUID *) pointer; strcpy(p.RISequence[p.RISequenceCount], interp->referencedSOPInstanceUID); ++p.RISequenceCount; break; } pointer = LST_Next(&l); } } } return 0; /* e[0].tag = DCM_RESREFERENCEDINTERPSEQ; e[1].tag = DCM_IDREFERENCEDSTUDYSEQ; for (index = 0; index < (int) DIM_OF(e); index++) { cond = DCM_GetSequenceList(object, e[index].tag, &e[index].d.sq); if (cond == DCM_ELEMENTNOTFOUND) continue; else if (cond != DCM_NORMAL) return -1; cond = SQ_ParseSequence(&e[index], &type, &l); if (cond != SQ_NORMAL) return -2; if (type == SQ_K_REFINTERPRETATIONSOPINSTANCEUID) { p.Update_Flag |= HIS_K_RESRISEQUENCE; interp = LST_Head(&l); if (interp != NULL) LST_Position(&l, interp); while (interp != NULL) { strcpy(p.RISequence[p.RISequenceCount], interp->referencedSOPInstanceUID); ++p.RISequenceCount; interp = LST_Next(&l); } } if (type == SQ_K_REFSTUDYSOPINSTANCEUID) { p.Update_Flag |= HIS_K_RESRSSEQUENCE; study = LST_Head(&l); if (study != NULL) LST_Position(&l, study); while (study != NULL) { strcpy(p.RSSequence[p.RSSequenceCount], study->referencedSOPInstanceUID); ++p.RSSequenceCount; study = LST_Next(&l); } } } return 0; */ }
static void browseSelectionCB_scrolledList3( Widget wgt, XtPointer cd, XtPointer cb) { Widget UxWidget = wgt; XtPointer UxClientData = cd; XtPointer UxCallbackArg = cb; { /* * scrolledList3 * * * Purpose: * This subroutine lists the description of the selected * attribute * in the text widgets. * * * Parameter Dictinary: * cbs input, pointer to the * selected attribute * * * Return Value: * Description of the element * * * Notes: * * * Algorithm: * Description of the algorithm (optional) and any * other notes. * * */ XmListCallbackStruct *cbs; char *atname; int i; char buf2[64], buf1[64]; CONDITION cond; unsigned short gg, ee; cbs = (XmListCallbackStruct *) UxCallbackArg; if ((atname = (char *) malloc(64)) == NULL) printf(" malloc atname failed\n"); XmStringGetLtoR(cbs->item, XmSTRING_DEFAULT_CHARSET, &atname); if (strlen(XmTextGetString(text1)) != 0) XmTextSetString(text1, NULL); if (strlen(XmTextGetString(text2)) != 0) XmTextSetString(text2, NULL); ieAttr = LST_Head(&attr_head); (void) LST_Position(&attr_head, ieAttr); for (i = 2; i <= cbs->item_position; i++) ieAttr = LST_Next(&attr_head); cond = DCM_LookupElement(&ieAttr->element); if (cond != DCM_NORMAL) { (void) COND_ExtractConditions(errorstackP); copyWtext(info); (void) COND_PopCondition(clearStack); free(info); } sprintf(buf1, " %s", atname); XmTextSetString(text1, buf1); if (ieAttr->element.length == 0) { strcpy(buf2, "<None>"); XmTextSetString(text2, buf2); } else { switch (ieAttr->element.representation) { case DCM_AS: /* Age String */ case DCM_CS: /* control string */ case DCM_DA: /* date */ case DCM_DS: /* decimal string */ case DCM_IS: /* integer string */ case DCM_LO: /* long string */ case DCM_LT: /* long text */ case DCM_ST: /* short text */ case DCM_SH: /* short string */ case DCM_TM: /* time */ case DCM_UI: /* uid */ case DCM_PN: /* person name */ gg = DCM_TAG_GROUP(ieAttr->element.tag); ee = DCM_TAG_ELEMENT(ieAttr->element.tag); sprintf(buf2, "%04x, %04x, %s", gg, ee, ieAttr->element.d.string); XmTextSetString(text2, buf2); break; case DCM_SS: /* signed short */ gg = DCM_TAG_GROUP(ieAttr->element.tag); ee = DCM_TAG_ELEMENT(ieAttr->element.tag); sprintf(buf2, "%04x, %04x, %d", gg, ee, *(ieAttr->element.d.us)); XmTextSetString(text2, buf2); break; case DCM_SL: /* signed long */ gg = DCM_TAG_GROUP(ieAttr->element.tag); ee = DCM_TAG_ELEMENT(ieAttr->element.tag); sprintf(buf2, " %04x, %04x, %d", gg, ee, *(ieAttr->element.d.sl)); XmTextSetString(text2, buf2); break; case DCM_US: /* unsigned short */ gg = DCM_TAG_GROUP(ieAttr->element.tag); ee = DCM_TAG_ELEMENT(ieAttr->element.tag); sprintf(buf2, " %04x, %04x, %d", gg, ee, *(ieAttr->element.d.us)); XmTextSetString(text2, buf2); break; case DCM_UL: /* unsigned long */ gg = DCM_TAG_GROUP(ieAttr->element.tag); ee = DCM_TAG_ELEMENT(ieAttr->element.tag); sprintf(buf2, " %04x, %04x, %d", gg, ee, *(ieAttr->element.d.ul)); XmTextSetString(text2, buf2); break; default: break; } } free(atname); } }