コード例 #1
0
static inline void initializeWithUserDefault(WTFLogChannel& channel)
{
    DWORD length = GetEnvironmentVariableA(channel.defaultName, 0, 0);
    if (!length)
        return;

    OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]);

    if (!GetEnvironmentVariableA(channel.defaultName, buffer.get(), length))
        return;

    String variableValue(buffer.get());

    static const String& hexadecimalPrefix = *new String("0x");
    if (variableValue.length() < 3 || !variableValue.startsWith(hexadecimalPrefix, false)) {
        LOG_ERROR("Unable to parse hex value for %s (%s), logging is off", channel.defaultName, buffer.get());
        return;
    }

    String unprefixedValue = variableValue.substring(2);

    // Now parse the unprefixed string as a hexadecimal number.
    bool parsedSuccessfully = false;
    unsigned logLevel = unprefixedValue.toUIntStrict(&parsedSuccessfully, 16);

    if (!parsedSuccessfully) {
        LOG_ERROR("Unable to parse hex value for %s (%s), logging is off", channel.defaultName, buffer.get());
        return;
    }

    if ((logLevel & channel.mask) == channel.mask)
        channel.state = WTFLogChannelOn;
    else
        channel.state = WTFLogChannelOff;
}
コード例 #2
0
ファイル: exerexx.cpp プロジェクト: yoosofan/REXX
valBool executeRexxCls::callInternalFunction(int lif,fCallContCls &tt)
{ //return pointerOfInternalFunctions[lif-1](tt);
	valBool ret1;
	ret1.b=true;
	NUMBERfORM  dd12=0;
	variableValue vv11,vv22,vv33;
	  char *p1,*p2;
	 int cmp1,i1,i2,j;
	 int no_arg=tt.size();
  switch (lif)
  {
	 case 1:
// 	   ABS
		 ret1.val=tt.getArg(0);
		 dd12=ret1.val.getNumberOfVar();
		 dd12=fabs(dd12);
		 ret1.val=variableValue(dd12);
	 break;
	 case 2:
//	{ "COMPARE",2,2},

	  vv11=tt.getArg(0);
	  vv22=tt.getArg(1);

	  p1=vv11.getNewCharPointer();
	  p2=vv22.getNewCharPointer();
		cmp1=ahmadStrcmp(p1,p2);
	  ret1.val=variableValue(cmp1);
	  delete[] p1;
	  delete[] p2;

	 break;
	 case 3:
			vv11=tt.getArg(0);
			vv22=tt.getArg(1);

			p1=vv11.getNewCharPointer();
			cmp1=vv22.getNumberOfVar();
		 i1=strlen(p1)+1;

		 if(no_arg==3)
		 {
			vv33=tt.getArg(2);
			i1=vv33.getNumberOfVar();

		 }
		 j=0;
		 for(;*p1&&(*p1==' ');p1++);
		 i2=strlen(p1)+1;
		 p2=new char[i2+2];
	  if(!( ( i2<cmp1) || ( cmp1<0 ) ) )
	  {
		 for(;*(p1+cmp1);p1++)
		 {
		  if(!i1)
			 break;
		  i1--;
		  p2[j++]=*(p1+cmp1);
		 }
		 p2[j]=NULL;
		 ret1.val=variableValue(p2);
	  }
	  else
		ret1.val=variableValue("");

		delete[] p2;
	  ret1.b=true;

	 break;
/*
	 case 4:

	 break;

	 case 5:

	 break;
	 case 6:

    break;
    case 7:

    break;
    case 8:

    break;
    case 9:

	 break;
    case 10:

    break;
    case 11:

    break;
	 case 12:

	 break;
    case 13:

    break;
	 case 14:

    break;
    case 15:

    break;
    case 16:

    break;
    case 17:

    break;
	 case 18:

	 break;
	 case 19:

    break;
    case 20:

	 break;
    case 21:

    break;
    case 22:

    break;
	 case 23:

    break;

    case 24:

    break;
	 case 25:

	 break;
	 case 26:

	 break;
	 case 27:

	 break;
	 case 28:

	 break;
	 case 29:

	 break;
	 case 30:

	 break;
  */
	default :
	break;
}
return ret1;
}
コード例 #3
0
ファイル: SFSBuddyManager.cpp プロジェクト: ThiQuocCuong/RPS
// -------------------------------------------------------------------
// MyState
// -------------------------------------------------------------------
void SFSBuddyManager::MyState(string value)
{
	boost::shared_ptr<string> variableValue (new string(value));
	boost::shared_ptr<BuddyVariable> variable(new SFSBuddyVariable(ReservedBuddyVariables::BV_STATE, variableValue, VARIABLETYPE_STRING)),
	SetMyVariable(variable);
}