/*$no list*//*$no trace <<< mtc.h >>> */ /* * mtc.h - Multi-C definitions * Multi-C (c) Copyright 1992 Mix Software, Inc. & Creative C Corporation * All rights reserved. */ #ifndef MTC_H #define MTC_H #include "mtc_defs.h" #undef MtCAbend typedef void THREAD; typedef void SEMA_INFO; #ifdef __cplusplus extern "C" { #endif int mtc_entry(int argc, char *argv[]); ECODE mtc_abend(ECODE, char*, char*, int); ECODE mtc_split(THREAD**, MTCBOOL*); ECODE mtc_stop(THREAD*); ECODE mtc_yield(void); ECODE mtc_getpri(THREAD*,MTCPRI*); ECODE mtc_setpri(THREAD*,MTCPRI); ECODE mtc_asend(THREAD*, void*, int, int); ECODE mtc_send(THREAD*, void*, int, int); ECODE mtc_receive(void*, int*); ECODE mtc_mcount(int*); ECODE mtc_msize(int*); ECODE mtc_mpriority(int*); ECODE mtc_mdata(void**); ECODE mtc_mtraverse(TRAVERSE_FUNC, void*); ECODE mtc_mignore(void); ECODE mtc_semacreate(SEMA_INFO**); ECODE mtc_semadel(SEMA_INFO*); ECODE mtc_semaset(SEMA_INFO*); ECODE mtc_semareset(SEMA_INFO*); ECODE mtc_semainvert(SEMA_INFO*); ECODE mtc_semaget(SEMA_INFO*, MTCBOOL*); ECODE mtc_semawait(SEMA_INFO*, MTCBOOL); ECODE mtc_me(THREAD**); ECODE mtc_setthreshold(MTCPRI, int); ECODE mtc_getthreshold(MTCPRI, int*); ECODE mtc_setcount(MTCPRI, int); ECODE mtc_getcount(MTCPRI, int*); ECODE mtc_setuptr(void*); ECODE mtc_getuptr(void**); /* rename main to mtc_main */ #ifdef __cplusplus } #define main \ main(int argc, char *argv[]) \ { \ return(mtc_entry(argc, argv)); \ } \ extern "C" mtc_main #else #define main \ main(int argc, char *argv[]) \ { \ return(mtc_entry(argc, argv)); \ } \ mtc_main #endif #define MtCCoroutine(func) {THREAD *tp; MTCBOOL original;\ MtCSplit(&tp,&original);\ if (!original) {\ func;\ MtCStop(NULL);\ }\ } #ifndef MTC_RETURN /* do not automatically return to calling function if error occurs */ #define MtCAbend(ecode,msg) mtc_abend(ecode,msg,__FILE__,__LINE__) #define MtCSplit(tpp,bp) mtc_split(tpp,bp) #define MtCStop(tp) mtc_stop(tp) #define MtCYield() mtc_yield() #define MtCGetPri(tp,pp) mtc_getpri(tp,pp) #define MtCSetPri(tp,p) mtc_setpri(tp,p) #define MtCASend(tp,dp,sp,p) mtc_asend(tp,dp,sp,p) #define MtCSend(tp,dp,sp,p) mtc_send(tp,dp,sp,p) #define MtCReceive(d,sp) mtc_receive(d,sp) #define MtCMsgCount(np) mtc_mcount(np) #define MtCMsgSize(sizp) mtc_msize(sizp) #define MtCMsgPriority(pp) mtc_mpriority(pp) #define MtCMsgData(dp) mtc_mdata(dp) #define MtCMsgTraverse(p,x) mtc_mtraverse(p,x) #define MtCMsgIgnore() mtc_mignore() #define MtCSemaCreate(sp) mtc_semacreate(sp) #define MtCSemaDel(s) mtc_semadel(s) #define MtCSemaSet(s) mtc_semaset(s) #define MtCSemaReset(s) mtc_semareset(s) #define MtCSemaInvert(s) mtc_semainvert(s) #define MtCSemaGet(s,bp) mtc_semaget(s,bp) #define MtCSemaWait(s,b) mtc_semawait(s,b) #define MtCMe(tpp) mtc_me(tpp) #define MtCSetThreshold(l,cnt) mtc_setthreshold(l,cnt) #define MtCGetThreshold(l,cnt) mtc_getthreshold(l,cnt) #define MtCSetCount(l,cnt) mtc_setcount(l,cnt) #define MtCGetCount(l,cnt) mtc_getcount(l,cnt) #define MtCSetUPtr(p) mtc_setuptr(p) #define MtCGetUPtr(pp) mtc_getuptr(pp) #else /* automatically return to calling function if error occurs */ #define MtCAbend(ecode,msg) return(mtc_abend(ecode,msg,__FILE__,__LINE__)) #define MtCSplit(tpp,bp) {register ECODE _e;\ if ((_e = mtc_split(tpp,bp)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCStop(tp) {register ECODE _e;\ if ((_e = mtc_stop(tp)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCYield() {register ECODE _e;\ if ((_e = mtc_yield()) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCGetPri(tp,pp) {register ECODE _e;\ if ((_e = mtc_getpri(tp,pp)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCSetPri(tp,p) {register ECODE _e;\ if ((_e = mtc_setpri(tp,p)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCASend(tp,dp,sp,p) {register ECODE _e;\ if ((_e = mtc_asend(tp,dp,sp,p)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCSend(tp,dp,sp,p) {register ECODE _e;\ if ((_e = mtc_send(tp,dp,sp,p)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCReceive(d,sp) {register ECODE _e;\ if ((_e = mtc_receive(d,sp)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCMsgCount(np) {register ECODE _e;\ if ((_e = mtc_mcount(np)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCMsgSize(sizp) {register ECODE _e;\ if ((_e = mtc_msize(sizp)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCMsgPriority(pp) {register ECODE _e;\ if ((_e = mtc_mpriority(pp)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCMsgData(dp) {register ECODE _e;\ if ((_e = mtc_mdata(dp)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCMsgTraverse(p,x) {register ECODE _e;\ if ((_e = mtc_mtraverse(p,x)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCMsgIgnore() {register ECODE _e;\ if ((_e = mtc_mignore()) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCSemaCreate(sp) {register ECODE _e;\ if ((_e = mtc_semacreate(sp)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCSemaDel(s) {register ECODE _e;\ if ((_e = mtc_semadel(s)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCSemaSet(s) {register ECODE _e;\ if ((_e = mtc_semaset(s)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCSemaReset(s) {register ECODE _e;\ if ((_e = mtc_semareset(s)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCSemaInvert(s) {register ECODE _e;\ if ((_e = mtc_semainvert(s)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCSemaGet(s,bp) {register ECODE _e;\ if ((_e = mtc_semaget(s,bp)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCSemaWait(s,b) {register ECODE _e;\ if ((_e = mtc_semawait(s,b)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCMe(tpp) {register ECODE _e;\ if ((_e = mtc_me(tpp)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCSetThreshold(l,cnt) {register ECODE _e;\ if ((_e = mtc_setthreshold(l,cnt)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCGetThreshold(l,cnt) {register ECODE _e;\ if ((_e = mtc_getthreshold(l,cnt)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCSetCount(l,cnt) {register ECODE _e;\ if ((_e = mtc_setcount(l,cnt)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCGetCount(l,cnt) {register ECODE _e;\ if ((_e = mtc_getcount(l,cnt)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCSetUPtr(p) {register ECODE _e;\ if ((_e = mtc_setuptr(p)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #define MtCGetUPtr(pp) {register ECODE _e;\ if ((_e = mtc_getuptr(pp)) != SUCCESS)\ MtCAbend(_e,NULL);\ } #endif /* MTC_RETURN */ #endif /* MTC_H */ /*$list*//*$trace <<< mtc.h >>> */