@@ -28,90 +28,109 @@ int main( )
2828 * Create the HDF file.
2929 */
3030 file_id = Hopen (FILE_NAME , DFACC_CREATE , 0 );
31+ CHECK_NOT_VAL (file_id , FAIL , "Hopen" );
3132
3233 /*
3334 * Initialize the AN interface.
3435 */
3536 an_id = ANstart (file_id );
37+ CHECK_NOT_VAL (an_id , FAIL , "ANstart" );
3638
3739 /*
3840 * Create the file label.
3941 */
4042 file_label_id = ANcreatef (an_id , AN_FILE_LABEL );
43+ CHECK_NOT_VAL (file_label_id , FAIL , "AN_FILE_LABEL" );
4144
4245 /*
4346 * Write the annotations to the file label.
4447 */
45- status_32 = ANwriteann (file_label_id , FILE_LABEL_TXT ,
46- strlen ( FILE_LABEL_TXT ) );
48+ status_32 = ANwriteann (file_label_id , FILE_LABEL_TXT , strlen ( FILE_LABEL_TXT ));
49+ CHECK_NOT_VAL ( status_32 , FAIL , "ANwriteann" );
4750
4851 /*
4952 * Create file description.
5053 */
5154 file_desc_id = ANcreatef (an_id , AN_FILE_DESC );
55+ CHECK_NOT_VAL (file_desc_id , FAIL , "ANcreatef" );
5256
5357 /*
54- * Write the annotation to the file description.
58+ * Write the annotation to the file description.
5559 */
56- status_32 = ANwriteann (file_desc_id , FILE_DESC_TXT ,
57- strlen ( FILE_DESC_TXT ) );
60+ status_32 = ANwriteann (file_desc_id , FILE_DESC_TXT , strlen ( FILE_DESC_TXT ));
61+ CHECK_NOT_VAL ( status_32 , FAIL , "ANwriteann" );
5862
5963 /*
60- * Create a vgroup in the V interface. Note that the vgroup's ref number
64+ * Create a vgroup in the V interface. Note that the vgroup's ref number
6165 * is set to -1 for creating and the access mode is "w" for writing.
6266 */
6367 status_n = Vstart (file_id );
68+ CHECK_NOT_VAL (status_n , FAIL , "Vstart" );
6469 vgroup_id = Vattach (file_id , -1 , "w" );
70+ CHECK_NOT_VAL (vgroup_id , FAIL , "Vattach" );
6571 status_32 = Vsetname (vgroup_id , VG_NAME );
72+ CHECK_NOT_VAL (status_32 , FAIL , "Vsetname" );
6673
6774 /*
6875 * Obtain the tag and ref number of the vgroup for subsequent
69- * references.
76+ * references.
7077 */
7178 vgroup_tag = (uint16 ) VQuerytag (vgroup_id );
7279 vgroup_ref = (uint16 ) VQueryref (vgroup_id );
7380
7481 /*
75- * Create the data label for the vgroup identified by its tag
82+ * Create the data label for the vgroup identified by its tag
7683 * and ref number.
7784 */
7885 data_label_id = ANcreate (an_id , vgroup_tag , vgroup_ref , AN_DATA_LABEL );
86+ CHECK_NOT_VAL (data_label_id , FAIL , "ANcreate" );
7987
8088 /*
8189 * Write the annotation text to the data label.
8290 */
83- status_32 = ANwriteann (data_label_id , DATA_LABEL_TXT ,
84- strlen ( DATA_LABEL_TXT ) );
91+ status_32 = ANwriteann (data_label_id , DATA_LABEL_TXT , strlen ( DATA_LABEL_TXT ));
92+ CHECK_NOT_VAL ( status_32 , FAIL , "ANwriteann" );
8593
8694 /*
87- * Create the data description for the vgroup identified by its tag
95+ * Create the data description for the vgroup identified by its tag
8896 * and ref number.
8997 */
9098 data_desc_id = ANcreate (an_id , vgroup_tag , vgroup_ref , AN_DATA_DESC );
99+ CHECK_NOT_VAL (data_desc_id , FAIL , "ANcreate" );
91100
92101 /*
93102 * Write the annotation text to the data description.
94103 */
95104 status_32 = ANwriteann (data_desc_id , DATA_DESC_TXT , strlen (DATA_DESC_TXT ));
105+ CHECK_NOT_VAL (status_32 , FAIL , "ANwriteann" );
96106
97107 /*
98108 * Teminate access to the vgroup and to the V interface.
99109 */
100110 status_32 = Vdetach (vgroup_id );
111+ CHECK_NOT_VAL (status_32 , FAIL , "Vdetach" );
101112 status_n = Vend (file_id );
113+ CHECK_NOT_VAL (status_n , FAIL , "Vend" );
102114
103115 /*
104116 * Terminate access to each annotation explicitly.
105117 */
106118 status_n = ANendaccess (file_label_id );
119+ CHECK_NOT_VAL (status_n , FAIL , "ANendaccess" );
107120 status_n = ANendaccess (file_desc_id );
121+ CHECK_NOT_VAL (status_n , FAIL , "ANendaccess" );
108122 status_n = ANendaccess (data_label_id );
123+ CHECK_NOT_VAL (status_n , FAIL , "ANendaccess" );
109124 status_n = ANendaccess (data_desc_id );
125+ CHECK_NOT_VAL (status_n , FAIL , "ANendaccess" );
110126
111127 /*
112128 * Terminate access to the AN interface and close the HDF file.
113129 */
114130 status_32 = ANend (an_id );
131+ CHECK_NOT_VAL (status_32 , FAIL , "ANend" );
115132 status_n = Hclose (file_id );
133+ CHECK_NOT_VAL (status_n , FAIL , "Hclose" );
134+
116135 return 0 ;
117136}
0 commit comments