1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 SAF_Algebraic *
 saf_declare_algebraic(SAF_ParMode pmode,
                       SAF_Db *db,                       /* The database in which to create the new algebraic type */
                       const char *name,                 /* Name of the algebraic type */
                       const char *url,                  /* An optional URL to the algebraic documentation */
                       hbool_t indirect,                 /* If true then field is indirection to another field */
                       SAF_Algebraic *alg                /* [OUT] Optional handle to initialize (and return) */
                       )
 {
     SAF_ENTER(saf_declare_algebraic, NULL);
     ss_scope_t          topscope;

     if (!_saf_is_participating_proc(pmode)) SAF_RETURN(NULL);
     ss_file_topscope(db, &topscope);
     alg = (ss_algebraic_t*)ss_pers_new(&topscope, SS_MAGIC(ss_algebraic_t), NULL, SAF_ALL==pmode?SS_ALLSAME:0U,
                                        (ss_pers_t*)alg, NULL);

     if (SAF_EACH==pmode) SS_PERS_UNIQUE(alg);
     ss_string_set(SS_ALGEBRAIC_P(alg,name), name);
     ss_string_set(SS_ALGEBRAIC_P(alg,url), url);
     SS_ALGEBRAIC(alg)->indirect = indirect;

     SAF_LEAVE(alg);
 }