reader.Close(); } // !!! ENTRIES IN THIS TABLE MUST BE SORTED BY THE FIRST FIELD !! static const CustomFormatFnTableItem LocalPrintFormats[] = { { "DATE", ATTR_Q_DATE, format_int_date, NULL }, { "JOB_COMMAND", ATTR_JOB_CMD, format_job_cmd_and_args, ATTR_JOB_DESCRIPTION "\0MATCH_EXP_" ATTR_JOB_DESCRIPTION "\0" }, { "JOB_ID", ATTR_CLUSTER_ID, format_job_id, ATTR_PROC_ID "\0" }, { "JOB_STATUS", ATTR_JOB_STATUS, format_int_job_status, ATTR_LAST_SUSPENSION_TIME "\0" ATTR_TRANSFERRING_INPUT "\0" ATTR_TRANSFERRING_OUTPUT "\0" }, { "JOB_STATUS_RAW", ATTR_JOB_STATUS, format_job_status_raw, NULL }, { "JOB_UNIVERSE", ATTR_JOB_UNIVERSE, format_job_universe, NULL }, { "READABLE_KB", ATTR_REQUEST_DISK, format_readable_kb, NULL }, { "READABLE_MB", ATTR_REQUEST_MEMORY, format_readable_mb, NULL }, { "RUNTIME", ATTR_JOB_REMOTE_WALL_CLOCK, format_utime_double, NULL }, }; static const CustomFormatFnTable LocalPrintFormatsTable = SORTED_TOKENER_TABLE(LocalPrintFormats); static int set_print_mask_from_stream( AttrListPrintMask & print_mask, std::string & constraint, const char * streamid, bool is_filename) { StringList attrs; // used for projection, which we don't currently do. std::string messages; printmask_aggregation_t aggregation; printmask_headerfooter_t headFoot = STD_HEADFOOT; std::vector<GroupByKeyInfo> group_by_keys; SimpleInputStream * pstream = NULL; FILE *file = NULL;
#define KW(a) { #a, kw_##a, 0 } static const Keyword SelectKeywordItems[] = { KW(AS), KW(AUTO), KW(LEFT), KW(NOPREFIX), KW(NOSUFFIX), KW(PRINTAS), KW(PRINTF), KW(RIGHT), KW(TRUNCATE), KW(WIDTH), }; #undef KW static const KeywordTable SelectKeywords = SORTED_TOKENER_TABLE(SelectKeywordItems); enum { gw_AS=1, gw_ASCENDING, gw_DECENDING, }; #define GW(a) { #a, gw_##a, 0 } static const Keyword GroupKeywordItems[] = { GW(AS), GW(ASCENDING), GW(DECENDING), }; #undef KW static const KeywordTable GroupKeywords = SORTED_TOKENER_TABLE(GroupKeywordItems);
TBLITEM(bar,4), TBLITEM(BAZ,5), TBLITEM(AAA,6), }; static const UnsortedTestTable UnTestTbl = UNSORTED_TOKENER_TABLE(UnsortedTestItems); static const TestTableItem SortedTestItems[] = { TBLITEM(AAA,0), TBLITEM(BAZ,1), TBLITEM(CCC,2), TBLITEM(aaa,3), TBLITEM(bar,4), TBLITEM(bbb,5), TBLITEM(foo,6), }; static const SortedTestTable TestTbl = SORTED_TOKENER_TABLE(SortedTestItems); static bool test_unsorted_table() { emit_test("Test UNSORTED_TOKENER_TABLE"); MyString msg; for (size_t ii = 0; ii < TestTbl.cItems; ++ii) { const char * key = TestTbl.pTable[ii].key; const TestTableItem * tti = UnTestTbl.lookup(key); if ( ! tti) { emit_step_failure(__LINE__, msg.formatstr("lookup('%s') returned NULL", key)); continue; } if (tti->id != TestTbl.pTable[ii].id) { emit_step_failure(__LINE__, msg.formatstr("lookup('%s') returned '%s'", key, tti->key));