Пример #1
0
void _stdcall OnNotifyStrikePrices( BSTR BProduct, BSTR BName, BSTR BCall, BSTR BPut, int nStrikePrice, int nYearMonth )
{
	if( m_nType == 5 )
	{
		CString strProduct(BProduct);
		CString strName(BName);
		CString strCall(BCall);
		CString strPut(BPut);

		CString strMsg;

		strMsg.Format(_T("%s %s  Call: %s  Put: %s  履約價:%d 年月:%d"),
			   strProduct,strName,strCall,strPut,nStrikePrice,nYearMonth);

		BSTR bstrMsg = strMsg.AllocSysString();

		SendMessage(FindWindow(NULL,_T("QuoteTester")),WM_DATA,m_nType,(int)bstrMsg);
		
		SysFreeString(bstrMsg);

	}
}
Пример #2
0
void doShow(ControlStruct *p, char *pStr)
{
   char *cp, *cp1, tmpBuf[2048];
   portConf *pDevc;
   int status = 0, x, flag, mask;


   if (dbg) syslog(LOG_DEBUG, "doShow():Enter");
   if ((cp = parseRE(p, pStr)) == NULL)
      return;

   for (; *cp && isspace(*cp); cp++);
   memset(tmpBuf, 0, sizeof(tmpBuf));
   for (x = 0, cp1 = tmpBuf; *cp != '\0' && !isspace(*cp) && x < 20; x++)
   {
      *(cp1++) = tolower(*cp++);
      *cp1 = '\0';
   }
   if (strcmp(tmpBuf, "status") != 0)
      status = 0;
   else
      status = 1;

   if (dbg) syslog(LOG_DEBUG, "doShow():%sShowing Status",
                     (status == 0) ? "Not " : "");
   for (x = 0, pDevc = pPortList; pDevc != NULL; pDevc = pDevc->pNext)
   {
      if (dbg) syslog(LOG_DEBUG, "doShow():Testing port |%s|, devc |%s|",
                      pDevc->srvc, pDevc->devc);
      if (regexec(&p->portRE, pDevc->srvc, 0, NULL, 0) == 0)
      {
         if (dbg) syslog(LOG_DEBUG, "doShow():Port matched!");
      }
      if (regexec(&p->devcRE, pDevc->devc, 0, NULL, 0) == 0)
      {
         if (dbg) syslog(LOG_DEBUG, "doShow():Devc matched!");
      }
      if (regexec(&p->portRE, pDevc->srvc, 0, NULL, 0) == 0 &&
          (regexec(&p->devcRE, pDevc->dnam, 0, NULL, 0) == 0 ||
           regexec(&p->devcRE, pDevc->devc, 0, NULL, 0) == 0))
      {
         if (dbg) syslog(LOG_DEBUG, "doShow():Have match!");
         if (status == 0) 
         {
            if (dbg) syslog(LOG_DEBUG, "doShow():Here!");
            fprintf(p->fp, "\nName:\t'%s'\tPort:\t'%s'\tDevice:\t'%s'\n", 
                    pDevc->dnam, pDevc->srvc, pDevc->devc);
            fprintf(p->fp, "Baud:\t%d\n", baudList[pDevc->speed]);
            memset(tmpBuf, '\0', sizeof(tmpBuf));
            flag = pDevc->tios.c_iflag;
            if (flag & IGNBRK) 
               strPut(tmpBuf, sizeof(tmpBuf), "IGNBRK");
            if (flag & BRKINT) 
               strPut(tmpBuf, sizeof(tmpBuf), "BRKINT");
            if (flag & PARMRK) 
               strPut(tmpBuf, sizeof(tmpBuf), "PARMRK");
            if (flag & INPCK) 
               strPut(tmpBuf, sizeof(tmpBuf), "INPCK");
            if (flag & ISTRIP) 
               strPut(tmpBuf, sizeof(tmpBuf), "ISTRIP");
            if (flag & INLCR) 
               strPut(tmpBuf, sizeof(tmpBuf), "INLCR");
            if (flag & IGNCR) 
               strPut(tmpBuf, sizeof(tmpBuf), "IGNCR");
            if (flag & ICRNL) 
               strPut(tmpBuf, sizeof(tmpBuf), "ICRNL");
#ifndef FreeBSD
            if (flag & IUCLC) 
               strPut(tmpBuf, sizeof(tmpBuf), "IUCLC");
#endif /* FreeBSD */
            if (flag & IXON) 
               strPut(tmpBuf, sizeof(tmpBuf), "IXON");
            if (flag & IXANY) 
               strPut(tmpBuf, sizeof(tmpBuf), "IXANY");
            if (flag & IXOFF) 
               strPut(tmpBuf, sizeof(tmpBuf), "IMAXBEL");
            if (strlen(tmpBuf))
            {
               fputs("Input flags:\n", p->fp);
               strcat(tmpBuf, "\n");
               fputs(tmpBuf, p->fp);
            }

            memset(tmpBuf, '\0', sizeof(tmpBuf));
            flag = pDevc->tios.c_oflag;
            if (flag & OPOST) 
               strPut(tmpBuf, sizeof(tmpBuf), "OPOST");
            if (flag & ONLCR) 
               strPut(tmpBuf, sizeof(tmpBuf), "ONLCR");

#ifndef FreeBSD
            if (flag & OLCUC) 
               strPut(tmpBuf, sizeof(tmpBuf), "OLCUC");
            if (flag & OCRNL) 
               strPut(tmpBuf, sizeof(tmpBuf), "OCRNL");
            if (flag & ONOCR) 
               strPut(tmpBuf, sizeof(tmpBuf), "ONOCR");
            if (flag & ONLRET) 
               strPut(tmpBuf, sizeof(tmpBuf), "ONLRET");
            if (flag & OFDEL) 
               strPut(tmpBuf, sizeof(tmpBuf), "OFDEL");

            mask = flag & NLDLY;
            if (mask == NL0) 
               strPut(tmpBuf, sizeof(tmpBuf), "NL0");
            else if (mask == NL1)
               strPut(tmpBuf, sizeof(tmpBuf), "NL1");

            mask = flag & CRDLY;
            if (mask == CR0) 
               strPut(tmpBuf, sizeof(tmpBuf), "CR0");
            else if (mask == CR1)
               strPut(tmpBuf, sizeof(tmpBuf), "CR1");
            else if (mask == CR2)
               strPut(tmpBuf, sizeof(tmpBuf), "CR2");
            else if (mask == CR3)
               strPut(tmpBuf, sizeof(tmpBuf), "CR3");

            mask = flag & TABDLY;
            if (mask == TAB0) 
               strPut(tmpBuf, sizeof(tmpBuf), "TAB0");
            else if (mask == TAB1)
               strPut(tmpBuf, sizeof(tmpBuf), "TAB1");
            else if (mask == TAB2)
               strPut(tmpBuf, sizeof(tmpBuf), "TAB2");
            else if (mask == TAB3)
               strPut(tmpBuf, sizeof(tmpBuf), "TAB3");
#if !defined(OSF) && !defined(AIX) && !defined(SCO)
            else if (mask == XTABS)
               strPut(tmpBuf, sizeof(tmpBuf), "XTABS");
#endif

            mask = flag & BSDLY;
            if (mask == BS0) 
               strPut(tmpBuf, sizeof(tmpBuf), "BS0");
            else if (mask == BS1)
               strPut(tmpBuf, sizeof(tmpBuf), "BS1");

            mask = flag & VTDLY;
            if (mask == VT0) 
               strPut(tmpBuf, sizeof(tmpBuf), "VT0");
            else if (mask == VT1)
               strPut(tmpBuf, sizeof(tmpBuf), "VT1");

            mask = flag & FFDLY;
            if (mask == FF0) 
               strPut(tmpBuf, sizeof(tmpBuf), "FF0");
            else if (mask == FF1)
               strPut(tmpBuf, sizeof(tmpBuf), "FF1");
            if (strlen(tmpBuf))
            {
               fputs("Output flags:\n", p->fp);
               strcat(tmpBuf, "\n");
               fputs(tmpBuf, p->fp);
            }
#endif /* FreeBSD */

            memset(tmpBuf, '\0', sizeof(tmpBuf));
            flag = pDevc->tios.c_cflag;
            mask = flag & CSIZE;
            if (mask == CS5) 
               strPut(tmpBuf, sizeof(tmpBuf), "CS5");
            else if (mask == CS6)
               strPut(tmpBuf, sizeof(tmpBuf), "CS6");
            else if (mask == CS7)
               strPut(tmpBuf, sizeof(tmpBuf), "CS7");
            else if (mask == CS8)
               strPut(tmpBuf, sizeof(tmpBuf), "CS8");

            if (flag & CSTOPB) 
               strPut(tmpBuf, sizeof(tmpBuf), "CSTOPB");
            if (flag & PARENB) 
            {
               strPut(tmpBuf, sizeof(tmpBuf), "PARENB");
               if (flag & PARODD) 
                  strPut(tmpBuf, sizeof(tmpBuf), "PARODD");
            }
            if (flag & HUPCL) 
               strPut(tmpBuf, sizeof(tmpBuf), "HUPCL");
            if (flag & CLOCAL) 
               strPut(tmpBuf, sizeof(tmpBuf), "CLOCAL");
#if !defined(AIX) && !defined(SCO)
            if (flag & CRTSCTS) 
               strPut(tmpBuf, sizeof(tmpBuf), "CRTSCTS");
#endif
            if (strlen(tmpBuf))
            {
               fputs("Control flags:\n", p->fp);
               strcat(tmpBuf, "\n");
               fputs(tmpBuf, p->fp);
            }

            memset(tmpBuf, '\0', sizeof(tmpBuf));
            flag = pDevc->tios.c_lflag;
            if (flag & ISIG)
               strPut(tmpBuf, sizeof(tmpBuf), "ISIG");
            if (flag & ICANON)
               strPut(tmpBuf, sizeof(tmpBuf), "ICANON");
#ifndef FreeBSD
            if (flag & XCASE)
               strPut(tmpBuf, sizeof(tmpBuf), "XCASE");
#endif /* FreeBSD */
            if (flag & ECHO)
               strPut(tmpBuf, sizeof(tmpBuf), "ECHO");
            if (flag & ECHOE)
               strPut(tmpBuf, sizeof(tmpBuf), "ECHOE");
            if (flag & ECHOK)
               strPut(tmpBuf, sizeof(tmpBuf), "ECHOK");
            if (flag & ECHONL)
               strPut(tmpBuf, sizeof(tmpBuf), "ECHONL");
#if !defined(SCO)
            if (flag & ECHOCTL)
               strPut(tmpBuf, sizeof(tmpBuf), "ECHOCTL");
            if (flag & ECHOPRT)
               strPut(tmpBuf, sizeof(tmpBuf), "ECHOPRT");
            if (flag & ECHOKE)
               strPut(tmpBuf, sizeof(tmpBuf), "ECHOKE");
            if (flag & FLUSHO)
               strPut(tmpBuf, sizeof(tmpBuf), "FLUSHO");
            if (flag & PENDIN)
               strPut(tmpBuf, sizeof(tmpBuf), "PENDIN");
#endif
            if (flag & TOSTOP)
               strPut(tmpBuf, sizeof(tmpBuf), "TOSTOP");
            if (strlen(tmpBuf))
            {
               fputs("Local flags:\n", p->fp);
               strcat(tmpBuf, "\n");
               fputs(tmpBuf, p->fp);
            }
            fflush(p->fp);
         }
         else 
         {
            if (p->verbose) 
            {
               if ((x % 20) == 0) 
               {
                  fputs("\n\nName            Port     Device          State      IP\n", p->fp);
                  fputs("===================================================================\n", p->fp);
               }
               x++;
               fprintf(p->fp, "%-15s %-8s %-15s %-10s %s\n", pDevc->dnam, pDevc->srvc, 
                                                   pDevc->devc,
                                                   (pDevc->enabled == 0) ?
                                                   "Disabled" : (pDevc->pid > 0) ?
                                                   "In Use" : "Enabled",
                                                   (pDevc->pid == 0) ? "" :
                                                   inet_ntoa(pDevc->addr.sin_addr));
            }
            else
            {
               fprintf(p->fp, "105:%s:%s:%s:%s:%s\n", pDevc->dnam, pDevc->srvc, 
                                                   pDevc->devc,
                                                   (pDevc->enabled == 0) ?
                                                   "Disabled" : (pDevc->pid > 0) ?
                                                   "In Use" : "Enabled",
                                                   (pDevc->pid == 0) ? "" :
                                                   inet_ntoa(pDevc->addr.sin_addr));
            }
         }
      }
   }
}