Back to index

im-sdk  12.3.91
aux.c
Go to the documentation of this file.
00001 /*
00002   aux.c
00003 */
00004 
00005 #include <stdlib.h>
00006 #include <string.h>
00007 #include "iiimcfint.h"
00008 
00009 static IIIMCF_aux_rec*
00010 create_aux_rec(
00011     IIIMCF_context_rec *pc,
00012     int namelen,
00013     const IIIMP_card16 *name,
00014     IIIMP_card32 index
00015 );
00016 
00017 static IIIMCF_event_rec*
00018 create_aux_event(
00019     IIIMCF_event_type type,
00020     IIIMCF_aux_rec *pa
00021 );
00022 
00023 void
00024 iiimcf_delete_aux_event(
00025     IIIMCF_event_rec *pe
00026 );
00027 
00028 /********************************************************************************
00029                             message handlers
00030 ********************************************************************************/
00031 
00032 IIIMF_status
00033 iiimcf_enable_aux(
00034     IIIMCF_context_rec *pc,
00035     IIIMP_message *pmes
00036 )
00037 {
00038     IIIMCF_aux_rec *pa;
00039     IIIMP_aux_start_v *pimas;
00040     IIIMCF_event_rec *pe;
00041 
00042     ASSERT(pmes->opcode == IM_AUX_START);
00043     pimas = &pmes->v.aux_start;
00044 
00045 
00046     pa = create_aux_rec(pc,
00047                      pimas->input_method_name->len,
00048                      pimas->input_method_name->ptr,
00049                      pimas->class_index);
00050     if (!pa) return IIIMF_STATUS_MALLOC;
00051     pa->mode = 1;
00052 
00053     pe = create_aux_event(IIIMCF_EVENT_TYPE_AUX_START, pa);
00054     if (!pe) return IIIMF_STATUS_MALLOC;
00055 
00056     return iiimcf_store_event(pc, pe);
00057 }
00058 
00059 static IIIMF_status
00060 process_aux_data (
00061     IIIMCF_context_rec *pc,
00062     IIIMP_message *pmes,
00063     IIIMCF_event_type aux_event_type
00064 )
00065 {
00066     IIIMCF_aux_rec *pa;
00067     IIIMP_aux_draw_v *pimad;
00068     IIIMCF_event_rec *pe;
00069 
00070     pimad = &pmes->v.aux_draw;
00071 
00072     pa = create_aux_rec(pc,
00073                      pimad->input_method_name->len,
00074                      pimad->input_method_name->ptr,
00075                      pimad->class_index);
00076     if (!pa) return IIIMF_STATUS_MALLOC;
00077 
00078     /* integer value */
00079     {
00080        int n;
00081        IIIMP_card32 *pc32s;
00082 
00083        if (pimad->integer_value) {
00084            n = pimad->integer_value->count;
00085            pc32s = pimad->integer_value->ptr;
00086        } else {
00087            n = 0;
00088            pc32s = NULL;
00089        }
00090 
00091        if (n > 0) {
00092            IIIMP_card32 *pc32d;
00093 
00094            pc32d = (IIIMP_card32*) realloc(pa->pintvals, sizeof(*pc32d) * n);
00095            if (!pc32d) {
00096               return IIIMF_STATUS_MALLOC;
00097            }
00098            pa->pintvals = pc32d;
00099            memcpy(pc32d, pc32s, sizeof(*pc32s) * n);
00100        } else {
00101            if (pa->pintvals) free(pa->pintvals);
00102            pa->pintvals = NULL;
00103        }
00104        pa->num_intvals = n;
00105     }
00106     /* string value */
00107     {
00108        int i, n;
00109        IIIMP_string *pimstr;
00110        IIIMP_card16 **pstrs;
00111 
00112        n = 0;
00113        for (pimstr = pimad->string_value; pimstr; pimstr = pimstr->next) n++;
00114        if (n > pa->num_strvals) {
00115            pstrs = (IIIMP_card16**) realloc(pa->pstrs, sizeof(*pstrs) * n);
00116            if (!pstrs) return IIIMF_STATUS_MALLOC;
00117            memset(pstrs + pa->num_strvals, 0, (n - pa->num_strvals) * sizeof(*pstrs));
00118            pa->pstrs = pstrs;
00119        } else if (n < pa->num_strvals) {
00120            pstrs = pa->pstrs + n;
00121            for (i = n; i < pa->num_strvals; i++, pstrs++) {
00122               if (*pstrs) {
00123                 free(*pstrs);
00124                 *pstrs = NULL;
00125               }
00126            }
00127            if (n == 0) {
00128               free(pa->pstrs);
00129               pa->pstrs = NULL;
00130            }
00131            pstrs = pa->pstrs;
00132        } else {
00133            pstrs = pa->pstrs;
00134        }
00135        pa->num_strvals = n;
00136        for (pimstr = pimad->string_value; pimstr;
00137             pimstr = pimstr->next, pstrs++) {
00138            if (*pstrs) free(*pstrs);
00139            *pstrs = iiimcf_make_string(pimstr->ptr, pimstr->len);
00140            if (!*pstrs) {
00141               return IIIMF_STATUS_MALLOC;
00142            }
00143        }
00144     }
00145 
00146     pe = create_aux_event(aux_event_type, pa);
00147     if (!pe) return IIIMF_STATUS_MALLOC;
00148 
00149     return iiimcf_store_event(pc, pe);
00150 }
00151 
00152 IIIMF_status
00153 iiimcf_update_aux_draw(
00154     IIIMCF_context_rec *pc,
00155     IIIMP_message *pmes
00156 )
00157 {
00158     ASSERT(pmes->opcode == IM_AUX_DRAW);
00159     return process_aux_data (pc, pmes, IIIMCF_EVENT_TYPE_AUX_DRAW);
00160 }
00161 
00162 IIIMF_status
00163 iiimcf_update_aux_getvaluesreply(
00164     IIIMCF_context_rec *pc,
00165     IIIMP_message *pmes
00166 )
00167 {
00168     ASSERT(pmes->opcode == IM_AUX_GETVALUES_REPLY);
00169     return process_aux_data (pc, pmes, IIIMCF_EVENT_TYPE_AUX_GETVALUES);
00170 }
00171 
00172 IIIMF_status
00173 iiimcf_disable_aux(
00174     IIIMCF_context_rec *pc,
00175     IIIMP_message *pmes
00176 )
00177 {
00178     IIIMCF_aux_rec *pa;
00179     IIIMP_aux_done_v *pimad;
00180     IIIMCF_event_rec *pe;
00181 
00182     ASSERT(pmes->opcode == IM_AUX_DONE);
00183     pimad = &pmes->v.aux_done;
00184 
00185 
00186     pa = create_aux_rec(pc,
00187                      pimad->input_method_name->len,
00188                      pimad->input_method_name->ptr,
00189                      pimad->class_index);
00190     if (!pa) return IIIMF_STATUS_MALLOC;
00191     pa->mode = 0;
00192 
00193     pe = create_aux_event(IIIMCF_EVENT_TYPE_AUX_DONE, pa);
00194     if (!pe) return IIIMF_STATUS_MALLOC;
00195 
00196     return iiimcf_store_event(pc, pe);
00197 }
00198 
00199 /********************************************************************************
00200                             internal services
00201 ********************************************************************************/
00202 
00203 static int
00204 iiimcf_UTF16_strncmp(
00205     int maxlen,
00206     const IIIMP_card16 *pstr1,
00207     const IIIMP_card16 *pstr2
00208 )
00209 {
00210     int i;
00211     for (i = 0;i < maxlen; pstr1++, pstr2++, i++) {
00212        if (*pstr1 > *pstr2) return 1;
00213        if (*pstr1 < *pstr2) return -1;
00214        if (*pstr1 == 0) return 0;
00215     }
00216     if (*pstr2 == 0) return 0;
00217     return -1;
00218 }
00219 
00220 static IIIMCF_aux_rec*
00221 find_aux_rec(
00222     IIIMCF_context_rec *pc,
00223     int namelen,
00224     const IIIMP_card16 *name,
00225     IIIMP_card32 index
00226 )
00227 {
00228     IIIMCF_aux_rec *pa;
00229 
00230     for (pa = pc->paux; pa; pa = pa->pnext) {
00231        if ((pa->index == index)
00232            && (iiimcf_UTF16_strncmp(namelen, name, pa->name) == 0))
00233            return pa;
00234     }
00235     /* fail */
00236     return NULL;
00237 }
00238 
00239 static IIIMCF_aux_rec*
00240 create_aux_rec(
00241     IIIMCF_context_rec *pc,
00242     int namelen,
00243     const IIIMP_card16 *name,
00244     IIIMP_card32 index
00245 )
00246 {
00247     IIIMCF_aux_rec *pa;
00248 
00249     pa = find_aux_rec(pc, namelen, name, index);
00250     if (pa) return pa;
00251 
00252     pa = (IIIMCF_aux_rec*) malloc(sizeof(*pa));
00253     if (!pa) return NULL;
00254     memset(pa, 0, sizeof(*pa));
00255 
00256     {
00257        IIIMP_card16 *pu;
00258 
00259        pu = (IIIMP_card16*) malloc(sizeof(*pu) * (namelen + 1));
00260        if (!pu) {
00261            free(pa);
00262            return NULL;
00263        }
00264        memcpy(pu, name, sizeof(*pu) * namelen);
00265        pu[namelen] = 0;
00266        pa->name = pu;
00267     }
00268     pa->index = index;
00269 
00270     pa->pnext = pc->paux;
00271     pc->paux = pa;
00272 
00273     return pa;
00274 }
00275 
00276 static IIIMCF_event_rec*
00277 create_aux_event(
00278     IIIMCF_event_type type,
00279     IIIMCF_aux_rec *pa
00280 )
00281 {
00282     IIIMCF_event_rec *pe;
00283     IIIMCF_auxevent *pae;
00284 
00285     ASSERT((type == IIIMCF_EVENT_TYPE_AUX_START)
00286           || (type == IIIMCF_EVENT_TYPE_AUX_DONE)
00287           || (type == IIIMCF_EVENT_TYPE_AUX_GETVALUES)
00288           || (type == IIIMCF_EVENT_TYPE_AUX_DRAW));
00289 
00290     pe = iiimcf_make_event(type);
00291     if (!pe) return NULL;
00292 
00293     pae = (IIIMCF_auxevent*) malloc(sizeof(*pae));
00294     if (!pae) goto memory_error;
00295     memset(pae, 0, sizeof(*pae));
00296     pe->v.pauxevent = pae;
00297 
00298     pae->name = iiimcf_duplicate_string(pa->name);
00299     if (!pae->name) goto memory_error;
00300     pae->index = pa->index;
00301 
00302     if ((type == IIIMCF_EVENT_TYPE_AUX_DRAW)
00303           || (type == IIIMCF_EVENT_TYPE_AUX_GETVALUES)) {
00304        pae->num_intvals = pa->num_intvals;
00305        if (pa->num_intvals > 0) {
00306            int bytelen = sizeof(IIIMP_card32) * pae->num_intvals;
00307            pae->pintvals = (IIIMP_card32*) malloc(bytelen);
00308            if (!pae->pintvals) goto memory_error;
00309            memcpy(pae->pintvals, pa->pintvals, bytelen);
00310        }
00311        pae->num_strvals = pa->num_strvals;
00312        if (pa->num_strvals > 0) {
00313            int i;
00314            int bytelen = sizeof(IIIMP_card16*) * pae->num_strvals;
00315            IIIMP_card16 **ppus, **ppud;
00316 
00317            pae->pstrs = (IIIMP_card16**) malloc(bytelen);
00318            if (!pae->pstrs) goto memory_error;
00319            memset(pae->pstrs, 0, bytelen);
00320            for (i = 0, ppud = pae->pstrs, ppus = pa->pstrs;
00321                i < pa->num_strvals;
00322                i++, ppud++, ppus++) {
00323               if (*ppus) {
00324                   *ppud = iiimcf_duplicate_string(*ppus);
00325                   if (!*ppud) goto memory_error;
00326               }
00327            }
00328        }
00329     }
00330 
00331     return pe;
00332 
00333 memory_error:
00334     iiimcf_delete_aux_event(pe);
00335     free(pe);
00336 
00337     return NULL;
00338 }
00339 
00340 IIIMF_status
00341 iiimcf_forward_aux_setvalues(
00342     IIIMCF_context_rec *pc,
00343     IIIMCF_event_rec *pe
00344 )
00345 {
00346     IIIMF_status st;
00347     IIIMCF_handle_rec *ph = pc->ph;
00348     IIIMP_data_s *pds = ph->data_s;
00349     IIIMCF_auxevent *pae = pe->v.pauxevent;
00350     IIIMP_string *pimname, *pimstrs;
00351     IIIMP_card32_list *pimc32l;
00352     IIIMP_message *pmes;
00353 
00354     pimname = NULL;
00355     pimc32l = NULL;
00356     pimstrs = NULL;
00357 
00358     pimname = iiimp_string_new(pds, iiimcf_string_length(pae->name), pae->name);
00359     if (!pimname) return IIIMF_STATUS_MALLOC;
00360     pimc32l = iiimp_card32_list_new(pds, pae->num_intvals, pae->pintvals);
00361     if (!pimc32l) goto memory_error;
00362     {
00363        int i;
00364        IIIMP_card16 **pstr;
00365        IIIMP_string *pimstr;
00366 
00367        for (i = 0, pstr = (pae->pstrs + pae->num_strvals - 1);
00368             i < pae->num_strvals;
00369             i++, pstr--) {
00370            pimstr = iiimp_string_new(pds, iiimcf_string_length(*pstr), *pstr);
00371            if (!pimstr) goto memory_error;
00372            pimstr->next = pimstrs;
00373            pimstrs = pimstr;
00374        }
00375     }
00376     pmes = iiimp_aux_setvalues_new(pds, ph->im_id, pc->ic_id,
00377                                pae->index, pimname, pimc32l,
00378                                pimstrs);
00379     if (!pmes) goto memory_error;
00380 
00381     st = iiimcf_request_message(ph, pmes, pc, IM_AUX_SETVALUES_REPLY, NULL);
00382 
00383     return st;
00384 
00385 memory_error:
00386     if (pimname) iiimp_string_delete(pds, pimname);
00387     if (pimc32l) iiimp_card32_list_delete(pds, pimc32l);
00388     if (pimstrs) iiimp_string_list_delete(pds, pimstrs);
00389 
00390     return IIIMF_STATUS_MALLOC;
00391 }
00392 
00393 IIIMF_status
00394 iiimcf_forward_aux_getvalues(
00395     IIIMCF_context_rec *pc,
00396     IIIMCF_event_rec *pe
00397 )
00398 {
00399     IIIMF_status st;
00400     IIIMCF_handle_rec *ph = pc->ph;
00401     IIIMP_data_s *pds = ph->data_s;
00402     IIIMCF_auxevent *pae = pe->v.pauxevent;
00403     IIIMP_string *pimname, *pimstrs;
00404     IIIMP_card32_list *pimc32l;
00405     IIIMP_message *pmes;
00406     IIIMP_message *prepmes;
00407 
00408     pimname = NULL;
00409     pimc32l = NULL;
00410     pimstrs = NULL;
00411 
00412     pimname = iiimp_string_new(pds, iiimcf_string_length(pae->name), pae->name);
00413     if (!pimname) return IIIMF_STATUS_MALLOC;
00414     pimc32l = iiimp_card32_list_new(pds, pae->num_intvals, pae->pintvals);
00415     if (!pimc32l) goto memory_error;
00416     {
00417        int i;
00418        IIIMP_card16 **pstr;
00419        IIIMP_string *pimstr;
00420 
00421        for (i = 0, pstr = (pae->pstrs + pae->num_strvals - 1);
00422             i < pae->num_strvals;
00423             i++, pstr--) {
00424            pimstr = iiimp_string_new(pds, iiimcf_string_length(*pstr), *pstr);
00425            if (!pimstr) goto memory_error;
00426            pimstr->next = pimstrs;
00427            pimstrs = pimstr;
00428        }
00429     }
00430     pmes = iiimp_aux_getvalues_new(pds, ph->im_id, pc->ic_id,
00431                                pae->index, pimname, pimc32l,
00432                                pimstrs);
00433     if (!pmes) goto memory_error;
00434 
00435     prepmes = NULL;
00436     st = iiimcf_request_message(ph, pmes, pc, IM_AUX_GETVALUES_REPLY, &prepmes);
00437 
00438     if (prepmes)
00439     {
00440        st = iiimcf_update_aux_getvaluesreply(pc, prepmes);
00441        iiimp_message_delete(ph->data_s, prepmes);
00442     }
00443 
00444     return st;
00445 
00446 memory_error:
00447     if (pimname) iiimp_string_delete(pds, pimname);
00448     if (pimc32l) iiimp_card32_list_delete(pds, pimc32l);
00449     if (pimstrs) iiimp_string_list_delete(pds, pimstrs);
00450 
00451     return IIIMF_STATUS_MALLOC;
00452 }
00453 
00454 void
00455 iiimcf_delete_all_aux_data(
00456     IIIMCF_context_rec *pc
00457 )
00458 {
00459     int i, n;
00460     IIIMCF_aux_rec *pa, *pa2;
00461     IIIMP_card16 **pstrs;
00462 
00463     for (pa = pc->paux; pa; pa = pa2) {
00464        pa2 = pa->pnext;
00465        if (pa->name) free(pa->name);
00466        if (pa->pintvals) free(pa->pintvals);
00467        n = pa->num_strvals;
00468        pstrs = pa->pstrs;
00469        if (pstrs) {
00470            for (i = 0; i < n; i++, pstrs++) {
00471               if (*pstrs) free(*pstrs);
00472            }
00473            free(pa->pstrs);
00474        }
00475        free(pa);
00476     }
00477 }
00478 
00479 void
00480 iiimcf_delete_aux_event(
00481     IIIMCF_event_rec *pe
00482 )
00483 {
00484     IIIMCF_auxevent *pae = pe->v.pauxevent;
00485 
00486     if (pae) {
00487        if (pae->name) free(pae->name);
00488        if (pae->pintvals) free(pae->pintvals);
00489        if (pae->pstrs) {
00490            int i;
00491            for (i = 0; i < pae->num_strvals; i++) {
00492               if (pae->pstrs[i]) free(pae->pstrs[i]);
00493            }
00494            free(pae->pstrs);
00495        }
00496        free(pae);
00497     }
00498 }
00499 
00500 /********************************************************************************
00501                                  APIs
00502 ********************************************************************************/
00503 
00504 #if 0 /* Should we implement this feature?  */
00505 IIIMF_status
00506 iiimcf_get_updated_auxes(
00507     IIIMCF_context context,
00508     int *pupdated_aux_num,
00509     const IIIMP_card16 ***ppaux_name
00510 )
00511 {
00512 }
00513 #endif
00514 
00515 IIIMF_status
00516 iiimcf_get_aux_draw_data(
00517     IIIMCF_context context,
00518     const IIIMP_card16 *aux_name,
00519     IIIMP_card32 class_idx,
00520     int *pnum_intvals,
00521     const IIIMP_card32 **ppintvals,
00522     int *pnum_strvals,
00523     const IIIMP_card16 ***ppstrs
00524 )
00525 {
00526     IIIMCF_aux_rec *pa;
00527     IIIMCF_context_rec *pc = (IIIMCF_context_rec*) context;
00528     int len;
00529 
00530     if (IIIMCF_IS_IC_INVALID(pc)) return IIIMF_STATUS_IC_INVALID;
00531     len = iiimcf_string_length(aux_name);
00532     pa = find_aux_rec(pc, len, aux_name, class_idx);
00533     if ((!pa) || (!pa->mode))
00534        return IIIMF_STATUS_NO_AUX;
00535 
00536     if (pnum_intvals) *pnum_intvals = pa->num_intvals;
00537     if (ppintvals) *ppintvals = pa->pintvals;
00538     if (pnum_strvals) *pnum_strvals = pa->num_strvals;
00539     if (ppstrs) *ppstrs = (const IIIMP_card16**) pa->pstrs;
00540 
00541     return IIIMF_STATUS_SUCCESS;
00542 }
00543 
00544 IIIMF_status
00545 iiimcf_create_aux_setvalues_event(
00546     const IIIMP_card16 *aux_name,
00547     IIIMP_card32 class_idx,
00548     int num_intvals,
00549     const IIIMP_card32 *pintvals,
00550     int num_strvals,
00551     const IIIMP_card16 **pstrs,
00552     IIIMCF_event *pevent
00553 )
00554 {
00555     IIIMCF_event_rec *pe;
00556     IIIMCF_auxevent *pae;
00557 
00558     pe = iiimcf_make_event(IIIMCF_EVENT_TYPE_AUX_SETVALUES);
00559     if (!pe) return IIIMF_STATUS_MALLOC;
00560 
00561     pae = (IIIMCF_auxevent*) malloc(sizeof(*pae));
00562     if (!pae) goto memory_error;
00563     memset(pae, 0, sizeof(*pae));
00564     pe->v.pauxevent = pae;
00565 
00566     pae->index = class_idx;
00567     pae->name = iiimcf_duplicate_string(aux_name);
00568     if (!pae->name) goto memory_error;
00569 
00570     /* integer value */
00571     if (num_intvals > 0) {
00572        IIIMP_card32 *pc32;
00573 
00574        pc32 = (IIIMP_card32*) malloc(sizeof(*pc32) * num_intvals);
00575        if (!pc32) goto memory_error;
00576        memcpy(pc32, pintvals, sizeof(*pc32) * num_intvals);
00577        pae->pintvals = pc32;
00578        pae->num_intvals = num_intvals;
00579     }
00580     /* string value */
00581     if (num_strvals > 0) {
00582        int i;
00583        IIIMP_card16 **ppu16;
00584 
00585        ppu16 = (IIIMP_card16**) malloc(sizeof(*ppu16) * num_strvals);
00586        if (!ppu16) goto memory_error;
00587        pae->pstrs = ppu16;
00588        pae->num_strvals = num_strvals;
00589        memset(ppu16, 0, sizeof(*ppu16) * num_strvals);
00590        for (i = 0; i < num_strvals; i++) {
00591            *ppu16 = iiimcf_duplicate_string(*pstrs);
00592            if (!*ppu16) goto memory_error;
00593            ppu16++;
00594            pstrs++;
00595        }
00596     }
00597 
00598     *pevent = pe;
00599 
00600     return IIIMF_STATUS_SUCCESS;
00601 
00602 memory_error:
00603     iiimcf_delete_aux_event(pe);
00604     free(pe);
00605     return IIIMF_STATUS_MALLOC;
00606 }
00607 
00608 IIIMF_status
00609 iiimcf_create_aux_getvalues_event(
00610     const IIIMP_card16 *aux_name,
00611     IIIMP_card32 class_idx,
00612     int num_intvals,
00613     const IIIMP_card32 *pintvals,
00614     int num_strvals,
00615     const IIIMP_card16 **pstrs,
00616     IIIMCF_event *pevent
00617 )
00618 {
00619     IIIMCF_event_rec *pe;
00620     IIIMCF_auxevent *pae;
00621 
00622     pe = iiimcf_make_event(IIIMCF_EVENT_TYPE_AUX_GETVALUES);
00623     if (!pe) return IIIMF_STATUS_MALLOC;
00624 
00625     pae = (IIIMCF_auxevent*) malloc(sizeof(*pae));
00626     if (!pae) goto memory_error;
00627     memset(pae, 0, sizeof(*pae));
00628     pe->v.pauxevent = pae;
00629 
00630     pae->index = class_idx;
00631     pae->name = iiimcf_duplicate_string(aux_name);
00632     if (!pae->name) goto memory_error;
00633 
00634     /* integer value */
00635     if (num_intvals > 0) {
00636        IIIMP_card32 *pc32;
00637 
00638        pc32 = (IIIMP_card32*) malloc(sizeof(*pc32) * num_intvals);
00639        if (!pc32) goto memory_error;
00640        memcpy(pc32, pintvals, sizeof(*pc32) * num_intvals);
00641        pae->pintvals = pc32;
00642        pae->num_intvals = num_intvals;
00643     }
00644     /* string value */
00645     if (num_strvals > 0) {
00646        int i;
00647        IIIMP_card16 **ppu16;
00648 
00649        ppu16 = (IIIMP_card16**) malloc(sizeof(*ppu16) * num_strvals);
00650        if (!ppu16) goto memory_error;
00651        pae->pstrs = ppu16;
00652        pae->num_strvals = num_strvals;
00653        memset(ppu16, 0, sizeof(*ppu16) * num_strvals);
00654        for (i = 0; i < num_strvals; i++) {
00655            *ppu16 = iiimcf_duplicate_string(*pstrs);
00656            if (!*ppu16) goto memory_error;
00657            ppu16++;
00658            pstrs++;
00659        }
00660     }
00661 
00662     *pevent = pe;
00663 
00664     return IIIMF_STATUS_SUCCESS;
00665 
00666 memory_error:
00667     iiimcf_delete_aux_event(pe);
00668     free(pe);
00669     return IIIMF_STATUS_MALLOC;
00670 }
00671 
00672 IIIMF_status
00673 iiimcf_get_aux_event_value(
00674     IIIMCF_event event,
00675     const IIIMP_card16 **paux_name,
00676     IIIMP_card32 *pclass_idx,
00677     int *pnum_intvals,
00678     const IIIMP_card32 **ppintvals,
00679     int *pnum_strvals,
00680     const IIIMP_card16 ***ppstrs
00681 )
00682 {
00683     IIIMCF_event_rec *pe = (IIIMCF_event_rec*) event;
00684     IIIMCF_auxevent *pae;
00685 
00686     if (!((pe->type > IIIMCF_EVENT_TYPE_AUX)
00687          || (pe->type < IIIMCF_EVENT_TYPE_AUX_END))) {
00688        return IIIMF_STATUS_ARGUMENT;
00689     }
00690 
00691     pae = pe->v.pauxevent;
00692     if (paux_name) *paux_name = pae->name;
00693     if (pclass_idx) *pclass_idx = pae->index;
00694     if (pnum_intvals) *pnum_intvals = pae->num_intvals;
00695     if (ppintvals) *ppintvals = pae->pintvals;
00696     if (pnum_strvals) *pnum_strvals = pae->num_strvals;
00697     if (ppstrs) *ppstrs = (const IIIMP_card16**) pae->pstrs;
00698 
00699     return IIIMF_STATUS_SUCCESS;
00700 }
00701 
00702 /* Local Variables: */
00703 /* c-file-style: "iiim-project" */
00704 /* End: */