TEST(CSSTokenizerTest, CommentToken)
{
    TEST_TOKENS("/*comment*/a", ident("a"));
    TEST_TOKENS("/**\\2f**//", delim('/'));
    TEST_TOKENS("/**y*a*y**/ ", whitespace());
    TEST_TOKENS(",/* \n :) \n */)", comma(), rightParenthesis());
    TEST_TOKENS(":/*/*/", colon());
    TEST_TOKENS("/**/*", delim('*'));
    TEST_TOKENS(";/******", semicolon());
}
示例#2
0
文件: main.c 项目: cooljeanius/macgdb
static void
done (int exit_code)
{
  if (verbose)
    {
      stack_heap_stats ();
      mem_usage_stats ();
      printf ("insns: %14s\n", comma (cycles));
    }
  exit (exit_code);
}
void PrintHandler::key(const std::string& k)
{
	if (!_objStart) comma();
	
	_objStart = true;	
		
	_out << _tab;
	Stringifier::formatString(k, _out);
	if (!printFlat()) _out << ' ';
	_out << ':';
	if (!printFlat()) _out << ' ';
}
示例#4
0
void var_in(){

	if (str_in1 == 1) 						{				// in1에 입력받은 수가 한자리라면
		if (in1[0] >= 'A' && in1[0] <= 'Z')		{ 			// in1에 대문자 들어갈 때
			if (in2[0] == '=')  {
				var[var_num] = in1[0];						// 변수 저장 배열에 변수 이름 넣기
				for (int i = 0; i <= 60; i++)
					var_var[var_num][i] = in3[i];			// 변수에 입력값 저장
				for (int u = 0; u <= N; u++)
					in1[u] = var_var[var_num][u];			// in1 배열에 저장받은 변수 값 넣기 (저장한 값을 출력하기 위함)
				separate();
				p = strlen(in1_s);
				printf("        = ");
				comma(in1_j);
				if (p != 0)									// in1 소수 자리수가 있으면
				{printf(".");								// '.' 찍기
					comma(in1_s);}

				var_num++; chosen = 1;
				return ;			}					}

		else if (in1[0] >= 'a' && in1[0] <= 'z')  {			// in1에 소문자 들어갈 때
			if (in2[0] == '=')   {
				var[var_num] = in1[0] - 32;					// 대소문자 구별 안 함. 변수 저장 배열에 변수 이름 넣기
				for (int i = 0; i <= 60; i++)
					var_var[var_num][i] = in3[i];			// 변수에 입력값 저장
				for (int u = 0; u <= N; u++)
					in1[u] = var_var[var_num][u];			// in1 배열에 저장했던 변수값 넣기 (저장한 값 출력하기 위함)
				separate();
				p = strlen(in1_s);
				printf("        = ");
				comma(in1_j);								// 세자리마다 , 실행
				if (p != 0)									// in1에 소수 자리수가 있으면
				{printf(".");								// '.' 찍기
					comma(in1_s);}

				var_num++; chosen = 1;						// main 함수 start 부분부터 다시 시작
				return ;			}					  }}

} // var_in 함수
示例#5
0
void var_in(){

	if (str_in1 == 1) 						{
		if (in1[0] >= 'A' && in1[0] <= 'Z')		{ 
			if (in2[0] == '=')  {
				var[var_num] = in1[0];
				for (int i = 0; i <= 60; i++)
					var_var[var_num][i] = in3[i];
				for (int u = 0; u <= N; u++)
					in1[u] = var_var[var_num][u];
				separate();
				p = strlen(in1_s);
				printf("        = ");
				comma(in1_j);
				if (p != 0)
				{printf(".");
					comma(in1_s);}

				var_num++; chosen = 1;
				return ;			}					}

		else if (in1[0] >= 'a' && in1[0] <= 'z')  {
			if (in2[0] == '=')   {
				var[var_num] = in1[0] - 32;
				for (int i = 0; i <= 60; i++)
					var_var[var_num][i] = in3[i];
				for (int u = 0; u <= N; u++)
					in1[u] = var_var[var_num][u];
				separate();
				p = strlen(in1_s);
				printf("        = ");
				comma(in1_j);
				if (p != 0)
				{printf(".");
					comma(in1_s);}

				var_num++; chosen = 1;
				return ;			}					  }}

} // var_in 함수
示例#6
0
void var_in(){

	if (str_in1 == 1) 						{
	if (in1[0] >= 'A' && in1[0] <= 'Z')		{
	scanf("%s", in2); 
	if (in2[0] == '=')  {
	var[var_num] = in1[0];
	scanf("%s", var_var[var_num]);				// 콤마 찍기 구현 안됨
	for (int u = 0; u <= N; u++)
	in1[u] = var_var[var_num][u];
	separate();
	p = strlen(in1_s);
	printf("        = ");
	comma(in1_j);
	if (p != 0)
	{printf(".");
	comma(in1_s);}
		
	var_num++; chosen = 1;
	return ;			}					}
	
	else if (in1[0] >= 'a' && in1[0] <= 'z')  {
	scanf("%s", in2);
	if (in2[0] = '=')   {
	var[var_num] = in1[0] - 32;
	scanf("%s", var_var[var_num]);
	for (int u = 0; u <= N; u++)
	in1[u] = var_var[var_num][u];
	separate();
	p = strlen(in1_s);
	printf("        = ");
	comma(in1_j);
	if (p != 0)
	{printf(".");
	comma(in1_s);}
		
	var_num++; chosen = 1;
	return ;			}					  }}

} // var_in 함수
示例#7
0
void ExitFlag::dump(PrintStream& out) const
{
    if (!m_bits) {
        out.print("false");
        return;
    }
    
    CommaPrinter comma("|");
    if (isSet(ExitFromNotInlined))
        out.print(comma, "notInlined");
    if (isSet(ExitFromInlined))
        out.print(comma, "inlined");
}
TEST(CSSTokenizerTest, UrlToken)
{
    TEST_TOKENS("url(foo.gif)", url("foo.gif"));
    TEST_TOKENS("urL(https://example.com/cats.png)", url("https://example.com/cats.png"));
    TEST_TOKENS("uRl(what-a.crazy^URL~this\\ is!)", url("what-a.crazy^URL~this is!"));
    TEST_TOKENS("uRL(123#test)", url("123#test"));
    TEST_TOKENS("Url(escapes\\ \\\"\\'\\)\\()", url("escapes \"')("));
    TEST_TOKENS("UrL(   whitespace   )", url("whitespace"));
    TEST_TOKENS("URl( whitespace-eof ", url("whitespace-eof"));
    TEST_TOKENS("URL(eof", url("eof"));
    TEST_TOKENS("url(not/*a*/comment)", url("not/*a*/comment"));
    TEST_TOKENS("urL()", url(""));
    TEST_TOKENS("uRl(white space),", badUrl(), comma());
    TEST_TOKENS("Url(b(ad),", badUrl(), comma());
    TEST_TOKENS("uRl(ba'd):", badUrl(), colon());
    TEST_TOKENS("urL(b\"ad):", badUrl(), colon());
    TEST_TOKENS("uRl(b\"ad):", badUrl(), colon());
    TEST_TOKENS("Url(b\\\rad):", badUrl(), colon());
    TEST_TOKENS("url(b\\\nad):", badUrl(), colon());
    TEST_TOKENS("url(/*'bad')*/", badUrl(), delim('*'), delim('/'));
    TEST_TOKENS("url(ba'd\\\\))", badUrl(), rightParenthesis());
}
示例#9
0
void PrintHandler::key(const std::string& k)
{
	if (_value)
	{
		comma();
		_value = false;
	}
	_out << _tab;
	Stringifier::formatString(k, _out);
	if (!printFlat()) _out << ' ';
	_out << ':';
	if (!printFlat()) _out << ' ';
}
示例#10
0
void compile(context_t *ctx, int n, ...)
{
    va_list params;
    va_start(params, n);

    for (int i = 0; i < n; i++)
    {
        word_t arg = va_arg(params, word_t);
        comma(ctx, arg);
    }

    va_end(params);
}
示例#11
0
      /**
       * Write a value.
       * 
       * Write the specified string to the output stream with
       * quotes around it and quotes inside escaped to double
       * quotes.
       *
       * @param s String to write.
       */
      void write(const std::string& s) {
        comma();

        o_ << '"';
        for (size_t i = 0; i < s.size(); ++i) {
          if (s.at(i) == '"') {
            o_ << '"' << '"'; // double quotes
          } else {
            o_ << s.at(i);
          }
        }
        o_ << '"';
      }
