Example #1
0
void run() {
	out_incTab();
	out_incTab();
	out_print ( "TEXT", "DEFAULT-MODULE" );
	out_print ( "FUNTION", getFunction() );
	
	if (strcmp(getFunction(), "show") == 0) {
			show();
	} else if (strcmp(getFunction(), "copyright") == 0) {
			copyright();
	} else {
		error();
	}
//	out_print ( "Parameter 0: Key => %s Value => %s", gParameter[0].key, gParameter[0].value);
}
Example #2
0
int main(int argc, char *argv[]) {

	Net network = NULL;
	int flags = 0;
	output out = NULL;
	char * file_name = NULL;

	flags = check_options(argc, argv);

	network = read_data(file_name);

	out = out_new();

	dinic(network, &out, flags);

	out_print(out,flags);

	out_destroy(out);
	net_destroy(network);

	return 0;
}
Example #3
0
File: zlog.c Project: rocflyhi/glow
int _thread_zlog_do(void *param)
{
    while (1) {
        sema_p(gs_zlog.sema);
        mutex_lock(gs_zlog.mutex);
        if (gs_zlog.is_to_exit == TRUE && gs_zlog.head == NULL) {
            mutex_unlock(gs_zlog.mutex);
            break;
        }
        if (gs_zlog.head == NULL) {
            mutex_unlock(gs_zlog.mutex);
            continue;
        }

        zlog_info_t *zlog_info = gs_zlog.head;
        gs_zlog.head = gs_zlog.head->next;
        mutex_unlock(gs_zlog.mutex);

        out_print(zlog_info->content);
        free(zlog_info->content);
    }
    return 0;
}
Example #4
0
/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  copyright
 *  Description:  
 * =====================================================================================
 */
	void
