⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trypost.cpp

📁 一个很棒的网络控制系统仿真软件
💻 CPP
字号:
#ifndef TRY_POST#define TRY_POSTbool ttTryPost(char* mailbox, void* msg) {  MailboxNode* mbn;  Mailbox* m;  mbn = (MailboxNode*) rtsys->mailboxList->getFirst();  while (mbn != NULL) {    if (mbn->getMailbox()->name != NULL) {      if (strcmp(mbn->getMailbox()->name, mailbox) == 0)	break;    }    mbn = (MailboxNode*) mbn->getNext();  }      if (mbn == NULL) {    char buf[200];    sprintf(buf, "ttTryPost: Non-existent mailbox '%s'!", mailbox);    MEX_ERROR(buf);    return false;  }  m = mbn->getMailbox();  if (m->count == m->maxSize) {    printf("ttTryPost: Mailbox '%s' is full\n", mailbox);    return false;  } else {    m->buffer[m->inP] = msg;    m->count++;    m->inP = (m->inP + 1) % m->maxSize;    return true;  }  }int ttTryPostMATLAB(char* mailbox) {  MailboxNode* mbn;  Mailbox* m;  int value;  mbn = (MailboxNode*) rtsys->mailboxList->getFirst();  while (mbn != NULL) {    if (mbn->getMailbox()->name != NULL) {      if (strcmp(mbn->getMailbox()->name, mailbox) == 0)	break;    }    mbn = (MailboxNode*) mbn->getNext();  }      if (mbn == NULL) {    // Mailbox does not exist     char buf[200];    sprintf(buf, "ttTryPost: Non-existent mailbox '%s'\n", mailbox);    MEX_ERROR(buf);    return 0;  }  m = mbn->getMailbox();  if (m->count == m->maxSize) {    printf("ttTryPost: Mailbox '%s' is full\n", mailbox);    value = 0;  } else {    m->count++;    value = m->inP + 1;    m->inP = (m->inP + 1) % m->maxSize;  }      return value;}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -