Index: branches/czw_branch/20110406/ippTools/src/laptool.c
===================================================================
--- branches/czw_branch/20110406/ippTools/src/laptool.c	(revision 31396)
+++ branches/czw_branch/20110406/ippTools/src/laptool.c	(revision 31397)
@@ -15,4 +15,8 @@
 #include "laptool.h"
 
+
+// Sequence level
+static bool definesequenceMode(pxConfig *config);
+static bool listsequenceMode(pxConfig *config);
 
 // Run level
@@ -21,9 +25,10 @@
 static bool updaterunMode(pxConfig *config);
 // Exposure level
-static bool pendingchipexpMode(pxConfig *config);
-static bool pendingquickstackMode(pxConfig *config);
-static bool pendingdiffMode(pxConfig *config);
-static bool pendingfinalstackMode(pxConfig *config);
+static bool pendingexpMode(pxConfig *config);
+static bool exposuresMode(pxConfig *config);
+static bool stacksMode(pxConfig *config);
 static bool updateexpMode(pxConfig *config);
+
+static bool inactiveexpMode(pxConfig *config);
 
 # define MODECASE(caseName, func) \
@@ -105,5 +110,5 @@
       psError(PS_ERR_UNKNOWN, false, "database error");
     }
-    psError(PS_ERR_UNKNOWN, false "database error");
+    psError(PS_ERR_UNKNOWN, false, "database error");
     psFree(run);
     return(true);
@@ -140,5 +145,5 @@
   psString query = pxDataGet("laptool_listsequence.sql");
   if (!query) {
-    psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement");
+    psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement");
     return false;
   }
@@ -151,5 +156,5 @@
   if (limit) {
     psString limitString = psDBGenerateLimitSQL(limit);
-    psStringAppend(&query, " %s" limitString);
+    psStringAppend(&query, " %s", limitString);
     psFree(limitString);
   }
@@ -209,4 +214,5 @@
   PXOPT_LOOKUP_STR(label,           config->args, "-label",           false, false);
   PXOPT_LOOKUP_STR(dist_group,      config->args, "-dist_group",      false, false);
+  PXOPT_LOOKUP_BOOL(simple,         config->args, "-simple",          false);
 
   lapRunRow *run = lapRunRowAlloc(0, // lap_id
@@ -220,6 +226,6 @@
 				  NULL, // registered
 				  0,    // fault
-				  NULL, // quick_sass_id
-				  NULL, // final_sass_id
+				  0,    // quick_sass_id
+				  0     // final_sass_id
 				  );
   if (!run) {
@@ -233,9 +239,9 @@
   }
 
