/*HEAD CREATE_A_PROCESS CCC ITK */
#include <stdlib.h>
#include <TCcore/aom.h>
#include <tc/emh.h>
#include <epm/epm.h>
免费分享网站源码
#include <tc/tc.h>
#include <sa/tcfile.h>
#include <itk/mem.h>
#define EXIT_FAILURE 1
#define ERROR_CHECK(X) (report_error( __FILE__, __LINE__, #X, (X)))
static void report_error( char *file, int line, char *function, int return_code)
{
    if (return_code != ITK_ok)
    {
        char *error_message_string;
        EMH_get_error_string (NULLTAG, return_code, &error_message_string);
        printf ("ERROR: %d ERROR MSG: %s.\n", return_code, error_message_string);
        printf ("FUNCTION: %s\nFILE: %s LINE: %d\n", function, file, line);
        if(error_message_string) MEM_free(error_message_string);
        printf("\nExiting program!\n");
        exit (EXIT_FAILURE);   
    }
}
#define EXIT_IF_NULL(X) (check_value(#X, (X)))
static void check_value( char *function, int value )
{
    if (value == 0)
    {
        printf ("\t%s is NULL\n", function);
        printf("\nExiting program!\n");
        exit (EXIT_FAILURE);   
    }
}
static void do_it(void)
{
    int
        attach_types[1] = {1};
    tag_t
        rev = NULLTAG,
        process_template = NULLTAG,
        process = NULLTAG;
    ERROR_CHECK( ITEM_find_rev("000206", "A", &rev) );
    EXIT_IF_NULL( rev );
    ERROR_CHECK( EPM_find_process_template("oneStepWithStatus", &process_template) );
    EXIT_IF_NULL( process_template );
    ERROR_CHECK( EPM_create_process("5421377", "desc", process_template, 1, &rev,
        attach_types, &process) );
    EXIT_IF_NULL( process );
}
int ITK_user_main(int argc, char* argv[])
{
    int
        status = 0;
 
    ITK_initialize_text_services( ITK_BATCH_TEXT_MODE );
    status = ITK_auto_login();
 
    if (  (status != ITK_ok)) printf("\nLogin Failed!\n\n");
    else
    {
        printf("\nLogin successful!\n\n");
        ITK_set_journalling(TRUE);
        do_it();
    }
    ITK_exit_module(TRUE);
    return status;
}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。