Ejemplo n.º 1
0
int
main(void)
{
unsigned char buffer[1024];
while (fgets(CS buffer, sizeof(buffer), stdin) != NULL)
  {
  unsigned char name[24];
  unsigned char *s, *t;

  printf("%s", buffer);
  s = buffer;
  while (isspace(*s)) s++;
  if (*s == 0) continue;

  for (t = name; *s != 0 && !isspace(*s); s++) *t++ = *s;
  *t = 0;
  while (isspace(*s)) s++;

  if (strcmp(CS name, "findprop") == 0)
    {
    while (*s != 0)
      {
      unsigned char *endptr;
      int c = strtoul(CS s, CSS(&endptr), 16);
      print_prop(c);
      s = endptr;
      while (isspace(*s)) s++;
      }
    }

  else printf("Unknown test command %s\n", name);
  }

return 0;
}
Ejemplo n.º 2
0
static void GlobalInit()
{
    #ifdef MEMORY_LEAK_DEBUG
    _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
    //_CrtSetBreakAlloc(29260);
    #endif
    VersionInfo();
    CSS();
}
Ejemplo n.º 3
0
int main()
{
  read_input();
  
  ///////////////////////////// Load two points for standing D and D* //////////////////////////
  
  jvec CSL(T,njack);
  jvec CSS(T,njack);
  
  jack M,ZL,ZS;
  int idata_SL=0;
  for(int idata=0;idata<ndata;idata++)
    {
      CSL=(CSL*idata+load_2pts(idata))/(idata+1);
      data_path[idata][strlen(data_path[idata])-2]='3';
      if(file_exists(data_path[idata]))
	{
	  CSS=(CSS*idata_SL+load_2pts(idata))/(idata_SL+1);
	  idata_SL++;
	}
      
      //compute mass
      two_pts_SL_fit(M,ZL,ZS,CSL.simmetrized(1),CSS.simmetrized(1),tmin,tmax,tmin,tmax,combine("M_%02d.xmg",idata).c_str());
      cout<<"nsources: "<<idata<<" mass: "<<M<<endl;
      
      if(idata==ndata-1)
	{
	  M.write_to_binfile("M");
	  ZL.write_to_binfile("ZL");
	}
    }
  
  CSL.write_to_binfile("CSL");
  
  return 0;
}
Ejemplo n.º 4
0
bool serverPage::Send(wxSocketBase* pSocket)
{
    bool        bRes = false;
    wxString    sHTTP;
    wxString    sPageText;

    D(debug("serverPage::Send(%p)\n", pSocket));

#ifdef  ENABLE_DEBUG_SEND
    FILE* fOut = fopen("/tmp/http.txt", "w");
#endif

    pSocket->SaveState();
    pSocket->SetFlags(wxSOCKET_WAITALL);

    if (m_type == PAGE_HTML) {
        sPageText = HTML();
    } else if (m_type == PAGE_TEXT) {
        sPageText = TEXT();
        m_size = sPageText.Length();
    } else if (m_type == PAGE_CSS) {
        sPageText = CSS();
        m_size = sPageText.Length();
    } else if (m_type == PAGE_JSCRIPT) {
        sPageText = JSCRIPT();
        m_size = sPageText.Length();
    }

    sHTTP =  wxT("HTTP/1.1 200 OK") + sHTMLEol;
    sHTTP += wxT("Server: ") + sServerID + sHTMLEol;
    sHTTP += wxT("Content-Type: ") + m_sMimeType + sHTMLEol;
    if (m_bEnableCaching) {
        sHTTP += wxT("Expires: ") + m_sCacheExpires + sHTMLEol;
    } else {
        sHTTP += wxT("Cache-Control: no-store, no-cache, must-revalidate, max-age=0") + sHTMLEol;
    }
    sHTTP += wxT("Content-Length: ") + wxString::Format(wxT("%ld"), m_size) + sHTMLEol;

//    sHTTP += wxT("Expires: ") +
//             wxDateTime::Now().Format( wxT("%a, %d %b %Y %T GMT") , wxDateTime::UTC ) +
//             sHTMLEol;

#if 1
    sHTTP += wxT("Connection: Close") + sHTMLEol;
#else
    sHTTP += wxT("Connection: Keep-Alive") + sHTMLEol;
#endif

    /* Add cookies to header */
    if (!m_cookies.IsEmpty()) {
        D(debug("-- adding cookies to header!\n"));
        for (size_t x = 0 ; x < m_cookies.Count() ; x++) {
            sHTTP += m_cookies[x].header() + sHTMLEol;
        }
    }

    sHTTP += sHTMLEol;

    /* Write the HTTP header... */
    pSocket->Write( sHTTP.c_str(), sHTTP.Length() );

#ifdef  ENABLE_DEBUG_SEND
    fwrite(sHTTP.c_str(), sHTTP.Length(), 1, fOut);
#endif

    if ((m_type == PAGE_HTML) ||
        (m_type == PAGE_CSS)  ||
        (m_type == PAGE_TEXT) ||
        (m_type == PAGE_JSCRIPT))
    {
        pSocket->Write( sPageText.c_str(), m_size);
    } else {
        pSocket->Write( m_pBinaryData, m_size );
    }

    bRes = true;

    pSocket->RestoreState();

#ifdef  ENABLE_DEBUG_SEND
    fclose(fOut);
#endif

    return bRes;
}
Ejemplo n.º 5
0
static int html_drawaln(struct AbstractTview* tv, int tid, int pos)
    {
    int y,x;
    html_tview_t* ptr=FROM_TV(tv);
    html_clear(tv);
    base_draw_aln(tv,  tid, pos);
    fputs("<html><head>",ptr->out);
    fprintf(ptr->out,"<title>%s:%d</title>",
    	tv->header->target_name[tid],
    	pos+1
    	);
    //style
   
    fputs("<style type='text/css'>\n",ptr->out);
    fputs(".tviewbody { margin:5px; background-color:white;text-align:center;}\n",ptr->out);
    fputs(".tviewtitle {text-align:center;}\n",ptr->out);
    fputs(".tviewpre { margin:5px; background-color:white;}\n",ptr->out);
    #define CSS(id,col) fprintf(ptr->out,".tviewc%d {color:%s;}\n.tviewcu%d {color:%s;text-decoration:underline;}\n",id,col,id,col);
        CSS(0, "black");
    	CSS(1, "blue");
	CSS(2, "green");
	CSS(3, "yellow");
	CSS(4, "black");
	CSS(5, "green");
	CSS(6, "cyan");
	CSS(7, "yellow");
	CSS(8, "red");
	CSS(9, "blue");
    #undef CSS
    fputs("</style>",ptr->out);
    
    fputs("</head><body>",ptr->out);
    
      fprintf(ptr->out,"<div class='tviewbody'><div class='tviewtitle'>%s:%d</div>",
    	tv->header->target_name[tid],
    	pos+1
    	);
    
    fputs("<pre class='tviewpre'>",ptr->out);
    for(y=0;y< ptr->row_count;++y)
    	{
    	
    	for(x=0;x< tv->mcol;++x)
	    	{
	    	
		
		if(x== 0 || ptr->screen[y][x].attributes != ptr->screen[y][x-1].attributes)
	    		{
	    		int css=0;
			fprintf(ptr->out,"<span");
	    		while(css<32)
	    			{
	    			//if(y>1) fprintf(stderr,"css=%d pow2=%d vs %d\n",css,(1 << (css)),ptr->screen[y][x].attributes);
	    			if(( (ptr->screen[y][x].attributes) & (1 << (css)))!=0)
	    				{
	    				
	    				fprintf(ptr->out," class='tviewc%s%d'",
	    					(( (ptr->screen[y][x].attributes) & (1 << (UNDERLINE_FLAG)) )!=0?"u":""),
	    					css);
	    				break;
	    				}
	    			++css;
	    			}


	    		fputs(">",ptr->out);
	    		}
		
		int ch=ptr->screen[y][x].ch;
		switch(ch)
			{
			case '<': fputs("&lt;",ptr->out);break;
			case '>': fputs("&gt;",ptr->out);break;
			case '&': fputs("&amp;",ptr->out);break;
			default: fputc(ch,ptr->out); break;
			}
	    	
	    	
	    	if(x+1 == tv->mcol  || ptr->screen[y][x].attributes!=ptr->screen[y][x+1].attributes)
	    		{
	    		fputs("</span>",ptr->out);
	    		}
	    	}
    	if(y+1 < ptr->row_count) fputs("<br/>",ptr->out);
    	}
    fputs("</pre></div></body></html>",ptr->out);
    return 0;
    }