Example #1
0
void
expandPatientStudy(LST_HEAD * patientList, LST_HEAD * patientStudyList)
{
    FIS_PATIENTRECORD
    * p;
    FIS_STUDYRECORD
	* s;
    RSA_PATIENTSTUDY
	* ps;

    clearPatientStudy(patientStudyList);
    p = LST_Head(&patientList);
    if (p != NULL)
	(void) LST_Position(&patientList, p);
    while (p != NULL) {
	s = LST_Head(&p->StudyList);
	if (s != NULL)
	    (void) LST_Position(&p->StudyList, s);
	while (s != NULL) {
	    ps = malloc(sizeof(*ps));
	    ps->Patient = *p;
	    ps->Study = *s;
	    (void) LST_Enqueue(&patientStudyList, ps);
	    s = LST_Next(&p->StudyList);
	}
	p = LST_Next(&patientList);
    }
}
Example #2
0
CONDITION
extractGroups(LST_HEAD * src, LST_HEAD * dst)
{
    DMAN_GROUPNAMES
	* s,
	*p;

    s = LST_Head(&src);
    if (s != NULL)
	(void) LST_Position(&src, s);

    while (s != NULL) {
	p = LST_Head(&dst);
	if (p != NULL)
	    (void) LST_Position(&dst, p);
	while (p != NULL) {
	    if (strcmp(s->GroupName, p->GroupName) == 0)
		break;
	    else
		p = LST_Next(&dst);
	}
	if (p == NULL) {
	    p = malloc(sizeof(*p));
	    if (p == NULL)
		return 0;
	    *p = *s;
	    (void) LST_Enqueue(&dst, p);
	}
	s = LST_Next(&src);
    }
    return 1;
}
Example #3
0
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;
}
Example #4
0
/**************************************************************************
 *
 * PrintConfigList 
 *
 * SYNOPSIS
 *		void PrintConfigList (LST_LIST *list)
 *
 * PURPOSE
 *		Print ConfigList (for Debugging)
 *
 * INPUT
 *
 *
 * EFFECTS
 *
 *
 * RETURN VALUE
 *
 *
 * BUGS
 *
 *
 * HISTORY
 *
 *
 * SEE ALSO
 *
*/
void PrintConfigList (LST_LIST *list)
{
	ConfigType	*cf;
	Statement	*st;

	printf ("------Config Rules------\n");
	cf = (ConfigType*)LST_Head (list);
	while (!LST_EndOfList (cf)) {
		printf ("%s:\n", LST_NodeName(cf));
		st = (Statement*)LST_Head (&cf->Statements);
		while (!LST_EndOfList (st)) {
			switch (st->Command) {
			case CMD_OPEN:
				printf ("\t_Open");
				if (st->Arg1) {
					printf (" \"%s\"", st->Arg1);
				}
				printf ("\n");
				break;
			case CMD_PRINT:
				printf ("\t_Print \"%s\"\n", LST_NodeName(st));
				break;
			case CMD_NAMES:
				printf ("\t_Names \"%s\"", LST_NodeName(st));
				if (st->Arg1) {
					printf (" RULE \"%s\"", st->Arg1);
				}
				if (st->Arg2) {
					printf (" REPEATRULE \"%s\"", st->Arg2);
				}
				if (st->Arg3) {
					printf (" END \"%s\"", st->Arg3);
				}
				printf ("\n");
				break;
			case CMD_CLOSE:
				printf ("\t_Close\n");
				break;
			default:
				printf ("***\tERROR: Unknown command (%d)\n", st->Command);
				break;
			}
			st = (Statement*)LST_Next (st);
		}
		cf = (ConfigType*)LST_Next (cf);
	}

} /* PrintConfigList  */
Example #5
0
static void printResults(LST_HEAD* patientList)
{
  ITEM* patientItem;

  patientItem = (ITEM*)LST_Head(&patientList);
  (void)LST_Position(&patientList, patientItem);
  while (patientItem != 0) {
    char* s;
    DCM_TAG pTags[] = { DCM_PATNAME, DCM_PATID, DCM_PATBIRTHDATE };
    int i;

    for (i = 0; i < (int)DIM_OF(pTags); i++) {
      s = getString(patientItem->obj, pTags[i]);
      if (s == 0) {
	printf("%08x %s\n", pTags[i], "");
      } else {
	printf("%08x %s\n", pTags[i], s);
	free(s);
      }
    }
    printStudyResults(patientItem->lst);
    printf("\n");

    patientItem = (ITEM*)LST_Next(&patientList);
  }
}
Example #6
0
static void printStudyResults(LST_HEAD* studyList)
{
  ITEM* studyItem;

  if (studyList == 0)
    return;

  studyItem = (ITEM*)LST_Head(&studyList);
  (void)LST_Position(&studyList, studyItem);
  while (studyItem != 0) {
    char* s;
    DCM_TAG tags[] = { DCM_RELSTUDYINSTANCEUID, DCM_IDSTUDYDATE,
		       DCM_IDSTUDYTIME, DCM_IDACCESSIONNUMBER,
		       DCM_IDSTUDYDESCRIPTION
    };

    int i;

    for (i = 0; i < (int)DIM_OF(tags); i++) {
      s = getString(studyItem->obj, tags[i]);
      if (s == 0) {
	printf(" %08x %s\n", tags[i], "");
      } else {
	printf(" %08x %s\n", tags[i], s);
	free(s);
      }
    }
    printSeriesResults(studyItem->lst);
    printf("\n");

    studyItem = (ITEM*)LST_Next(&studyList);
  }
}
Example #7
0
static void printSeriesResults(LST_HEAD* lst)
{
  ITEM* item;

  if (lst == 0)
    return;

  item = (ITEM*)LST_Head(&lst);
  (void)LST_Position(&lst, item);
  while (item != 0) {
    char* s;
    DCM_TAG tags[] = { DCM_IDMODALITY, DCM_RELSERIESNUMBER,
		       DCM_ACQBODYPARTEXAMINED, DCM_ACQVIEWPOSITION
    };

    int i;

    for (i = 0; i < (int)DIM_OF(tags); i++) {
      s = getString(item->obj, tags[i]);
      if (s == 0) {
	printf("  %08x %s\n", tags[i], "");
      } else {
	printf("  %08x %s\n", tags[i], s);
	free(s);
      }
    }
    printf("\n");

    item = (ITEM*)LST_Next(&lst);
  }
}
Example #8
0
DUL_PRESENTATIONCONTEXT *
SRVPRV_PresentationContext(DUL_ASSOCIATESERVICEPARAMETERS * params, char *classUID)
{
    DUL_PRESENTATIONCONTEXT    	* presentationCtx;/* Presentation context for this service */

#if 0
    fprintf(stderr, "<%s>\n", classUID);
#endif

    if (params->acceptedPresentationContext == NULL) return NULL;

    presentationCtx = LST_Head(&params->acceptedPresentationContext);
    if (presentationCtx == NULL) return NULL;

    (void) LST_Position(&params->acceptedPresentationContext, presentationCtx);

    while (presentationCtx != NULL){
#if 0
    	fprintf(stderr, "%d <%s> <%s>\n", presentationCtx->result, classUID, presentationCtx->abstractSyntax);
#endif
    	if ((strcmp(classUID, presentationCtx->abstractSyntax) == 0) && (presentationCtx->result == DUL_PRESENTATION_ACCEPT)) return presentationCtx;
    	presentationCtx = LST_Next(&params->acceptedPresentationContext);
    }

    if (strcmp(classUID, DICOM_SOPCLASSDETACHEDINTERPRETMGMT) == 0){
    	return SRVPRV_PresentationContext(params, DICOM_SOPCLASSDETACHEDRESULTSMGMTMETA);
    }else if (strcmp(classUID, DICOM_SOPCLASSDETACHEDINTERPRETMGMT) == 0){
    	return SRVPRV_PresentationContext(params, DICOM_SOPCLASSDETACHEDRESULTSMGMTMETA);
    }
    return NULL;
}
Example #9
0
File: cget.c Project: nagyistge/ctn
static CONDITION
selectCallback(IDB_Query * queryResponse, long count, LST_HEAD * lst)
{
    QUERY_LIST_ITEM
    * item;
    IDB_InstanceListElement
	* e1, *e2;

    item = malloc(sizeof(*item));
    if (item == NULL)
	return 0;

    item->query = *queryResponse;
    if (queryResponse->image.InstanceList != NULL) {
	item->query.image.InstanceList = LST_Create();
	if (item->query.image.InstanceList == NULL)
	    return 0;
	e1 = LST_Head(&queryResponse->image.InstanceList);
	(void) LST_Position(&queryResponse->image.InstanceList, e1);
	while (e1 != NULL) {
	    e2 = malloc(sizeof(*e2));
	    *e2 = *e1;
	    (void) LST_Enqueue(&item->query.image.InstanceList, e2);
	    e1 = LST_Next(&queryResponse->image.InstanceList);
	}
    }
    (void) LST_Enqueue(&lst, item);
    return IDB_NORMAL;
}
Example #10
0
/* selectStudy
**
** Purpose:
**	This function is called when the user selects a study from
**	the study list.  This will then call other functions
**	to display the images in that study.
**
** Parameter Dictionary:
**	w
**	client_data
**	call_data
**
** Return Values:
**	None.
**
** Notes:
**
** Algorithm:
**	Description of the algorithm (optional) and any other notes.
*/
static void
selectStudy(Widget w, XtPointer client_data, XtPointer call_data)
{
    XawListReturnStruct
    * data;
    LIST_ITEM
	* item;

    data = (XawListReturnStruct *) call_data;
    printf("you have selected %s\n", data->string);
    item = LST_Position(&lst_studylist, LST_Head(&lst_studylist));
    if (item == NULL) {
	printf("Fatal Error: LST_Position failed in selectStudy \n");
	return;
    }
    printf("searching in list, getting \n");
    printf("%s\n", item->combo);
    while ((item != NULL) && (strcmp(item->combo, data->string) != 0)) {
	item = LST_Next(&lst_studylist);
	printf("searching in list, getting \n");
	printf("%s\n", item->combo);
    }
    if (item == NULL) {
	printf("Fatal Error: Major Logic Error in selectStudy\n");
	return;
    }
    if (PreviewStudy(icon_index, icon_file, item->AccessionNumber) == FALSE) {
	COND_DumpConditions();
	printf("Error: PreviewStudy failed in selectStudy\n");
    }
}
Example #11
0
/*
 *  ======== NTFY_Notify ========
 *  Purpose:
 *      Execute notify function (signal event) for every
 *      element in the notification list that is to be notified about the
 *      event specified in uEventMask.
 */
