Ejemplo n.º 1
0
int detect_sb()
{
        char *penv ;

        if ((penv = (char *)getenv("BLASTER"))) {
                if (!(scan_env(penv,'A',&audio.port,16)&&
                      scan_env(penv,'D',&audio.dma,10)&&
                      scan_env(penv,'I',&audio.irq,10)))

                        printf("BLASTER environment found, but it seems corrupted.\n") ;
                else
                {
                 printf("SoundBlaster found at Port 0x%3x with Dma channel %d and Irq %d.\n",
                        audio.port, audio.dma, audio.irq) ;

                if (!SbDetect()) {
                        printf("Failed to init DSP.\n") ;
                        return FALSE ;
                }
                else    return TRUE ;
                }
        }
        return FALSE ;
}
Ejemplo n.º 2
0
static void globals_init(char *program)
{
  char *p;
  int n;

#ifdef WIN32
  setvbuf(stdout,NULL,_IONBF,0);
#else
  signal(SIGPIPE,SIG_IGN);
#endif

  /* public globals */
  st_ops.output_directory = ".";
  st_ops.output_prefix = "";
  st_ops.output_postfix = "";
  st_ops.output_format = NULL;

  /* private globals */
  st_priv.progname = ((p = strrchr(program,PATHSEPCHAR))) ? (p + 1) : program;
  if ((p = extname(st_priv.progname)))
    *(p-1) = 0;
  strcpy(st_priv.fullprogname,st_priv.progname);
  st_priv.progmode = NULL;
  st_priv.clobber_action = CLOBBER_ACTION_ASK;
  st_priv.reorder_type = ORDER_NATURAL;
  st_priv.progress_type = PROGRESS_PERCENT;
  st_priv.is_aliased = FALSE;
  st_priv.show_hmmss = FALSE;
  st_priv.suppress_warnings = FALSE;
  st_priv.suppress_stderr = FALSE;
  st_priv.screen_dirty = FALSE;

  st_input.type = INPUT_CMDLINE;
  st_input.filename_source = NULLDEVICE;
  st_input.fd = NULL;
  st_input.argn = 0;
  st_input.argc = 0;
  st_input.argv = NULL;
  st_input.filecur = 0;
  st_input.filemax = 0;

  p = scan_env(SHNTOOL_DEBUG_ENV);
  n = p ? atoi(p) : 0;

  st_priv.debug_level = (n > 0) ? n : 0;
}
Ejemplo n.º 3
0
void parse_param_file( char *file ) {
   static char line1[ LINE_MAX ];
   static char line[ LINE_MAX ] ;
    FILE *fp;
    assert( file != NULL );
   fp = fopen( file, "rt" );
    if (fp) {
        while( fgets( line, LINE_MAX-1, fp ) ) {
            int len = strlen( line );
            if ( len > 0 && line[len-1] == '\n' )
                line[len-1] = '\0';
         scan_env(line1, line) ;
         parse_param_line( line1 );
        }
        fclose( fp );
    } else {
        perror( file );
    }
}
Ejemplo n.º 4
0
int parse_arbitrary(char *string)
/*
 * take a C string and and convert it to ARGC, ARGV format and then run
 * it through the argument parser
 */
{
    char *argv[40];
    char output[1024];
    int rv, i;
    int argc = 1;
    if (!string || ! *string)
        return 1;
    scan_env(output, string);
    string = output;
    while (1)
    {
        int quoted = ' ';
        while (*string == ' ')
            string++;
        if (! *string)
            break;
        if (*string == '\"')
            quoted =  *string++;
        argv[argc++] = string;
        while (*string &&  *string != quoted)
            string++;
        if (! *string)
            break;
        *string = 0;
        string++;
    }
    rv = parse_args(&argc, argv, TRUE);
    for (i = 1; i < argc; i++)
        InsertAnyFile(argv[i], 0,  - 1);
    return rv;
}
Ejemplo n.º 5
0
Archivo: glx.c Proyecto: ssvb/glshim
GLXContext glXCreateContext(Display *display,
                            XVisualInfo *visual,
                            GLXContext shareList,
                            Bool isDirect) {
    EGLint configAttribs[] = {
#ifdef PANDORA
        EGL_RED_SIZE, 5,
        EGL_GREEN_SIZE, 6,
        EGL_BLUE_SIZE, 5,
#endif
        EGL_DEPTH_SIZE, 16,
#ifdef USE_ES2
        EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
#else
        EGL_BUFFER_SIZE, 16,
        EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
        EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
#endif
        EGL_NONE
    };

#ifdef USE_ES2
    EGLint attrib_list[] = {
        EGL_CONTEXT_CLIENT_VERSION, 2,
        EGL_NONE
    };
#else
    EGLint *attrib_list = NULL;
#endif

    scan_env();

#ifdef BCMHOST
    if (! g_bcm_active) {
        g_bcm_active = true;
        bcm_host_init();
    }
#endif

    GLXContext fake = malloc(sizeof(struct __GLXContextRec));
    if (eglDisplay != NULL) {
        eglMakeCurrent(eglDisplay, NULL, NULL, EGL_NO_CONTEXT);
        if (eglContext != NULL) {
            eglDestroyContext(eglDisplay, eglContext);
            eglContext = NULL;
        }
        if (eglSurface != NULL) {
            eglDestroySurface(eglDisplay, eglSurface);
            eglSurface = NULL;
        }
    }

    // make an egl context here...
    EGLBoolean result;
    if (eglDisplay == NULL || eglDisplay == EGL_NO_DISPLAY) {
        if (xDisplay == NULL) {
            xDisplay = display;
        }
        if (g_usefb) {
            eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
        } else {
            eglDisplay = eglGetDisplay(xDisplay);
        }
        if (eglDisplay == EGL_NO_DISPLAY) {
            printf("Unable to create EGL display.\n");
            return fake;
        }
    }

    // first time?
    if (eglInitialized == false) {
        eglBindAPI(EGL_OPENGL_ES_API);
        result = eglInitialize(eglDisplay, NULL, NULL);
        if (result != EGL_TRUE) {
            printf("Unable to initialize EGL display.\n");
            return fake;
        }
        eglInitialized = true;
    }

    int configsFound;
    result = eglChooseConfig(eglDisplay, configAttribs, eglConfigs, 1, &configsFound);
    CheckEGLErrors();
    if (result != EGL_TRUE || configsFound == 0) {
        printf("No EGL configs found.\n");
        return fake;
    }
    eglContext = eglCreateContext(eglDisplay, eglConfigs[0], EGL_NO_CONTEXT, attrib_list);
    CheckEGLErrors();

    // need to return a glx context pointing at it
    fake->display = xDisplay;
    fake->direct = true;
    fake->xid = 1;
    return fake;
}