/*HEAD CREATE_A_PROCESS CCC ITK */ #include <stdlib.h> #include <TCcore/aom.h> #include <tc/emh.h> #include <tc/tc.h> #include <sa/tcfile.h> #include <itk/mem.h> #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) ); ERROR_CHECK( EPM_find_process_template("oneStepWithStatus", &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; }