void NTFY_Notify(struct NTFY_OBJECT *hNtfy, u32 uEventMask)
{
	struct NOTIFICATION *pNotify;

	DBC_Require(MEM_IsValidHandle(hNtfy, NTFY_SIGNATURE));

	/*
	 *  Go through notifyList and notify all clients registered for
	 *  uEventMask events.
	 */

	(void) SYNC_EnterCS(hNtfy->hSync);

	pNotify = (struct NOTIFICATION *)LST_First(hNtfy->notifyList);
	while (pNotify != NULL) {
		if (pNotify->uEventMask & uEventMask) {
			/* Notify */
			if (pNotify->uNotifyType == DSP_SIGNALEVENT)
				(void)SYNC_SetEvent(pNotify->hSync);

		}
		pNotify = (struct NOTIFICATION *)LST_Next(hNtfy->notifyList,
			  (struct list_head *)pNotify);
	}

	(void) SYNC_LeaveCS(hNtfy->hSync);
}
Example #12
0
CONDITION
SRV_RegisterSOPClass(const char *SOPClass, DUL_SC_ROLE role, DUL_ASSOCIATESERVICEPARAMETERS * params)
{
  DUL_PRESENTATIONCONTEXTID 	contextID = 1;
  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(&params->requestedPresentationContext);
  if (ctx != NULL) (void) LST_Position(&params->requestedPresentationContext, ctx);

  while (ctx != NULL) {
	  contextID += 2;
	  if (strcmp(SOPClass, ctx->abstractSyntax) == 0) return SRV_NORMAL;
	  ctx = LST_Next(&params->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(&params->requestedPresentationContext, ctx);
  if (cond != LST_NORMAL) return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE), "SRV_RegisterSOPClass");

  return SRV_NORMAL;
}
Example #13
0
CONDITION
SRV_RegisterSOPClassXfer(const char *SOPClass, const char* xferSyntax, DUL_SC_ROLE role, DUL_ASSOCIATESERVICEPARAMETERS * params)
{
  DUL_PRESENTATIONCONTEXTID 	contextID = 1;
  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_RegisterSOPClassXfer");
  }

  ctx = LST_Head(&params->requestedPresentationContext);
  if (ctx != NULL) (void) LST_Position(&params->requestedPresentationContext, ctx);

  while (ctx != NULL) {
	  DUL_TRANSFERSYNTAX* 	xferItem;

	  contextID += 2;
	  xferItem = (DUL_TRANSFERSYNTAX*) LST_Head(&ctx->proposedTransferSyntax);

	  if ((strcmp(SOPClass, ctx->abstractSyntax) == 0) && (strcmp(xferSyntax, xferItem->transferSyntax) == 0) && (role == ctx->proposedSCRole)) return SRV_NORMAL;
	  ctx = LST_Next(&params->requestedPresentationContext);
  }

  cond = DUL_MakePresentationCtx(&ctx, role, DUL_SC_ROLE_DEFAULT, contextID, 0, SOPClass, "", xferSyntax, NULL);
  if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_RegisterSOPClassXfer");

  cond = LST_Enqueue(&params->requestedPresentationContext, ctx);
  if (cond != LST_NORMAL) return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE), "SRV_RegisterSOPClassXfer");

  return SRV_NORMAL;
}
Example #14
0
CONDITION
SRV_RequestServiceClass(const char *SOPClass, DUL_SC_ROLE role, DUL_ASSOCIATESERVICEPARAMETERS * params)
{
    DUL_PRESENTATIONCONTEXTID	contextID = 1;
    int					        index;
    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_RequestServiceClass");
    }

    ctx = LST_Head(&params->requestedPresentationContext);
    if (ctx != NULL) (void) LST_Position(&params->requestedPresentationContext, ctx);

    while (ctx != NULL){
    	contextID += 2;
    	if (strcmp(SOPClass, ctx->abstractSyntax) == 0) return SRV_NORMAL;
    	ctx = LST_Next(&params->requestedPresentationContext);
    }

    for (index = 0; index < (int) DIM_OF(syntaxList) && !found; index++) {
    	if (strcmp(SOPClass, syntaxList[index]) == 0) found = TRUE;
	}
    if (found) {
    	char 	**xferSyntaxes;
    	int 	singleMode = 1;
    	int 	xferSyntaxCount = 0;

    	xferSyntaxes = mapProposedSOPToXferSyntax(SOPClass,	"PROPOSE/XFER", &xferSyntaxCount, &singleMode);

    	if (singleMode == 1) {
    		cond = DUL_AddSinglePresentationCtx(params, role, DUL_SC_ROLE_DEFAULT, contextID, 0, SOPClass, xferSyntaxes, xferSyntaxCount);
    	}else{
    		cond = DUL_AddMultiplePresentationCtx(params, role, DUL_SC_ROLE_DEFAULT, contextID, 0, SOPClass, xferSyntaxes, xferSyntaxCount);
    	}
    	if (cond != DUL_NORMAL) return COND_PushCondition(SRV_PRESENTATIONCONTEXTERROR, SRV_Message(SRV_PRESENTATIONCONTEXTERROR), "SRV_RequestServiceClass");

    	/* Legacy version removed 1/3/2001, smm
		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_RequestServiceClass");
		}else{
			cond = LST_Enqueue(&params->requestedPresentationContext, ctx);
			if (cond != LST_NORMAL) return COND_PushCondition(SRV_LISTFAILURE, SRV_Message(SRV_LISTFAILURE), "SRV_RequestServiceClass");
			contextID += 2;
		}
    	 */

    }else{
    	return COND_PushCondition(SRV_UNSUPPORTEDSERVICE, SRV_Message(SRV_UNSUPPORTEDSERVICE), SOPClass, "SRV_RequestServiceClass");
    }
    return SRV_NORMAL;
}
Example #15
0
static void handleStudyQueries(DUL_ASSOCIATIONKEY** association,
			       DUL_ASSOCIATESERVICEPARAMETERS* params,
			       MSG_C_FIND_REQ* patientRequest,
			       LST_HEAD* patientList,
			       const char* queryLevel)
{
  ITEM* item;
  CONDITION cond;
  MSG_C_FIND_RESP response;

  item = (ITEM*)LST_Head(&patientList);
  (void)LST_Position(&patientList, item);
  while (item != 0) {
    char* patientName;
    char* patientID;
    char* charSet;
    MSG_C_FIND_REQ studyRequest;
    DCM_OBJECT* q;

    patientName = getString(item->obj, DCM_PATNAME);
    patientID = getString(item->obj, DCM_PATID);
    charSet = getString(patientRequest->identifier, DCM_IDSPECIFICCHARACTER);

    printf("%s %s\n", patientID, patientName);

    studyRequest = *patientRequest;
    studyRequest.identifier = 0;
    DCM_CreateObject(&q, 0);

    addString(q, DCM_PATID, patientID);
    addString(q, DCM_IDSPECIFICCHARACTER, charSet);
    addString(q, DCM_IDQUERYLEVEL, "STUDY");
    addString(q, DCM_RELSTUDYINSTANCEUID, "");
    addString(q, DCM_IDSTUDYDATE, "");
    addString(q, DCM_IDSTUDYTIME, "");
    addString(q, DCM_IDACCESSIONNUMBER, "");
    addString(q, DCM_IDSTUDYDESCRIPTION, "");

    studyRequest.identifier = q;
    studyRequest.messageID = SRV_MessageIDOut();

    item->lst = LST_Create();

    cond = SRV_CFindRequest(association, params,
			    &studyRequest, &response,
			    queryCallback, item->lst, "");
    if (!(CTN_SUCCESS(cond))) {
      (void) printf("Verification Request unsuccessful\n");
      COND_DumpConditions();
    } else {

    }

    item = LST_Next(&patientList);
  }
}
Example #16
0
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;
}
Example #17
0
/**************************************************************************
 *
 * 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  */
