1 //------------------------------------------------------------------------------
2 // SLIP_LU/SLIP_initialize: initialize SLIP_LU
3 //------------------------------------------------------------------------------
4 
5 // SLIP_LU: (c) 2019-2020, Chris Lourenco, Jinhao Chen, Erick Moreno-Centeno,
6 // Timothy A. Davis, Texas A&M University.  All Rights Reserved.  See
7 // SLIP_LU/License for the license.
8 
9 //------------------------------------------------------------------------------
10 
11 // SLIP_initialize initializes the working evironment for SLIP_LU.
12 
13 #include "slip_internal.h"
14 
15 //------------------------------------------------------------------------------
16 // global variable access
17 //------------------------------------------------------------------------------
18 
19 // a global variable, but only accessible within this file.
20 extern bool slip_initialize_has_been_called ;
21 
22 bool slip_initialize_has_been_called = false ;
23 
slip_initialized(void)24 bool slip_initialized ( void )
25 {
26     return (slip_initialize_has_been_called) ;
27 }
28 
slip_set_initialized(bool s)29 void slip_set_initialized (bool s)
30 {
31     slip_initialize_has_been_called = s ;
32 }
33 
34 //------------------------------------------------------------------------------
35 // SLIP_initialize
36 //------------------------------------------------------------------------------
37 
SLIP_initialize(void)38 SLIP_info SLIP_initialize ( void )
39 {
40     if (slip_initialized ( )) return (SLIP_PANIC) ;
41 
42     mp_set_memory_functions (slip_gmp_allocate, slip_gmp_reallocate,
43         slip_gmp_free) ;
44 
45     slip_set_initialized (true) ;
46     return (SLIP_OK) ;
47 }
48 
49