Commit dbc2c02b authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

renamed: namelist.c -> nml.c.

parent 7c34f056
......@@ -86,8 +86,8 @@ libcdo_la_SOURCES = \
merge_sort2.h \
modules.c \
modules.h \
namelist.c \
namelist.h \
nml.c \
nml.h \
normal.c \
nth_element.c \
nth_element.h \
......
......@@ -124,7 +124,7 @@ am_libcdo_la_OBJECTS = libcdo_la-cdo_pthread.lo libcdo_la-cdo_vlist.lo \
libcdo_la-interpol.lo libcdo_la-job.lo libcdo_la-juldate.lo \
libcdo_la-grid_search.lo libcdo_la-listarray.lo \
libcdo_la-list.lo libcdo_la-merge_sort2.lo \
libcdo_la-modules.lo libcdo_la-namelist.lo libcdo_la-normal.lo \
libcdo_la-modules.lo libcdo_la-nml.lo libcdo_la-normal.lo \
libcdo_la-nth_element.lo libcdo_la-par_io.lo \
libcdo_la-parse_cmor_table.lo libcdo_la-percentiles_hist.lo \
libcdo_la-percentiles.lo libcdo_la-pipe.lo libcdo_la-pml.lo \
......@@ -514,22 +514,22 @@ libcdo_la_SOURCES = cdo_int.h compare.h cdo_pthread.c cdo_vlist.c \
griddes_nc.c hetaeta.c hetaeta.h institution.c interpol.c \
interpol.h job.c juldate.c grid_search.c grid_search.h \
listarray.c listarray.h list.c list.h merge_sort2.c \
merge_sort2.h modules.c modules.h namelist.c namelist.h \
normal.c nth_element.c nth_element.h operator_help.h par_io.c \
par_io.h parse_cmor_table.c percentiles_hist.c \
percentiles_hist.h percentiles.c percentiles.h pipe.c pipe.h \
pml.c pml.h pmlist.c pmlist.h pragma_omp_atomic_update.h \
printinfo.h process.c process.h pstream.c pstream.h \
pstream_write.h pstream_int.h pthread_debug.c pthread_debug.h \
readline.c realtime.c remap.h remaplib.c remapsort.c \
remap_scrip_io.c remap_search_reg2d.c remap_search_latbins.c \
remap_store_link.c remap_store_link.h remap_store_link_cnsrv.c \
remap_store_link_cnsrv.h remap_conserv.c remap_conserv_scrip.c \
remap_distwgt.c remap_bicubic_scrip.c remap_bilinear_scrip.c \
stdnametable.c stdnametable.h specspace.c specspace.h \
statistic.c statistic.h table.c text.c text.h timebase.h \
timer.c userlog.c uthash.h util.c util.h zaxis.c json/jsmn.h \
json/jsmn.c kdtreelib/kdtree.h kdtreelib/kdtree_cartesian.c \
merge_sort2.h modules.c modules.h nml.c nml.h normal.c \
nth_element.c nth_element.h operator_help.h par_io.c par_io.h \
parse_cmor_table.c percentiles_hist.c percentiles_hist.h \
percentiles.c percentiles.h pipe.c pipe.h pml.c pml.h pmlist.c \
pmlist.h pragma_omp_atomic_update.h printinfo.h process.c \
process.h pstream.c pstream.h pstream_write.h pstream_int.h \
pthread_debug.c pthread_debug.h readline.c realtime.c remap.h \
remaplib.c remapsort.c remap_scrip_io.c remap_search_reg2d.c \
remap_search_latbins.c remap_store_link.c remap_store_link.h \
remap_store_link_cnsrv.c remap_store_link_cnsrv.h \
remap_conserv.c remap_conserv_scrip.c remap_distwgt.c \
remap_bicubic_scrip.c remap_bilinear_scrip.c stdnametable.c \
stdnametable.h specspace.c specspace.h statistic.c statistic.h \
table.c text.c text.h timebase.h timer.c userlog.c uthash.h \
util.c util.h zaxis.c json/jsmn.h json/jsmn.c \
kdtreelib/kdtree.h kdtreelib/kdtree_cartesian.c \
kdtreelib/kdtree_common.c kdtreelib/kdtree_spherical.c \
kdtreelib/qsort.c kdtreelib/pmergesort.c kdtreelib/pqueue.c \
kdtreelib/pqueue.h clipping/clipping.c clipping/clipping.h \
......@@ -1038,7 +1038,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-listarray.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-merge_sort2.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-modules.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-namelist.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-nml.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-normal.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-nth_element.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-par_io.Plo@am__quote@
......@@ -1455,12 +1455,12 @@ libcdo_la-modules.lo: modules.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdo_la-modules.lo `test -f 'modules.c' || echo '$(srcdir)/'`modules.c
libcdo_la-namelist.lo: namelist.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdo_la-namelist.lo -MD -MP -MF $(DEPDIR)/libcdo_la-namelist.Tpo -c -o libcdo_la-namelist.lo `test -f 'namelist.c' || echo '$(srcdir)/'`namelist.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcdo_la-namelist.Tpo $(DEPDIR)/libcdo_la-namelist.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='namelist.c' object='libcdo_la-namelist.lo' libtool=yes @AMDEPBACKSLASH@
libcdo_la-nml.lo: nml.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdo_la-nml.lo -MD -MP -MF $(DEPDIR)/libcdo_la-nml.Tpo -c -o libcdo_la-nml.lo `test -f 'nml.c' || echo '$(srcdir)/'`nml.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcdo_la-nml.Tpo $(DEPDIR)/libcdo_la-nml.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nml.c' object='libcdo_la-nml.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdo_la-namelist.lo `test -f 'namelist.c' || echo '$(srcdir)/'`namelist.c
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdo_la-nml.lo `test -f 'nml.c' || echo '$(srcdir)/'`nml.c
libcdo_la-normal.lo: normal.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdo_la-normal.lo -MD -MP -MF $(DEPDIR)/libcdo_la-normal.Tpo -c -o libcdo_la-normal.lo `test -f 'normal.c' || echo '$(srcdir)/'`normal.c
......
......@@ -23,7 +23,7 @@
#include "cdo.h"
#include "cdo_int.h"
#include "namelist.h"
#include "nml.h"
void *Nmltest(void *argument)
......
......@@ -43,7 +43,7 @@
#include "cdo_int.h"
#include "pstream.h"
#include "util.h"
#include "namelist.h"
#include "nml.h"
int stringToParam(const char *paramstr);
......
......@@ -16,7 +16,7 @@
*/
#include "cdo_int.h"
#include "namelist.h"
#include "nml.h"
#ifndef strdupx
......
......@@ -6,13 +6,13 @@
#include <sys/stat.h>
typedef enum {
enum namelisttype {
NAMELIST_UNDEFINED = 0,
NAMELIST_OBJECT = 1,
NAMELIST_KEY = 2,
NAMELIST_STRING = 3,
NAMELIST_WORD = 4
} namelisttype_t;
};
enum namelisterr {
......@@ -26,7 +26,7 @@ enum namelisterr {
// NAMELIST token description.
typedef struct {
namelisttype_t type; // type (object, key, string word)
int type; // type (object, key, string word)
int start; // start position in NAMELIST buffer
int end; // end position in NAMELIST buffer
} namelisttok_t;
......@@ -94,7 +94,7 @@ namelisttok_t *namelist_alloc_token(namelist_parser *parser)
// Fills token type and boundaries.
static
void namelist_fill_token(namelisttok_t *token, namelisttype_t type, int start, int end)
void namelist_fill_token(namelisttok_t *token, int type, int start, int end)
{
token->type = type;
token->start = start;
......@@ -207,15 +207,15 @@ int namelist_parse_string(namelist_parser *parser, const char *buf, size_t len)
static
int namelist_check_keyname(const char *buf, namelisttok_t *t)
{
switch ((int)(t->type))
switch (t->type)
{
case (int)NAMELIST_STRING:
case NAMELIST_STRING:
while ( isspace((int) buf[t->start]) && t->start < t->end ) t->start++;
while ( isspace((int) buf[t->end-1]) && t->start < t->end ) t->end--;
if ( (t->end - t->start) < 1 ) return NAMELIST_ERROR_EMKEY;
for ( int i = t->start; i < t->end; ++i )
if ( isspace((int)buf[i]) ) return NAMELIST_ERROR_INKEY;
case (int)NAMELIST_WORD:
case NAMELIST_WORD:
t->type = NAMELIST_KEY;
break;
default:
......@@ -367,12 +367,19 @@ int main(int argc, char *argv[])
int status = namelist_parse(p, buffer, filesize);
printf("Processed number of lines: %d\n", p->lineno-1);
if ( status == NAMELIST_ERROR_INVAL ) fprintf(stderr, "Namelist error: Invalid character in %s (line=%d character='%c')!\n", filename, p->lineno, buffer[p->pos]);
if ( status == NAMELIST_ERROR_PART ) fprintf(stderr, "Namelist error: End of string not found in %s (line=%d)!\n", filename, p->lineno);
if ( status == NAMELIST_ERROR_INKEY ) fprintf(stderr, "Namelist error: Invalid key word in %s (line=%d)!\n", filename, p->lineno);
if ( status == NAMELIST_ERROR_INTYP ) fprintf(stderr, "Namelist error: Invalid key word type in %s (line=%d)!\n", filename, p->lineno);
if ( status == NAMELIST_ERROR_INOBJ ) fprintf(stderr, "Namelist error: Invalid object in %s (line=%d)!\n", filename, p->lineno);
if ( status == NAMELIST_ERROR_EMKEY ) fprintf(stderr, "Namelsit error: Emtry key name in %s (line=%d)!\n", filename, p->lineno);
if ( status != 0 )
{
switch (status)
{
case NAMELIST_ERROR_INVAL: fprintf(stderr, "Namelist error: Invalid character in %s (line=%d character='%c')!\n", filename, p->lineno, buffer[p->pos]); break;
case NAMELIST_ERROR_PART: fprintf(stderr, "Namelist error: End of string not found in %s (line=%d)!\n", filename, p->lineno); break;
case NAMELIST_ERROR_INKEY: fprintf(stderr, "Namelist error: Invalid key word in %s (line=%d)!\n", filename, p->lineno); break;
case NAMELIST_ERROR_INTYP: fprintf(stderr, "Namelist error: Invalid key word type in %s (line=%d)!\n", filename, p->lineno); break;
case NAMELIST_ERROR_INOBJ: fprintf(stderr, "Namelist error: Invalid object in %s (line=%d)!\n", filename, p->lineno); break;
case NAMELIST_ERROR_EMKEY: fprintf(stderr, "Namelsit error: Emtry key name in %s (line=%d)!\n", filename, p->lineno); break;
default: fprintf(stderr, "Namelsit error in %s (line=%d)!\n", filename, p->lineno); break;
}
}
namelist_dump(p, buffer);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment