Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
x_set_func.c
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2 of the GNU General Public License as
00007   published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if 
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU General Public License along
00021   with this program; if not, write the Free Software Foundation, Inc., 59
00022   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00023 
00024   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00025   Mountain View, CA 94043, or:
00026 
00027   http://www.sgi.com
00028 
00029   For further information regarding this notice, see:
00030 
00031   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00032 
00033 */
00034 
00035 
00036 /* ====================================================================
00037  * ====================================================================
00038  *
00039  *
00040  * Revision history:
00041  *  05-05-93 - Original Version
00042  *
00043  * Description:
00044  *
00045  *      Template for functional implementation of sets of objects.
00046  *      This is processed by common/util/gen_x_set into a particular
00047  *      instantiation for a particular base type.  See below for a
00048  *      complete interface documentation.
00049  *
00050  * ====================================================================
00051  * ====================================================================
00052  */
00053 
00054 BEGIN
00055 
00056 #include "bitset.h"
00057 #include "#filename#.h"
00058 
00059 #uset# *#uset#_Create(
00060   size_t    size,
00061   MEM_POOL *pool
00062 )
00063 {
00064   return (#uset#*) BS_Create(size,pool);
00065 }
00066 
00067 size_t #uset#_Size_Alloc_Size(
00068   size_t    size
00069 )
00070 {
00071   return BS_Size_Alloc_Size(size);
00072 }
00073 
00074 size_t #uset#_Alloc_Size(
00075   #uset# *set
00076 )
00077 {
00078   return BS_Alloc_Size((BS*) set);
00079 }
00080 
00081 #uset# *#uset#_ClearD(
00082   #uset# *set
00083 )
00084 {
00085   return (#uset#*) BS_ClearD((BS*) set);
00086 }
00087 
00088 #uset# *#uset#_Create_Empty(
00089   size_t size,
00090   MEM_POOL *pool
00091 )
00092 {
00093   return (#uset#*) BS_Create_Empty(size,pool);
00094 }
00095 
00096 #uset# *#uset#_Range(
00097   BS_ELT      low,
00098   BS_ELT      high,
00099   MEM_POOL   *pool
00100 )
00101 {
00102   return (#uset#*) BS_Range(low,high,pool);
00103 }
00104 
00105 #uset# *#uset#_RangeD(
00106   #uset#     *set,
00107   BS_ELT      low,
00108   BS_ELT      high,
00109   MEM_POOL   *pool
00110 )
00111 {
00112   return (#uset#*) BS_RangeD((BS*) set,low,high,pool);
00113 }
00114 
00115 #uset# *#uset#_Singleton(
00116   #base_type# element,
00117   MEM_POOL   *pool
00118 )
00119 {
00120   return (#uset#*) BS_Singleton(#elt_num#(element),pool);
00121 }
00122 
00123 #uset# *#uset#_SingletonD(
00124   #uset#     *set,
00125   #base_type# element,
00126   MEM_POOL   *pool
00127 )
00128 {
00129   return (#uset#*) BS_SingletonD((BS*) set,#elt_num#(element),pool);
00130 }
00131 
00132 BEGIN SUBUNIVERSES
00133 #uset# *#uset#_SingletonS(
00134   #base_type# element,
00135   MEM_POOL   *pool,
00136   #uset#_SUBUNIVERSE *sub
00137 )
00138 {
00139   return (#uset#*) BS_Singleton(#elt_num_sub#(element,sub),pool);
00140 }
00141 
00142 #uset# *#uset#_SingletonDS(
00143   #uset#     *set,
00144   #base_type# element,
00145   MEM_POOL   *pool,
00146   #uset#_SUBUNIVERSE *sub
00147 )
00148 {
00149   return (#uset#*) BS_SingletonD((BS*) set,#elt_num_sub#(element,sub),pool);
00150 }
00151 
00152 END SUBUNIVERSES
00153 #uset# *#uset#_Universe(
00154   size_t    size,
00155   MEM_POOL *pool
00156 )
00157 {
00158   return (#uset#*) BS_Universe(size,pool);
00159 }
00160 
00161 #uset# *#uset#_UniverseD(
00162   #uset#   *set,
00163   size_t    size,
00164   MEM_POOL *pool
00165 )
00166 {
00167   return (#uset#*) BS_UniverseD((BS*) set,size,pool);
00168 }
00169 
00170 #uset# *#uset#_Copy(
00171   #uset#   *set,
00172   MEM_POOL *pool
00173 )
00174 {
00175   return (#uset#*) BS_Copy((BS*) set,pool);
00176 }
00177 
00178 #uset# *#uset#_CopyD(
00179   #uset#   *set1,
00180   #uset#   *set2,
00181   MEM_POOL *pool
00182 )
00183 {
00184   return (#uset#*) BS_CopyD((BS*) set1,(BS*) set2,pool);
00185 }
00186 
00187 #base_type# #uset#_Choose(
00188   #uset# *set
00189 )
00190 {
00191   BS_ELT elt = BS_Choose((BS*) set);
00192   if ( elt != BS_CHOOSE_FAILURE )
00193     return #num_elt#(elt);
00194   else
00195     return #uset#_CHOOSE_FAILURE;
00196 }
00197 
00198 #base_type# #uset#_Intersection_Choose(
00199   #uset# *set1,
00200   #uset# *set2
00201 )
00202 {
00203   BS_ELT elt = BS_Intersection_Choose((BS*) set1, (BS*) set2);
00204   if ( elt != BS_CHOOSE_FAILURE )
00205     return #num_elt#(elt);
00206   else
00207     return #uset#_CHOOSE_FAILURE;
00208 }
00209 
00210 #base_type# #uset#_Choose_Next(
00211   #uset#     *set,
00212   #base_type# x
00213 )
00214 {
00215   BS_ELT elt = BS_Choose_Next((BS*) set, #elt_num#(x));
00216   if ( elt != BS_CHOOSE_FAILURE )
00217     return #num_elt#(elt);
00218   else
00219     return #uset#_CHOOSE_FAILURE;
00220 }
00221 
00222 #base_type# #uset#_Intersection_Choose_Next(
00223   #uset#     *set1,
00224   #uset#     *set2,
00225   #base_type# x
00226 )
00227 {
00228   BS_ELT elt = BS_Intersection_Choose_Next((BS*) set1, (BS*) set2,
00229                                                       #elt_num#(x));
00230   if ( elt != BS_CHOOSE_FAILURE )
00231     return #num_elt#(elt);
00232   else
00233     return #uset#_CHOOSE_FAILURE;
00234 }
00235 
00236 #base_type# #uset#_Choose_Range(
00237   #uset#   *set,
00238   BS_ELT    low,
00239   BS_ELT    high
00240 )
00241 {
00242   BS_ELT elt = BS_Choose_Range((BS*) set,low,high);
00243   if ( elt != BS_CHOOSE_FAILURE )
00244     return #num_elt#(elt);
00245   else
00246     return #uset#_CHOOSE_FAILURE;
00247 }
00248 
00249 BEGIN SUBUNIVERSES
00250 #base_type# #uset#_ChooseS(
00251   #uset# *set,
00252   #uset#_SUBUNIVERSE *sub
00253 )
00254 {
00255   BS_ELT elt = BS_Choose((BS*) set);
00256   if ( elt != BS_CHOOSE_FAILURE )
00257     return #num_elt_sub#(elt,sub);
00258   else
00259     return #uset#_CHOOSE_FAILURE;
00260 }
00261 
00262 #base_type# #uset#_Intersection_ChooseS(
00263   #uset# *set1,
00264   #uset# *set2,
00265   #uset#_SUBUNIVERSE *sub
00266 )
00267 {
00268   BS_ELT elt = BS_Intersection_Choose((BS*) set1, (BS*) set2);
00269   if ( elt != BS_CHOOSE_FAILURE )
00270     return #num_elt_sub#(elt,sub);
00271   else
00272     return #uset#_CHOOSE_FAILURE;
00273 }
00274 
00275 #base_type# #uset#_Choose_NextS(
00276   #uset#     *set,
00277   #base_type# x,
00278   #uset#_SUBUNIVERSE *sub
00279 )
00280 {
00281   BS_ELT elt = BS_Choose_Next((BS*) set, #elt_num_sub#(x,sub));
00282   if ( elt != BS_CHOOSE_FAILURE )
00283     return #num_elt_sub#(elt,sub);
00284   else
00285     return #uset#_CHOOSE_FAILURE;
00286 }
00287 
00288 #base_type# #uset#_Intersection_Choose_NextS(
00289   #uset#     *set1,
00290   #uset#     *set2,
00291   #base_type# x,
00292   #uset#_SUBUNIVERSE *sub
00293 )
00294 {
00295   BS_ELT elt = BS_Intersection_Choose_Next((BS*) set1, (BS*) set2,
00296                                                       #elt_num_sub#(x,sub));
00297   if ( elt != BS_CHOOSE_FAILURE )
00298     return #num_elt_sub#(elt,sub);
00299   else
00300     return #uset#_CHOOSE_FAILURE;
00301 }
00302 
00303 #base_type# #uset#_Choose_RangeS(
00304   #uset#   *set,
00305   BS_ELT    low,
00306   BS_ELT    high,
00307   #uset#_SUBUNIVERSE *sub
00308 )
00309 {
00310   BS_ELT elt = BS_Choose_Range((BS*) set,low,high);
00311   if ( elt != BS_CHOOSE_FAILURE )
00312     return #num_elt_sub#(elt,sub);
00313   else
00314     return #uset#_CHOOSE_FAILURE;
00315 }
00316 
00317 END SUBUNIVERSES
00318 #uset# *#uset#_Difference(
00319   #uset#   *set1,
00320   #uset#   *set2,
00321   MEM_POOL *pool
00322 )
00323 {
00324   return (#uset#*) BS_Difference((BS*) set1,(BS*) set2,pool);
00325 }
00326 
00327 #uset# *#uset#_DifferenceD(
00328   #uset# *set1,
00329   #uset# *set2
00330 )
00331 {
00332   return (#uset#*) BS_DifferenceD((BS*) set1,(BS*) set2);
00333 }
00334 
00335 #uset# *#uset#_Difference1(
00336   #uset#     *set,
00337   #base_type# x,
00338   MEM_POOL   *pool
00339 )
00340 {
00341   return (#uset#*) BS_Difference1((BS*) set,#elt_num#(x),pool);
00342 }
00343 
00344 #uset# *#uset#_Difference1D(
00345   #uset#     *set,
00346   #base_type# x
00347 )
00348 {
00349   return (#uset#*) BS_Difference1D((BS*) set,#elt_num#(x));
00350 }
00351 
00352 BEGIN SUBUNIVERSES
00353 #uset# *#uset#_Difference1S(
00354   #uset#     *set,
00355   #base_type# x,
00356   MEM_POOL   *pool,
00357   #uset#_SUBUNIVERSE *sub
00358 )
00359 {
00360   return (#uset#*) BS_Difference1((BS*) set,#elt_num_sub#(x,sub),pool);
00361 }
00362 
00363 #uset# *#uset#_Difference1DS(
00364   #uset#     *set,
00365   #base_type# x,
00366   #uset#_SUBUNIVERSE *sub
00367 )
00368 {
00369   return (#uset#*) BS_Difference1D((BS*) set,#elt_num_sub#(x,sub));
00370 }
00371 
00372 END SUBUNIVERSES
00373 #uset# *#uset#_Intersection(
00374   #uset#   *set1,
00375   #uset#   *set2,
00376   MEM_POOL *pool
00377 )
00378 {
00379   return (#uset#*) BS_Intersection((BS*) set1,(BS*) set2,pool);
00380 }
00381 
00382 #uset# *#uset#_IntersectionD(
00383   #uset# *set1,
00384   #uset# *set2
00385 )
00386 {
00387   return (#uset#*) BS_IntersectionD((BS*) set1,(BS*) set2);
00388 }
00389 
00390 size_t #uset#_Size(
00391   #uset# *set
00392 )
00393 {
00394   return BS_Size((BS*) set);
00395 }
00396 
00397 #uset# *#uset#_Union(
00398   #uset#   *set1,
00399   #uset#   *set2,
00400   MEM_POOL *pool
00401 )
00402 {
00403   return (#uset#*) BS_Union((BS*) set1,(BS*) set2,pool);
00404 }
00405 
00406 #uset# *#uset#_UnionD(
00407   #uset#   *set1,
00408   #uset#   *set2,
00409   MEM_POOL *pool
00410 )
00411 {
00412   return (#uset#*) BS_UnionD((BS*) set1,(BS*) set2,pool);
00413 }
00414 
00415 #uset# *#uset#_Union1(
00416   #uset#     *set,
00417   #base_type# x,
00418   MEM_POOL   *pool
00419 )
00420 {
00421   return (#uset#*) BS_Union1((BS*) set,#elt_num#(x),pool);
00422 }
00423 
00424 #uset# *#uset#_Union1D(
00425   #uset#     *set,
00426   #base_type# x,
00427   MEM_POOL   *pool
00428 )
00429 {
00430   return (#uset#*) BS_Union1D((BS*) set,#elt_num#(x),pool);
00431 }
00432 
00433 #uset# *#uset#_Union1D_Intersection( #uset# *set1, #uset# *set2, #uset# *set3,
00434                                      MEM_POOL *pool )
00435 {
00436   return (#uset#*) BS_UnionD_Intersection((BS*)set1,(BS*)set2,(BS*)set3,pool);
00437 }
00438 
00439 BEGIN SUBUNIVERSES
00440 #uset# *#uset#_Union1S(
00441   #uset#     *set,
00442   #base_type# x,
00443   MEM_POOL   *pool,
00444   #uset#_SUBUNIVERSE *sub
00445 )
00446 {
00447   return (#uset#*) BS_Union1((BS*) set,#elt_num_sub#(x,sub),pool);
00448 }
00449 
00450 #uset# *#uset#_Union1DS(
00451   #uset#     *set,
00452   #base_type# x,
00453   MEM_POOL   *pool,
00454   #uset#_SUBUNIVERSE *sub
00455 )
00456 {
00457   return (#uset#*) BS_Union1D((BS*) set,#elt_num_sub#(x,sub),pool);
00458 }
00459 
00460 END SUBUNIVERSES
00461 BOOL #uset#_ContainsP(
00462   #uset# *set1,
00463   #uset# *set2
00464 )
00465 {
00466   return BS_ContainsP((BS*) set1,(BS*) set2);
00467 }
00468 
00469 BOOL #uset#_EmptyP(
00470   #uset# *set
00471 )
00472 {
00473   return BS_EmptyP((BS*) set);
00474 }
00475 
00476 BOOL #uset#_EqualP(
00477   #uset# *set1,
00478   #uset# *set2
00479 )
00480 {
00481   return BS_EqualP((BS*) set1,(BS*) set2);
00482 }
00483 
00484 BOOL #uset#_IntersectsP(
00485   #uset# *set1,
00486   #uset# *set2
00487 )
00488 {
00489   return BS_IntersectsP((BS*) set1,(BS*) set2);
00490 }
00491 
00492 BOOL #uset#_MemberP(
00493   #uset#     *set,
00494   #base_type# x
00495 )
00496 {
00497   return BS_MemberP((BS*) set,#elt_num#(x));
00498 }
00499 
00500 BOOL #uset#_Intersection_MemberP(
00501   #uset#     *set1,
00502   #uset#     *set2,
00503   #base_type# x
00504 )
00505 {
00506   return BS_Intersection_MemberP((BS*) set1, (BS*) set2, #elt_num#(x));
00507 }
00508 
00509 BEGIN SUBUNIVERSES
00510 BOOL #uset#_MemberPS(
00511   #uset#     *set,
00512   #base_type# x,
00513   #uset#_SUBUNIVERSE *sub
00514 )
00515 {
00516   return BS_MemberP((BS*) set,#elt_num_sub#(x,sub));
00517 }
00518 
00519 BOOL #uset#_Intersection_MemberPS(
00520   #uset#     *set1,
00521   #uset#     *set2,
00522   #base_type# x,
00523   #uset#_SUBUNIVERSE *sub
00524 )
00525 {
00526   return BS_Intersection_MemberP((BS*) set1, (BS*) set2, #elt_num_sub#(x,sub));
00527 }
00528 
00529 END SUBUNIVERSES
00530 
00531 void #uset#_Print(
00532   #uset# *set,
00533   FILE   *f
00534 )
00535 {
00536   BS_Print((BS*) set,f);
00537 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines