1 //------------------------------------------------------------------------------
2 // GrB_Type_new: create a new user-defined type
3 //------------------------------------------------------------------------------
4
5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
6 // SPDX-License-Identifier: Apache-2.0
7
8 //------------------------------------------------------------------------------
9
10 // GrB_Type_new is implemented both as a macro and a function. Both are
11 // user-callable. The default is to use the macro, since this allows the name
12 // of the type to be saved as a string, for subsequent error reporting by
13 // GrB_error. It is also provided as a function so that applications that
14 // require a function instead of macro can access it. User code can simply do
15 // #undef GrB_Type_new before using the function. This approach also places
16 // the function GrB_Type_new in the linkable SuiteSparse:GraphBLAS library so
17 // that it is visible for linking with applications in languages other than
18 // ANSI C. The function version does not allow the name of the ctype to be
19 // saved in the new GraphBLAS type, however. It is given the generic name.
20
21 #include "GB.h"
22
23 // the macro version of this function must first be #undefined
24 #undef GrB_Type_new
25 #undef GrM_Type_new
26
GRB(Type_new)27 GrB_Info GRB (Type_new) // create a new GraphBLAS type
28 (
29 GrB_Type *type, // handle of user type to create
30 size_t sizeof_ctype // size = sizeof (ctype) of the C type
31 )
32 {
33 return (GB_Type_new (type, sizeof_ctype, NULL)) ;
34 }
35
36