/****************************************************************************1* Copyright (c) 1998 Free Software Foundation, Inc. *2* *3* Permission is hereby granted, free of charge, to any person obtaining a *4* copy of this software and associated documentation files (the *5* "Software"), to deal in the Software without restriction, including *6* without limitation the rights to use, copy, modify, merge, publish, *7* distribute, distribute with modifications, sublicense, and/or sell *8* copies of the Software, and to permit persons to whom the Software is *9* furnished to do so, subject to the following conditions: *10* *11* The above copyright notice and this permission notice shall be included *12* in all copies or substantial portions of the Software. *13* *14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *15* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *16* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *17* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *18* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *19* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *20* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *21* *22* Except as contained in this notice, the name(s) of the above copyright *23* holders shall not be used in advertising or otherwise to promote the *24* sale, use or other dealings in this Software without prior written *25* authorization. *26****************************************************************************/2728/****************************************************************************29* Author: Juergen Pfeifer <[email protected]> 1995,1997 *30****************************************************************************/3132#include "form.priv.h"3334MODULE_ID("$Id$")3536/*---------------------------------------------------------------------------37| Facility : libnform38| Function : FIELDTYPE *link_fieldtype(39| FIELDTYPE *type1,40| FIELDTYPE *type2)41|42| Description : Create a new fieldtype built from the two given types.43| They are connected by an logical 'OR'.44| If an error occurs, errno is set to45| E_BAD_ARGUMENT - invalid arguments46| E_SYSTEM_ERROR - system error (no memory)47|48| Return Values : Fieldtype pointer or NULL if error occurred.49+--------------------------------------------------------------------------*/50FIELDTYPE *link_fieldtype(FIELDTYPE * type1, FIELDTYPE * type2)51{52FIELDTYPE *nftyp = (FIELDTYPE *)0;5354if ( type1 && type2 )55{56nftyp = (FIELDTYPE *)malloc(sizeof(FIELDTYPE));57if (nftyp)58{59*nftyp = *_nc_Default_FieldType;60nftyp->status |= _LINKED_TYPE;61if ((type1->status & _HAS_ARGS) || (type2->status & _HAS_ARGS) )62nftyp->status |= _HAS_ARGS;63if ((type1->status & _HAS_CHOICE) || (type2->status & _HAS_CHOICE) )64nftyp->status |= _HAS_CHOICE;65nftyp->left = type1;66nftyp->right = type2;67type1->ref++;68type2->ref++;69}70else71{72SET_ERROR( E_SYSTEM_ERROR );73}74}75else76{77SET_ERROR( E_BAD_ARGUMENT );78}79return nftyp;80}8182/* fld_ftlink.c ends here */838485