copyright ()
{
	out_print("COPYRIGHT", "Stephan Laukien (c) 2011");
}		/* -----  end of function copyright  ----- */
Example #5
0
/*******************************************************************************
 SEND TO OMP
*******************************************************************************/
int SendToOMP( dbm_msg_t *rmesg , unsigned short usLen )
{
	int  dBodyLen;
	int  idx, realmsgID;

	short	CurCount;
	short	TotCount;

	static char  prn_buf2[16384];

	idx = rmesg->head.cmd_id;
	realmsgID = rmesg->head.msg_id;

	log_print(LOGN_INFO, "[INFO] PROC RECV MSG MSGID:[%d] IDX:[%d] USLEN:[%d] ", realmsgID, idx, usLen );
	log_print(LOGN_INFO, "[INFO] COMMON ERR[%d]", rmesg->common.mml_err );

	dBodyLen = usLen;

	/*
    * CASE : INVALID RUN_TBL INDEX
    */
    if( idx > (MAX_TMR_REC - 1) || idx < 0 ) {
        log_print(LOGN_CRI, "[ERROR] INVALID RUN_TBL INDEX FROM PROCESS IDX[%d] REALMSGID[%d]",
                         idx, realmsgID );

        return 0;
    }

	log_print( LOGN_INFO, "RUN_CMDID:[%d] RUN_MSGID:[%d] REALMSGID:[%d]",
						run_tbl->cmd_id[idx], run_tbl->msg_id[idx], realmsgID );

	if( run_tbl->cmd_id[idx] != 0 && run_tbl->msg_id[idx] == realmsgID ) {
		if( rmesg->common.mml_err < 0 )
        {

        }
        else {
            if( rmesg->common.curr_cnt != 0 ) {
                run_tbl->stat_cur_cnt[idx] += rmesg->common.curr_cnt;
            }

            if( rmesg->common.total_cnt != 0 ) {
                run_tbl->stat_tot_cnt[idx] = rmesg->common.total_cnt;
            }
        }

		if( run_tbl->ucbinflag[idx] == 0x00 ) {
			if( lib_tbl[realmsgID%MAX_LIB_TABLE].mmc_res != NULL ) {
				sprintf(prn_buf2, "M%04d  %s",
					lib_tbl[realmsgID%MAX_LIB_TABLE].mcode,
					lib_tbl[realmsgID%MAX_LIB_TABLE].msg_header );

				//CurCount = run_tbl->stat_TOT_NUM[idx] - run_tbl->stat_TOTAL[idx]+1;
				//TotCount = run_tbl->stat_TOT_NUM[idx];
				CurCount = run_tbl->stat_cur_cnt[idx];
				TotCount = run_tbl->stat_tot_cnt[idx];

				log_print(LOGN_DEBUG, "TUNDRA ");
				(*lib_tbl[realmsgID%MAX_LIB_TABLE].mmc_res)(prn_buf2, rmesg, &CurCount, &TotCount  );
			}
		}
		else {
			if( rmesg->common.mml_err < 0 )
			{
				sprintf(prn_buf2, "M%04d  %s",
                    lib_tbl[realmsgID%MAX_LIB_TABLE].mcode,
                    lib_tbl[realmsgID%MAX_LIB_TABLE].msg_header );

                //CurCount = run_tbl->stat_TOT_NUM[idx] - run_tbl->stat_TOTAL[idx]+1;
                //TotCount = run_tbl->stat_TOT_NUM[idx];
				CurCount = run_tbl->stat_cur_cnt[idx];
                TotCount = run_tbl->stat_tot_cnt[idx];

                log_print(LOGN_DEBUG, "TUNDRA ");
                (*lib_tbl[realmsgID%MAX_LIB_TABLE].mmc_res)(prn_buf2, rmesg, &CurCount, &TotCount  );
			}
			else
			{
				log_print(LOGN_DEBUG, "TUNDRA 3");
				dBodyLen = rmesg->head.msg_len;
				memcpy( &prn_buf2[0], &rmesg->data[0], dBodyLen );
				prn_buf2[dBodyLen] = 0x00;
			}
		}

		/*
		* SEND RESULT TO OMP, RMI, OR NMS
		*/
		out_print(&prn_buf2[0], rmesg, dBodyLen, rmesg->head.cmd_id, rmesg->common.mml_err, rmesg->common.cont_flag);
	}
	else if( run_tbl->cmd_id[idx] == 0 && run_tbl->msg_id[idx] == 0 ) {
		log_print(LOGN_DEBUG,
			"ALREADY DELETED COMMAND IDX[%d] CMD_ID[%d] MSGID[%d]",
			idx, run_tbl->cmd_id[idx], run_tbl->msg_id[idx]);

		clear_my_tmr( idx );

		return 0;
	}

	if( rmesg->common.mml_err < 0 ) {
		if( dCheckStatFlag(rmesg->common.StatFlag) == 1 ) {
            run_tbl->stat_TOTAL[idx] = run_tbl->stat_TOTAL[idx] - 1;
            run_tbl->time[idx] = TIME_OUT + run_tbl->period[idx];

            if( run_tbl->stat_TOTAL[idx] == 0 )
                clear_my_tmr( idx );
        }
        else {
			clear_my_tmr( idx );
		}
	}
	else if( rmesg->common.cont_flag == DBM_END ) {
		if( dCheckStatFlag(rmesg->common.StatFlag) == 1 ) {
			run_tbl->stat_TOTAL[idx] = run_tbl->stat_TOTAL[idx] - 1;
			run_tbl->time[idx] = TIME_OUT + run_tbl->period[idx];

			if( run_tbl->stat_TOTAL[idx] == 0 )
				clear_my_tmr( idx );
		}
		else {
			clear_my_tmr( idx );
		}
	}
	else {
		if( dCheckStatFlag(rmesg->common.StatFlag) == 1 ) {
			run_tbl->stat_cur_cnt[idx] += rmesg->common.curr_cnt;
            run_tbl->stat_tot_cnt[idx] = rmesg->common.total_cnt;
            run_tbl->stat_cur_page[idx] = rmesg->common.CurPage;
            run_tbl->stat_tot_page[idx] = rmesg->common.TotPage;
		}
	}

	return 0;
}