void NandTitle::AsciiTID(u64 tid, char* out)
{
	//gprintf("AsciiTID( %016llx ): ");
	out[0] = ascii(TITLE_3( tid ));
	out[1] = ascii(TITLE_2( tid ));
	out[2] = ascii(TITLE_1( tid ));
	out[3] = ascii((u8) (tid));
	out[4] = 0;
	//gprintf("%s\n", out );
}
Beispiel #2
0
/**
 * @param dim A dimension object that encapsulates the axis data
 */
void PlotAxis::titleFromDimension(const Mantid::Geometry::IMDDimension &dim) {
  m_title = QString::fromStdString(dim.getName());
  if (!m_title.isEmpty()) {
    auto unitLbl = dim.getUnits();
    if (!unitLbl.utf8().empty()) {
      m_title += " (" + QString::fromStdWString(unitLbl.utf8()) + ")";
    } else if (!unitLbl.ascii().empty()) {
      m_title += " (" + QString::fromStdString(unitLbl.ascii()) + ")";
    }
  }
}
Beispiel #3
0
void TestFramework::loadFile()
{
	QString file = QFileDialog::getOpenFileName(0,
										"Choose a test file",
										getWorkingDir().c_str(),
										"*.btf");

	if (ascii(file) == "") return;

	filename_ = ascii(file);
	setWorkingDirFromFilename_(filename_);
}
Beispiel #4
0
void LCD_Out(unsigned int DATA)
{
   unsigned char A[4], i;
   for (i=0; i<4; i++) {
      A[i] = DATA % 16;
      DATA = DATA / 16;
      } 
   LCD_Write(ascii(A[3]));
   LCD_Write(ascii(A[2]));
   LCD_Write(ascii(A[1]));
   LCD_Write(ascii(A[0]));
   }
Beispiel #5
0
int main( int argc, char * argv[] ) {


  // Verify filename
  if (argc != 2) { throwError(1); return 0; } 

  char* str1[MAX];


  // allocate memory for array of strings.

  for (i=0; i<MAX; i++) {

    str1[i] = malloc(sizeof(char)*MAX);

  }

  int fileSize = readFile( argv[1], str1 );
  if (!fileSize) { return 0; }

  createArray   (*str1);
  sort       (*str1);
  printArray   (*str1);
  reverse      (*str1);
  printArray   (*str1);
  ascii      (*str1);

  
} // end main()
Beispiel #6
0
        // TODO: use a const_string class. would be much faster.
        static std::string apply(v8::Handle<v8::Value> const& value)
        {
            v8::String::AsciiValue ascii(value);

            char const* result = *ascii;
            return result ? std::string(result) : "<string conversion failed>";
        }
Beispiel #7
0
System* MolecularFileDialog::openFile_(String type)
{
	QStringList files = QFileDialog::getOpenFileNames(
											0,
											tr("Choose a molecular file to open"),
											getWorkingDir().c_str(),
											"*.*");

	System* system = 0;
	for (QStringList::Iterator it = files.begin(); it != files.end(); ++it) 
	{
		vector<String> fields;
		String seperators(FileSystem::PATH_SEPARATOR);
		// workaround on windows: QT returns the filename in linux style
		// but I am not sure, if this will stay this way.
#ifdef BALL_OS_WINDOWS
		 seperators += "/";
#endif
		String file = ascii(*it);
		Position p = file.split(fields, seperators.c_str()) -1;
		String filename = fields[p];				
		setWorkingDirFromFilename_(file);

		// construct a name for the system(the filename without the dir path)
		system = openMolecularFile(file, type, filename);
	}

	return system;
}
Beispiel #8
0
void PythonSettings::writePreferenceEntries(INIFile& inifile)
{
	PreferencesEntry::writePreferenceEntries(inifile);
	
	// the font size
	inifile.insertValue("PYTHON", "font", ascii(font_.toString()));
}
Beispiel #9
0
void Debug_hexdump (void *d, int len)
{
    u8 *data;
    int i, off;
    data = (u8*) d;

    gprintf("\n       0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F  0123456789ABCDEF");
    gprintf("\n====  ===============================================  ================\n");

    for (off = 0; off < len; off += 16)
    {
        gprintf("%04x  ", off);
        for (i = 0; i < 16; i++)
            if ((i + off) >= len)
                gprintf("   ");
            else gprintf("%02x ", data[off + i]);

        gprintf(" ");
        for (i = 0; i < 16; i++)
            if ((i + off) >= len)
                gprintf(" ");
            else gprintf("%c", ascii(data[off + i]));
        gprintf("\n");
    }
} 
void	ft_recup_files(t_dvm *vm, t_dargs *args)
{
	int		i;
	char	*message;

	i = 0;
	message = 0;
	while (i < vm->nbr_players)
	{
		l1(1, "OPEN FILE", args[i].file);
		if (!ft_strstr(args[i].file, ".cor")
		|| ((args[i].fd = open(args[i].file, O_RDONLY)) == -1))
		{
			message = ft_strjoin("Can't open this f*****g file: ",
					args[i].file);
			if (!vm->console)
				ft_printf("%s\n", message);
			free_data(data());
			ascii(ASC_EXIT_1);
			exitascii(data(), 1, message);
			free(message);
			exit(1);
		}
		++i;
	}
}
Beispiel #11
0
void HexView::paintAscii(QPainter *painter, int &left,int first, int last)
{
    for (int i=first ;i<=last;++i) {
        for (int j=0;j<bytesPerRow_;++j) {

            int validx = (i * bytesPerRow()) + j;

            if (validx < contentLength_) {
                int valueint = value(validx);


                QRectF ascii(left + (j * asciiSpacer()),i * rowHeight(),asciiSpacer(),rowHeight());
                QPen pen;
                pen.setColor(Qt::black);
                 painter->setPen(pen);
                 if (std::isprint(valueint)) {
                     QChar c(valueint);
                     painter->drawText( ascii ,Qt::AlignCenter,QString(c)  );
                 } else {
                     painter->drawText( ascii ,Qt::AlignCenter,"."  );
                 }
            }
        }
    }

}
Beispiel #12
0
// python.exec function: execute a python command through a maxscript string
Value*
exec_cf( Value** arg_list, int count ) {
    // Step 1: make sure the arguments supplied are correct in count
    check_arg_count( python.exec, 1, count );

    // Step 2: protect the maxscript memory
    MXS_PROTECT(one_value_local(mxs_command));
    MXS_EVAL( arg_list[0], vl.mxs_command );

    // Step 2: create a python file based on the filename
    const MCHAR* command	= NULL;
    try {
        command	= vl.mxs_command->to_string();
    }
    MXS_CATCHERRORS();

    // Step 3: check to make sure the command is valid
    if ( !command ) {
        MXS_CLEANUP();
        return &false_value;
    }

    {
        MCharToPyString ascii(command);
        if( ascii.pyString() )
            PyRun_SimpleString( ascii.data() );

        PY_ERROR_PROPAGATE_MXS_CLEANUP();
    }

    // Step 5: cleanup the memory
    MXS_CLEANUP();

    return &ok;
}
string FileLine::warnMore() const {
    if (m_lineno) {
	return V3Error::warnMore()+ascii()+": ";
    } else {
	return V3Error::warnMore();
    }
}
Beispiel #14
0
Common::String Console::toAscii(const Common::String &str) {
	Common::String ascii(str);

	for (uint i = 0; i < ascii.size(); ++i)
		ascii.setChar(ascii[i] & 0x7f, i);

	return ascii;
}
		void BALLaxyInterfacePreferences::storeValues()
		{
			BALLaxyInterface* bi = BALLaxyInterface::getInstance(0);
			if (bi == 0) return;

			bi->setPage(new HTMLPage(bi, ignore_ssl_errors->isChecked()));
			bi->setBALLaxyBaseUrl(ascii(url_edit->text()));
		}
Beispiel #16
0
void test_eeprom(void) {
	volatile unsigned int i;
    volatile unsigned char x;

	EEPROM_Init(EEPROM_ADDR);

	for(i=0; i < 1;i++ ) {
		  ascii(message[i]);
		  EEPROM_ByteWrite(i, message[i]);
		  EEPROM_AckPolling();
	}

	for(i=0; i < 1;i++ ) {
		  x=EEPROM_RandomRead(i);
		  ascii(x);
	}
}
Beispiel #17
0
 v8::Handle<v8::Value> SubEntityJS:: setMaterialByNameConvert( SubEntityJS* subEntityJS, const v8::Arguments& args ) 
 	{
	 v8::String::AsciiValue ascii( args[ 0 ] ) ;
	 
	 subEntityJS-> subEntity-> setMaterialName( *ascii ) ;
	 
	 return v8::Undefined() ;
	}
Beispiel #18
0
static	bool	TransformTiffCorner(GTIF * gtif, GTIFDefn * defn, double x, double y, double& outLon, double& outLat)
{
    /* Try to transform the coordinate into PCS space */
    if( !GTIFImageToPCS( gtif, &x, &y ) )
        return false;
	
    if( defn->Model == ModelTypeGeographic )
    {
    	outLon = x;
    	outLat = y;
    	return true;
    }
    else    
	{
        if( GTIFProj4ToLatLong( defn, 1, &x, &y ) )
        {
			outLon = x;
			outLat = y;
			return true;
		}

		int size = 0;
		tagtype_t type = TYPE_UNKNOWN;
		int key_count = GTIFKeyInfo(gtif, GTCitationGeoKey, &size, &type);
		
		if(key_count > 0 && key_count < 1024 && type == TYPE_ASCII && size == 1)
		{
			vector<char>	ascii(key_count);
			int r = GTIFKeyGet(gtif, GTCitationGeoKey, &ascii[0], 0, key_count);
			if(r == key_count)
			{
				DebugAssert(ascii.back() == 0);
				string citation = string(&ascii[0]);
				if(citation == "PCS Name = WGS_1984_Web_Mercator_Auxiliary_Sphere")
				{
					char ** args = CSLTokenizeStringComplex("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs", " +", TRUE, FALSE);
					PJ * psPJ = pj_init( CSLCount(args), args );
					CSLDestroy(args);
					if(psPJ)
					{
						projUV	sUV;

						sUV.u = x;
						sUV.v = y;

						sUV = pj_inv( sUV, psPJ );

						outLon = sUV.u * RAD_TO_DEG;
						outLat = sUV.v * RAD_TO_DEG;
						pj_free(psPJ);
						return true;
					}
				}
			}
		}
	}
	return false;
}
int main(void) {
	volatile unsigned int i;
    volatile unsigned char x;
    WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer

    EEPROM_Init(0x50);

	for(i=0; i < 3;i++ ) {
		  ascii(message[i]);
		  EEPROM_ByteWrite(i, message[i]);
		  EEPROM_AckPolling();
	}

	for(i=0; i < 3;i++ ) {
		  x=EEPROM_RandomRead(i);
		  ascii(x);
	}
 }
Beispiel #20
0
	virtual int getStringValue(char* buff, size_t buffsize)
	{
		v8::String::AsciiValue ascii(m_v8Object->ToString());

		if (!buff)
			return strlen(*ascii);

		return Safe::strcpy(buff, buffsize, *ascii);
	}
Beispiel #21
0
 v8::Handle<v8::Value> EntityJS:: New( const v8::Arguments& args ) 
	{
	 v8::String::AsciiValue ascii( args[ 0 ] ) ;
	
	 EventEmitterJS:: prototypeTemplate-> GetFunction()-> Call( args.This(), 0, NULL ) ;

	 new EntityJS( args.This(), *ascii ) ;

	 return args.This() ;
	}
Beispiel #22
0
v8::Handle<v8::Value> StaticTextJS::setCaptionConvert( StaticTextJS* bound, const v8::Arguments& args ) 
	{
	 v8::String::AsciiValue ascii( args[ 0 ] ) ;
	
	 printf( "setCaptionConvert %s", *ascii ) ;

	 ( (MyGUI::StaticTextPtr) bound-> widget )-> setCaption( *ascii ) ;

	 return v8::Undefined() ;
	}
