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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
|
#ifndef __CULL_MULTITYPE_H
#define __CULL_MULTITYPE_H
/*___INFO__MARK_BEGIN__*/
/*************************************************************************
*
* The Contents of this file are made available subject to the terms of
* the Sun Industry Standards Source License Version 1.2
*
* Sun Microsystems Inc., March, 2001
*
*
* Sun Industry Standards Source License Version 1.2
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.2 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2001 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
************************************************************************/
/* Portions of this code are Copyright (c) 2011 Univa Corporation. */
/*___INFO__MARK_END__*/
#include <stdio.h>
#include "cull/cull_list.h"
#include "sge.h"
#ifdef __cplusplus
extern "C" {
#endif
#define SGE_NO_ABORT 0
#define SGE_DO_ABORT 1
#define for_each_attr(ATTR, LDP) for (ATTR = LDP->nm; ATTR != NoName; LDP++, ATTR = LDP->nm)
extern const char *multitypes[];
typedef int (*lCmpFunction)(lListElem *, lListElem *, int);
void lWriteDescrTo(const lDescr *dp, FILE *fp);
int _lGetPosInDescr(const lDescr *dp, int name);
int lGetPosInDescr(const lDescr *dp, int name);
int lGetPosType(const lDescr *dp, int pos);
int lCountDescr(const lDescr *dp);
lDescr* lCopyDescr(const lDescr *dp);
int lGetPosViaElem(const lListElem *element, int nm, int abort);
void lInit(const lNameSpace *namev);
const char *lNm2Str(int nm);
int lStr2Nm(const char *str);
const char *lMt2Str(int mt);
char **lGetPosStringRef(const lListElem *ep, int id);
char **lGetPosHostRef(const lListElem *ep, int id);
lList **lGetListRef(const lListElem *ep, int name);
int lGetType(const lDescr *dp, int nm);
int lGetPosName(const lDescr *dp, int pos);
int lXchgList(lListElem *ep, int name, lList **lpp);
int lXchgString(lListElem *ep, int name, char **str);
int lSwapList(lListElem *to, int to_nm, lListElem *from, int from_nm);
lInt lGetPosInt(const lListElem *ep, int id);
lUlong lGetPosUlong(const lListElem *ep, int id);
lUlong64 lGetPosUlong64(const lListElem *ep, int id);
const char *lGetPosString(const lListElem *ep, int id);
const char *lGetPosHost(const lListElem *ep, int id);
lList *lGetPosList(const lListElem *ep, int id);
lFloat lGetPosFloat(const lListElem *ep, int id);
lDouble lGetPosDouble(const lListElem *ep, int id);
lLong lGetPosLong(const lListElem *ep, int id);
lChar lGetPosChar(const lListElem *ep, int id);
lBool lGetPosBool(const lListElem *ep, int id);
lObject lGetPosObject(const lListElem *ep, int id);
lRef lGetPosRef(const lListElem *ep, int id);
int lSetPosInt(lListElem *ep, int pos, int value);
int lSetPosUlong(lListElem *ep, int pos, lUlong value);
int lSetPosUlong64(lListElem *ep, int pos, lUlong64 value);
int lSetPosString(lListElem *ep, int pos, const char *value);
int lSetPosHost(lListElem *ep, int pos, const char *value);
int lSetPosList(lListElem *ep, int pos, lList *value);
int lSetPosFloat(lListElem *ep, int pos, lFloat value);
int lSetPosDouble(lListElem *ep, int pos, lDouble value);
int lSetPosLong(lListElem *ep, int pos, lLong value);
int lSetPosChar(lListElem *ep, int pos, lChar value);
int lSetPosBool(lListElem *ep, int pos, lBool value);
int lSetPosObject(lListElem *ep, int pos, lListElem *value);
int lSetPosRef(lListElem *ep, int pos, lRef value);
lInt lGetInt(const lListElem *ep, int name);
lUlong lGetUlong(const lListElem *ep, int name);
lUlong64 lGetUlong64(const lListElem *ep, int name);
const char *lGetString(const lListElem *ep, int name);
const char *lGetHost(const lListElem *ep, int name);
lList *lGetList(const lListElem *ep, int name);
lList *lGetOrCreateList(lListElem *ep, int name, const char *list_name, const lDescr *descr);
lFloat lGetFloat(const lListElem *ep, int name);
lDouble lGetDouble(const lListElem *ep, int name);
lLong lGetLong(const lListElem *ep, int name);
lChar lGetChar(const lListElem *ep, int name);
lBool lGetBool(const lListElem *ep, int name);
lObject lGetObject(const lListElem *ep, int name);
lRef lGetRef(const lListElem *ep, int name);
int lSetInt(lListElem *ep, int name, int value);
int lSetUlong(lListElem *ep, int name, lUlong value);
int lSetUlong64(lListElem *ep, int name, lUlong64 value);
int lSetString(lListElem *ep, int name, const char *value);
int lSetHost(lListElem *ep, int name, const char *value);
int lSetList(lListElem *ep, int name, lList *value);
int lSetFloat(lListElem *ep, int name, lFloat value);
int lSetDouble(lListElem *ep, int name, lDouble value);
int lSetLong(lListElem *ep, int name, lLong value);
int lSetChar(lListElem *ep, int name, lChar value);
int lSetBool(lListElem *ep, int name, lBool value);
int lSetObject(lListElem *ep, int name, lListElem *value);
int lSetRef(lListElem *ep, int name, lRef value);
int lAddDouble(lListElem *ep, int name, lDouble offset);
int lAddUlong(lListElem *ep, int name, lUlong offset);
int lAddUlong64(lListElem *ep, int name, lUlong64 offset);
int intcmp(lInt i0, lInt i1);
int ulongcmp(lUlong u0, lUlong u1);
int bitmaskcmp(lUlong bm0, lUlong bm1);
int ulong64cmp(lUlong64 u0, lUlong64 u1);
int floatcmp(lFloat u0, lFloat u1);
int doublecmp(lDouble u0, lDouble u1);
int charcmp(lChar u0, lChar u1);
int boolcmp(lBool u0, lBool u1);
int longcmp(lLong u0, lLong u1);
int refcmp(lRef u0, lRef u1);
int incompatibleType(const char *str) __attribute__ ((noreturn));
int incompatibleType2(const char *fmt, ...) __attribute__ ((format (printf, 1, 2), noreturn));
int unknownType(const char *str) __attribute__ ((noreturn));
/* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
functions for lists with a char * as key
*/
lListElem* lAddElemStr(lList **lpp, int nm, const char *str, const lDescr *dp);
lListElem* lAddElemHost(lList **lpp, int nm, const char *str, const lDescr *dp);
int lDelElemStr(lList **lpp, int nm, const char *str);
lListElem *lGetElemStr(const lList *lp, int nm, const char *str);
lListElem *lGetElemStrFirst(const lList *lp, int nm, const char *str, const void **iterator);
lListElem *lGetElemStrNext(const lList *lp, int nm, const char *str, const void **iterator);
lListElem *lGetElemStrLike(const lList *lp, int nm, const char *str);
/* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
functions for sublists with a char * as key
*/
lListElem* lAddSubStr(lListElem *ep, int nm, const char *str, int snm, const lDescr *dp);
int lDelSubStr(lListElem *ep, int nm, const char *str, int snm);
lListElem *lGetSubStr(const lListElem *ep, int nm, const char *str, int snm);
/* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
functions for lists with a ulong as key
*/
lListElem* lAddElemUlong(lList **lpp, int nm, lUlong val, const lDescr *dp);
int lDelElemUlong(lList **lpp, int nm, lUlong val);
lListElem *lGetElemUlong(const lList *lp, int nm, lUlong val);
lListElem *lGetElemUlongFirst(const lList *lp, int nm, lUlong val, const void **iterator);
lListElem *lGetElemUlongNext(const lList *lp, int nm, lUlong val, const void **iterator);
/* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
functions for sublists with a ulong as key
*/
lListElem* lAddSubUlong(lListElem *ep, int nm, lUlong val, int snm, const lDescr *dp);
int lDelSubUlong(lListElem *ep, int nm, lUlong val, int snm);
lListElem *lGetSubUlong(const lListElem *ep, int nm, lUlong val, int snm);
/* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
functions for lists with a ulong64 as key
*/
lListElem* lAddElemUlong64(lList **lpp, int nm, lUlong64 val, const lDescr *dp);
int lDelElemUlong64(lList **lpp, int nm, lUlong64 val);
lListElem *lGetElemUlong64(const lList *lp, int nm, lUlong64 val);
lListElem *lGetElemUlong64First(const lList *lp, int nm, lUlong64 val, const void **iterator);
lListElem *lGetElemUlong64Next(const lList *lp, int nm, lUlong64 val, const void **iterator);
/* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
functions for sublists with a ulong64 as key
*/
lListElem* lAddSubUlong64(lListElem *ep, int nm, lUlong64 val, int snm, const lDescr *dp);
int lDelSubUlong64(lListElem *ep, int nm, lUlong64 val, int snm);
lListElem *lGetSubUlong64(const lListElem *ep, int nm, lUlong64 val, int snm);
/* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
functions for lists with a case insensitive char * as key
*/
int lDelElemCaseStr(lList **lpp, int nm, const char *str);
lListElem *lGetElemCaseStr(const lList *lp, int nm, const char *str);
/* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
functions for sublists with a char * as key
*/
int lDelSubCaseStr(lListElem *ep, int nm, const char *str, int snm);
lListElem *lGetSubCaseStr(const lListElem *ep, int nm, const char *str, int snm);
/* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
functions for sublists with a hostname as key
*/
lListElem* lAddSubHost(lListElem *ep, int nm, const char *str, int snm, const lDescr *dp);
int lDelElemHost(lList **lpp, int nm, const char *str);
lListElem *lGetSubHost(const lListElem *ep, int nm, const char *str, int snm);
lListElem *lGetElemHost(const lList *lp, int nm, const char *str);
lListElem *lGetElemHostFirst(const lList *lp, int nm, const char *str, const void **iterator);
lListElem *lGetElemHostNext(const lList *lp, int nm, const char *str, const void **iterator);
#ifdef __cplusplus
}
#endif
#endif /* __CULL_MULTITYPE_H */
|