1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 int
 saf_describe_quantity(SAF_ParMode pmode,
                       SAF_Quantity *quantity,   /* Quantity about which to retrieve information. */
                       char **description,       /* If non-null then upon return this will point to an allocated copy of the
                                                  * quantity description. */
                       char **abbreviation,      /* If non-null then upon return this will point to an allocated copy of the
                                                  * quantity abbreviation if one is defined. */
                       char **url,               /* If non-null then upon return this will point to an allocated copy of the
                                                  * quantity documentation URL if one is defined. */
                       unsigned *flags,          /* If non-null then the special quantity flags are written into the location
                                                  * indicated by this pointer. */
                       unsigned *power           /* If non-null then upon return this seven-element array will be filled in
                                                  * with the powers of the seven basic quantities. */
                       )
 {
     SAF_ENTER(saf_describe_quantity, SAF_PRECONDITION_ERROR);
     int                 i;

     SAF_REQUIRE(_saf_valid_pmode(pmode), SAF_LOW_CHK_COST, SAF_PRECONDITION_ERROR,
                 _saf_errmsg("PMODE must be valid"));
     if (!_saf_is_participating_proc(pmode)) SAF_RETURN(-1);
     SAF_REQUIRE(SS_QUANTITY(quantity), SAF_LOW_CHK_COST, SAF_PRECONDITION_ERROR,
                 _saf_errmsg("QUANTITY must be a valid quantity handle"));

     _saf_setupReturned_string(description, ss_string_ptr(SS_QUANTITY_P(quantity,name)));
     _saf_setupReturned_string(url, ss_string_ptr(SS_QUANTITY_P(quantity,url)));
     _saf_setupReturned_string(abbreviation,ss_string_ptr(SS_QUANTITY_P(quantity,abbr)));

     if (flags) *flags = SS_QUANTITY(quantity)->flags;
     if (power)
         for (i=0; i<SS_MAX_BASEQS; i++) power[i] = SS_QUANTITY(quantity)->power[i];
     SAF_LEAVE(SAF_SUCCESS);
 }