Skip to content
Snippets Groups Projects
Commit 59a7f2b5 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added cdiInqVarKeyStringPtr().

parent 949a0a3f
No related branches found
No related tags found
1 merge request!7Replaced gridDefDatatype()/gridInqDatatype() by cdiDefKeyInt()/cdiInqKeyInt()...
......@@ -4,7 +4,6 @@
#include "vlist.h"
#include "resource_unpack.h"
enum {KEY_INT = 1, KEY_FLOAT, KEY_BYTES};
static
cdi_keys_t *vlist_get_keysp(vlist_t *vlistptr, int varID)
......@@ -379,6 +378,17 @@ int cdiInqKeyString(int cdiID, int varID, int key, char *string, int *length)
return status;
}
const char *cdiInqVarKeyStringPtr(cdi_keys_t *keysp, int key)
{
cdi_key_t *keyp = find_key(keysp, key);
if ( keyp != NULL ) // key in use
{
if ( keyp->type == KEY_BYTES ) return (const char *)keyp->v.s;
}
return NULL;
}
/*
* Local Variables:
* c-file-style: "Java"
......
......@@ -22,10 +22,12 @@ typedef struct {
cdi_key_t value[MAX_KEYS];
} cdi_keys_t;
enum {KEY_INT = 1, KEY_FLOAT, KEY_BYTES};
void cdiDefVarKeyInt(cdi_keys_t *keysp, int key, int value);
void cdiDefVarKeyBytes(cdi_keys_t *keysp, int key, const unsigned char *bytes, int length);
cdi_key_t *find_key(cdi_keys_t *keysp, int key);
const char *cdiInqVarKeyStringPtr(cdi_keys_t *keysp, int key);
void cdiCopyVarKeys(cdi_keys_t *keysp, int cdiID2, int varID2);
void cdiDeleteVarKeys(cdi_keys_t *keysp);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment