1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group.                                               *
3  * All rights reserved.                                                      *
4  *                                                                           *
5  * This file is part of HDF.  The full HDF copyright notice, including       *
6  * terms governing use, modification, and redistribution, is contained in    *
7  * the COPYING file, which can be found at the root of the source code       *
8  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/.  *
9  * If you do not have access to either file, you may request a copy from     *
10  * help@hdfgroup.org.                                                        *
11  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
12 
13 /* Creating vdatas with names and classes that are longer than 64 characters
14    to test bug HDFFR-1267. -BMR */
15 
16 #include "hdf.h"
17 
18 #define	FILENAME	"vslongname.hdf"
19 #define	VDATA1_NAME	"Vdata 1 9112345678921234567893123456789412345678951234567896123456789 72"
20 #define	VDATA2_NAME	"Vdata 2 9112345678921234567893123456789412345678951234567896123456789 72"
21 #define	VDATA_CLASS	"Long Name Vdatas78921234567893123456789412345678951234567896123456789 72"
22 
23 
main()24 int main( )
25 {
26    /************************* Variable declaration **************************/
27 
28    intn  status_n;	/* returned status for functions returning an intn  */
29    int32 status_32;	/* returned status for functions returning an int32 */
30    int32 file_id, file2_id, vdata_id, vdata1_id, vdata2_id;
31    int32 vdata_ref = -1;     /* ref number of a vdata, set to -1 to create  */
32    char vsclass[100], fields[10];
33 
34    /********************** End of variable declaration **********************/
35 
36    /*
37    * Create the first HDF file.
38    */
39    file_id = Hopen (FILENAME, DFACC_CREATE, 0);
40 
41    /*
42    * Initialize the VS interface associated with the first HDF file.
43    */
44    status_n = Vstart (file_id);
45 
46    /*
47    * Create a vdata in the first HDF file.
48    */
49    vdata1_id = VSattach (file_id, -1, "w");
50    vdata2_id = VSattach (file_id, -1, "w");
51 
52    /*
53    * Assign name and class to the vdata.
54    */
55    status_32 = VSsetname (vdata1_id, VDATA1_NAME);
56    status_32 = VSsetname (vdata2_id, VDATA2_NAME);
57 
58    status_32 = VSsetclass (vdata1_id, VDATA_CLASS);
59    status_32 = VSsetclass (vdata2_id, VDATA_CLASS);
60 
61    /*
62    * Add fields to the vdata.
63    */
64    status_n = VSfdefine (vdata1_id, "field 1", DFNT_FLOAT32, 1);
65    status_n = VSfdefine (vdata2_id, "field 1", DFNT_FLOAT32, 1);
66 
67    status_n = VSsetfields (vdata1_id, "field 1");
68    status_n = VSsetfields (vdata2_id, "field 1");
69 
70    /*
71    * Terminate access to the vdata in the first HDF file.
72    */
73    status_32 = VSdetach (vdata1_id);
74    status_32 = VSdetach (vdata2_id);
75 
76    /*
77    * Terminate access to the VS interface associated with the first HDF file.
78    */
79    status_n = Vend (file_id);
80 
81    /*
82    * Close the first HDF file.
83    */
84    status_n = Hclose (file_id);
85    return 0;
86 }
87