コード例 #1
0
ファイル: pack_unpack_test2.c プロジェクト: javins/fpt
int main()
{
  double x[1000] ;
  // double y[8000] ;
  // if storage is sufficient, source and destination
  // can be same array
  int i ;

  outS("enter a word : ") ;

  inS(x) ;

  outS(x) ;  
  outS("_hello\n") ;


  //  unpack(y, x) ;
  unpack(x, x) ;

  i = 0 ;
  //  while (y[i] != 0) { y[i] += 2.0 ; i++ ; }
  while (x[i] != 0) { x[i] += 2.0 ; i++ ; }

  //  pack(x, y) ;
  pack(x, x) ;

  outS(x) ;  
  outS("_goodbye\n") ;
}
コード例 #2
0
ファイル: map.c プロジェクト: clbr/SGDK
void outMap(tilemap_* map, FILE* fs, FILE* fh, char* id, int global)
{
    int size;
    char temp[MAX_PATH_LEN];

    if (map->packed != PACK_NONE) size = map->packedSize;
    else size = map->w * map->h * 2;

    // map data
    strcpy(temp, id);
    strcat(temp, "_map");
    // declare
    decl(fs, fh, NULL, temp, 2, FALSE);
    // output data
    if (size == (map->w * map->h * 2)) outS((unsigned char*) map->data, 0, size, fs, 2);
    else outS((unsigned char*) map->data, 0, size, fs, 1);
    fprintf(fs, "\n");

    // map structure
    decl(fs, fh, "Map", id, 2, global);
    // compression
    fprintf(fs, "    dc.w    %d\n", map->packed);
    // size
    fprintf(fs, "    dc.w    %d, %d\n", map->w, map->h);
    // map data pointer
    fprintf(fs, "    dc.l    %s\n", temp);
    fprintf(fs, "\n");
}
コード例 #3
0
ファイル: mesg.c プロジェクト: rennis250/sam
void
outTS(Hmesg type, String *s)
{
	outstart(type);
	outS(s);
	outsend();
}
コード例 #4
0
ファイル: palette.c プロジェクト: elraro/SGDK
void outPalette(unsigned short* palette, int startInd, int palSize, FILE* fs, FILE* fh, char* id, int global)
{
    char temp[MAX_PATH_LEN];
    int size;

    // we can't have more than 64 colors max
    size = MIN(64 - startInd, palSize);

    // palette data
    strcpy(temp, id);
    strcat(temp, "_pal");
    // declare
    decl(fs, fh, NULL, temp, 2, FALSE);
    // output data
    outS((unsigned char*) palette, 0, size * 2, fs, 2);
    fprintf(fs, "\n");

    // palette structure
    decl(fs, fh, "Palette", id, 2, global);
    // first color index and palette size
    fprintf(fs, "    dc.w    %d, %d\n", startInd, size);
    // set palette pointer
    fprintf(fs, "    dc.l    %s\n", temp);
    fprintf(fs, "\n");
}
コード例 #5
0
ファイル: bitmap.c プロジェクト: ehaliewicz/SGDK
void outBitmap(unsigned char* bitmap, int packed, int w, int h, int size, FILE* fs, FILE* fh, char* id, int global)
{
    char temp[MAX_PATH_LEN];

    // bitmap data
    strcpy(temp, id);
    strcat(temp, "_image");
    // declare
    decl(fs, fh, NULL, temp, 2, FALSE);
    // output data
    outS(bitmap, 0, size, fs, 1);
    fprintf(fs, "\n");

    // output Bitmap structure
    decl(fs, fh, "Bitmap", id, 2, global);
    // set compression info
    fprintf(fs, "    dc.w    %d\n", packed);
    // set size in pixel
    fprintf(fs, "    dc.w    %d, %d\n", w, h);
    // set palette pointer
    fprintf(fs, "    dc.l    %s_palette\n", id);
    // set image pointer
    fprintf(fs, "    dc.l    %s\n", temp);
    fprintf(fs, "\n");
}
コード例 #6
0
ファイル: mesg.c プロジェクト: rennis250/sam
void
outTsS(Hmesg type, int s1, String *s)
{
	outstart(type);
	outshort(s1);
	outS(s);
	outsend();
}
コード例 #7
0
void outVGM(unsigned char* data, int size, int align, FILE* fs, FILE* fh, char* id, int global)
{
    // declare
    declArray(fs, fh, "u8", id, size, align, TRUE);
    // output data
    outS(data, 0, size, fs, 1);
    fprintf(fs, "\n");
}
コード例 #8
0
void Map::save(QString dir)
{
    QDir qDir(dir);
    qDir.mkpath(dir);

    if(dir[dir.size() - 1] != '\\')
        dir += '\\';

    leftPopulation -> savePopulation(dir + "LeftPopulation\\");
    rightPopulation -> savePopulation(dir + "RightPopulation\\");

    QFile *fileX = new QFile(dir + "mapX.save");
    QFile *fileY = new QFile(dir + "mapY.save");
    QFile *fileS = new QFile(dir + "mapS.save");
    if (! fileX -> open(QIODevice::WriteOnly | QIODevice::Text) ||
            ! fileY -> open(QIODevice::WriteOnly | QIODevice::Text) ||
            ! fileS -> open(QIODevice::WriteOnly | QIODevice::Text) )
    {
        // Error while trying to write file
    }
    else
    {
        // Everything is OK
        QTextStream outX(fileX);
        QTextStream outY(fileY);
        QTextStream outS(fileS);

        outS << minDeltaX << "\n";
        outS << maxDeltaX << "\n";
        outS << minDeltaY << "\n";
        outS << maxDeltaY << "\n";
        outS << lengthStartEnd << "\n";
        outS << lengthTotal << "\n";


        outX << points.size() << "\n";
        outY << points.size() << "\n";
        for(int i = 0; i < points.size(); ++i)
        {
            QString tmp;

            tmp = "";
            tmp.setNum(points[i].x, 'f', 4);
            outX << tmp << "\n";

            tmp = "";
            tmp.setNum(points[i].y, 'f', 4);
            outY << tmp << "\n";
        }
    }

    fileX -> close();
    fileY -> close();
    fileS -> close();
}
コード例 #9
0
ファイル: mesg.c プロジェクト: rennis250/sam
void
outTslS(Hmesg type, int s1, Posn l1, String *s)
{
	outstart(type);
	outshort(s1);
	journaln(1, s1);
	outlong(l1);
	journaln(1, l1);
	outS(s);
	outsend();
}
コード例 #10
0
ファイル: testparse.cpp プロジェクト: JamesAwesome/subsurface
void TestParse::testParseCompareOutput()
{
	QCOMPARE(save_dives("./testout.ssrf"), 0);
	QFile org(SUBSURFACE_SOURCE "/dives/test40-42.xml");
	org.open(QFile::ReadOnly);
	QFile out("./testout.ssrf");
	out.open(QFile::ReadOnly);
	QTextStream orgS(&org);
	QTextStream outS(&out);
	QString readin = orgS.readAll();
	QString written = outS.readAll();
	QCOMPARE(readin, written);
}
コード例 #11
0
ファイル: testparse.cpp プロジェクト: ngdmcc/subsurface
void TestParse::testParseCompareNewFormatOutput()
{
	QCOMPARE(save_dives("./testsbnewout.ssrf"), 0);
	QFile org(SUBSURFACE_SOURCE "/dives/TestDiveSeabearNewFormat.xml");
	org.open(QFile::ReadOnly);
	QFile out("./testsbnewout.ssrf");
	out.open(QFile::ReadOnly);
	QTextStream orgS(&org);
	QTextStream outS(&out);
	QString readin = orgS.readAll();
	QString written = outS.readAll();
	QCOMPARE(readin, written);
	clear_dive_file_data();
}
コード例 #12
0
_String WriteFileDialogInput(void) {
    if (currentExecutionList && currentExecutionList->stdinRedirect) {
        _String outS (currentExecutionList->FetchFromStdinRedirect());
        if (outS.sLength) {
            return outS;
        }
    }
    
    defFileNameValue = ProcessLiteralArgument (&defFileString,nil);
    _String resolvedFilePath;
    
#ifdef __HEADLESS__
    WarnError ("Unhandled standard input call in headless HYPHY. Only redirected standard input (via ExecuteAFile) is allowed");
    return empty;
#else
  #ifdef __MAC__
      resolvedFilePath =  MacSimpleFileSave();
  #endif

  #ifdef __WINDOZE__

      resolvedFilePath = ReturnFileDialogSelectionWin(true);
  #endif

  #ifdef __HYPHY_GTK__
      if (PopUpFileDialog (dialogPrompt)) {
          resolvedFilePath = *argFileName;
      } 
  #endif
    #ifdef __HYPHYQT__  
        resolvedFilePath = _hyQTFileDialog (dialogPrompt,defFileNameValue, true);
    #endif
            
    #if defined __UNIX__ && ! defined __HYPHYQT__ && ! defined __HYPHY_GTK__
        resolvedFilePath = ReturnDialogInput(true);
    #endif
#endif
    
    if (resolvedFilePath.sLength == 0) {
        terminateExecution = true;
    }
    defFileNameValue = empty;
    return resolvedFilePath;

}
コード例 #13
0
ファイル: helloworld.c プロジェクト: javins/fpt
int main()
{
  outS("Hello World!\n");
}