コード例 #1
0
ファイル: main.cpp プロジェクト: kamillys/IN_SDL_Demo
int main(int argc, char *argv[])
{
    SDLApplication sdlapp;
    //std::unique_ptr<INScene> app;
    std::unique_ptr<GLWindowBase> app;
    int exitCode = 0;
    try
    {
        app.reset(new INScene(&sdlapp, 1280, 720));
        //app.reset(new TestTextures(&sdlapp, 1280, 720));

        sdlapp.mainLoop();
    }
    catch (VTF::Exception& e)
    {
        DebugLogV(e.getMessage().c_str());
        exitCode = e.getExitCode();
    }
    catch (std::exception& e)
    {
        DebugLogV(e.what());
        exitCode = -1;
    }
    catch(const char* str)
    {
        DebugLogV(str);
        exitCode = -1;
    }
    catch(const wchar_t* str)
    {
        std::wstring ws( str );
        std::string s( ws.begin(), ws.end() );
        DebugLogV(s.c_str());
        exitCode = -1;
    }
    catch(...)
    {
        DebugLogV("Unknown error");
        exitCode = -1;
    }
    app.reset();
    return exitCode;
}
コード例 #2
0
ファイル: type.c プロジェクト: MichelValentin/PC-DCL
static int dcltype_do_it(char *path,DCL_FIND_DATA *ff,void *fn_param, char bdir)
{
    PARAM *type_param;
    FILE *fp;
    char buffer[MAX_TOKEN+2];
    char vms[MAX_TOKEN];
    char msg[MAX_TOKEN];
    int  line   = 0;
    int  row    = terminfo.Size.Y;
    int  column = terminfo.Size.X;
    int  records=0;
    int  hdrlen = 0;
    int  len    = 0;

    if (path == NULL) return(DCL_ERROR);
    if (ff == NULL) return(DCL_ERROR);
    if (fn_param == NULL) return(DCL_ERROR);

    DebugLogV(DEBUGLOG_LEVEL_DEBUG, "row=%d col=%d", row, column);

    if (bdir)
        goto exit_label;

    type_param = (PARAM *) fn_param;
    if (!type_param->all){
        if (ff->dwFileAttributes & _A_HIDDEN ||
            ff->dwFileAttributes & _A_SYSTEM)
            goto exit_label;
    }
    if ((unsigned long)ff->WriteTime < (unsigned long)type_param->since ||
        (unsigned long)ff->WriteTime > (unsigned long)type_param->before) {
        goto exit_label;
    }

    type_param->file_nb++;

    cvfs_dos_to_vms(path,vms);
    if (type_param->confirm) {
        sprintf(msg,"Type %s",vms);
        switch (dcl_confirm(msg)){
            case CONFIRM_YES    :   type_param->ok = 1;
                                    break;
            case CONFIRM_ALL    :   type_param->ok = 1;
                                    type_param->confirm = 0;
                                    break;
            case CONFIRM_QUIT   :   type_param->ok = 0;
                                    type_param->confirm = 0;
                                    break;
            default             :   type_param->ok = 0;
        }
    }
    if (!type_param->ok) {
        goto exit_label;
    }
    if (type_param->page) {
        (void) tio_clrscr();
    }
    if (type_param->wildcard) {
        (void) dcl_printf(type_param->output,"\n");
        if (HARDERR) return(-1);
        (void) dcl_printf(type_param->output,"%s",vms);
        if (HARDERR) return(-1);
        (void) dcl_printf(type_param->output,"\n");
        if (HARDERR) return(-1);
        (void) dcl_printf(type_param->output,"\n");
    }
    if ((fp = fopen(path,"rt"))==NULL) {
		(void) dcl_printf(dcl[D].SYS_OUTPUT,"%s: %s\n",vms,strerror(errno));
        _STATUS = errno;
        _SEVERITY = 2;
        goto exit_label;
    }
    else {
        while (fgets(buffer,MAX_TOKEN,fp) && !HARDERR) {
            records++;
            if (buffer[strlen(buffer)-1] != '\n')
                strcat(buffer,"\n");
            //strcat(buffer,"\r");
            if (type_param->page && line >= row - 2) {
                if (dcltype_ask_more(type_param->output) == 0)
                    goto exit_label;
               (void) tio_clrscr();
               line = 0;
            }
            if (type_param->numbers) {
                (void) dcl_printf(type_param->output,"%5.5d ",records);
                hdrlen = 6;
            }
    		DebugLogV(DEBUGLOG_LEVEL_DEBUG, "%s", buffer);
            (void) dcl_printf(type_param->output,"%s",buffer);
            if (HARDERR) {
                _SEVERITY = 2;
                break;
            }
            len = (int)strlen(buffer) + hdrlen;
            line += (len / column) + 1;
        }

        fclose(fp);

        if (type_param->page && type_param->wildcard) {
            (void) dcltype_ask_more(type_param->output);
        }
    }

exit_label:
    return(0);
}
コード例 #3
0
ファイル: termio_mini.c プロジェクト: MichelValentin/PC-DCL
void tio_gotoxy(int x, int y)
{
	DebugLogV(DEBUGLOG_LEVEL_DEBUG, "<tio_gotoxy> gotoxy(%d, %d)", x, y);
	char *cap = tigetstr("cup");
	putp(tparm(cap, y, x));
}