Exemplo n.º 1
0
/*** qytDelete - delete an existing file or directory.
 ***/
int
qytDelete(pObject obj, pObjTrxTree* oxt)
    {
    pQytData inf = NULL;
    pSnNode node;
    int rval = 0;

	/** Determine node path **/
	node = snReadNode(obj->Prev);
	if (!node) 
	    {
	    mssError(0,"QYT","Could not access node object for querytree");
	    rval = -1;
	    goto error;
	    }

	/** Process path to determine actual path of object. **/
	inf = qyt_internal_ProcessPath(obj->Session, obj->Pathname, node, obj->SubPtr, node->Data, 0, 0);
	if (inf->LLObj) objClose(inf->LLObj);
	inf->LLObj = NULL;
	obj_internal_PathPart(obj->Pathname, 0,0);

	/** Call delete on it, using the actual path determined by process_path. **/
	if (inf->Pathname[0]) 
	    {
	    if (objDelete(obj->Session, inf->Pathname) < 0)
	        {
		mssError(0,"QYT","Could not delete object referenced by querytree");
		rval = -1;
		goto error;
		}
	    }
	else
	    {
	    mssError(0,"QYT","Could not determine referenced querytree object");
	    rval = -1;
	    goto error;
	    }

    error:

	/** Release, don't call close because that might write data to a deleted object **/
	if (inf)
	    {
	    qyt_internal_Close(inf);
	    }

    return rval;
    }
Exemplo n.º 2
0
/*** qyDelete - delete an existing file or directory.
 ***/
int
qyDelete(pObject obj, pObjTrxTree* oxt)
    {
    pQyData inf, find_inf, search_inf;
    int is_empty = 1;
    int i;
    char* node_path;
    pSnNode node;

	/** Determine node path **/
	node_path = obj_internal_PathPart(obj->Pathname, 0, obj->SubPtr);
	node = snReadNode(node_path);
	if (!node) 
	    {
	    mssError(0,"QY","Could not access node object for querytree");
	    return -1;
	    }

	/** Process path to determine actual path of object. **/
	inf = qy_internal_ProcessPath(obj->Session, obj->Pathname, node, obj->SubPtr, node->Data, 0, 0);
	if (inf->LLObj) objClose(inf->LLObj);
	obj_internal_PathPart(obj->Pathname, 0,0);

	/** Call delete on it, using the actual path determined by process_path. **/
	if (inf->Pathname[0]) 
	    {
	    if (objDelete(obj->Session, inf->Pathname) < 0)
	        {
		nmFree(inf, sizeof(QyData));
		mssError(0,"QY","Could not delete object referenced by querytree");
		return -1;
		}
	    }
	else
	    {
	    nmFree(inf,sizeof(QyData));
	    mssError(0,"QY","Could not determine referenced querytree object");
	    return -1;
	    }

	/** Release, don't call close because that might write data to a deleted object **/
	nmFree(inf,sizeof(QyData));

    return 0;
    }
Exemplo n.º 3
0
//==============================================================
static void objDeleteAll(u_int type, char *id_str)
//--------------------------------------------------------------
// オブジェクトを全て削除
//--------------------------------------------------------------
// in:	type   = フィルタリング
//		id_str = 識別名
//--------------------------------------------------------------
// out:	なし
//==============================================================
{
	sOBJ *obj;

	obj = ObjGetNext(NULL, type, id_str);
	while(obj)
	{
		sOBJ *next;

		next = ObjGetNext(obj, type, id_str);
		objDelete(obj);
		obj = next;
	}
}
Exemplo n.º 4
0
//==============================================================
static int objTask(sTaskBody *body, int msg, int lParam, int rParam)
//--------------------------------------------------------------
// タスク処理
//--------------------------------------------------------------
// in:	body           = ハンドル
//		msg            = メッセージ
//		lParam, rParam = 汎用パラメータ
//--------------------------------------------------------------
// out:	実行結果
//==============================================================
{
	int res = 0;

	switch(msg)
	{
		case MSG_CREATE:
		{
			param_hash = HashCreate("obj");
			obj_link = ObjLinkCreate(sizeof(sOBJ), OBJ_NUM, MEM_SYS, FALSE);

			SYSINFO(".... object initialize");
		}
		break;

		case MSG_KILL:
		{
			ObjDeleteParamAll();

			HashKill(param_hash);
			ObjLinkDestroy(obj_link);

			SYSINFO(".... object finish");
		}
		break;

		case MSG_PREPROC:
		{
			{
				sOBJ *obj;

				obj = ObjGetNext(NULL, OBJ_TYPE_ALL, NULL);
				while(obj)
				{
					obj->create = FALSE;
					obj = ObjGetNext(obj, OBJ_TYPE_ALL, NULL);
				}
			}
			ObjPostMsgAll(OBJ_TYPE_ALL, msg, FALSE, 0, 0);
		}
		break;

		case MSG_STEP:
		{
			ObjPostMsgAll(OBJ_TYPE_ALL, msg, FALSE, 0, 0);
			{
				sOBJ *obj;

				obj = ObjGetNext(NULL, OBJ_TYPE_ALL, NULL);
				while(obj)
				{
					sOBJ *next;

					next = ObjGetNext(obj, OBJ_TYPE_ALL, NULL);
					if(obj->kill_req)	objDelete(obj);
					obj = next;
				}
			}
		}
		break;

		case MSG_UPDATE:
		{
			ObjPostMsgAll(OBJ_TYPE_ALL, msg, FALSE, 0, 0);
		}
		break;

		case MSG_DRAW:
		{
			ObjPostMsgAll(OBJ_TYPE_ALL, msg, FALSE, 0, 0);
		}
		break;

		default:
		{
			ObjPostMsgAll(OBJ_TYPE_ALL, msg, FALSE, lParam, rParam);
		}
		break;
	}

	return res;
}