3 * $Id: field.c,v 1.4 2004/04/08 01:36:15 mdw Exp $
5 * Abstract field operations
7 * (c) 2001 Straylight/Edgeware
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of Catacomb.
14 * Catacomb is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
19 * Catacomb is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with Catacomb; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30 /*----- Header files ------------------------------------------------------*/
35 /*----- Main code ---------------------------------------------------------*/
37 /* --- @field_id@ --- *
39 * Arguments: @field *f@ = pointer to a field
40 * @mp *d@ = a destination element
41 * @mp *x@ = a source element
43 * Returns: The result element.
45 * Use: An identity operation which can be used if your field has no
46 * internal representation.
49 mp *field_id(field *f, mp *d, mp *x)
56 /* --- @field_samep@ --- *
58 * Arguments: @field *f, *g@ = two fields
60 * Returns: Nonzero if the fields are identical (not just isomorphic).
62 * Use: Checks for sameness of fields. This function does the full
63 * check, not just the field-type-specific check done by the
64 * @sampep@ field operation.
67 int field_samep(field *f, field *g)
69 return (f->ops == g->ops && F_SAMEP(f, g));
72 /* --- @field_stdsamep@ --- *
74 * Arguments: @field *f, *g@ = two fields
76 * Returns: Nonzero if the fields are identical (not just isomorphic).
78 * Use: Standard sameness check, based on equality of the @m@
82 int field_stdsamep(field *f, field *g)
84 return (MP_EQ(f->m, g->m));
87 /*----- That's all, folks -------------------------------------------------*/