-  if (!lapSequenceInsertObject(config->dbh, run)) {
+  if (!lapRunInsertObject(config->dbh, run)) {
     if (!psDBRollback(config->dbh)) {
       psError(PS_ERR_UNKNOWN, false, "database error");
     }
-    psError(PS_ERR_UNKNOWN, false "database error");
+    psError(PS_ERR_UNKNOWN, false, "database error");
     psFree(run);
     return(true);
@@ -248,5 +254,5 @@
   }
 
-  if (lapSequencePrintObject(stdout, run, !simple)) {
+  if (lapRunPrintObject(stdout, run, !simple)) {
     psError(PS_ERR_UNKNOWN, false, "failed to print object");
     psFree(run);
@@ -259,5 +265,5 @@
   psString query = pxDataGet("laptool_definerun.sql");
   if (!query) {
-    psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement");
+    psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement");
     return(false);
   }
@@ -292,9 +298,8 @@
   for (long i = 0; i < output->n; i++) {
     psMetadata *row = output->data[i]; // Row from select
-    bool status;
-    lapExpRow *reExp = lapExpObjectFromMetadata(row);
-    reExp->lap_id = lap_id;
-
-    if (!lapExpInsertObject(config->dbh,reExp)) {
+    lapExpRow *lapExp = lapExpObjectFromMetadata(row);
+    lapExp->lap_id = lap_id;
+
+    if (!lapExpInsertObject(config->dbh,lapExp)) {
       if (!psDBRollback(config->dbh)) {
 	psError(PS_ERR_UNKNOWN, false, "database error");
@@ -302,5 +307,5 @@
       psError(PS_ERR_UNKNOWN, false, "database error");
       psFree(output);
-      psFree(reExp);
+      psFree(lapExp);
       return(false);
     }
@@ -328,5 +333,5 @@
   psString query = pxDataGet("laptool_pendingrun.sql");
   if (!query) {
-    psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement");
+    psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement");
     return false;
   }
@@ -433,5 +438,5 @@
   psString query = pxDataGet("laptool_pendingexp.sql");
   if (!query) {
-    psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement");
+    psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement");
     return false;
   }
@@ -444,5 +449,5 @@
   if (limit) {
     psString limitString = psDBGenerateLimitSQL(limit);
-    psStringAppend(&query, " %s" limitString);
+    psStringAppend(&query, " %s", limitString);
     psFree(limitString);
   }
@@ -500,5 +505,5 @@
   psString query = pxDataGet("laptool_exposures.sql");
   if (!query) {
-    psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement");
+    psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement");
     return(false);
   }
@@ -557,5 +562,5 @@
   psString query = pxDataGet("laptool_stacks.sql");
   if (!query) {
-    psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement");
+    psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement");
     return(false);
   }
@@ -614,10 +619,10 @@
   PXOPT_LOOKUP_S64(set_chip_id, config->args, "-set_chip_id", false, false);
   PXOPT_LOOKUP_S64(set_pair_id, config->args, "-set_pair_id", false, false);
-  PXOPT_LOOKUP_BOOL(private,    config->args, "-private",     false, false);
-  PXOPT_LOOKUP_BOOL(public,     config->args, "-public",      false, false);
-  PXOPT_LOOKUP_BOOL(pairwise,   config->args, "-pairwise",    false, false);
-  PXOPT_LOOKUP_BOOL(nopairwise, config->args, "-nopairwise",  false, false);
-  PXOPT_LOOKUP_BOOL(active,     config->args, "-active",      false, false);
-  PXOPT_LOOKUP_BOOL(inactive,   config->args, "-inactive",    false, false);
+  PXOPT_LOOKUP_BOOL(private,    config->args, "-private",     false);
+  PXOPT_LOOKUP_BOOL(public,     config->args, "-public",      false);
+  PXOPT_LOOKUP_BOOL(pairwise,   config->args, "-pairwise",    false);
+  PXOPT_LOOKUP_BOOL(nopairwise, config->args, "-nopairwise",  false);
+  PXOPT_LOOKUP_BOOL(active,     config->args, "-active",      false);
+  PXOPT_LOOKUP_BOOL(inactive,   config->args, "-inactive",    false);
 
 
@@ -632,5 +637,4 @@
   }
 
-  psMetadata *where = psMetadataAlloc();
   PXOPT_COPY_S64(config->args, where, "-lap_id", "lap_id", "==");
   PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
@@ -687,5 +691,5 @@
   psString query = pxDataGet("laptool_inactiveexp.sql");
   if (!query) {
-    psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement");
+    psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement");
     return(false);
   }
Index: branches/czw_branch/20110406/ippTools/src/laptoolConfig.c
===================================================================
--- branches/czw_branch/20110406/ippTools/src/laptoolConfig.c	(revision 31396)
+++ branches/czw_branch/20110406/ippTools/src/laptoolConfig.c	(revision 31397)
@@ -12,5 +12,5 @@
 #include <psmodules.h>
 #include "pxtools.h"
-#include "regtool.h"
+#include "laptool.h"
 
 #define ADD_OPT(TYPE,TARG,NAME,COMMENT,DEFAULT) psMetadataAdd##TYPE(TARG, PS_LIST_TAIL, NAME, 0, COMMENT, DEFAULT)
@@ -74,6 +74,6 @@
   ADD_OPT(S16, updaterunArgs, "-fault",                       "set fault code", INT16_MAX);
   ADD_OPT(Str, updaterunArgs, "-set_label",                   "set label", NULL);
-  ADD_OPT(S64, updaterunArgs, "-set_quick_sass_id",           "set quick stack sass_id", NAN);
-  ADD_OPT(S64, updaterunArgs, "-set_final_sass_id",           "set final stack sass_id", NAN);
+  ADD_OPT(S64, updaterunArgs, "-set_quick_sass_id",           "set quick stack sass_id", 0);
+  ADD_OPT(S64, updaterunArgs, "-set_final_sass_id",           "set final stack sass_id", 0);
   
   
