本文整理汇总了C++中HDstrcmp函数的典型用法代码示例。如果您正苦于以下问题:C++ HDstrcmp函数的具体用法?C++ HDstrcmp怎么用?C++ HDstrcmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HDstrcmp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: h5trav_getindex
ssize_t
h5trav_getindex(const trav_info_t *info, const char *obj)
{
size_t u; /* Local index variable */
/* Loop over all paths in 'info' struct, looking for object */
for(u = 0; u < info->nused; u++) {
/* Check for object name having full path (with leading '/') */
if(HDstrcmp(obj, info->paths[u].path) == 0)
return((ssize_t)u);
/* Check for object name without leading '/' */
if(HDstrcmp(obj, (info->paths[u].path + 1)) == 0)
return((ssize_t)u);
} /* end for */
return((ssize_t)-1);
} /* end h5trav_getindex() */
开发者ID:ihutch,项目名称:sceptic3D,代码行数:18,代码来源:h5trav.c
示例2: hrepack_addcomp
int hrepack_addcomp(const char* str,
options_t *options)
{
obj_list_t *obj_list=NULL; /*one object list for the -t and -c option entry */
comp_info_t comp; /*compression info for the current -t option entry */
int n_objs; /*number of objects in the current -t or -c option entry */
int i;
if (options->all_comp==1){
printf("Error: Invalid compression input: '*' is present with other objects <%s>\n",str);
return FAIL;
}
/* initialize parse struct to FAIL */
HDmemset(&comp,FAIL,sizeof(comp_info_t));
/* parse the -t option */
if ((obj_list = parse_comp(str,&n_objs,&comp)) == NULL)
return FAIL;
/* searh for the "*" all objects character */
for (i = 0; i < n_objs; i++)
{
if (HDstrcmp("*",obj_list[i].obj)==0)
{
/* if we are compressing all set the global comp type */
options->all_comp=1;
options->comp_g=comp;
}
}
if (i>1 && options->all_comp==1)
{
printf("\nError: '*' cannot be with other objects, <%s>. Exiting...\n",str);
goto out;
}
if (options->all_comp==0)
{
if (options_add_comp(obj_list,n_objs,comp,options->op_tbl)<0)
goto out;
}
HDfree(obj_list);
return SUCCEED;
out:
HDfree(obj_list);
return FAIL;
}
开发者ID:Higginbottom,项目名称:zeus_python,代码行数:56,代码来源:hrepack.c
示例3: long_desc_cb
/*-------------------------------------------------------------------------
* Function: long_desc_cb
*
* Purpose: Callback function to help test long description handling
*
* Return: Success: 0
*
* Failure: -1
*
* Programmer: Quincey Koziol
* January 19, 2005
*
*-------------------------------------------------------------------------
*/
static herr_t
long_desc_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *client_data)
{
char *real_desc = (char *)client_data;
if(err_desc->desc != NULL && HDstrcmp(err_desc->desc, real_desc) == 0)
return(0);
else
return(-1);
} /* end long_desc_cb() */
开发者ID:adasworks,项目名称:hdf5,代码行数:24,代码来源:error_test.c
示例4: hrepack_addchunk
int hrepack_addchunk(const char* str,
options_t *options)
{
obj_list_t *obj_list=NULL; /*one object list for the -t and -c option entry */
int n_objs; /*number of objects in the current -t or -c option entry */
int32 chunk_lengths[H4_MAX_VAR_DIMS]; /* chunk lengths along each dimension */
int chunk_rank; /*global rank for chunks */
int i, j;
if (options->all_chunk==1){
printf("Error: Invalid chunking input: '*' is present with other objects <%s>\n",str);
return FAIL;
}
/* parse the -c option */
if ((obj_list = parse_chunk(str,&n_objs,chunk_lengths,&chunk_rank)) == NULL)
return FAIL;
/* searh for the "*" all objects character */
for (i = 0; i < n_objs; i++)
{
if (HDstrcmp("*",obj_list[i].obj)==0)
{
/* if we are chunking all set the global chunking type */
options->all_chunk=1;
options->chunk_g.rank=chunk_rank;
for (j = 0; j < chunk_rank; j++)
options->chunk_g.chunk_lengths[j] = chunk_lengths[j];
}
}
if (i>1)
{
printf("\nError: '*' cannot be with other objects, <%s>. Exiting...\n",str);
goto out;
}
if (options->all_chunk==0)
{
if (options_add_chunk(obj_list,n_objs,chunk_lengths,chunk_rank,options->op_tbl)<0)
goto out;
}
HDfree(obj_list);
return SUCCEED;
out:
HDfree(obj_list);
return FAIL;
}
开发者ID:Higginbottom,项目名称:zeus_python,代码行数:55,代码来源:hrepack.c
示例5: main
/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: h5repack main program
*
* Return: Success: EXIT_SUCCESS(0)
*
* Failure: EXIT_FAILURE(1)
*
* Programmer: Pedro Vicente, [email protected]
*
* Date: May 9, 2003
*
* Comments:
*
*-------------------------------------------------------------------------
*/
int main(int argc, const char **argv) {
pack_opt_t options; /*the global options */
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
/* Initialize h5tools lib */
h5tools_init();
/* update hyperslab buffer size from H5TOOLS_BUFSIZE env if exist */
if (h5tools_getenv_update_hyperslab_bufsize() < 0) {
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* initialize options */
h5repack_init(&options, 0);
if (parse_command_line(argc, argv, &options) < 0)
goto done;
/* get file names if they were not yet got */
if (has_i_o == 0) {
if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) {
infile = argv[opt_ind];
outfile = argv[opt_ind + 1];
if ( HDstrcmp( infile, outfile ) == 0) {
error_msg("file names cannot be the same\n");
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
}
else {
error_msg("file names missing\n");
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
}
/* pack it */
h5tools_setstatus(h5repack(infile, outfile, &options));
done:
/* free tables */
h5repack_end(&options);
leave(h5tools_getstatus());
return 0;
}
开发者ID:lsubigdata,项目名称:hdf5ssh,代码行数:72,代码来源:h5repack_main.c
示例6: main
/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: h5repack main program
*
* Return: Success: EXIT_SUCCESS(0)
*
* Failure: EXIT_FAILURE(1)
*
* Programmer: Pedro Vicente, [email protected]
*
* Date: May 9, 2003
*
* Comments:
*
*-------------------------------------------------------------------------
*/
int main(int argc, const char **argv)
{
pack_opt_t options; /*the global options */
int ret=-1;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
/* Initialize h5tools lib */
h5tools_init();
/* initialize options */
h5repack_init(&options,0);
parse_command_line(argc, argv, &options);
/* get file names if they were not yet got */
if ( has_i_o == 0 )
{
if ( argv[ opt_ind ] != NULL && argv[ opt_ind + 1 ] != NULL )
{
infile = argv[ opt_ind ];
outfile = argv[ opt_ind + 1 ];
if ( HDstrcmp( infile, outfile ) == 0 )
{
error_msg("file names cannot be the same\n");
usage(h5tools_getprogname());
HDexit(EXIT_FAILURE);
}
}
else
{
error_msg("file names missing\n");
usage(h5tools_getprogname());
HDexit(EXIT_FAILURE);
}
}
/* pack it */
ret=h5repack(infile,outfile,&options);
/* free tables */
h5repack_end(&options);
if (ret==-1)
return 1;
else
return 0;
}
开发者ID:ArielleBassanelli,项目名称:gempak,代码行数:72,代码来源:h5repack_main.c
示例7: SetTest
/*
* Set (control) which test will be tested.
* SKIPTEST: skip this test
* ONLYTEST: do only this test
* BEGINETEST: skip all tests before this test
*
*/
void SetTest(const char *testname, int action)
{
int Loop;
switch (action){
case SKIPTEST:
for (Loop = 0; Loop < Index; Loop++)
if (HDstrcmp(testname, Test[Loop].Name) == 0){
Test[Loop].SkipFlag = 1;
break;
}
break;
case BEGINTEST:
for (Loop = 0; Loop < Index; Loop++) {
if (HDstrcmp(testname, Test[Loop].Name) != 0)
Test[Loop].SkipFlag = 1;
else{
/* Found it. Set it to run. Done. */
Test[Loop].SkipFlag = 0;
break;
}
}
break;
case ONLYTEST:
for (Loop = 0; Loop < Index; Loop++) {
if (HDstrcmp(testname, Test[Loop].Name) != 0)
Test[Loop].SkipFlag = 1;
else {
/* Found it. Set it to run. Break to skip the rest. */
Test[Loop].SkipFlag = 0;
break;
}
}
/* skip the rest */
while (++Loop < Index)
Test[Loop].SkipFlag = 1;
break;
default:
/* error */
printf("*** ERROR: Unknown action (%d) for SetTest\n", action);
break;
}
}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:49,代码来源:testframe.c
示例8: cmp_par
/*-------------------------------------------------------------------------
* function that compares one particle
* Comparing floating point should be safe here; HDF5 should store the
* fields verbatim and not lose any bits. -JML
*-------------------------------------------------------------------------
*/
static int cmp_par(size_t i, size_t j, particle_t *rbuf, particle_t *wbuf )
{
if ( ( HDstrcmp( rbuf[i].name, wbuf[j].name ) != 0 ) ||
rbuf[i].lati != wbuf[j].lati ||
rbuf[i].longi != wbuf[j].longi ||
!FLT_ABS_EQUAL(rbuf[i].pressure,wbuf[j].pressure) ||
!DBL_ABS_EQUAL(rbuf[i].temperature,wbuf[j].temperature) ) {
return -1;
}
return 0;
}
开发者ID:quinoacomputing,项目名称:HDF5,代码行数:17,代码来源:test_packet.c
示例9: main
/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Part 2 of a two-part H5Fflush() test.
*
* Return: Success: 0
*
* Failure: 1
*
* Programmer: Robb Matzke
* Friday, October 23, 1998
*
* Modifications:
* Leon Arber
* Sept. 26, 2006, expand to check for case where the was file not flushed.
*
*-------------------------------------------------------------------------
*/
int
main(int argc, char* argv[])
{
hid_t fapl1, fapl2;
H5E_auto2_t func;
char name[1024];
const char *envval = NULL;
int mpi_size, mpi_rank;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
MPI_Init(&argc, &argv);
MPI_Comm_size(comm, &mpi_size);
MPI_Comm_rank(comm, &mpi_rank);
fapl1 = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_mpio(fapl1, comm, info);
fapl2 = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_mpio(fapl2, comm, info);
if(mpi_rank == 0)
TESTING("H5Fflush (part2 with flush)");
/* Don't run this test using the core or split file drivers */
envval = HDgetenv("HDF5_DRIVER");
if (envval == NULL)
envval = "nomatch";
if (HDstrcmp(envval, "core") && HDstrcmp(envval, "split")) {
/* Check the case where the file was flushed */
h5_fixname(FILENAME[0], fapl1, name, sizeof name);
if(check_file(name, fapl1))
{
H5_FAILED()
goto error;
}
else if(mpi_rank == 0)
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:58,代码来源:t_pflush2.c
示例10: symlink_is_visited
/*-------------------------------------------------------------------------
* Function: symlink_is_visited
*
* Purpose: Check if an symbolic link has already been visited
*
* Return: TRUE/FALSE
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE hbool_t
symlink_is_visited(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path)
{
size_t u; /* Local index variable */
/* Look for symlink */
for(u = 0; u < visited->nused; u++) {
/* Check for symlink values already in array */
/* check type and path pair to distingush between symbolic links */
if((visited->objs[u].type == type) && !HDstrcmp(visited->objs[u].path, path)) {
/* if external link, file need to be matched as well */
if(visited->objs[u].type == H5L_TYPE_EXTERNAL)
if(!HDstrcmp(visited->objs[u].file, file))
return(TRUE);
return (TRUE);
} /* end if */
} /* end for */
/* Didn't find symlink */
return(FALSE);
} /* end symlink_is_visited() */
开发者ID:GATB,项目名称:gatb-core,代码行数:30,代码来源:h5trav.c
示例11: DFPputpal
/*--------------------------------------------------------------------------
NAME
DFPputpal -- Write palette to file
USAGE
intn DFPputpal(filename,palette,overwrite,filemode)
char *filename; IN: name of HDF file
void * palette; IN: ptr to the buffer retrieve the palette from
intn overwrite; IN: whether to (1) overwrite last palette written,
or (0) write it as a fresh palette
char *filemode; IN: if "a" append palette to file, "w" create
new file
RETURNS
SUCCEED on success, FAIL on failure.
DESCRIPTION
Stores a palette in an HDF file, with options for creating new file or appending,
and overwriting last palette written.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
To overwrite, the filename must be the same as for the previous call.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
intn
DFPputpal(const char *filename, const void * palette, intn overwrite, const char *filemode)
{
CONSTR(FUNC, "DFPputpal");
int32 file_id;
intn ret_value = SUCCEED;
HEclear();
if (!palette)
HGOTO_ERROR(DFE_ARGS, FAIL);
if (overwrite && HDstrcmp(filename, Lastfile))
HGOTO_ERROR(DFE_BADCALL, FAIL);
file_id = DFPIopen(filename, (*filemode == 'w') ? DFACC_CREATE : DFACC_WRITE);
if (file_id == FAIL)
HGOTO_ERROR(DFE_BADOPEN, FAIL);
/* if we want to overwrite, Lastref is the ref to write. If not, if
Writeref is set, we use that ref. If not we get a fresh ref. The
ref to write is placed in Lastref */
if (!overwrite)
Lastref = (uint16) (Writeref ? Writeref : Htagnewref(file_id,DFTAG_IP8));
if (Lastref == 0)
HGOTO_ERROR(DFE_NOREF, FAIL);
Writeref = 0; /* don't know ref to write after this */
/* write out palette */
if (Hputelement(file_id, DFTAG_IP8, Lastref, (const uint8 *) palette, (int32) 768) < 0)
{
ret_value = (HDerr(file_id));
goto done;
}
/* Check for the tag/ref before creating it willy-nilly */
if(Hexist(file_id,DFTAG_LUT,Lastref)==FAIL)
Hdupdd(file_id, DFTAG_LUT, Lastref, DFTAG_IP8, Lastref);
ret_value = (Hclose(file_id));
done:
if(ret_value == FAIL)
{ /* Error condition cleanup */
} /* end if */
/* Normal function cleanup */
return ret_value;
} /* end DFPputpal() */
开发者ID:schwehr,项目名称:hdf4,代码行数:73,代码来源:dfp.c
示例12: test_vl_string
/*
* test_vl_string
* Tests variable-length string datatype with UTF-8 strings.
*/
void test_vl_string(hid_t fid, const char *string)
{
hid_t type_id, space_id, dset_id;
hsize_t dims = 1;
hsize_t size; /* Number of bytes used */
char *read_buf[1];
herr_t ret;
/* Create dataspace for datasets */
space_id = H5Screate_simple(RANK, &dims, NULL);
CHECK(space_id, FAIL, "H5Screate_simple");
/* Create a datatype to refer to */
type_id = H5Tcopy(H5T_C_S1);
CHECK(type_id, FAIL, "H5Tcopy");
ret = H5Tset_size(type_id, H5T_VARIABLE);
CHECK(ret, FAIL, "H5Tset_size");
/* Create a dataset */
dset_id = H5Dcreate2(fid, VL_DSET1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dcreate2");
/* Write dataset to disk */
ret = H5Dwrite(dset_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &string);
CHECK(ret, FAIL, "H5Dwrite");
/* Make certain the correct amount of memory will be used */
ret = H5Dvlen_get_buf_size(dset_id, type_id, space_id, &size);
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
VERIFY(size, (hsize_t)HDstrlen(string) + 1, "H5Dvlen_get_buf_size");
/* Read dataset from disk */
ret = H5Dread(dset_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read in */
VERIFY(HDstrcmp(string, read_buf[0]), 0, "strcmp");
/* Reclaim the read VL data */
ret = H5Dvlen_reclaim(type_id, space_id, H5P_DEFAULT, read_buf);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Close all */
ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
ret = H5Tclose(type_id);
CHECK(ret, FAIL, "H5Tclose");
ret = H5Sclose(space_id);
CHECK(ret, FAIL, "H5Sclose");
}
开发者ID:Hulalazz,项目名称:rnnlib,代码行数:54,代码来源:tunicode.c
示例13: trav_fileinfo_add
/*-------------------------------------------------------------------------
* Function: trav_fileinfo_add
*
* Purpose: Add a file addr & fileno to info struct
*
* Return: void
*
*-------------------------------------------------------------------------
*/
void
trav_fileinfo_add(trav_info_t *info, hid_t loc_id)
{
H5O_info_t oinfo;
size_t idx = info->nused - 1;
if ( info->paths[idx].path && HDstrcmp(info->paths[idx].path, "."))
H5Oget_info_by_name(loc_id, info->paths[idx].path, &oinfo, H5P_DEFAULT);
else
H5Oget_info(loc_id, &oinfo);
info->paths[idx].objno = oinfo.addr;
info->paths[idx].fileno = oinfo.fileno;
} /* end trav_fileinfo_add() */
开发者ID:FilipeMaia,项目名称:hdf5,代码行数:23,代码来源:h5trav.c
示例14: test_fl_string
/*
* test_fl_string
* Tests that UTF-8 can be used for fixed-length string data.
* Writes the string to a dataset and reads it back again.
*/
void test_fl_string(hid_t fid, const char *string)
{
hid_t dtype_id, space_id, dset_id;
hsize_t dims = 1;
char read_buf[MAX_STRING_LENGTH];
H5T_cset_t cset;
herr_t ret;
/* Create the datatype, ensure that the character set behaves
* correctly (it should default to ASCII and can be set to UTF8)
*/
dtype_id = H5Tcopy(H5T_C_S1);
CHECK(dtype_id, FAIL, "H5Tcopy");
ret = H5Tset_size(dtype_id, (size_t)MAX_STRING_LENGTH);
CHECK(ret, FAIL, "H5Tset_size");
cset = H5Tget_cset(dtype_id);
VERIFY(cset, H5T_CSET_ASCII, "H5Tget_cset");
ret = H5Tset_cset(dtype_id, H5T_CSET_UTF8);
CHECK(ret, FAIL, "H5Tset_cset");
cset = H5Tget_cset(dtype_id);
VERIFY(cset, H5T_CSET_UTF8, "H5Tget_cset");
/* Create dataspace for a dataset */
space_id = H5Screate_simple(RANK, &dims, NULL);
CHECK(space_id, FAIL, "H5Screate_simple");
/* Create a dataset */
dset_id = H5Dcreate2(fid, DSET1_NAME, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dcreate2");
/* Write UTF-8 string to dataset */
ret = H5Dwrite(dset_id, dtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, string);
CHECK(ret, FAIL, "H5Dwrite");
/* Read string back and make sure it is unchanged */
ret = H5Dread(dset_id, dtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf);
CHECK(ret, FAIL, "H5Dread");
VERIFY(HDstrcmp(string, read_buf), 0, "strcmp");
/* Close all */
ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
ret = H5Tclose(dtype_id);
CHECK(ret, FAIL, "H5Tclose");
ret = H5Sclose(space_id);
CHECK(ret, FAIL, "H5Sclose");
}
开发者ID:Hulalazz,项目名称:rnnlib,代码行数:54,代码来源:tunicode.c
示例15: options_get_object
pack_info_t* options_get_object(const char *path, pack_opttbl_t *table) {
unsigned int i;
char tbl_path[MAX_NC_NAME + 1]; /* +1 for start with "/" case */
for (i = 0; i < table->nelems; i++) {
/* make full path (start with "/") to compare correctly */
if (HDstrncmp(table->objs[i].path, "/", 1)) {
HDstrcpy(tbl_path, "/");
HDstrcat(tbl_path, table->objs[i].path);
}
else
HDstrcpy(tbl_path, table->objs[i].path);
/* found it */
if (HDstrcmp(tbl_path, path) == 0) {
return (&table->objs[i]);
}
}
return NULL;
}
开发者ID:flexi-framework,项目名称:HDF5,代码行数:21,代码来源:h5repack_opttable.c
示例16: read_scalar_dset
/* Helper routine for test_vl_rewrite() */
static void read_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, char *data)
{
hid_t dset;
herr_t ret;
char *data_read;
dset = H5Dopen2(file, name, H5P_DEFAULT);
CHECK(dset, FAIL, "H5Dopen2");
ret = H5Dread(dset, type, space, space, H5P_DEFAULT, &data_read);
CHECK(ret, FAIL, "H5Dread");
ret = H5Dclose(dset);
CHECK(ret, FAIL, "H5Dclose");
if(HDstrcmp(data, data_read))
TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read);
ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &data_read);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
}
开发者ID:ElaraFX,项目名称:hdf5,代码行数:22,代码来源:tvlstr.c
示例17: parse_flag
static int parse_flag(const char* s_flag, unsigned *flag)
{
unsigned fla=0;
if (HDstrcmp(s_flag,"shallow")==0)
{
fla = H5O_COPY_SHALLOW_HIERARCHY_FLAG;
}
else if (HDstrcmp(s_flag,"soft")==0)
{
fla = H5O_COPY_EXPAND_SOFT_LINK_FLAG;
}
else if (HDstrcmp(s_flag,"ext")==0)
{
fla = H5O_COPY_EXPAND_EXT_LINK_FLAG;
}
else if (HDstrcmp(s_flag,"ref")==0)
{
fla = H5O_COPY_EXPAND_REFERENCE_FLAG;
}
else if (HDstrcmp(s_flag,"noattr")==0)
{
fla = H5O_COPY_WITHOUT_ATTR_FLAG;
}
else if (HDstrcmp(s_flag,"allflags")==0)
{
fla = H5O_COPY_ALL;
}
else if (HDstrcmp(s_flag,"nullmsg")==0)
{
fla = H5O_COPY_PRESERVE_NULL_FLAG;
}
else
{
error_msg("Error in input flag\n");
return -1;
}
*flag = (*flag) | fla;
return 0;
}
开发者ID:ElaraFX,项目名称:hdf5,代码行数:42,代码来源:h5copy.c
示例18: test_tst_iterate
/****************************************************************
**
** test_tst_iterate(): Test basic H5ST (ternary search tree) code.
** Tests iterating through key/value pairs in TST
**
****************************************************************/
static void
test_tst_iterate(void)
{
H5ST_tree_t *tree; /* TST created */
H5ST_ptr_t found; /* Pointer to TST node found */
size_t u; /* Local index counter */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Iterating Over TSTs\n"));
/* Create the TST */
tree=H5ST_create();
CHECK(tree, NULL, "H5ST_create");
/* Insert unique words into TST, in random order */
for(u=0; u<num_uniq_words; u++) {
ret=H5ST_insert(tree,rand_uniq_words[u],rand_uniq_words[u]);
CHECK(ret, FAIL, "H5ST_insert");
} /* end for */
/* Use findfirst/findnext calls to iterate through TST */
found=H5ST_findfirst(tree);
CHECK(found, NULL, "H5ST_findfirst");
u=0;
do {
/* Check that the strings in the TST are in the correct order */
if(HDstrcmp((const char *)found->eqkid,sort_uniq_words[u]))
TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, sort_uniq_words[%u]=%s\n",__LINE__,(char *)found->eqkid,(unsigned)u,sort_uniq_words[u]);
/* Advance to next string in TST */
found=H5ST_findnext(found);
u++;
} while(found!=NULL);
/* Close the TST */
ret=H5ST_close(tree);
CHECK(ret, FAIL, "H5ST_close");
} /* end test_tst_iterate() */
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:45,代码来源:ttst.c
示例19: test_misc
/*-------------------------------------------------------------------------
* Function: test_misc
*
* Purpose: Test miscellaneous group stuff.
*
* Return: Success: 0
*
* Failure: number of errors
*
* Programmer: Robb Matzke
* Tuesday, November 24, 1998
*
*-------------------------------------------------------------------------
*/
static int
test_misc(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t g1 = (-1), g2 = (-1), g3 = (-1);
char filename[NAME_BUF_SIZE];
char comment[64];
if(new_format)
TESTING("miscellaneous group tests (w/new group format)")
else
TESTING("miscellaneous group tests")
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Create initial groups for testing, then close */
if((g1 = H5Gcreate2(fid, "test_1a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if((g2 = H5Gcreate2(g1, "sub_1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if((g3 = H5Gcreate2(fid, "test_1b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Oset_comment(g3, "hello world") < 0) TEST_ERROR
if(H5Gclose(g1) < 0) TEST_ERROR
if(H5Gclose(g2) < 0) TEST_ERROR
if(H5Gclose(g3) < 0) TEST_ERROR
/* Open all groups with absolute names to check for exsistence */
if((g1 = H5Gopen2(fid, "/test_1a", H5P_DEFAULT)) < 0) TEST_ERROR
if((g2 = H5Gopen2(fid, "/test_1a/sub_1", H5P_DEFAULT)) < 0) TEST_ERROR
if((g3 = H5Gopen2(fid, "/test_1b", H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Oget_comment_by_name(g3, "././.", comment, sizeof comment, H5P_DEFAULT) < 0) TEST_ERROR
if(HDstrcmp(comment, "hello world")) {
H5_FAILED();
puts(" Read the wrong comment string from the group.");
printf(" got: \"%s\"\n ans: \"hello world\"\n", comment);
TEST_ERROR
}
开发者ID:FilipeMaia,项目名称:hdf5,代码行数:51,代码来源:stab.c
示例20: H5G_link_cmp_name_inc
* equal to, or greater than the second. If two members compare
* as equal, their order in the sorted array is undefined.
* (i.e. same as strcmp())
*
* Programmer: Quincey Koziol
* [email protected]
* Sep 5 2005
*
*-------------------------------------------------------------------------
*/
static int
H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk1)->name, ((const H5O_link_t *)lnk2)->name))
} /* end H5G_link_cmp_name_inc() */
/*-------------------------------------------------------------------------
* Function: H5G_link_cmp_name_dec
*
* Purpose: Callback routine for comparing two link names, in
* decreasing alphabetic order
*
* Return: An integer less than, equal to, or greater than zero if the
* second argument is considered to be respectively less than,
* equal to, or greater than the first. If two members compare
* as equal, their order in the sorted array is undefined.
* (i.e. opposite strcmp())
*
开发者ID:ElsevierSoftwareX,项目名称:SOFTX-D-15-00004,代码行数:31,代码来源:H5Glink.c
注:本文中的HDstrcmp函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论