示例#12
0
void UTC()//get the UTC data -- the time
{
  char i;
  char time[9]={
    '0','0','0','0','0','0','0','0','0'
  };
  double t=0.0;
 
  if( ID())//check ID
  {
    comma(1);//remove 1 ','
    //get the datas after headers
    while(1)
    {
      if(Serial.available())
      {
        time[i] = Serial.read();
        i++;
      }
      if(i==9)
      {
        i=0;
        t=Datatransfer(time,2);//convert data
        t=t-30000.00;//convert to the chinese time GMT+8 Time zone
        long time=t;
        int h=time/10000;
        int m=(time/100)%100;
        int s=time%100;
        
//        if(h>=24)               //UTC+
//        {
//        h-=24;
//        }
 
         if (h<0)               //UTC-
        {
          h+=24;
        }
        Serial.print(h);
        Serial.print("h");
        Serial.print(m);
        Serial.print("m");
        Serial.print(s);
        Serial.println("s");
 
        //Serial.println(t);//Print data 
        return;
      }  
    }
  }
}
示例#13
0
static void numbers(struct ParseData *d, int alignment, int multiple, kvec_float_t *v)
{
    int i;

    wsp(d);

    for (;;)
    {
        for (i = 0; i < alignment; ++i)
        {
            if (i == 0)
            {
                kv_push_back(*v, number(d));
            }
            else
            {
                comma(d);
                kv_push_back(*v, number(d));
            }
        }

        if (!multiple)
            break;

        if (hasComma(d))
        {
            comma(d);
            continue;
        }

        wsp(d);

        if (!hasNumber(d))
            break;
    }
}
示例#14
0
void ExecutableBase::dump(PrintStream& out) const
{
    ExecutableBase* realThis = const_cast<ExecutableBase*>(this);
    
    if (classInfo() == NativeExecutable::info()) {
        NativeExecutable* native = jsCast<NativeExecutable*>(realThis);
        out.print("NativeExecutable:", RawPointer(bitwise_cast<void*>(native->function())), "/", RawPointer(bitwise_cast<void*>(native->constructor())));
        return;
    }
    
    if (classInfo() == EvalExecutable::info()) {
        EvalExecutable* eval = jsCast<EvalExecutable*>(realThis);
        if (CodeBlock* codeBlock = eval->codeBlock())
            out.print(*codeBlock);
        else
            out.print("EvalExecutable w/o CodeBlock");
        return;
    }
    
    if (classInfo() == ProgramExecutable::info()) {
        ProgramExecutable* eval = jsCast<ProgramExecutable*>(realThis);
        if (CodeBlock* codeBlock = eval->codeBlock())
            out.print(*codeBlock);
        else
            out.print("ProgramExecutable w/o CodeBlock");
        return;
    }

    if (classInfo() == ModuleProgramExecutable::info()) {
        ModuleProgramExecutable* executable = jsCast<ModuleProgramExecutable*>(realThis);
        if (CodeBlock* codeBlock = executable->codeBlock())
            out.print(*codeBlock);
        else
            out.print("ModuleProgramExecutable w/o CodeBlock");
        return;
    }
    
    FunctionExecutable* function = jsCast<FunctionExecutable*>(realThis);
    if (!function->eitherCodeBlock())
        out.print("FunctionExecutable w/o CodeBlock");
    else {
        CommaPrinter comma("/");
        if (function->codeBlockForCall())
            out.print(comma, *function->codeBlockForCall());
        if (function->codeBlockForConstruct())
            out.print(comma, *function->codeBlockForConstruct());
    }
}
示例#15
0
文件: json.c 项目: 1100110/dmd
void JsonOut::objectEnd()
{
    indentLevel--;
    removeComma();
    if (buf->offset >= 2 &&
        buf->data[buf->offset - 2] == '{' &&
        buf->data[buf->offset - 1] == '\n')
        buf->offset -= 1;
    else
    {
        buf->writestring("\n");
        indent();
    }
    buf->writestring("}");
    comma();
}
示例#16
0
文件: options.cpp 项目: cpehle/lean
format pp(options const & o) {
    bool unicode = get_pp_unicode(o);
    format r;
    bool first = true;
    char const * arrow = unicode ? g_arrow : g_assign;
    for_each(o.m_value, [&](sexpr const & p) {
            if (first) { first = false; } else { r += comma(); r += line(); }
            name const & n = to_name(head(p));
            unsigned sz = n.size();
            unsigned indent = unicode ? sz+3 : sz+4;
            r += group(nest(indent, pp(head(p)) + space() + format(arrow) + space() + pp(tail(p))));
        });
    format open  = unicode ? format(g_left_angle_bracket) : lp();
    format close = unicode ? format(g_right_angle_bracket) : rp();
    return group(nest(1, open + r + close));
}
示例#17
0
文件: json.c 项目: 1100110/dmd
void JsonOut::arrayEnd()
{
    indentLevel--;
    removeComma();
    if (buf->offset >= 2 &&
        buf->data[buf->offset - 2] == '[' &&
        buf->data[buf->offset - 1] == '\n')
        buf->offset -= 1;
    else if (!(buf->offset >= 1 &&
        buf->data[buf->offset - 1] == '['))
    {
        buf->writestring("\n");
        indent();
    }
    buf->writestring("]");
    comma();
}
示例#18
0
文件: main.c 项目: ChrisG0x20/gdb
static void
done (int exit_code)
{
  if (verbose)
    {
      stack_heap_stats ();
      mem_usage_stats ();
      /* Only use comma separated numbers when being very verbose.
	 Comma separated numbers are hard to parse in awk scripts.  */
      if (verbose > 1)
	printf ("insns: %14s\n", comma (rx_cycles));
      else
	printf ("insns: %u\n", rx_cycles);

      pipeline_stats ();
    }
  exit (exit_code);
}
示例#19
0
void Effects::dump(PrintStream& out) const
{
    CommaPrinter comma("|");
    if (terminal)
        out.print(comma, "Terminal");
    if (exitsSideways)
        out.print(comma, "ExitsSideways");
    if (controlDependent)
        out.print(comma, "ControlDependent");
    if (writesLocalState)
        out.print(comma, "WritesLocalState");
    if (readsLocalState)
        out.print(comma, "ReadsLocalState");
    if (writes)
        out.print(comma, "Writes:", writes);
    if (reads)
        out.print(comma, "Reads:", reads);
}
示例#20
0
QString ServicesDb::_escapeIds(const vector<long>& v) const
{
  QString str;
  str.reserve(v.size() * 6);
  QString comma(",");

  str.append("{");
  for (size_t i = 0; i < v.size(); i++)
  {
    if (i != 0)
    {
      str.append(comma);
    }
    str.append(QString::number(v[i]));
  }
  str.append("}");

  return str;
}
示例#21
0
void dumpArrayModes(PrintStream& out, ArrayModes arrayModes)
{
    if (!arrayModes) {
        out.print("<empty>");
        return;
    }
    
    if (arrayModes == ALL_ARRAY_MODES) {
        out.print("TOP");
        return;
    }
    
    CommaPrinter comma("|");
    if (arrayModes & asArrayModes(NonArray))
        out.print(comma, "NonArray");
    if (arrayModes & asArrayModes(NonArrayWithInt32))
        out.print(comma, "NonArrayWithInt32");
    if (arrayModes & asArrayModes(NonArrayWithDouble))
        out.print(comma, "NonArrayWithDouble");
    if (arrayModes & asArrayModes(NonArrayWithContiguous))
        out.print(comma, "NonArrayWithContiguous");
    if (arrayModes & asArrayModes(NonArrayWithArrayStorage))
        out.print(comma, "NonArrayWithArrayStorage");
    if (arrayModes & asArrayModes(NonArrayWithSlowPutArrayStorage))
        out.print(comma, "NonArrayWithSlowPutArrayStorage");
    if (arrayModes & asArrayModes(ArrayClass))
        out.print(comma, "ArrayClass");
    if (arrayModes & asArrayModes(ArrayWithUndecided))
        out.print(comma, "ArrayWithUndecided");
    if (arrayModes & asArrayModes(ArrayWithInt32))
        out.print(comma, "ArrayWithInt32");
    if (arrayModes & asArrayModes(ArrayWithDouble))
        out.print(comma, "ArrayWithDouble");
    if (arrayModes & asArrayModes(ArrayWithContiguous))
        out.print(comma, "ArrayWithContiguous");
    if (arrayModes & asArrayModes(ArrayWithArrayStorage))
        out.print(comma, "ArrayWithArrayStorage");
    if (arrayModes & asArrayModes(ArrayWithSlowPutArrayStorage))
        out.print(comma, "ArrayWithSlowPutArrayStorage");
}
/*! 
 * Generate the display label
 * \a contact to read the data from .
 * \a detailList contains the details to be read from the contact
 * \return synthesised display label 
 */
QString CntDisplayLabel::generateDisplayLabel( const QContact &contact, const QList<QList<QPair<QLatin1String, QLatin1String> > > detailList) const
{
    // Default to empty display label. It is up to the client to create a
    // localised presentation of a contact without a name.
    QString displayLabel("");
    
    //loop through the details and create display label
    for(int i = 0; i < detailList.count() && displayLabel.isEmpty(); i++ )
    {
        QList<QPair<QLatin1String, QLatin1String> > detailPairList = detailList.at(i);
        QContactDetail contactDetail;
        
        for(int j = 0; j < detailPairList.count(); j++)
        {
            contactDetail = contact.detail(detailPairList.at(j).first);
                    
            if(displayLabel.isEmpty()){ //read the value and set it as display label
                displayLabel =  contactDetail.value(detailPairList.at(j).second);
            }
            else{ //read the value and append it to the display label
                QString label = contactDetail.value(detailPairList.at(j).second);
                
                if(!label.isEmpty())
                {
#ifdef SYMBIAN_BACKEND_USE_SQLITE
                    // Inlcude a comma if needed in the display label
                    if (m_nameOrder == CntOrderLastCommaFirst)
                        displayLabel.append(comma());
#endif
                    displayLabel.append(delimiter());                        
                    displayLabel.append(label);
                }  
            }
        }
    }

    return displayLabel;
}
示例#23
0
文件: fold3.C 项目: ChenBoTang/gcc
int main() {
  static_assert(add() == int(), "");
  static_assert(mul() == 1, "");
  static_assert(bor() == int(), "");
  static_assert(band() == -1, "");
  static_assert(land() == true, "");
  static_assert(lor() == false, "");
  comma(); // No value to theck

  // These are all errors, but the error is emitted at the point
  // of instantiation (line 10).
  sub();			// { dg-message "required from here" }
  div();			// { dg-message "required from here" }
  mod();			// { dg-message "required from here" }
  lsh();			// { dg-message "required from here" }
  rsh();			// { dg-message "required from here" }
  assign();			// { dg-message "required from here" }
  addi();			// { dg-message "required from here" }
  subi();			// { dg-message "required from here" }
  muli();			// { dg-message "required from here" }
  divi();			// { dg-message "required from here" }
  modi();			// { dg-message "required from here" }
  bxor();			// { dg-message "required from here" }
  bxori();			// { dg-message "required from here" }
  bori();			// { dg-message "required from here" }
  bandi();			// { dg-message "required from here" }
  lshi();			// { dg-message "required from here" }
  rshi();			// { dg-message "required from here" }
  eq();				// { dg-message "required from here" }
  ne();				// { dg-message "required from here" }
  lt();				// { dg-message "required from here" }
  gt();				// { dg-message "required from here" }
  le();				// { dg-message "required from here" }
  ge();				// { dg-message "required from here" }
  dot_star();			// { dg-message "required from here" }
  arrow_star();			// { dg-message "required from here" }
}
示例#24
0
void lat_dir()//get dimensions
{
  char i=0,val;
 
  if( ID())
  {
    comma(3);
    while(1)
    {
      if(Serial.available())
      {
        val = Serial.read();
        Serial.write(val);
        Serial.println();
        i++;
      }
      if(i==1)
      {
        i=0;
        return;
      }  
    }
  }
}
示例#25
0
void lon_dir()//get direction data
{
  char i=0,val;
 
  if( ID())
  {
    comma(5);
    while(1)
    {
      if(Serial.available())
      {
        val = Serial.read();
        Serial.write(val); //Serial.println(val,BYTE);
        Serial.println();
        i++;
      }
      if(i==1)
      {
        i=0;
        return;
      }  
    }
  }
}
示例#26
0
void IntelDisassembler::handle_stmt(IntelSyntaxDisStmt &stmt)
{
	if(stmt.ident == symbol_write)
	{
		write(unquotify(stmt.args[0]).c_str());
	}
	else
	if(stmt.ident == symbol_space)
	{
		space();
	}
	else
	if(stmt.ident == symbol_maybe_write_space_args_imm32)
	{
		if(icode->imm != get_num(stmt.args[0]))
		{
			space();
			write_args();
		}
	}
	else
	if(stmt.ident == symbol_write_args)
	{
		write_args();
	}
	else
	if(stmt.ident == symbol_write_arg)
	{
		if(stmt.args.size() == 1)
			write_arg(get_num(stmt.args[0]));
		else
		if(stmt.args.size() == 2)
			write_arg(get_num(stmt.args[0]), get_num(stmt.args[1]));
		else
		if(stmt.args.size() == 3)
			write_arg(get_num(stmt.args[0]), get_num(stmt.args[1]), get_num(stmt.args[2]));
		else
		if(stmt.args.size() == 4)
			write_arg(get_num(stmt.args[0]), get_num(stmt.args[1]), get_num(stmt.args[2]), get_num(stmt.args[3]));
	}
	else
	if(stmt.ident == symbol_write_rep)
	{
		if(icode->lockrep == 2 || icode->lockrep == 3)
			write("rep ");
	}
	else
	if(stmt.ident == symbol_write_repcc)
	{
		if(icode->lockrep == 2)
			write("repnz ");
		else
		if(icode->lockrep == 3)
			write("repz ");
	}
	else
	if(stmt.ident == symbol_write_size_suffix_argsize)
	{
		write_size_suffix(icode->argsize[get_num(stmt.args[0])]);
	}
	else
	if(stmt.ident == symbol_write_size_suffix_osz)
	{
		write_size_suffix(2 << icode->osz);
	}
	else
	if(stmt.ident == symbol_write_seg_reg)
	{
		if(icode->ea.sreg <= 5)
		{
			do_write_seg_reg(icode->ea.sreg);
			write(" ");
		}
	}
	else
	if(stmt.ident == symbol_comma)
	{
		comma();
	}
	else
	if(stmt.ident == symbol_write_osz64)
	{
		write(unquotify(stmt.args[(icode->osz == 2) ? 0 : 1]).c_str());
	}
	else
	if(stmt.ident == symbol_write_stack_o16_o32_o64)
	{
		if(dsz == 2)
		{
			// 64bit mode.
			if(icode->osz == 0)
				write("o16 ");
		}
		else
		if(dsz != icode->osz)
		{
			write_o16_o32_o64();
		}
	}
	else
	if(stmt.ident == symbol_do_nop_xchg)
	{
		// do_nop_xchg("nop", "xchg", 1) means: argvalue(1) is 0, nop else do xchg
		int a = get_num(stmt.args[2]);
		if(icode->argvalue[a] == 0 && state->opcode0 == 0x90 && icode->argtype[0] == IntelArgTypes::Treg_gr)
			write(unquotify(stmt.args[0]).c_str());
		else
		{
			write(unquotify(stmt.args[1]).c_str());
			space();
			write_args();
		}
	}
	else
	if(stmt.ident == symbol_write_xlat_o16_o32_o64)
	{
		if(dsz == 2)
		{
			// 64bit mode.
			if(icode->osz != 1)
				write_o16_o32_o64();
		}
		else
		if(dsz != icode->osz)
		{
			write_o16_o32_o64();
		}
	}
	else
	if(stmt.ident == symbol_write_osz)
	{
		// if osz == 0, write 1st argument.
		// if osz == 1, write 2nd argument.
		// if osz == 2, write 3rd argument.
		write(unquotify(stmt.args[icode->osz]).c_str());
	}
	else
	if(stmt.ident == symbol_write_asz)
	{
		// if asz == 0, write 1st argument.
		// if asz == 1, write 2nd argument.
		// if asz == 2, write 3rd argument.
		write(unquotify(stmt.args[icode->asz]).c_str());
	}
	else
	if(stmt.ident == symbol_write_far_imm)
	{
		write_far_imm();
	}
	else
	if(stmt.ident == symbol_write_jrcxz_o16_o32_o64)
	{
		if(dsz != 2)
		{
			if(icode->osz != dsz)
				write_o16_o32_o64();
		}
	}
	else
	{
		write("<unimpl-stmt>");
	}
}
示例#27
0
void dumpNodeFlags(PrintStream& actualOut, NodeFlags flags)
{
    StringPrintStream out;
    CommaPrinter comma("|");

    if (flags & NodeResultMask) {
        switch (flags & NodeResultMask) {
        case NodeResultJS:
            out.print(comma, "JS");
            break;
        case NodeResultNumber:
            out.print(comma, "Number");
            break;
        case NodeResultDouble:
            out.print(comma, "Double");
            break;
        case NodeResultInt32:
            out.print(comma, "Int32");
            break;
        case NodeResultInt52:
            out.print(comma, "Int52");
            break;
        case NodeResultBoolean:
            out.print(comma, "Boolean");
            break;
        case NodeResultStorage:
            out.print(comma, "Storage");
            break;
        default:
            RELEASE_ASSERT_NOT_REACHED();
            break;
        }
    }

    if (flags & NodeMustGenerate)
        out.print(comma, "MustGen");

    if (flags & NodeHasVarArgs)
        out.print(comma, "VarArgs");

    if (flags & NodeResultMask) {
        if (!(flags & NodeBytecodeUsesAsNumber) && !(flags & NodeBytecodeNeedsNegZero))
            out.print(comma, "PureInt");
        else if (!(flags & NodeBytecodeUsesAsNumber))
            out.print(comma, "PureInt(w/ neg zero)");
        else if (!(flags & NodeBytecodeNeedsNegZero))
            out.print(comma, "PureNum");
        if (flags & NodeBytecodeUsesAsOther)
            out.print(comma, "UseAsOther");
    }

    if (flags & NodeMayHaveNonIntResult)
        out.print(comma, "MayHaveNonIntResult");

    if (flags & NodeMayOverflowInt52)
        out.print(comma, "MayOverflowInt52");

    if (flags & NodeMayOverflowInt32InBaseline)
        out.print(comma, "MayOverflowInt32InBaseline");

    if (flags & NodeMayOverflowInt32InDFG)
        out.print(comma, "MayOverflowInt32InDFG");

    if (flags & NodeMayNegZeroInBaseline)
        out.print(comma, "MayNegZeroInBaseline");

    if (flags & NodeMayNegZeroInDFG)
        out.print(comma, "MayNegZeroInDFG");

    if (flags & NodeBytecodeUsesAsInt)
        out.print(comma, "UseAsInt");

    if (flags & NodeBytecodeUsesAsArrayIndex)
        out.print(comma, "ReallyWantsInt");

    if (flags & NodeIsFlushed)
        out.print(comma, "IsFlushed");

    CString string = out.toCString();
    if (!string.length())
        actualOut.print("<empty>");
    else
        actualOut.print(string);
}
示例#28
0
文件: version.c 项目: NCDS/hexchat
int
main (int argc, char *argv[])
{
	if (argc > 1)
	{
		if (!strcmp (argv[1], "-r"))			/* hexchat.rc/FILEVERSION, PRODUCTVERSION */
		{
			printf ("#define COMMA_VERSION %s\n", comma ());
		}
		else if (!strcmp (argv[1], "-a"))	/* hexchat.iss/AppVerName */
		{
#ifdef _WIN64
			printf ("AppVerName=HexChat %s (x64)\n", PACKAGE_VERSION);
#else
			printf ("AppVerName=HexChat %s (x86)\n", PACKAGE_VERSION);
#endif
		}
		else if (!strcmp (argv[1], "-v"))	/* hexchat.iss/AppVersion */
		{
			/* printf ("AppVersion=%s\n", point ()); this was required only for nnnn[-n] version numbers */
			printf ("AppVersion=%s\n", PACKAGE_VERSION);
		}
		else if (!strcmp (argv[1], "-i"))	/* hexchat.iss/VersionInfoVersion */
		{
			/* printf ("VersionInfoVersion=%s\n", point ()); this was required only for nnnn[-n] version numbers */
			printf ("VersionInfoVersion=%s\n", PACKAGE_VERSION);
		}
		else if (!strcmp (argv[1], "-o"))	/* hexchat.iss/OutputBaseFilename */
		{
#ifdef _WIN64
			printf ("OutputBaseFilename=HexChat %s x64\n", PACKAGE_VERSION);
#else
			printf ("OutputBaseFilename=HexChat %s x86\n", PACKAGE_VERSION);
#endif
		}
		else if (!strcmp (argv[1], "-v"))	/* version.txt */
		{
			printf ("%s", PACKAGE_VERSION);
		} else
		{
			printf ("usage:\n\t-a\thexchat.iss/AppVerName\n\t-i\thexchat.iss/VersionInfoVersion\n\t-o\thexchat.iss/OutputBaseFilename\n\t-r\thexchat.rc/FILEVERSION, PRODUCTVERSION\n\t-v\thexchat.iss/AppVersion\n");
		}
	} else
	{
		printf ("usage:\n\t-a\thexchat.iss/AppVerName\n\t-i\thexchat.iss/VersionInfoVersion\n\t-o\thexchat.iss/OutputBaseFilename\n\t-r\thexchat.rc/FILEVERSION, PRODUCTVERSION\n\t-v\thexchat.iss/AppVersion\n");
	}

#if 0 /* ugly hack */
	switch ((int) argv[1][0])
	{
		case 'r':	/* hexchat.rc/FILEVERSION, PRODUCTVERSION*/
			printf ("#define COMMA_VERSION \"%s\"\n", comma ());
			break;
		case 'a':	/* hexchat.iss/AppVerName */
			printf ("AppVerName=HexChat %s\n", PACKAGE_VERSION);
			break;
		case 'v':	/* hexchat.iss/AppVersion */
			printf ("AppVersion=%s\n", point ());
			break;
		case 'i':	/* hexchat.iss/VersionInfoVersion */
			printf ("VersionInfoVersion=%s\n", point ());
			break;
		case 'o':	/* hexchat.iss/OutputBaseFilename */
			printf ("OutputBaseFilename=HexChat %s\n", PACKAGE_VERSION);
			break;
		case 'u':	/* version.txt */
			printf ("%s", PACKAGE_VERSION);
			break;
		default:
			printf ("use a, i, o, r or v.\n");
			break;
	}
#endif

	return 0;
}
示例#29
0
void BlockSet::dump(PrintStream& out) const
{
    CommaPrinter comma(" ");
    for (BlockIndex blockIndex = m_set.findBit(0, true); blockIndex < m_set.size(); blockIndex = m_set.findBit(blockIndex + 1, true))
        out.print(comma, "#", blockIndex);
}
/*
 * Initialise the model from a file. The file must be in the same formats as those saved by the model: csv etc
 * 
 * ...FileName: the file name of the file containing the respective tumour cell metabolic population data.
 * lattice: the lattice to populate, either T or T1.
 * model: the model object.
 */
