| File: | src/annabs.c |
| Warning: | line 357, column 9 Value stored to 'typeSx' during its initialization is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | #include "axlobs.h" |
| 2 | |
| 3 | #include "ablogic.h" |
| 4 | #include "absyn.h" |
| 5 | #include "archive.h" |
| 6 | #include "doc.h" |
| 7 | #include "debug.h" |
| 8 | #include "int.h" |
| 9 | #include "sefo.h" |
| 10 | #include "sexpr.h" |
| 11 | #include "stab.h" |
| 12 | #include "store.h" |
| 13 | #include "syme.h" |
| 14 | #include "spesym.h" |
| 15 | #include "table.h" |
| 16 | #include "ti_bup.h" |
| 17 | #include "ti_tdn.h" |
| 18 | #include "tform.h" |
| 19 | |
| 20 | /***************************************************************************** |
| 21 | * |
| 22 | * :: Annotated SExpression |
| 23 | * |
| 24 | ****************************************************************************/ |
| 25 | static Bool abcElideInnerExpressions; |
| 26 | |
| 27 | typedef struct _AbAnnotationBucket { |
| 28 | Table indexForSefo; |
| 29 | Table sxForIndex; |
| 30 | AInt nextIndex; |
| 31 | Table indexForSyme; |
| 32 | Table symeSxForIndex; |
| 33 | AInt nextSymeIndex; |
| 34 | } *AbAnnotationBucket; |
| 35 | |
| 36 | localstatic AbAnnotationBucket abcNew(void); |
| 37 | localstatic void abcFree(AbAnnotationBucket bucket); |
| 38 | localstatic AInt abcGetSefo(AbAnnotationBucket bucket, Sefo sefo); |
| 39 | localstatic AInt abcAddSefo(AbAnnotationBucket bucket, Sefo sefo); |
| 40 | localstatic void abcSetSefoSExpr(AbAnnotationBucket bucket, AInt idx, SExpr sx); |
| 41 | |
| 42 | localstatic AInt abcGetSyme(AbAnnotationBucket bucket, Syme syme); |
| 43 | localstatic AInt abcAddSyme(AbAnnotationBucket bucket, Syme syme); |
| 44 | localstatic void abcSetSymeSExpr(AbAnnotationBucket bucket, AInt idx, SExpr sx); |
| 45 | |
| 46 | localstatic SExpr abAnnotateSymeRef(Syme syme, AbAnnotationBucket bucket); |
| 47 | localstatic SExpr abAnnotateSyme(Syme syme, AbAnnotationBucket bucket); |
| 48 | |
| 49 | localstatic SExpr abAnnotatedSExpr(AbSyn ab, AbAnnotationBucket bucket); |
| 50 | localstatic SExpr abAnnotateId(AbSyn id, AbAnnotationBucket bucket); |
| 51 | localstatic SExpr abAnnotateUnique(AbSyn id, AbAnnotationBucket bucket); |
| 52 | localstatic SExpr abAnnotateTPoss(AbSyn id, AbAnnotationBucket bucket); |
| 53 | localstatic SExpr abAnnotateError(AbSyn id, AbAnnotationBucket bucket); |
| 54 | localstatic SExpr abToAnnotatedTForm(TForm tf, AbAnnotationBucket bucket); |
| 55 | localstatic SExpr abAnnotateSefo(Sefo sefo, AbAnnotationBucket bucket); |
| 56 | localstatic SExpr abAnnotateExportArchive(Archive ar, Syme syme); |
| 57 | |
| 58 | localstatic AbAnnotationBucket |
| 59 | abcNew(void) |
| 60 | { |
| 61 | AbAnnotationBucket bucket = (AbAnnotationBucket) stoAlloc((int) OB_Other0, sizeof(*bucket)); |
| 62 | bucket->indexForSefo = tblNew((TblHashFun) abHashSefo, (TblEqFun) sefoEqual); |
| 63 | bucket->sxForIndex = tblNew((TblHashFun) aintPtrHash, (TblEqFun) aintPtrEqual); |
| 64 | bucket->indexForSyme = tblNew((TblHashFun) symeHashFn, (TblEqFun) symeEqualWithAnnotation); |
| 65 | bucket->symeSxForIndex = tblNew((TblHashFun) aintPtrHash, (TblEqFun) aintPtrEqual); |
| 66 | bucket->nextIndex = 0; |
| 67 | bucket->nextSymeIndex = 0; |
| 68 | return bucket; |
| 69 | } |
| 70 | |
| 71 | localstatic void |
| 72 | abcFree(AbAnnotationBucket bucket) |
| 73 | { |
| 74 | tblFree(bucket->indexForSefo); |
| 75 | tblFree(bucket->sxForIndex); |
| 76 | tblFree(bucket->indexForSyme); |
| 77 | tblFree(bucket->symeSxForIndex); |
| 78 | stoFree(bucket); |
| 79 | } |
| 80 | |
| 81 | |
| 82 | localstatic AInt |
| 83 | abcGetSefo(AbAnnotationBucket bucket, Sefo sefo) |
| 84 | { |
| 85 | return (AInt) tblElt(bucket->indexForSefo, sefo, (TblElt) (AInt) -1); |
| 86 | } |
| 87 | |
| 88 | localstatic AInt |
| 89 | abcAddSefo(AbAnnotationBucket bucket, Sefo sefo) |
| 90 | { |
| 91 | AInt idx = bucket->nextIndex++; |
| 92 | tblSetElt(bucket->indexForSefo, sefo, (TblElt) (AInt) idx); |
| 93 | return idx; |
| 94 | } |
| 95 | |
| 96 | localstatic void |
| 97 | abcSetSefoSExpr(AbAnnotationBucket bucket, AInt idx, SExpr sx) |
| 98 | { |
| 99 | tblSetElt(bucket->sxForIndex, (TblElt) idx, sx); |
| 100 | } |
| 101 | |
| 102 | |
| 103 | localstatic AInt |
| 104 | abcGetSyme(AbAnnotationBucket bucket, Syme syme) |
| 105 | { |
| 106 | return (AInt) tblElt(bucket->indexForSyme, syme, (TblElt) (AInt) -1); |
| 107 | } |
| 108 | |
| 109 | localstatic AInt |
| 110 | abcAddSyme(AbAnnotationBucket bucket, Syme syme) |
| 111 | { |
| 112 | AInt idx = bucket->nextSymeIndex++; |
| 113 | tblSetElt(bucket->indexForSyme, syme, (TblElt) (AInt) idx); |
| 114 | return idx; |
| 115 | } |
| 116 | |
| 117 | localstatic void |
| 118 | abcSetSymeSExpr(AbAnnotationBucket bucket, AInt idx, SExpr sx) |
| 119 | { |
| 120 | tblSetElt(bucket->symeSxForIndex, (TblElt) idx, sx); |
| 121 | } |
| 122 | |
| 123 | localstatic SExpr |
| 124 | abAnnotatedSExprElided(AbSyn ab, AbAnnotationBucket bucket) |
| 125 | { |
| 126 | SExpr sx; |
| 127 | Bool current = abcElideInnerExpressions; |
| 128 | abcElideInnerExpressions = true1; |
| 129 | sx = abAnnotatedSExpr(ab, bucket); |
| 130 | abcElideInnerExpressions = current; |
| 131 | return sx; |
| 132 | } |
| 133 | |
| 134 | |
| 135 | |
| 136 | localstatic SExpr |
| 137 | abcSExpr(AbAnnotationBucket bucket) |
| 138 | { |
| 139 | SExpr wholeSefo = sxNil; |
| 140 | SExpr wholeSyme = sxNil; |
| 141 | int i; |
| 142 | for (i=0; i<bucket->nextIndex; i++) { |
| 143 | SExpr sx = tblElt(bucket->sxForIndex, (TblElt) (AInt) i, NULL((void*)0)); |
| 144 | wholeSefo = sxCons(sx, wholeSefo); |
| 145 | } |
| 146 | for (i=0; i<bucket->nextSymeIndex; i++) { |
| 147 | SExpr sx = tblElt(bucket->symeSxForIndex, (TblElt) (AInt) i, NULL((void*)0)); |
| 148 | wholeSyme = sxCons(sx, wholeSyme); |
| 149 | } |
| 150 | |
| 151 | return sxiList(2, sxNReverse(wholeSyme), sxNReverse(wholeSefo)); |
| 152 | } |
| 153 | |
| 154 | SExpr |
| 155 | abToAnnotatedSExpr(AbSyn whole) |
| 156 | { |
| 157 | AbAnnotationBucket bucket = abcNew(); |
| 158 | SExpr sexpr; |
| 159 | |
| 160 | sexpr = abAnnotatedSExpr(whole, bucket); |
| 161 | sexpr = sxCons(sexpr, abcSExpr(bucket)); |
| 162 | abcFree(bucket); |
| 163 | |
| 164 | return sexpr; |
| 165 | } |
| 166 | |
| 167 | localstatic SExpr |
| 168 | abAnnotatedSExpr(AbSyn ab, AbAnnotationBucket bucket) |
| 169 | { |
| 170 | Length ai; |
| 171 | SExpr sx; |
| 172 | |
| 173 | if (!ab) return sxNil; |
| 174 | |
| 175 | switch (abTag(ab)((ab)->abHdr.tag)) { |
| 176 | case AB_Nothing: |
| 177 | sx = sxNil; |
| 178 | break; |
| 179 | case AB_Blank: |
| 180 | case AB_IdSy: |
| 181 | sx = sxiList(2, |
| 182 | abInfo(abTag(ab))abInfoTable[(((ab)->abHdr.tag)) - AB_START].sxsym, |
| 183 | sxiFrSymbol(ab->abId.sym)); |
| 184 | break; |
| 185 | case AB_Id: |
| 186 | sx = abAnnotateId(ab, bucket); |
| 187 | break; |
| 188 | case AB_DocText: |
| 189 | sx = sxiList(2, |
| 190 | abInfo(abTag(ab))abInfoTable[(((ab)->abHdr.tag)) - AB_START].sxsym, |
| 191 | sxiFrString(docString(ab->abDocText.doc)((ab->abDocText.doc)->corpus)) |
| 192 | ); |
| 193 | break; |
| 194 | case AB_LitInteger: |
| 195 | case AB_LitString: |
| 196 | case AB_LitFloat: |
| 197 | sx = sxiList(2, |
| 198 | abInfo(abTag(ab))abInfoTable[(((ab)->abHdr.tag)) - AB_START].sxsym, |
| 199 | sxiFrString(ab->abLitString.str) |
| 200 | ); |
| 201 | break; |
| 202 | case AB_Declare: { |
| 203 | Syme syme = abSyme(ab->abDeclare.id)((ab->abDeclare.id)->abHdr.seman ? (ab->abDeclare.id )->abHdr.seman->syme : 0); |
| 204 | |
| 205 | sx = sxCons(abInfo(abTag(ab))abInfoTable[(((ab)->abHdr.tag)) - AB_START].sxsym, sxNil); |
| 206 | for (ai = 0; ai < abArgc(ab)((ab)->abHdr.argc); ai++) |
| 207 | sx = sxCons(abAnnotatedSExpr(abArgv(ab)((ab)->abGen.data.argv)[ai], bucket), sx); |
| 208 | |
| 209 | sx = sxNReverse(sx); |
| 210 | break; |
| 211 | } |
| 212 | case AB_Add: |
| 213 | case AB_With: { |
| 214 | if (abcElideInnerExpressions) { |
| 215 | sx = sxCons(abInfo(abTag(ab))abInfoTable[(((ab)->abHdr.tag)) - AB_START].sxsym, sxNil); |
| 216 | } |
| 217 | else { |
| 218 | sx = sxCons(abInfo(abTag(ab))abInfoTable[(((ab)->abHdr.tag)) - AB_START].sxsym, sxNil); |
| 219 | for (ai = 0; ai < abArgc(ab)((ab)->abHdr.argc); ai++) |
| 220 | sx = sxCons(abAnnotatedSExpr(abArgv(ab)((ab)->abGen.data.argv)[ai], bucket), sx); |
| 221 | sx = sxNReverse(sx); |
| 222 | } |
| 223 | break; |
| 224 | } |
| 225 | default: |
| 226 | sx = sxCons(abInfo(abTag(ab))abInfoTable[(((ab)->abHdr.tag)) - AB_START].sxsym, sxNil); |
| 227 | for (ai = 0; ai < abArgc(ab)((ab)->abHdr.argc); ai++) |
| 228 | sx = sxCons(abAnnotatedSExpr(abArgv(ab)((ab)->abGen.data.argv)[ai], bucket), sx); |
| 229 | sx = sxNReverse(sx); |
| 230 | } |
| 231 | |
| 232 | sx = sxiRepos(abPos(ab)(spstackFirst((ab)->abHdr.pos)), sx); |
| 233 | return sx; |
| 234 | } |
| 235 | |
| 236 | localstatic SExpr |
| 237 | abAnnotateId(AbSyn id, AbAnnotationBucket bucket) |
| 238 | { |
| 239 | SExpr sx; |
| 240 | switch (abState(id)((id)->abHdr.state)) { |
| 241 | case AB_State_AbSyn: |
| 242 | case AB_State_HasPoss: |
| 243 | sx = abAnnotateTPoss(id, bucket); |
| 244 | break; |
| 245 | case AB_State_HasUnique: |
| 246 | sx = abAnnotateUnique(id, bucket); |
| 247 | break; |
| 248 | case AB_State_Error: |
| 249 | sx = abAnnotateError(id, bucket); |
| 250 | break; |
| 251 | default: |
| 252 | sx = NULL((void*)0); |
| 253 | assert(false)do { if (!(((int) 0))) _do_assert(("false"),"annabs.c",253); } while (0); |
| 254 | } |
| 255 | |
| 256 | return sxCons(abInfo(abTag(id))abInfoTable[(((id)->abHdr.tag)) - AB_START].sxsym, sx); |
| 257 | } |
| 258 | |
| 259 | localstatic SExpr |
| 260 | abAnnotateAbSyn(AbSyn id, AbAnnotationBucket bucket) |
| 261 | { |
| 262 | SExpr whole = sxNil; |
| 263 | |
| 264 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("name")symProbe("name", 1)), sxiFrSymbol(abIdSym(id)((id)->abId.sym))), whole); |
| 265 | |
| 266 | return whole; |
| 267 | } |
| 268 | |
| 269 | localstatic SExpr |
| 270 | abAnnotateUnique(AbSyn id, AbAnnotationBucket bucket) |
| 271 | { |
| 272 | Syme syme = abSyme(id)((id)->abHdr.seman ? (id)->abHdr.seman->syme : 0); |
| 273 | SrcPos spos = abPos(id)(spstackFirst((id)->abHdr.pos)); |
| 274 | SExpr sposSx = (sposIsNone(spos)sposEqual(spos, sposNone)) ? sxNil : sposToSExpr(spos); |
| 275 | |
| 276 | if (abIsTheId(id, ssymCategory)(((id)->abHdr.tag == (AB_Id)) && ((id)->abId.sym )==(ssymCategory))) { |
| 277 | syme = car(stabGetMeanings(stabFile(), ablogFalse(), ssymCategory))((stabGetMeanings(stabFile(), ablogFalse(), ssymCategory))-> first); |
| 278 | } |
| 279 | else if (syme == NULL((void*)0)) { |
| 280 | return abAnnotateAbSyn(id, bucket); |
| 281 | } |
| 282 | SExpr symeSx = abAnnotateSyme(syme, bucket); |
| 283 | SExpr whole = sxNil; |
| 284 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("syme")symProbe("syme", 1)), symeSx), whole); |
| 285 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("srcpos")symProbe("srcpos", 1)), sposSx), whole); |
| 286 | |
| 287 | return whole; |
| 288 | } |
| 289 | |
| 290 | localstatic SExpr |
| 291 | abAnnotateSyme(Syme syme, AbAnnotationBucket bucket) |
| 292 | { |
| 293 | AInt idx = abcGetSyme(bucket, syme); |
| 294 | if (idx == -1) { |
| 295 | AInt newIdx = abcAddSyme(bucket, syme); |
| 296 | SExpr sx = abAnnotateSymeRef(syme, bucket); |
| 297 | abcSetSymeSExpr(bucket, newIdx, sx); |
| 298 | return sxCons(sxiFrSymbol(symInternConst("ref")symProbe("ref", 1)), sxiFrInteger(newIdx)); |
| 299 | } |
| 300 | else { |
| 301 | return sxCons(sxiFrSymbol(symInternConst("ref")symProbe("ref", 1)), sxiFrInteger(idx)); |
| 302 | } |
| 303 | |
| 304 | } |
| 305 | |
| 306 | localstatic SExpr |
| 307 | abAnnotateSymeRef(Syme syme, AbAnnotationBucket bucket) |
| 308 | { |
| 309 | TForm tf = symeType(syme); |
| 310 | SExpr exporterSx = sxNil; |
| 311 | |
| 312 | SrcPos spos = symeSrcPos(syme)((SrcPos) (SYFI_SrcPos < (8 * sizeof(int)) && !((( ((syme)->kind == SYME_Trigger ? libGetAllSymes((syme)-> lib) : ((void*)0)), (syme))->hasmask) & (1 << (SYFI_SrcPos ))) ? (symeFieldInfo[SYFI_SrcPos].def) : (((((syme)->kind == SYME_Trigger ? libGetAllSymes((syme)->lib) : ((void*)0)), (syme))->locmask) & (1 << (SYFI_SrcPos))) ? ((( (((syme)->kind == SYME_Trigger ? libGetAllSymes((syme)-> lib) : ((void*)0)), (syme))->locmask) & (1 << (SYFI_SrcPos ))) ? ((syme)->fieldv)[symeIndex(syme,SYFI_SrcPos)] : (symeFieldInfo [SYFI_SrcPos].def)) : symeGetFieldFn(syme,SYFI_SrcPos))); |
| 313 | SExpr sposSx = (sposIsNone(spos)sposEqual(spos, sposNone)) ? NULL((void*)0) : sposToSExpr(spos); |
| 314 | Bool wantType = true1; |
| 315 | SExpr whole = sxNil; |
| 316 | |
| 317 | if (symeIsLibrary(syme)(((((syme)->kind == SYME_Trigger ? libGetAllSymes((syme)-> lib) : ((void*)0)), (syme))->kind) == SYME_Library)) { |
| 318 | wantType = false((int) 0); |
| 319 | } |
| 320 | if (symeIsExport(syme)(((((syme)->kind == SYME_Trigger ? libGetAllSymes((syme)-> lib) : ((void*)0)), (syme))->kind) == SYME_Export)) { |
| 321 | Syme original = symeOriginal(syme); |
| 322 | AInt constNum = symeConstNum(original)(((AInt) (SYFI_ConstInfo < (8 * sizeof(int)) && !( ((((original)->kind == SYME_Trigger ? libGetAllSymes((original )->lib) : ((void*)0)), (original))->hasmask) & (1 << (SYFI_ConstInfo))) ? (symeFieldInfo[SYFI_ConstInfo].def) : ( ((((original)->kind == SYME_Trigger ? libGetAllSymes((original )->lib) : ((void*)0)), (original))->locmask) & (1 << (SYFI_ConstInfo))) ? ((((((original)->kind == SYME_Trigger ? libGetAllSymes((original)->lib) : ((void*)0)), (original ))->locmask) & (1 << (SYFI_ConstInfo))) ? ((original )->fieldv)[symeIndex(original,SYFI_ConstInfo)] : (symeFieldInfo [SYFI_ConstInfo].def)) : symeGetFieldFn(original,SYFI_ConstInfo ))) & 0xFFFF); |
| 323 | AInt defnNum = symeDefnNum(original)((int) (SYFI_DefnNum < (8 * sizeof(int)) && !((((( original)->kind == SYME_Trigger ? libGetAllSymes((original )->lib) : ((void*)0)), (original))->hasmask) & (1 << (SYFI_DefnNum))) ? (symeFieldInfo[SYFI_DefnNum].def) : ((((( original)->kind == SYME_Trigger ? libGetAllSymes((original )->lib) : ((void*)0)), (original))->locmask) & (1 << (SYFI_DefnNum))) ? ((((((original)->kind == SYME_Trigger ? libGetAllSymes((original)->lib) : ((void*)0)), (original) )->locmask) & (1 << (SYFI_DefnNum))) ? ((original )->fieldv)[symeIndex(original,SYFI_DefnNum)] : (symeFieldInfo [SYFI_DefnNum].def)) : symeGetFieldFn(original,SYFI_DefnNum)) ); |
| 324 | Lib lib = symeLib(syme)((syme)->lib); |
| 325 | |
| 326 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("typeCode")symProbe("typeCode", 1)), |
| 327 | sxiFrInteger(symeTypeCode(original))), whole); |
| 328 | if (lib != NULL((void*)0)) { |
| 329 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("lib")symProbe("lib", 1)), |
| 330 | sxiFrString(fnameUnparse(lib->name))), whole); |
| 331 | } |
| 332 | } |
| 333 | if (symeIsImport(syme)(((((syme)->kind == SYME_Trigger ? libGetAllSymes((syme)-> lib) : ((void*)0)), (syme))->kind) == SYME_Import)) { |
| 334 | TForm exporter = symeExporter(syme); |
| 335 | |
| 336 | if (tfIsArchive(exporter)) { |
| 337 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("typeCode")symProbe("typeCode", 1)), |
| 338 | sxiFrInteger(symeTypeCode(syme))), whole); |
| 339 | exporterSx = abAnnotateExportArchive(tfArchiveAr(exporter), syme); |
| 340 | wantType = false((int) 0); |
| 341 | } |
| 342 | else { |
| 343 | Syme original = symeOriginal(syme); |
| 344 | SExpr originalSx = abAnnotateSyme(original, bucket); |
| 345 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("original")symProbe("original", 1)), |
| 346 | originalSx), whole); |
| 347 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("typeCode")symProbe("typeCode", 1)), |
| 348 | sxiFrInteger(symeTypeCode(original))), whole); |
| 349 | exporterSx = abToAnnotatedTForm(exporter, bucket); |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | if (!sxiNull(exporterSx)(((exporterSx)->sxHdr.tag) == SX_Nil)) { |
| 354 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("exporter")symProbe("exporter", 1)), exporterSx), whole); |
| 355 | } |
| 356 | if (wantType) { |
| 357 | SExpr typeSx = sxNil; |
Value stored to 'typeSx' during its initialization is never read | |
| 358 | if (tfIsDomainType(tf)) { |
| 359 | typeSx = sxiFrString("-- Domain --"); |
| 360 | } |
| 361 | else if (tfIsCategoryType(tf) || tfIsThird(tf)(((tf)->tag) == TF_Third)) { |
| 362 | typeSx = sxiFrString("-- Category --"); |
| 363 | } |
| 364 | else { |
| 365 | typeSx = abToAnnotatedTForm(tf, bucket); |
| 366 | } |
| 367 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("type")symProbe("type", 1)), typeSx), whole); |
| 368 | } |
| 369 | |
| 370 | if (sposSx != NULL((void*)0)) { |
| 371 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("srcpos")symProbe("srcpos", 1)), sposSx), whole); |
| 372 | } |
| 373 | |
| 374 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("name")symProbe("name", 1)), sxiFrSymbol(symeId(syme)((syme)->id))), whole); |
| 375 | |
| 376 | return whole; |
| 377 | } |
| 378 | |
| 379 | localstatic SExpr |
| 380 | abAnnotateExportArchive(Archive ar, Syme syme) |
| 381 | { |
| 382 | Syme original = symeOriginal(syme); |
| 383 | Syme symeLib = arLibrarySyme(ar, original); |
| 384 | Lib lib = symeLibrary(symeLib)((Lib) (SYFI_Library < (8 * sizeof(int)) && !((((( symeLib)->kind == SYME_Trigger ? libGetAllSymes((symeLib)-> lib) : ((void*)0)), (symeLib))->hasmask) & (1 << (SYFI_Library))) ? (symeFieldInfo[SYFI_Library].def) : ((((( symeLib)->kind == SYME_Trigger ? libGetAllSymes((symeLib)-> lib) : ((void*)0)), (symeLib))->locmask) & (1 << (SYFI_Library))) ? ((((((symeLib)->kind == SYME_Trigger ? libGetAllSymes((symeLib)->lib) : ((void*)0)), (symeLib))-> locmask) & (1 << (SYFI_Library))) ? ((symeLib)-> fieldv)[symeIndex(symeLib,SYFI_Library)] : (symeFieldInfo[SYFI_Library ].def)) : symeGetFieldFn(symeLib,SYFI_Library))); |
| 385 | SExpr whole = sxNil; |
| 386 | |
| 387 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("lib")symProbe("lib", 1)), |
| 388 | sxiFrString(fnameUnparse(lib->name))), whole); |
| 389 | |
| 390 | return whole; |
| 391 | } |
| 392 | |
| 393 | |
| 394 | |
| 395 | localstatic SExpr |
| 396 | abAnnotateTPoss(AbSyn id, AbAnnotationBucket bucket) |
| 397 | { |
| 398 | SExpr whole = sxNil; |
| 399 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("name")symProbe("name", 1)), sxiFrSymbol(abIdSym(id)((id)->abId.sym))), |
| 400 | whole); |
| 401 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("state")symProbe("state", 1)), sxiFrString("tposs")), |
| 402 | whole); |
| 403 | return whole; |
| 404 | } |
| 405 | |
| 406 | localstatic SExpr |
| 407 | abAnnotateError(AbSyn id, AbAnnotationBucket bucket) |
| 408 | { |
| 409 | SExpr whole = sxNil; |
| 410 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("name")symProbe("name", 1)), sxiFrSymbol(abIdSym(id)((id)->abId.sym))), |
| 411 | whole); |
| 412 | whole = sxCons(sxCons(sxiFrSymbol(symInternConst("state")symProbe("state", 1)), sxiFrString("error")), |
| 413 | whole); |
| 414 | return whole; |
| 415 | } |
| 416 | |
| 417 | localstatic SExpr |
| 418 | abToAnnotatedTForm(TForm tf, AbAnnotationBucket bucket) |
| 419 | { |
| 420 | return abAnnotateSefo(tfExpr(tf)tfToAbSyn(tf), bucket); |
| 421 | } |
| 422 | |
| 423 | localstatic SExpr |
| 424 | abAnnotateSefo(Sefo sefo, AbAnnotationBucket bucket) |
| 425 | { |
| 426 | AInt idx = abcGetSefo(bucket, sefo); |
| 427 | if (idx == -1) { |
| 428 | AInt newIdx = abcAddSefo(bucket, sefo); |
| 429 | SExpr sx = abAnnotatedSExprElided(sefo, bucket); |
| 430 | abcSetSefoSExpr(bucket, newIdx, sx); |
| 431 | return sxCons(sxiFrSymbol(symInternConst("ref")symProbe("ref", 1)), sxiFrInteger(newIdx)); |
| 432 | } |
| 433 | else { |
| 434 | return sxCons(sxiFrSymbol(symInternConst("ref")symProbe("ref", 1)), sxiFrInteger(idx)); |
| 435 | } |
| 436 | } |
| 437 |