📄 sfraise.c
字号:
/* Copyright (c) Colorado School of Mines, 2006.*//* All rights reserved. */#include "sfhdr.h"/* Invoke event handlers for a stream**** Written by Kiem-Phong Vo.*/#if __STD_Cstatic int _sfraiseall(int type, Void_t* data)#elsestatic int _sfraiseall(type, data)int type; /* type of event */Void_t* data; /* associated data */#endif{ Sfio_t *f; Sfpool_t *p, *next; int n, rv; rv = 0; for(p = &_Sfpool; p; p = next) { for(next = p->next; next; next = next->next) if(next->n_sf > 0) break; for(n = 0; n < p->n_sf; ++n) { f = p->sf[n]; if(sfraise(f, type, data) < 0) rv -= 1; } } return rv;}#if __STD_Cint sfraise(Sfio_t* f, int type, Void_t* data)#elseint sfraise(f, type, data)Sfio_t* f; /* stream */int type; /* type of event */Void_t* data; /* associated data */#endif{ reg Sfdisc_t *disc, *next, *d; reg int local, rv; if(!f) return _sfraiseall(type,data); SFMTXSTART(f, -1); GETLOCAL(f,local); if(!SFKILLED(f) && !(local && (type == SF_NEW || type == SF_CLOSING || type == SF_FINAL || type == SF_ATEXIT)) && SFMODE(f,local) != (f->mode&SF_RDWR) && _sfmode(f,0,local) < 0) SFMTXRETURN(f, -1); SFLOCK(f,local); for(disc = f->disc; disc; ) { next = disc->disc; if(type == SF_FINAL) f->disc = next; if(disc->exceptf) { SFOPEN(f,0); if((rv = (*disc->exceptf)(f,type,data,disc)) != 0 ) SFMTXRETURN(f, rv); SFLOCK(f,0); } if((disc = next) ) { /* make sure that "next" hasn't been popped */ for(d = f->disc; d; d = d->disc) if(d == disc) break; if(!d) disc = f->disc; } } SFOPEN(f,local); SFMTXRETURN(f, 0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -