Ejemplo n.º 1
0
int QTshotWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMAINWINDOW::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: doHelp(); break;
        case 1: doQuit(); break;
        case 2: doOpen(); break;
        case 3: doNew(); break;
        case 4: doSave(); break;
        case 5: doData(); break;
        case 6: doExport(); break;
        case 7: doExportOK(); break;
        case 8: doOptions(); break;
        case 9: doToggle(); break;
        case 10: doCollapse(); break;
        case 11: doPlan(); break;
        case 12: doExtended(); break;
        case 13: do3D(); break;
        case 14: doCrossSection((*reinterpret_cast< DBlock*(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2])),(*reinterpret_cast< bool(*)>(_a[3]))); break;
        case 15: doCrossSection((*reinterpret_cast< DBlock*(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
        case 16: value_changed((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 17: double_clicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< const QPoint(*)>(_a[4]))); break;
        }
        _id -= 18;
    }
    return _id;
}
Ejemplo n.º 2
0
STATIC void parseString( const char *str ) {

/**/myassert( str != NULL );
    for(;;) {
        while( isspace( *str ) ) ++str;
        switch( *str ) {
        case 0:
            return;
        case SWCHAR:
        case '-':
            str += 2;
            switch( str[-1] ) {
            case 'o':   str = doOutput( str );      break;
            case 'd':   str = doDebug( str );       break;
            case 'p':   str = doParse( str );       break;
            case 'f':   str = doFile( str );        break;
            case 'q':   /* FALL THROUGH */
#if 0
            case 'l':
#endif
            case 'b':   str = doToggle( str );      break;
            default:    usage();
            }
            if( !isBreakChar( *str ) ) usage();
            break;
        case INCCHAR:
            str = doInclude( str + 1 );
            break;
        case CMTCHAR:
            str = doComment( str + 1 );
            break;
        default:
            str = addFile( str );
            break;
        }
    }

}
Ejemplo n.º 3
0
int main (int argc, char *argv [])
{
    int i ;
    int model, rev, mem, maker, overVolted ;

    if (getenv ("WIRINGPI_DEBUG") != NULL)
    {
        printf ("gpio: wiringPi debug mode enabled\n") ;
        wiringPiDebug = TRUE ;
    }

    if (argc == 1)
    {
        fprintf (stderr, "%s\n", usage) ;
        return 1 ;
    }

    // Help

    if (strcasecmp (argv [1], "-h") == 0)
    {
        printf ("%s: %s\n", argv [0], usage) ;
        return 0 ;
    }

    // Sort of a special:

    if (strcmp (argv [1], "-R") == 0)
    {
        printf ("%d\n", piBoardRev ()) ;
        return 0 ;
    }

    // Version & Warranty

    if (strcmp (argv [1], "-V") == 0)
    {
        printf ("%d\n", piBoardRev ()) ;
        return 0 ;
    }

    if (strcmp (argv [1], "-v") == 0)
    {
        printf ("gpio version: %s\n", VERSION) ;
        printf ("Copyright (c) 2012-2014 Gordon Henderson\n") ;
        printf ("This is free software with ABSOLUTELY NO WARRANTY.\n") ;
        printf ("For details type: %s -warranty\n", argv [0]) ;
        printf ("\n") ;
        piBoardId (&model, &rev, &mem, &maker, &overVolted) ;
        if (model == PI_MODEL_UNKNOWN)
        {
            printf ("Your Raspberry Pi has an unknown model type. Please report this to\n") ;
            printf ("    [email protected]\n") ;
            printf ("with a copy of your /proc/cpuinfo if possible\n") ;
        }
        else
        {
            printf ("Banana Pro Details:\n") ;
            printf ("  Type: %s, Revision: %s, Memory: %dMB, Maker: %s %s\n",
                    piModelNames [model], piRevisionNames [rev], mem, piMakerNames [maker], overVolted ? "[OV]" : "") ;
        }
        return 0 ;
    }

    if (strcasecmp (argv [1], "-warranty") == 0)
    {
        printf ("gpio version: %s\n", VERSION) ;
        printf ("Copyright (c) 2012-2014 Gordon Henderson\n") ;
        printf ("\n") ;
        printf ("    This program is free software; you can redistribute it and/or modify\n") ;
        printf ("    it under the terms of the GNU Leser General Public License as published\n") ;
        printf ("    by the Free Software Foundation, either version 3 of the License, or\n") ;
        printf ("    (at your option) any later version.\n") ;
        printf ("\n") ;
        printf ("    This program is distributed in the hope that it will be useful,\n") ;
        printf ("    but WITHOUT ANY WARRANTY; without even the implied warranty of\n") ;
        printf ("    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n") ;
        printf ("    GNU Lesser General Public License for more details.\n") ;
        printf ("\n") ;
        printf ("    You should have received a copy of the GNU Lesser General Public License\n") ;
        printf ("    along with this program. If not, see <http://www.gnu.org/licenses/>.\n") ;
        printf ("\n") ;
        return 0 ;
    }

    if (geteuid () != 0)
    {
        fprintf (stderr, "%s: Must be root to run. Program should be suid root. This is an error.\n", argv [0]) ;
        return 1 ;
    }

    // Initial test for /sys/class/gpio operations:

    /**/ if (strcasecmp (argv [1], "exports"    ) == 0)
    {
        doExports     (argc, argv) ;
        return 0 ;
    }
    else if (strcasecmp (argv [1], "export"     ) == 0)
    {
        doExport      (argc, argv) ;
        return 0 ;
    }
    else if (strcasecmp (argv [1], "edge"       ) == 0)
    {
        doEdge        (argc, argv) ;
        return 0 ;
    }
    else if (strcasecmp (argv [1], "unexport"   ) == 0)
    {
        doUnexport    (argc, argv) ;
        return 0 ;
    }
    else if (strcasecmp (argv [1], "unexportall") == 0)
    {
        doUnexportall (argv [0]) ;
        return 0 ;
    }

    // Check for load command:

    if (strcasecmp (argv [1], "load" ) == 0)
    {
        doLoad     (argc, argv) ;
        return 0 ;
    }


    // Check for -g argument

    if (strcasecmp (argv [1], "-g") == 0)
    {
        wiringPiSetupGpio () ;

        for (i = 2 ; i < argc ; ++i)
            argv [i - 1] = argv [i] ;
        --argc ;
        wpMode = WPI_MODE_GPIO ;
    }

    // Check for -1 argument

    else if (strcasecmp (argv [1], "-1") == 0)
    {
        wiringPiSetupPhys () ;

        for (i = 2 ; i < argc ; ++i)
            argv [i - 1] = argv [i] ;
        --argc ;
        wpMode = WPI_MODE_PHYS ;
    }

    // Default to wiringPi mode

    else
    {
        wiringPiSetup () ;
        wpMode = WPI_MODE_PINS ;
    }

    // Check for -x argument to load in a new extension

    if (strcasecmp (argv [1], "-x") == 0)
    {
        if (argc < 3)
        {
            fprintf (stderr, "%s: -x missing extension specification.\n", argv [0]) ;
            exit (EXIT_FAILURE) ;
        }

        if (!doExtension (argv [0], argv [2]))	// Prints its own error messages
            exit (EXIT_FAILURE) ;

        for (i = 3 ; i < argc ; ++i)
            argv [i - 2] = argv [i] ;
        argc -= 2 ;
    }

    if (argc <= 1)
    {
        fprintf (stderr, "%s: no command given\n", argv [0]) ;
        exit (EXIT_FAILURE) ;
    }

    // Core wiringPi functions

    /**/ if (strcasecmp (argv [1], "mode"   ) == 0) doMode      (argc, argv) ;
    else if (strcasecmp (argv [1], "read"   ) == 0) doRead      (argc, argv) ;
    else if (strcasecmp (argv [1], "write"  ) == 0) doWrite     (argc, argv) ;
    else if (strcasecmp (argv [1], "pwm"    ) == 0) doPwm       (argc, argv) ;
    else if (strcasecmp (argv [1], "awrite" ) == 0) doAwrite    (argc, argv) ;
    else if (strcasecmp (argv [1], "aread"  ) == 0) doAread     (argc, argv) ;

    // GPIO Nicies

    else if (strcasecmp (argv [1], "toggle" ) == 0) doToggle    (argc, argv) ;

    // Pi Specifics

    else if (strcasecmp (argv [1], "pwm-bal"  ) == 0) doPwmMode    (PWM_MODE_BAL) ;
    else if (strcasecmp (argv [1], "pwm-ms"   ) == 0) doPwmMode    (PWM_MODE_MS) ;
    else if (strcasecmp (argv [1], "pwmr"     ) == 0) doPwmRange   (argc, argv) ;
    else if (strcasecmp (argv [1], "pwmc"     ) == 0) doPwmClock   (argc, argv) ;
    else if (strcasecmp (argv [1], "pwmTone"  ) == 0) doPwmTone    (argc, argv) ;
    else if (strcasecmp (argv [1], "usbp"     ) == 0) doUsbP       (argc, argv) ;
    else if (strcasecmp (argv [1], "readall"  ) == 0) doReadall    () ;
    else if (strcasecmp (argv [1], "nreadall" ) == 0) doReadall    () ;
    else if (strcasecmp (argv [1], "pins"     ) == 0) doPins       () ;
    else if (strcasecmp (argv [1], "i2cdetect") == 0) doI2Cdetect  (argc, argv) ;
    else if (strcasecmp (argv [1], "i2cd"     ) == 0) doI2Cdetect  (argc, argv) ;
    else if (strcasecmp (argv [1], "reset"    ) == 0) doReset      (argv [0]) ;
    else if (strcasecmp (argv [1], "wb"       ) == 0) doWriteByte  (argc, argv) ;
    else
    {
        fprintf (stderr, "%s: Unknown command: %s.\n", argv [0], argv [1]) ;
        exit (EXIT_FAILURE) ;
    }
    return 0 ;
}
Ejemplo n.º 4
0
int main (int argc, char *argv [])
{
  int i ;

  if (getenv ("WIRINGPI_DEBUG") != NULL)
  {
    printf ("gpio: wiringPi debug mode enabled\n") ;
    wiringPiDebug = TRUE ;
  }

  if (argc == 1)
  {
    fprintf (stderr, "%s\n", usage) ;
    return 1 ;
  }

// Help

  if (strcasecmp (argv [1], "-h") == 0)
  {
    printf ("%s: %s\n", argv [0], usage) ;
    return 0 ;
  }

// Sort of a special:

  if (strcmp (argv [1], "-R") == 0)
  {
    printf ("%d\n", piBoardRev ()) ;
    return 0 ;
  }

// Version & Warranty

  if (strcmp (argv [1], "-V") == 0)
  {
    printf ("%d\n", piBoardRev ()) ;
    return 0 ;
  }

  if (strcmp (argv [1], "-v") == 0)
  {
    printf ("gpio version: %s\n", VERSION) ;
    printf ("Copyright (c) 2012-2013 Gordon Henderson\n") ;
    printf ("This is free software with ABSOLUTELY NO WARRANTY.\n") ;
    printf ("For details type: %s -warranty\n", argv [0]) ;
    printf ("\n") ;
    printf ("This Raspberry Pi is a revision %d board.\n", piBoardRev ()) ;
    return 0 ;
  }

  if (strcasecmp (argv [1], "-warranty") == 0)
  {
    printf ("gpio version: %s\n", VERSION) ;
    printf ("Copyright (c) 2012-2013 Gordon Henderson\n") ;
    printf ("\n") ;
    printf ("    This program is free software; you can redistribute it and/or modify\n") ;
    printf ("    it under the terms of the GNU Leser General Public License as published\n") ;
    printf ("    by the Free Software Foundation, either version 3 of the License, or\n") ;
    printf ("    (at your option) any later version.\n") ;
    printf ("\n") ;
    printf ("    This program is distributed in the hope that it will be useful,\n") ;
    printf ("    but WITHOUT ANY WARRANTY; without even the implied warranty of\n") ;
    printf ("    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n") ;
    printf ("    GNU Lesser General Public License for more details.\n") ;
    printf ("\n") ;
    printf ("    You should have received a copy of the GNU Lesser General Public License\n") ;
    printf ("    along with this program. If not, see <http://www.gnu.org/licenses/>.\n") ;
    printf ("\n") ;
    return 0 ;
  }

  if (geteuid () != 0)
  {
    fprintf (stderr, "%s: Must be root to run. Program should be suid root. This is an error.\n", argv [0]) ;
    return 1 ;
  }

// Initial test for /sys/class/gpio operations:

  /**/ if (strcasecmp (argv [1], "exports"    ) == 0)	{ doExports     (argc, argv) ;	return 0 ; }
  else if (strcasecmp (argv [1], "export"     ) == 0)	{ doExport      (argc, argv) ;	return 0 ; }
  else if (strcasecmp (argv [1], "edge"       ) == 0)	{ doEdge        (argc, argv) ;	return 0 ; }
  else if (strcasecmp (argv [1], "unexport"   ) == 0)	{ doUnexport    (argc, argv) ;	return 0 ; }
  else if (strcasecmp (argv [1], "unexportall") == 0)	{ doUnexportall (argv [0]) ;	return 0 ; }

// Check for load command:

  if (strcasecmp (argv [1], "load" ) == 0)	{ doLoad     (argc, argv) ; return 0 ; }

// Gertboard commands

  if (strcasecmp (argv [1], "gbr" ) == 0)	{ doGbr (argc, argv) ; return 0 ; }
  if (strcasecmp (argv [1], "gbw" ) == 0)	{ doGbw (argc, argv) ; return 0 ; }

// Check for -g argument

  /**/ if (strcasecmp (argv [1], "-g") == 0)
  {
    wiringPiSetupGpio () ;

    for (i = 2 ; i < argc ; ++i)
      argv [i - 1] = argv [i] ;
    --argc ;
    wpMode = WPI_MODE_GPIO ;
  }

// Check for -1 argument

  else if (strcasecmp (argv [1], "-1") == 0)
  {
    wiringPiSetupPhys () ;

    for (i = 2 ; i < argc ; ++i)
      argv [i - 1] = argv [i] ;
    --argc ;
    wpMode = WPI_MODE_PHYS ;
  }

// Check for -p argument for PiFace

  else if (strcasecmp (argv [1], "-p") == 0)
  {
    piFaceSetup (200) ;

    for (i = 2 ; i < argc ; ++i)
      argv [i - 1] = argv [i] ;
    --argc ;
    wpMode = WPI_MODE_PIFACE ;
  }

// Default to wiringPi mode

  else
  {
    wiringPiSetup () ;
    wpMode = WPI_MODE_PINS ;
  }

// Check for -x argument to load in a new extension

  if (strcasecmp (argv [1], "-x") == 0)
  {
    if (argc < 3)
    {
      fprintf (stderr, "%s: -x missing extension specification.\n", argv [0]) ;
      exit (EXIT_FAILURE) ;
    }

    if (!doExtension (argv [0], argv [2]))	// Prints its own error messages
      exit (EXIT_FAILURE) ;

    for (i = 3 ; i < argc ; ++i)
      argv [i - 2] = argv [i] ;
    argc -= 2 ;
  }

  if (argc <= 1)
  {
    fprintf (stderr, "%s: no command given\n", argv [0]) ;
    exit (EXIT_FAILURE) ;
  }

// Core wiringPi functions

  /**/ if (strcasecmp (argv [1], "mode"   ) == 0) doMode      (argc, argv) ;
  else if (strcasecmp (argv [1], "read"   ) == 0) doRead      (argc, argv) ;
  else if (strcasecmp (argv [1], "write"  ) == 0) doWrite     (argc, argv) ;
  else if (strcasecmp (argv [1], "pwm"    ) == 0) doPwm       (argc, argv) ;
  else if (strcasecmp (argv [1], "awrite" ) == 0) doAwrite    (argc, argv) ;
  else if (strcasecmp (argv [1], "aread"  ) == 0) doAread     (argc, argv) ;

// GPIO Nicies

  else if (strcasecmp (argv [1], "toggle" ) == 0) doToggle    (argc, argv) ;

// Pi Specifics

  else if (strcasecmp (argv [1], "pwm-bal"  ) == 0) doPwmMode   (PWM_MODE_BAL) ;
  else if (strcasecmp (argv [1], "pwm-ms"   ) == 0) doPwmMode   (PWM_MODE_MS) ;
  else if (strcasecmp (argv [1], "pwmr"     ) == 0) doPwmRange  (argc, argv) ;
  else if (strcasecmp (argv [1], "pwmc"     ) == 0) doPwmClock  (argc, argv) ;
  else if (strcasecmp (argv [1], "drive"    ) == 0) doPadDrive  (argc, argv) ;
  else if (strcasecmp (argv [1], "readall"  ) == 0) doReadall   () ;
  else if (strcasecmp (argv [1], "i2cdetect") == 0) doI2Cdetect (argc, argv) ;
  else if (strcasecmp (argv [1], "i2cd"     ) == 0) doI2Cdetect (argc, argv) ;
  else if (strcasecmp (argv [1], "reset"    ) == 0) doReset     (argv [0]) ;
  else if (strcasecmp (argv [1], "wb"       ) == 0) doWriteByte (argc, argv) ;
  else if (strcasecmp (argv [1], "clock"    ) == 0) doClock     (argc, argv) ;
  else if (strcasecmp (argv [1], "wfi"      ) == 0) doWfi       (argc, argv) ;
  else
  {
    fprintf (stderr, "%s: Unknown command: %s.\n", argv [0], argv [1]) ;
    exit (EXIT_FAILURE) ;
  }
  return 0 ;
}