void InitialiseModel::SetTumourComposition(const char *patFileName, const char *pantFileName,
	const char *qatFileName, const char *qantFileName, const char *dFileName, 
	const LatticeType lattice, Model *model) {
		
	LatticeSite *(*l)[HEIGHT][WIDTH];
	if (lattice == T)
		l = &(model->m_latticeT);
	else if (lattice == T1)
		l = &(model->m_latticeT1);		
		
	// Open the cellular description files		
	ifstream fPatIn(patFileName, ios_base::in); 
	// Check for errors
	if (fPatIn.fail()) throw string("Error: failed to open "+string(patFileName)+".");
	ifstream fPantIn(pantFileName, ios_base::in);
	if (fPantIn.fail()) throw string("Error: failed to open "+string(pantFileName)+".");
	ifstream fQatIn(qatFileName, ios_base::in);
	if (fQatIn.fail()) throw string("Error: failed to open "+string(qatFileName)+".");
	ifstream fQantIn(qantFileName, ios_base::in);
	if (fQantIn.fail()) throw string("Error: failed to open "+string(qantFileName)+".");
	ifstream fDIn(dFileName, ios_base::in);
	if (fDIn.fail()) throw string("Error: failed to open "+string(dFileName)+".");
	
	for (int i = 0; i < HEIGHT; ++i) {
		for (int j = 0; j < WIDTH; ++j) {					
			
			int patCellPopulation, pantCellPopulation, qatCellPopulation, qantCellPopulation, dCellPopulation;
			patCellPopulation = pantCellPopulation = qatCellPopulation = qantCellPopulation = dCellPopulation = 0;
			// Read the cell populations from file
			fPatIn >> patCellPopulation;
			fPantIn >> pantCellPopulation;
			fQatIn >> qatCellPopulation;
			fQantIn >> qantCellPopulation;
			fDIn >> dCellPopulation;
			
			// Set the lattice site cellular composition		
			(*l)[i][j]->SetCells(patCellPopulation, pantCellPopulation, qatCellPopulation, qantCellPopulation, dCellPopulation, 0);
			
			// Lines end with a non-comma character
			if (j < WIDTH-1) {
				for (int i = 0 ; i < 5; ++i) {	
					string comma("");
					switch (i) {
						case 0:
							fPatIn >> comma;
							if (comma != ",") throw string("Error: Contrary to expectations non ',' character read, "+comma+" read instead.");
							break;
						case 1:
							fPantIn >> comma;
							if (comma != ",") throw string("Error: Contrary to expectations non ',' charactor read, "+comma+" read instead.");
							break;
						case 2:
							fQatIn >> comma;
							if (comma != ",") throw string("Error: Contrary to expectation non ',' character read, "+comma+" read instead.");
							break;
						case 3:
							fQantIn >> comma;
							if (comma != ",") throw string("Error: Contrary to expectation non ',' character read, "+comma+" read instead.");
							break;
						case 4:
							fDIn >> comma;
							if (comma != ",") throw string("Error: Contrary to expectation non ',' character read, "+comma+" read instead.");
							break;
					}
				}
			}									
		}
	}	
	fPatIn.close();
	fPantIn.close();
	fQatIn.close();
	fQantIn.close();
	fDIn.close(); 
}