5 #define rindex(X,Y) strrchr(X,Y)
6 #define index(X,Y) strchr(X,Y)
7 #define bzero(X,Y) memset(X,0,Y)
27 { node_t
*p
; p
= (node_t
*)malloc(sizeof(node_t
)) ; bzero(p
,sizeof(node_t
)); p
->node_kind
= kind
; return (p
) ; }
30 add_node_to_end ( node_t
* node
, node_t
** list
)
37 for ( p
= *list
; p
->next
!= NULL
; p
= p
->next
) ;
44 add_node_to_end_4d ( node_t
* node
, node_t
** list
)
51 for ( p
= *list
; p
->next4d
!= NULL
; p
= p
->next4d
) ;
59 show_nodelist( node_t
* p
)
61 show_nodelist1( p
, 0 ) ;
64 show_nodelist1( node_t
* p
, int indent
)
66 if ( p
== NULL
) return(0) ;
67 show_node1( p
, indent
) ;
68 show_nodelist1( p
->next
, indent
) ;
72 show_node( node_t
* p
)
74 return(show_node1(p
,0)) ;
78 show_node1( node_t
* p
, int indent
)
81 char tmp
[25] , t1
[25] , t2
[25] ;
82 char * x
, *ca
, *ld
, *ss
, *se
, *sg
;
88 if ( p
== NULL
) return(1) ;
90 if ( indent
>= 0 && indent
< 20 ) tmp
[indent
] = '\0' ;
92 // this doesn't make much sense any more, ever since node_kind was
93 // changed to a bit mask
94 if ( p
->node_kind
& RCONFIG
) nodekind
= "RCONFIG" ;
95 else if ( p
->node_kind
& I1
) nodekind
= "I1" ;
96 else if ( p
->node_kind
& FIELD
) nodekind
= "FIELD" ;
97 else if ( p
->node_kind
& FOURD
) nodekind
= "FOURD" ;
98 else if ( p
->node_kind
& MEMBER
) nodekind
= "MEMBER" ;
99 else if ( p
->node_kind
& RCONFIG
) nodekind
= "RCONFIG" ;
101 if ( !p
->scalar_array_member
)
103 switch ( p
->node_kind
)
110 fprintf(stderr
,"%s%s : %10s ndims %1d\n",tmp
,nodekind
,p
->name
, p
->ndims
) ;
111 for ( i
= 0 ; i
< p
->ndims
; i
++ )
114 switch ( p
->dims
[i
]->coord_axis
) {
115 case COORD_X
: ca
= "X" ; if ( p
->stag_x
) sg
= "*" ; break ;
116 case COORD_Y
: ca
= "Y" ; if ( p
->stag_y
) sg
= "*" ; break ;
117 case COORD_Z
: ca
= "Z" ; if ( p
->stag_z
) sg
= "*" ; break ;
118 case COORD_C
: ca
= "C" ; break ;
120 switch ( p
->dims
[i
]->len_defined_how
) {
121 case DOMAIN_STANDARD
: ld
= "STANDARD" ; ss
= "" ; se
= "" ; break ;
122 case NAMELIST
: ld
= "NAMELIST" ; ss
= p
->dims
[i
]->associated_namelist_variable
; se
="" ; break ;
123 case CONSTANT
: ld
= "CONSTANT" ; sprintf(t1
,"%d",p
->dims
[i
]->coord_start
) ; ss
= t1
;
124 sprintf(t2
,"%d",p
->dims
[i
]->coord_end
) ; se
= t2
;
127 fprintf(stderr
," dim %1d: %c %2s%s %10s %10s %10s\n",i
,p
->dims
[i
]->dim_name
,ca
,sg
,ld
,ss
,se
) ;
130 if ( strlen( p
->use
) > 0 ) {
131 nl
= 1 ; fprintf(stderr
," use: %s",p
->use
) ;
132 if ( p
->scalar_array_member
) fprintf(stderr
,"(4D)") ;
134 if ( strlen( p
->dname
) > 0 ) { nl
= 1 ; fprintf(stderr
," dname: %s",p
->dname
) ; }
135 if ( strlen( p
->descrip
) > 0 ) { nl
= 1 ; fprintf(stderr
," descrip: %s",p
->descrip
) ; }
136 if ( nl
== 1 ) fprintf(stderr
,"\n") ;
137 show_node1( p
->type
, indent
+1 ) ;
141 if ( p
->type_type
== SIMPLE
) x
= "simple" ;
142 fprintf(stderr
,"%sTYPE : %10s %s ndims %1d\n",tmp
,p
->name
,x
, p
->ndims
) ;
143 show_nodelist1( p
->fields
, indent
+1 ) ;
151 show_nodelist1( p
->members
, indent
+2 ) ;
157 set_mark ( int val
, node_t
* lst
)
160 if ( lst
== NULL
) return(0) ;
161 for ( p
= lst
; p
!= NULL
; p
= p
->next
)
164 set_mark( val
, p
->fields
) ;
165 set_mark( val
, p
->members
) ;
171 set_mark_4d ( int val
, node_t
* lst
)
174 if ( lst
== NULL
) return(0) ;
175 for ( p
= lst
; p
!= NULL
; p
= p
->next4d
)
178 set_mark( val
, p
->fields
) ;
179 set_mark( val
, p
->members
) ;