📄 stt.c
字号:
type = FFESTP_dimtypeADJUSTABLEASSUMED; else type = FFESTP_dimtypeADJUSTABLE; } } if (next->upper != NULL) { if (ugly_assumed || (ffebld_op (next->upper) == FFEBLD_opSTAR)) { if (type == FFESTP_dimtypeADJUSTABLE) type = FFESTP_dimtypeADJUSTABLEASSUMED; else type = FFESTP_dimtypeASSUMED; } else if (ffebld_op (next->upper) != FFEBLD_opCONTER) type = FFESTP_dimtypeADJUSTABLE; } } return type;}/* ffestt_exprlist_append -- Append expr to list of exprs ffesttExprList list; ffelexToken t; ffestt_exprlist_append(list,expr,t); list must have already been created by ffestt_exprlist_create. The list is allocated out of the scratch pool. The token is consumed. */voidffestt_exprlist_append (ffesttExprList list, ffebld expr, ffelexToken t){ ffesttExprList new; new = (ffesttExprList) malloc_new_kp (ffesta_scratch_pool, "FFEST expr list", sizeof (*new)); new->next = list->previous->next; new->previous = list->previous; new->next->previous = new; new->previous->next = new; new->expr = expr; new->t = t;}/* ffestt_exprlist_create -- Create new list of exprs ffesttExprList list; list = ffestt_exprlist_create(); The list is allocated out of the scratch pool. */ffesttExprListffestt_exprlist_create (){ ffesttExprList new; new = (ffesttExprList) malloc_new_kp (ffesta_scratch_pool, "FFEST expr list root", sizeof (*new)); new->next = new->previous = new; new->expr = NULL; new->t = NULL; return new;}/* ffestt_exprlist_drive -- Drive list of token pairs into function ffesttExprList list; void fn(ffebld expr,ffelexToken t); ffestt_exprlist_drive(list,fn); The expr/token pairs in the list are passed to the function one pair at a time. */voidffestt_exprlist_drive (ffesttExprList list, void (*fn) (ffebld, ffelexToken)){ ffesttExprList next; if (list == NULL) return; for (next = list->next; next != list; next = next->next) { (*fn) (next->expr, next->t); }}/* ffestt_exprlist_dump -- Dump list of exprs ffesttExprList list; ffestt_exprlist_dump(list); The exprs in the list are dumped with commas separating them. */#if FFECOM_targetCURRENT == FFECOM_targetFFEvoidffestt_exprlist_dump (ffesttExprList list){ ffesttExprList next; for (next = list->next; next != list; next = next->next) { if (next != list->next) fputc (',', dmpout); ffebld_dump (next->expr); }}#endif/* ffestt_exprlist_kill -- Kill list of exprs ffesttExprList list; ffestt_exprlist_kill(list); The tokens on the list are killed. 02-Mar-90 JCB 1.1 Don't kill the list itself or change it, since it will be trashed when ffesta_scratch_pool is killed anyway, so kill only the lex tokens. */voidffestt_exprlist_kill (ffesttExprList list){ ffesttExprList next; for (next = list->next; next != list; next = next->next) { ffelex_token_kill (next->t); }}/* ffestt_formatlist_append -- Append null format to list of formats ffesttFormatList list, new; new = ffestt_formatlist_append(list); list must have already been created by ffestt_formatlist_create. The new item is allocated out of the scratch pool. The caller must initialize it appropriately. */ffesttFormatListffestt_formatlist_append (ffesttFormatList list){ ffesttFormatList new; new = (ffesttFormatList) malloc_new_kp (ffesta_scratch_pool, "FFEST format list", sizeof (*new)); new->next = list->previous->next; new->previous = list->previous; new->next->previous = new; new->previous->next = new; return new;}/* ffestt_formatlist_create -- Create new list of formats ffesttFormatList list; list = ffestt_formatlist_create(NULL); The list is allocated out of the scratch pool. */ffesttFormatListffestt_formatlist_create (ffesttFormatList parent, ffelexToken t){ ffesttFormatList new; new = (ffesttFormatList) malloc_new_kp (ffesta_scratch_pool, "FFEST format list root", sizeof (*new)); new->next = new->previous = new; new->type = FFESTP_formattypeNone; new->t = t; new->u.root.parent = parent; return new;}/* ffestt_formatlist_kill -- Kill tokens on list of formats ffesttFormatList list; ffestt_formatlist_kill(list); The tokens on the list are killed. */voidffestt_formatlist_kill (ffesttFormatList list){ ffesttFormatList next; /* Always kill from the very top on down. */ while (list->u.root.parent != NULL) list = list->u.root.parent->next; /* Kill first token for this list. */ if (list->t != NULL) ffelex_token_kill (list->t); /* Kill each item in this list. */ for (next = list->next; next != list; next = next->next) { ffelex_token_kill (next->t); switch (next->type) { case FFESTP_formattypeI: case FFESTP_formattypeB: case FFESTP_formattypeO: case FFESTP_formattypeZ: case FFESTP_formattypeF: case FFESTP_formattypeE: case FFESTP_formattypeEN: case FFESTP_formattypeG: case FFESTP_formattypeL: case FFESTP_formattypeA: case FFESTP_formattypeD: if (next->u.R1005.R1004.t != NULL) ffelex_token_kill (next->u.R1005.R1004.t); if (next->u.R1005.R1006.t != NULL) ffelex_token_kill (next->u.R1005.R1006.t); if (next->u.R1005.R1007_or_R1008.t != NULL) ffelex_token_kill (next->u.R1005.R1007_or_R1008.t); if (next->u.R1005.R1009.t != NULL) ffelex_token_kill (next->u.R1005.R1009.t); break; case FFESTP_formattypeQ: case FFESTP_formattypeDOLLAR: case FFESTP_formattypeP: case FFESTP_formattypeT: case FFESTP_formattypeTL: case FFESTP_formattypeTR: case FFESTP_formattypeX: case FFESTP_formattypeS: case FFESTP_formattypeSP: case FFESTP_formattypeSS: case FFESTP_formattypeBN: case FFESTP_formattypeBZ: case FFESTP_formattypeSLASH: case FFESTP_formattypeCOLON: if (next->u.R1010.val.t != NULL) ffelex_token_kill (next->u.R1010.val.t); break; case FFESTP_formattypeR1016: break; /* Nothing more to do. */ case FFESTP_formattypeFORMAT: if (next->u.R1003D.R1004.t != NULL) ffelex_token_kill (next->u.R1003D.R1004.t); next->u.R1003D.format->u.root.parent = NULL; /* Parent already dying. */ ffestt_formatlist_kill (next->u.R1003D.format); break; default: assert (FALSE); } }}/* ffestt_implist_append -- Append token pair to list of token pairs ffesttImpList list; ffelexToken t; ffestt_implist_append(list,start_token,end_token); list must have already been created by ffestt_implist_create. The list is allocated out of the scratch pool. The tokens are consumed. */voidffestt_implist_append (ffesttImpList list, ffelexToken first, ffelexToken last){ ffesttImpList new; new = (ffesttImpList) malloc_new_kp (ffesta_scratch_pool, "FFEST token list", sizeof (*new)); new->next = list->previous->next; new->previous = list->previous; new->next->previous = new; new->previous->next = new; new->first = first; new->last = last;}/* ffestt_implist_create -- Create new list of token pairs ffesttImpList list; list = ffestt_implist_create(); The list is allocated out of the scratch pool. */ffesttImpListffestt_implist_create (){ ffesttImpList new; new = (ffesttImpList) malloc_new_kp (ffesta_scratch_pool, "FFEST token list root", sizeof (*new)); new->next = new->previous = new; new->first = NULL; new->last = NULL; return new;}/* ffestt_implist_drive -- Drive list of token pairs into function ffesttImpList list; void fn(ffelexToken first,ffelexToken last); ffestt_implist_drive(list,fn); The token pairs in the list are passed to the function one pair at a time. */voidffestt_implist_drive (ffesttImpList list, void (*fn) (ffelexToken, ffelexToken)){ ffesttImpList next; if (list == NULL) return; for (next = list->next; next != list; next = next->next) { (*fn) (next->first, next->last); }}/* ffestt_implist_dump -- Dump list of token pairs ffesttImpList list; ffestt_implist_dump(list); The token pairs in the list are dumped with commas separating them. */#if FFECOM_targetCURRENT == FFECOM_targetFFEvoidffestt_implist_dump (ffesttImpList list){ ffesttImpList next; for (next = list->next; next != list; next = next->next) { if (next != list->next) fputc (',', dmpout); assert (ffelex_token_type (next->first) == FFELEX_typeNAME); fputs (ffelex_token_text (next->first), dmpout); if (next->last != NULL) { fputc ('-', dmpout); assert (ffelex_token_type (next->last) == FFELEX_typeNAME); fputs (ffelex_token_text (next->last), dmpout); } }}#endif/* ffestt_implist_kill -- Kill list of token pairs ffesttImpList list; ffestt_implist_kill(list); The tokens on the list are killed. */voidffestt_implist_kill (ffesttImpList list){ ffesttImpList next; for (next = list->next; next != list; next = next->next) { ffelex_token_kill (next->first); if (next->last != NULL) ffelex_token_kill (next->last); }}/* ffestt_tokenlist_append -- Append token to list of tokens ffesttTokenList tl; ffelexToken t; ffestt_tokenlist_append(tl,t); tl must have already been created by ffestt_tokenlist_create. The list is allocated out of the scratch pool. The token is consumed. */voidffestt_tokenlist_append (ffesttTokenList tl, ffelexToken t){ ffesttTokenItem ti; ti = (ffesttTokenItem) malloc_new_kp (ffesta_scratch_pool, "FFEST token item", sizeof (*ti)); ti->next = (ffesttTokenItem) &tl->first; ti->previous = tl->last; ti->next->previous = ti; ti->previous->next = ti; ti->t = t; ++tl->count;}/* ffestt_tokenlist_create -- Create new list of tokens ffesttTokenList tl; tl = ffestt_tokenlist_create(); The list is allocated out of the scratch pool. */ffesttTokenListffestt_tokenlist_create (){ ffesttTokenList tl; tl = (ffesttTokenList) malloc_new_kp (ffesta_scratch_pool, "FFEST token list", sizeof (*tl)); tl->first = tl->last = (ffesttTokenItem) &tl->first; tl->count = 0; return tl;}/* ffestt_tokenlist_drive -- Drive list of tokens ffesttTokenList tl; void fn(ffelexToken t); ffestt_tokenlist_drive(tl,fn); The tokens in the list are passed to the given function. */voidffestt_tokenlist_drive (ffesttTokenList tl, void (*fn) (ffelexToken)){ ffesttTokenItem ti; if (tl == NULL) return; for (ti = tl->first; ti != (ffesttTokenItem) &tl->first; ti = ti->next) { (*fn) (ti->t); }}/* ffestt_tokenlist_dump -- Dump list of tokens ffesttTokenList tl; ffestt_tokenlist_dump(tl); The tokens in the list are dumped with commas separating them. */#if FFECOM_targetCURRENT == FFECOM_targetFFEvoidffestt_tokenlist_dump (ffesttTokenList tl){ ffesttTokenItem ti; for (ti = tl->first; ti != (ffesttTokenItem) &tl->first; ti = ti->next) { if (ti != tl->first) fputc (',', dmpout); switch (ffelex_token_type (ti->t)) { case FFELEX_typeNUMBER: case FFELEX_typeNAME: case FFELEX_typeNAMES: fputs (ffelex_token_text (ti->t), dmpout); break; case FFELEX_typeASTERISK: fputc ('*', dmpout); break; default: assert (FALSE); fputc ('?', dmpout); break; } }}#endif/* ffestt_tokenlist_handle -- Handle list of tokens ffesttTokenList tl; ffelexHandler handler; handler = ffestt_tokenlist_handle(tl,handler); The tokens in the list are passed to the handler(s). */ffelexHandlerffestt_tokenlist_handle (ffesttTokenList tl, ffelexHandler handler){ ffesttTokenItem ti; for (ti = tl->first; ti != (ffesttTokenItem) &tl->first; ti = ti->next) handler = (ffelexHandler) (*handler) (ti->t); return (ffelexHandler) handler;}/* ffestt_tokenlist_kill -- Kill list of tokens ffesttTokenList tl; ffestt_tokenlist_kill(tl); The tokens on the list are killed. 02-Mar-90 JCB 1.1 Don't kill the list itself or change it, since it will be trashed when ffesta_scratch_pool is killed anyway, so kill only the lex tokens. */voidffestt_tokenlist_kill (ffesttTokenList tl){ ffesttTokenItem ti; for (ti = tl->first; ti != (ffesttTokenItem) &tl->first; ti = ti->next) { ffelex_token_kill (ti->t); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -