当前位置: 首页>>代码示例>>C++>>正文


C++ HDstrcmp函数代码示例

本文整理汇总了C++中HDstrcmp函数的典型用法代码示例。如果您正苦于以下问题:C++ HDstrcmp函数的具体用法?C++ HDstrcmp怎么用?C++ HDstrcmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了HDstrcmp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的HDstrcmp函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。