Ejemplo n.º 1
0
bool wxScriptFunctionCINT::Exec(wxScriptVar &ret, wxScriptVar *arg) const
{
	// create the string with the arguments to give to the function
	wxString cmd = GetCallString(arg);

	// exec the function
	G__value returnvalue = G__calc(cmd);

	// for float & double we need special conversion
	if (m_tReturn.GetGenericType() == wxSTG_FLOAT ||
		m_tReturn.GetGenericType() == wxSTG_DOUBLE) {
		
		ret.Set(m_tReturn.GetGenericType(), 
			wxString::Format(wxT("%f"), G__double(returnvalue)));
		return TRUE;
	}

	// for all other types, we just get an int...
	long res = G__int(returnvalue);

	// ... and transform it into the correct value
	ret.Set(m_tReturn.GetGenericType(), res);

	return TRUE;
}
Ejemplo n.º 2
0
int ExecP2F::DoP2F(char* s,double d) {
  char temp[200];
  int result;
  G__CallFunc func;
  int (*p)(char*,double);

  /* pointer to function is not set */
  if(!p2f) return(0);

  /* exec pointer to function */
  switch(mode) {
  case G__INTERPRETEDFUNC: // reconstruct function call as string
    sprintf(temp,"%s(%ld,%g)",fname,s,d);
#ifdef __CINT__
    result=G__calc(temp);
#else
    result=G__int(G__calc(temp));
#endif
    break;
  case G__BYTECODEFUNC: // calling bytecode function
    func.SetBytecode((struct G__bytecodefunc*)p2f);
    func.SetArg((long)s);
    func.SetArg((double)d);
    result=func.ExecInt((void*)NULL);
    break;
  case G__COMPILEDINTERFACEMETHOD: // using interface method
    func.SetFunc((G__InterfaceMethod)p2f);
    func.SetArg((long)s);
    func.SetArg((double)d);
    result=func.ExecInt((void*)NULL);
    break;
  case G__COMPILEDTRUEFUNC: // using true pointer to function
    p = (int (*)(char*,double))p2f;
    result=(*p)(s,d);
    break;
  case G__UNKNOWNFUNC: // this case will never happen
    p = (int (*)(char*,double))p2f;
    result=(*p)(s,d);
    break;
  }
  return(result);
}
Ejemplo n.º 3
0
		static T convert( G__value const& v )
			{ return ( ( T )( G__int( v ) ) ); }
Ejemplo n.º 4
0
		T cast( G__value const& v )
		{
			return ( reinterpret_cast< T >( G__int( v ) ) );
		}
Ejemplo n.º 5
0
static int G__posix__0_13(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
      G__letint(result7, 105, (long) S_ISCHR((mode_t) G__int(libp->para[0])));
   return(1 || funcname || hash || result7 || libp) ;
}
Ejemplo n.º 6
0
static int G__posix__0_9(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
      G__letint(result7, 105, (long) closedir((DIR*) G__int(libp->para[0])));
   return(1 || funcname || hash || result7 || libp) ;
}
Ejemplo n.º 7
0
static int G__posix__0_10(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
      G__letint(result7, 105, (long) stat((const char*) G__int(libp->para[0]), (struct stat*) G__int(libp->para[1])));
   return(1 || funcname || hash || result7 || libp) ;
}
Ejemplo n.º 8
0
static int G__posix__0_60(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
      G__letint(result7, 105, (long) isDirectory((struct dirent*) G__int(libp->para[0])));
   return(1 || funcname || hash || result7 || libp) ;
}
Ejemplo n.º 9
0
static int G__posix__0_8(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
      rewinddir((DIR*) G__int(libp->para[0]));
      G__setnull(result7);
   return(1 || funcname || hash || result7 || libp) ;
}
Ejemplo n.º 10
0
static int G__posix__0_53(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
      G__letint(result7, 105, (long) fchown((int) G__int(libp->para[0]), (uid_t) G__int(libp->para[1])
, (gid_t) G__int(libp->para[2])));
   return(1 || funcname || hash || result7 || libp) ;
}
Ejemplo n.º 11
0
static int G__posix__0_56(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
      G__letint(result7, 105, (long) getpgid((pid_t) G__int(libp->para[0])));
   return(1 || funcname || hash || result7 || libp) ;
}
Ejemplo n.º 12
0
static int G__posix__0_50(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
      G__letint(result7, 108, (long) time((time_t*) G__int(libp->para[0])));
   return(1 || funcname || hash || result7 || libp) ;
}
Ejemplo n.º 13
0
static int G__posix__0_43(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
      G__letint(result7, 67, (long) ctermid((char*) G__int(libp->para[0])));
   return(1 || funcname || hash || result7 || libp) ;
}
Ejemplo n.º 14
0
static int G__posix__0_25(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
      usleep((unsigned long) G__int(libp->para[0]));
      G__setnull(result7);
   return(1 || funcname || hash || result7 || libp) ;
}
Ejemplo n.º 15
0
static int G__posix__0_24(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
      G__letint(result7, 104, (long) sleep((unsigned int) G__int(libp->para[0])));
   return(1 || funcname || hash || result7 || libp) ;
}
Ejemplo n.º 16
0
static int G__posix__0_19(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
      G__letint(result7, 108, (long) write((int) G__int(libp->para[0]), (void*) G__int(libp->para[1])
, (size_t) G__int(libp->para[2])));
   return(1 || funcname || hash || result7 || libp) ;
}