Changeset 9987 for trunk/indexers/mg


Ignore:
Timestamp:
2005-05-31T09:41:19+12:00 (19 years ago)
Author:
kjdon
Message:

added in an exitValue/get_exit_value method to the MGPassesWrapper

Location:
trunk/indexers/mg
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/indexers/mg/java/org/greenstone/mg/MGPassesWrapper.java

    r7481 r9987  
    138138    public native boolean finish();
    139139
     140    /** get the exit value once finished */
     141    public native int exitValue();
    140142 
    141143    /** initialises field and method IDs for java side to enable access on C side */
  • trunk/indexers/mg/jni/MGPassesWrapperImpl.c

    r7631 r9987  
    234234}
    235235
    236 
     236/** get the exit value once finished */
     237JNIEXPORT jint JNICALL
     238Java_org_greenstone_mg_MGPassesWrapper_exitValue(JNIEnv *j_env,
     239                        jobject j_obj) {
     240
     241  return get_exit_value();
     242}
     243
  • trunk/indexers/mg/jni/org_greenstone_mg_MGPassesWrapper.h

    r7863 r9987  
    132132/*
    133133 * Class:     org_greenstone_mg_MGPassesWrapper
     134 * Method:    exitValue
     135 * Signature: ()I
     136 */
     137JNIEXPORT jint JNICALL Java_org_greenstone_mg_MGPassesWrapper_exitValue
     138  (JNIEnv *, jobject);
     139
     140/*
     141 * Class:     org_greenstone_mg_MGPassesWrapper
    134142 * Method:    initIDs
    135143 * Signature: ()V
  • trunk/indexers/mg/src/text/mg_passes_4jni.c

    r7630 r9987  
    8181static char *trace_name = NULL;
    8282
     83int mg_passes_exit_value = 0;
     84
    8385typedef struct pass_data
    8486  {
     
    142144  trace_name = NULL;
    143145 
    144  
     146  mg_passes_exit_value = 0;
    145147}
    146148
     
    283285{
    284286  int pass;
    285   if (!filename || *filename == '\0')
     287  if (!filename || *filename == '\0') {
     288    mg_passes_exit_value = 1;
    286289    FatalError (1, "A document collection name must be specified.");
    287 
    288   if ((Passes & (IVF_PASS_1 | IVF_PASS_2)) == (IVF_PASS_1 | IVF_PASS_2))
     290  }
     291
     292  if ((Passes & (IVF_PASS_1 | IVF_PASS_2)) == (IVF_PASS_1 | IVF_PASS_2)) {
     293    mg_passes_exit_value = 1;
    289294    FatalError (1, "I1 and I2 cannot be done simultaneously.");
    290295
    291   if ((Passes & (TEXT_PASS_1 | TEXT_PASS_2)) == (TEXT_PASS_1 | TEXT_PASS_2))
     296  }
     297  if ((Passes & (TEXT_PASS_1 | TEXT_PASS_2)) == (TEXT_PASS_1 | TEXT_PASS_2)) {
     298    mg_passes_exit_value = 1;
    292299    FatalError (1, "T1 and T2 cannot be done simultaneously.");
    293 
    294   if (!Passes)
     300  }
     301  if (!Passes) {
     302    mg_passes_exit_value = 1;
    295303    FatalError (1, "S, T1, T2, I1 or I2 must be specified.");
    296 
     304  }
    297305  if (trace)
    298306    {
     
    339347      pd->init_time.tv_usec -= ru.ru_utime.tv_usec + ru.ru_stime.tv_usec;
    340348#endif
    341       if (pd->init (filename) == COMPERROR)
     349      if (pd->init (filename) == COMPERROR) {
     350    mg_passes_exit_value = 1;
    342351    FatalError (1, "Error during init of \"%s\"", pd->name);
    343      
     352      }
    344353#ifdef HAVE_TIMES
    345354      times (&tims);
     
    464473    pd->done_time.tv_usec -= ru.ru_utime.tv_usec + ru.ru_stime.tv_usec;
    465474#endif
    466     if (pd->done (filename) == COMPERROR)
     475    if (pd->done (filename) == COMPERROR) {
     476      mg_passes_exit_value = 1;
    467477      FatalError (1, "Error during done of \"%s\"", pd->name);
    468 
     478    }
    469479#ifdef HAVE_TIMES
    470480    times (&tims);
     
    532542}
    533543
     544int get_exit_value() {
     545  return mg_passes_exit_value;
     546}
Note: See TracChangeset for help on using the changeset viewer.