include include # rdirectoryx -- print reseau table directory # This task prints the name, creation date, tracking (history) information, # and number of columns and rows for each entry in each reseau table # in the input list. # # The calls to smark and sfree appear to have no function. They are included # because the res_utils routines allocate memory using salloc, but they # never free the memory. By bracketing the rs_... calls with smark & sfree, # we deallocate memory after closing each reseau table. # # D. Giaretta, 01-Aug-1987 Original SPP version # Phil Hodge, 27-Mar-1992 Print size of grid instead of sfield info, # and allow a list of input names instead of just one. # Phil Hodge, 30-Apr-1992 Open table read-only instead of read-write. procedure t_rdirectoryx() int ilist # for list of input tables #-- pointer sp char input[SZ_FNAME] # input reseau table name char entry[SZ_R_PATTERN] # entry/pattern pointer rp # reseau file structure pointer rentp # current entry structurs pointer rs_open() # reseau file open structure pointer rs_template(), rlist # res entry template pointers int ntables # counter for number of tables int rs_readr(), rs_list() # reading res entries int clpopns(), clgfil() char datetime[SZ_R_TIME] begin ilist = clpopns ("input") call strcpy( "*", entry, SZ_R_PATTERN) # Loop over each table in list. ntables = 0 while (clgfil (ilist, input, SZ_FNAME) != EOF) { ntables = ntables + 1 if (ntables > 1) call printf ("\n") call smark (sp) # Open reseau table. iferr { rp = rs_open (input, READ_ONLY, NULL) } then { call eprintf ("%s is not a reseau table\n") call pargstr (input) call erract (EA_WARN) next } # get space for res. info call rs_alloc( rp, TY_REAL, rentp) # expand template rlist = rs_template( rp, entry) call printf ("# Directory for reseau table `%s':\n") call pargstr ( input ) call printf ( "#Entry Date Tracking ncols nrows\n") # loop over required entries while ( rs_readr( rp, rentp, "", rs_list(rlist) ) != RES_F_NONEXTENTRY) { # print the entry information call rs_cnvtime( rentp, datetime, SZ_R_TIME) call printf ( "%-16s %-24s %-12s %6d %6d\n" ) call pargstr ( RES_ENT_ENTRY(rentp) ) call pargstr ( datetime ) call pargstr ( RES_ENT_TRACKING(rentp) ) call pargi ( RES_ENT_NCOLS(rentp) ) call pargi ( RES_ENT_NROWS(rentp) ) } call flush (STDOUT) # close the table call rs_close( rp ) call sfree (sp) } call clpcls (ilist) end