Example #18
0
/*
 *  ======== RMM_free ========
 */
bool RMM_free(struct RMM_TargetObj *target, u32 segid, u32 addr, u32 size,
	bool reserved)

{
	struct RMM_OvlySect *sect;
	bool retVal = true;

	DBC_Require(MEM_IsValidHandle(target, RMM_TARGSIGNATURE));

	DBC_Require(reserved || segid < target->numSegs);
	DBC_Require(reserved || (addr >= target->segTab[segid].base &&
		   (addr + size) <= (target->segTab[segid].base +
		   target->segTab[segid].length)));

	GT_5trace(RMM_debugMask, GT_ENTER,
		 "RMM_free(0x%lx, 0x%lx, 0x%lx, 0x%lx, "
		 "0x%lx)\n", target, segid, addr, size, reserved);
	/*
	 *  Free or unreserve memory.
	 */
	if (!reserved) {
		retVal = freeBlock(target, segid, addr, size);
		if (retVal)
			target->segTab[segid].number--;

	} else {
		/* Unreserve memory */
		sect = (struct RMM_OvlySect *)LST_First(target->ovlyList);
		while (sect != NULL) {
			if (addr == sect->addr) {
				DBC_Assert(size == sect->size);
				/* Remove from list */
				LST_RemoveElem(target->ovlyList,
					      (struct LST_ELEM *)sect);
				MEM_Free(sect);
				break;
			}
			sect = (struct RMM_OvlySect *)LST_Next(target->ovlyList,
			       (struct LST_ELEM *)sect);
		}
		if (sect == NULL)
			retVal = false;

	}
	return retVal;
}
Example #19
0
/**************************************************************************
 *
 * FPrintName
 *
 * SYNOPSIS
 *		int   FPrintName (NameType *name, FILE *fp)
 *
 * PURPOSE
 *		
 *
 * INPUT
 *
 *
 * EFFECTS
 *
 *
 * RETURN VALUE
 *
 *
 * BUGS
 *
 *
 * HISTORY
 *
 *
 * SEE ALSO
 *
*/
int   FPrintName (NameType *name, FILE *fp)
{
	while (!LST_EndOfList (name)) {
		if (LST_NodeName(name)) {
			fprintf (fp, "%s", LST_NodeName(name));
		}
		if (name->Macro) {
			if (!FPrintMacro (name->Macro, fp)) {
				return FALSE;
			}
		}
		name = (NameType*)LST_Next (name);
		if (!LST_EndOfList(name) && name->Delim) {
			return FALSE;
		}
	}
	return TRUE;

} /* FPrintName */
Example #20
0
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(&params->requestedPresentationContext);
  if (ctx != NULL) (void) LST_Position(&params->requestedPresentationContext, ctx);
  while (ctx != NULL) {
	  contextID += 2;
	  if (strcmp(SOPClass, ctx->abstractSyntax) == 0) return SRV_NORMAL;
	  ctx = LST_Next(&params->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;
}
Example #21
0
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;
  }
}
Example #23
0
/**************************************************************************
 *
 * PrintName
 *
 * SYNOPSIS
 *		NameType *PrintName (NameType *name)
 *
 * PURPOSE
 *		
 *
 * INPUT
 *
 *
 * EFFECTS
 *
 *
 * RETURN VALUE
 *
 *
 * BUGS
 *
 *
 * HISTORY
 *
 *
 * SEE ALSO
 *
*/
NameType *PrintName (NameType *name)
{
	while (!LST_EndOfList (name)) {
		if (LST_NodeName(name)) {
			if (!StartFlag) {
				printf (" \\\n\t");
				StartFlag = TRUE;
			}
			printf ("%s", LST_NodeName(name));
		}
		if (name->Macro) {
			PrintMacro (name->Macro);
		}
		name = (NameType*)LST_Next (name);
		if (!LST_EndOfList(name) && name->Delim) {
			StartFlag = FALSE;
			break;
		}
	}
	return name;

} /* PrintName */
Example #24
0
/* 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(&params->acceptedPresentationContext);
    if (ctx == NULL)
	return NULL;
    (void) LST_Position(&params->acceptedPresentationContext, ctx);
    while (ctx != NULL) {
	if (ctx->presentationContextID == ctxid)	/* context id found */
	    break;
	ctx = LST_Next(&params->acceptedPresentationContext);
    }

    return ctx;
}
Example #25
0
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;
}
Example #26
0
/* 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;
}
Example #27
0
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;
*/
}
Example #28
0
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;
}
Example #29
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;
}
Example #30
0
/**************************************************************************
 *
 * 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 (&macro->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  */