Beispiel #23
0
TEST( csv, ascii_get )
{
    {
        comma::csv::ascii_test::simple_struct s;
        EXPECT_EQ( comma::join( comma::csv::names( s ), ',' ), "a,b,c,s,t,nested/x,nested/y" );
        comma::csv::ascii< comma::csv::ascii_test::simple_struct > ascii;
        ascii.get( s, "1,2,'c',hello,20110304T111111.1234,5,6" );
        EXPECT_EQ( s.a, 1 );
        EXPECT_EQ( s.b, 2 );
        EXPECT_EQ( s.c, 'c' );
        EXPECT_EQ( s.s, "hello" );
        EXPECT_EQ( s.t, boost::posix_time::from_iso_string( "20110304T111111.1234" ) );
        EXPECT_EQ( s.nested.x, 5 );
        EXPECT_EQ( s.nested.y, 6 );
    }
    {
        comma::csv::ascii_test::simple_struct s;
        comma::csv::ascii< comma::csv::ascii_test::simple_struct > ascii( ",,,," );
        EXPECT_EQ( comma::join( comma::csv::names< comma::csv::ascii_test::simple_struct >( ",,,," ), ',' ), ",,,," );
        ascii.get( s, "1,2,'c',\"hello\",20110304T111111.1234,5,6" );
        EXPECT_EQ( s.a, 0 );
        EXPECT_EQ( s.b, 0 );
        EXPECT_EQ( s.c, 0 );
        EXPECT_EQ( s.s, "" );
        EXPECT_EQ( s.t, boost::posix_time::not_a_date_time );
        EXPECT_EQ( s.nested.x, 0 );
        EXPECT_EQ( s.nested.y, 0 );
    }
    {
        comma::csv::ascii_test::simple_struct s;
        comma::csv::ascii< comma::csv::ascii_test::simple_struct > ascii( ",,,,t,," );
        ascii.get( s, "1,2,'c',\"hello\",20110304T111111.1234,5,6" );
        EXPECT_EQ( s.a, 0 );
        EXPECT_EQ( s.b, 0 );
        EXPECT_EQ( s.c, 0 );
        EXPECT_EQ( s.s, "" );
        EXPECT_EQ( s.t, boost::posix_time::from_iso_string( "20110304T111111.1234" ) );
        EXPECT_EQ( s.nested.x, 0 );
        EXPECT_EQ( s.nested.y, 0 );
    }
    // todo: more testing
}
Beispiel #24
0
int V8Proxy::contextDebugId(v8::Handle<v8::Context> context)
{
    v8::HandleScope scope;
    if (!context->GetData()->IsString())
        return -1;
    v8::String::AsciiValue ascii(context->GetData());
    char* comma = strnstr(*ascii, ",", ascii.length());
    if (!comma)
        return -1;
    return atoi(comma + 1);
}
Beispiel #25
0
		void ShortcutDialog:: browseExportFile_()
		{
			Path p;
			String filename = p.find("shortcuts_13.txt");

			QString s = QFileDialog::getSaveFileName(
			                0,
			                tr("Choose a File to export Shortcuts"),
			                filename.c_str(),
			                "Text files (*.*)");

			if (s.isEmpty()) return;

			bool ret = ShortcutRegistry::getInstance(0)->writeShortcutsToFile(ascii(s));
			if (!ret)
			{
				// TODO this method should not occure if the dialog was canceled
				Log.warn()<< (String)tr("Could not export shortcuts to file ") << ascii(s) << std::endl;
			}
		}
v8::Handle<v8::Value> ScriptHandler::logCallback(const v8::Arguments &args)
{
        v8::HandleScope handleScope;
        v8::Local<v8::Value> value =  args[0];
        v8::String::AsciiValue ascii(value);

        Log::addToLog(Globals::JAVASCRIPT_LOGFILE, *ascii);
        
        return value;

}
Beispiel #27
0
		void ShortcutDialog::browseImportFile_()
		{
			Path p;
			String filename = p.find("shortcuts_13.txt");
			QString s = QFileDialog::getOpenFileName(
			                0,
			                tr("Choose a file to import shortcuts from"),
			                filename.c_str(),
			                "Text files (*)");

			if (s.isEmpty())
			{
				// TODO this method should not occure if the dialog was canceled
				Log.warn()<< (String)tr("Could not import shortcuts from file ") << ascii(s) << std::endl;
				return;
			}
			else
			{
				loadShortcutsFromFile_(ascii(s));
			}
		}
int V8PerContextDebugData::contextDebugId(v8::Handle<v8::Context> context)
{
    v8::HandleScope scope(context->GetIsolate());
    v8::Handle<v8::Value> data = debugData(context);

    if (!data->IsString())
        return -1;
    v8::String::AsciiValue ascii(data);
    char* comma = strnstr(*ascii, ",", ascii.length());
    if (!comma)
        return -1;
    return atoi(comma + 1);
}
Beispiel #29
0
		void PTEDialog::elementClicked_()
		{
			QObject* w = sender();
			if (w == 0) return;
			QPushButton* bt = dynamic_cast<QPushButton*>(w);
			if (bt == 0) return;

			String element = ascii(bt->text());

			Element e = PTE[element];
			newElementType(e.getAtomicNumber());
			accept();
		}
Beispiel #30
0
 /**
  * @param s: The first string
  * @param b: The second string
  * @return true or false
  */
 bool anagram(string s, string t) {
     vector<int> ascii(128, 0);
     for (string::size_type c_iter = 0; c_iter != s.size(); c_iter++) {
         ascii[int(s[c_iter])]++;
     }
     for(string::size_type c_iter = 0; c_iter != t.size(); c_iter++){
         if(-- ascii[int(t[c_iter])]  < 0){
             return false;
             exit(0);    
         }
     }
     return true;
 }