void qPBReaderDictionaryDialog::DisplayDefinition(qPBReaderDocView * ipView,
      const QRect & iRect,
      const QString & isWord)
{
   TRSCOPE(dic, "qPBReaderDictionaryDialog::DisplayDefinition");

   ShowState(TRACE);

#ifdef Q_OS_POCKETBOOK
   TRACE << "thread id=" << (int)syscall(SYS_gettid) << endl;

#endif

   if (!_bOpened)
   {
      SetWord(iRect, isWord);
      _pView = ipView;
      ReplaceIVProcBeforeDic();
#ifdef Q_OS_POCKETBOOK
      OpenDictionaryView(pWord, 0);
#endif
   }

   else
   {
      TRACE << "Called while dictionary already opened" << endl;
   }
}
Пример #2
0
bool CMainDlg::InitModule(void)
{
	g_hMain = m_hWnd;

	ShowState("Current Version: 08.01.10.001");

	InitP2PSocket();

	if ( !m_app.Connect() )
	{
		ShowState("m_app connect failed");
		return false;
	}

	return true;
}
Пример #3
0
void Book::Error( const char *msg )
{
	cprintf( "Book::Error(%s)\n", msg );
    #ifdef _DEBUG
    int i;
    char c;
    fprintf( debug_log_file(), "Error: %s\n", msg );
    if( *desc )
        fprintf( debug_log_file(), "%s\n", desc );
    else
        fprintf( debug_log_file(), "%s-%s %s %s %s\n", white, black, date, site, event );
    for( i=0; i<sizeof(error_buf); i++ )
    {
        c = error_buf[error_ptr++];
        error_ptr &= (sizeof(error_buf)-1);
        if( c )
            fprintf( debug_log_file(), "%c", c );
    }
    fprintf( debug_log_file(), "\n" );
    for( i=0; i<nbrof(debug_buf); i++ )
    {
        c = debug_buf[debug_ptr].c;
        STATE state  = debug_buf[debug_ptr].state;
        debug_ptr++;
        debug_ptr &= (nbrof(debug_buf)-1);
        if( c )
            fprintf( debug_log_file(), "[%s]%c", ShowState(state), c );
    }
    #endif
}
Пример #4
0
void VerifyReportPromise(struct Promise *pp)

{ struct Attributes a = {{0}};
  struct CfLock thislock;
  struct Rlist *rp;
  char unique_name[CF_EXPANDSIZE];

a = GetReportsAttributes(pp);

if (strcmp(pp->classes,"any") == 0)
   {
   CfOut(cf_verbose,""," --> Reports promises may not be in class \"any\"");
   return;
   }

snprintf(unique_name,CF_EXPANDSIZE-1,"%s_%d",pp->promiser,pp->lineno);
thislock = AcquireLock(unique_name,VUQNAME,CFSTARTTIME,a,pp,false);

if (thislock.lock == NULL)
   {
   return;
   }

PromiseBanner(pp);

cfPS(cf_verbose,CF_CHG,"",pp,a,"Report: %s", pp->promiser);

if (a.report.to_file)
   {
   CfFOut(a.report.to_file,cf_error,"","%s",pp->promiser);
   }
else
   {
   CfOut(cf_reporting,"","R: %s",pp->promiser);
   }

if (a.report.haveprintfile)
   {
   PrintFile(a,pp);
   }

if (a.report.showstate)
   {
   for (rp = a.report.showstate; rp != NULL; rp=rp->next)
      {
      ShowState(rp->item,a,pp);
      }
   }

if (a.report.havelastseen)
   {
   FriendStatus(a,pp);
   }
    
YieldCurrentLock(thislock);
}
Пример #5
0
void Book::debug_dump()
{
    int i;
    for( i=0; i<nbrof(debug_buf); i++ )
    {
        char       c = debug_buf[debug_ptr].c;
        STATE state  = debug_buf[debug_ptr].state;
        debug_ptr++;
        debug_ptr &= (nbrof(debug_buf)-1);
        if( c )
            fprintf( debug_log_file(), "[%s]%c", ShowState(state), c );
    }    
}
Пример #6
0
void VerifyReportPromise(Promise *pp)
{
    Attributes a = { {0} };
    CfLock thislock;
    Rlist *rp;
    char unique_name[CF_EXPANDSIZE];

    a = GetReportsAttributes(pp);

    snprintf(unique_name, CF_EXPANDSIZE - 1, "%s_%zu", pp->promiser, pp->offset.line);
    thislock = AcquireLock(unique_name, VUQNAME, CFSTARTTIME, a, pp, false);

    if (thislock.lock == NULL)
    {
        return;
    }

    PromiseBanner(pp);

    cfPS(cf_verbose, CF_CHG, "", pp, a, "Report: %s", pp->promiser);

    if (a.report.to_file)
    {
        CfFOut(a.report.to_file, cf_error, "", "%s", pp->promiser);
    }
    else
    {
        CfOut(cf_reporting, "", "R: %s", pp->promiser);
    }

    if (a.report.haveprintfile)
    {
        PrintFile(a, pp);
    }

    if (a.report.showstate)
    {
        for (rp = a.report.showstate; rp != NULL; rp = rp->next)
        {
            ShowState(rp->item);
        }
    }

    if (a.report.havelastseen)
    {
        /* Do nothing. Deprecated. */
    }

    YieldCurrentLock(thislock);
}
Пример #7
0
/**
 * This function will print out all data specific to the parserState provided
 * @param _vecToPrint  vector all all elements
 * @param _lineState   ParserState of line from XML File
 * @param _lineNum     current line's number
 * @param _strLine     current line
 * @param _lastElement The tag name of the last opening tag
 */
void printXMLData( vector<Element*>& _vecToPrint, ParserState& _lineState, 
        int _lineNum, string& _strLine, string _lastElement )
{
  //if ( == ELEMENT_OPENING_TAG)
  if (1 == 1)
  {
    // Remove whitespace from the line
    removeWhiteSpace(_strLine);

    // Print line number and content
    cout << _lineNum << ". " << _strLine << endl;
    cout << "---------------------------------------------------------------------" << endl;

    // Print line parser state
    ShowState(_lineState);

    // Handle parser state specific actions
    if (_lineState == ELEMENT_OPENING_TAG)
    {    
      cout << "-- Adding '" << _lastElement << "' to Vector (Stack)" << endl;
      printVector(_vecToPrint);
    }
    else if (_lineState == ELEMENT_CLOSING_TAG)
    {
      cout << "-- Removing '" << _lastElement << "' from Vector (Stack)" << endl;
      printVector(_vecToPrint);
    }
    else if (_lineState == ELEMENT_NAME_AND_CONTENT || _lineState == SELF_CLOSING_TAG)
    {
      if (_lineState == ELEMENT_NAME_AND_CONTENT)
      {
        cout << "--   TAG NAME: '" << _lastElement << "'" << endl;
        cout << "--   TAG CONTENT: '" << getTagContent(_strLine) << "'" << endl;
      }

      cout << "-- Vector (Stack) unchanged" << endl;
    }
  }
}
void qPBReaderDictionaryDialog::UpdateDefinition(const QRect & iRect,
      const QString & isWord)
{
   TRSCOPE(dic, "qPBReaderDictionaryDialog::UpdateDefinition");

   ShowState(TRACE);

#ifdef Q_OS_POCKETBOOK
   TRACE << "thread id=" << (int)syscall(SYS_gettid) << endl;

#endif

   if (_bOpened)
   {
#ifdef Q_OS_POCKETBOOK
      SetWord(iRect, isWord);

      // dirty trick to force dictionary dialog update

      _bReenter = true;
      int x = (iRect.right() - iRect.left()) / 2 + iRect.left();
      int y = (iRect.bottom() - iRect.top()) / 2 + iRect.top();
      _pDicInternalProc(30, x, y);
      _pDicInternalProc(29, x, y);
      _bReenter = false;
#else
      Q_UNUSED(iRect);
      Q_UNUSED(isWord);
#endif
   }

   else
   {
      TRACE << "Called while dictionary not opened yet" << endl;
   }
}
Пример #9
0
void VerifyReportPromise(Promise *pp)
{
    Attributes a = { {0} };
    CfLock thislock;
    Rlist *rp;
    char unique_name[CF_EXPANDSIZE];

    a = GetReportsAttributes(pp);

    snprintf(unique_name, CF_EXPANDSIZE - 1, "%s_%zu", pp->promiser, pp->offset.line);
    thislock = AcquireLock(unique_name, VUQNAME, CFSTARTTIME, a, pp, false);

    // Handle return values before locks, as we always do this

    if (a.report.result)
    {
        // User-unwritable value last-result contains the useresult
        if (strlen(a.report.result) > 0)
        {
            snprintf(unique_name, CF_BUFSIZE, "last-result[%s]", a.report.result);
        }
        else
        {
            snprintf(unique_name, CF_BUFSIZE, "last-result");
        }

        NewScalar(pp->bundle, unique_name, pp->promiser, cf_str);
        return;
    }
       
    // Now do regular human reports
    
    if (thislock.lock == NULL)
    {
        return;
    }

    PromiseBanner(pp);

    cfPS(cf_verbose, CF_CHG, "", pp, a, "Report: %s", pp->promiser);

    if (a.report.to_file)
    {
        CfFOut(a.report.to_file, cf_error, "", "%s", pp->promiser);
    }
    else
    {
        CfOut(cf_reporting, "", "R: %s", pp->promiser);
    }

    if (a.report.haveprintfile)
    {
        PrintFile(a, pp);
    }

    if (a.report.showstate)
    {
        for (rp = a.report.showstate; rp != NULL; rp = rp->next)
        {
            ShowState(rp->item);
        }
    }

    if (a.report.havelastseen)
    {
        /* Do nothing. Deprecated. */
    }

    YieldCurrentLock(thislock);
}
Пример #10
0
int main (void)
#endif
{
    struct mouse_info info;
    struct mouse_box full_box, small_box;
    unsigned char width, height;
    char C;
    bool Invisible = true, Done = false, Jailed = false;

#ifdef __ATARIXL__
    cprintf ("adding heap: $%04X bytes at $%04X\r\n",
             &_HIDDEN_RAM_SIZE__ - (&_HIDDEN_RAM_LAST__ - &_HIDDEN_RAM_START__),
             &_HIDDEN_RAM_LAST__);

    _heapadd (&_HIDDEN_RAM_LAST__, (size_t)(&_HIDDEN_RAM_SIZE__ - (&_HIDDEN_RAM_LAST__ - &_HIDDEN_RAM_START__)));
    cgetc ();
#endif

#ifndef NO_DEBUG
    /* Initialize the debugger */
    DbgInit (0);
#endif

    /* Set dark-on-light colors.  Clear the screen. */
#ifdef __CBM__
    (void) bordercolor (COLOR_GRAY2);
    (void) bgcolor (COLOR_WHITE);
    (void) textcolor (COLOR_GRAY1);
#else
    (void) bordercolor (COLOR_BLUE);
    (void) bgcolor (COLOR_WHITE);
    (void) textcolor (COLOR_BLACK);
#endif
    cursor (0);
    clrscr ();

    /* If a lightpen driver is installed, then it can get a calibration value
    ** from this file (if it exists).  Or, the user can adjust the pen; and,
    ** the value will be put into this file, for the next time.
    ** (Other drivers will ignore this.)
    */
#if defined(__C64__) || defined(__C128__) || defined(__CBM510__)
    pen_adjust ("pen.dat");
#endif

#if DYN_DRV
    /* If a dynamically loadable driver is named on the command line,
    ** then use that driver instead of the standard one.
    */
    if (argc > 1) {
        mouse_name = argv[1];
    } else {
#if defined(__ATARI__) || defined(__C64__) || defined(__C128__)
        char selection, flag = 0;
        cprintf ("Select mouse driver:\r\n"
                 "  0 - Joystick\r\n"
#ifdef __ATARI__
                 "  1 - ST Mouse\r\n"
                 "  2 - Amiga Mouse\r\n"
                 "  3 - Atari Trakball\r\n"
                 "  4 - Atari TouchPad\r\n"
#else
                 "  1 - 1351 Mouse\r\n"
                 "  2 - Inkwell Mouse\r\n"
                 "  3 - Paddle\r\n"
#endif
                 "Enter selection: ");
        while (1) {
            switch (selection = cgetc ()) {
            case '0': mouse_name = MSENAME_0; flag = 1; break;
            case '1': mouse_name = MSENAME_1; flag = 1; break;
            case '2': mouse_name = MSENAME_2; flag = 1; break;
            case '3': mouse_name = MSENAME_3; flag = 1; break;
#ifdef __ATARI__
            case '4': mouse_name = MSENAME_4; flag = 1; break;
#endif
            }
            if (flag) break;
        }
        cprintf ("%c\r\nOK, loading \"%s\",\r\nplease wait patiently...\r\n", selection, mouse_name);
#else
        /* Output a warning about the standard driver that is needed. */
        DoWarning ();
        mouse_name = mouse_stddrv;
#endif
    }

    /* Load and install the driver. */
    CheckError ("mouse_load_driver",
                mouse_load_driver (&MOUSE_CALLBACK, mouse_name));
#else  /* not DYN_DRV */
#if !defined(MOUSE_DRIVER) && (defined(__ATARI__) || defined(__C64__) || defined(__C128__))
    {
        char selection, flag = 0;
        cprintf ("Select mouse driver:\r\n"
                 "  0 - Joystick\r\n"
#ifdef __ATARI__
                 "  1 - ST Mouse\r\n"
                 "  2 - Amiga Mouse\r\n"
                 "  3 - Atari Trakball\r\n"
                 "  4 - Atari TouchPad\r\n"
#else
                 "  1 - 1351 Mouse\r\n"
                 "  2 - Inkwell Mouse\r\n"
                 "  3 - Paddle\r\n"
#endif
                 "Enter selection: ");
        while (1) {
            switch (selection = cgetc ()) {
            case '0': mouse_drv_use = MSESTAT_0; flag = 1; break;
            case '1': mouse_drv_use = MSESTAT_1; flag = 1; break;
            case '2': mouse_drv_use = MSESTAT_2; flag = 1; break;
            case '3': mouse_drv_use = MSESTAT_3; flag = 1; break;
#ifdef __ATARI__
            case '4': mouse_drv_use = MSESTAT_4; flag = 1; break;
#endif
            }
            if (flag) break;
        }
    }
#else
    mouse_drv_use = mouse_static_stddrv;
#endif

    /* Install the driver. */
    CheckError ("mouse_install",
                mouse_install (&MOUSE_CALLBACK,
#  ifdef MOUSE_DRIVER
                               MOUSE_DRIVER
#  else
#if defined(__ATARI__) || defined(__C64__) || defined(__C128__)
                               mouse_drv_use
#else
                               mouse_static_stddrv
#endif
#  endif
                               ));
#endif

#ifndef NO_JAIL
    /* Get the initial bounding box. */
    mouse_getbox (&full_box);
#endif

    screensize (&width, &height);

top:
    clrscr ();

    /* Print a help line */
    cputs (" d)ebug  h)ide   q)uit   s)how   j)ail");

    gotoxy (1, 20);
    cprintf ("SP: $%04X", getsp());

    /* Put a cross at the center of the screen. */
    gotoxy (width / 2 - 3, height / 2 - 1);
#if defined(__CBM__)
    cprintf ("%3u,%3u\r\n%*s\xDB", width / 2 * 8 + 4, height / 2 * 8 + 4,
             width / 2, "");
#else
    cprintf ("%3u,%3u\r\n%*s+", width / 2 * 8 + 4, height / 2 * 8 + 4,
             width / 2, "");
#endif

    /* Test loop */
    ShowState (Jailed, Invisible);
    do {
        /* Get the current co-ordinates and button states; and, print them. */
        mouse_info (&info);
        gotoxy (0, 2);
        cprintf (" X  = %3d\r\n", info.pos.x);
        cprintf (" Y  = %3d\r\n", info.pos.y);
        cprintf (" B1 = %c\r\n", (info.buttons & MOUSE_BTN_LEFT) ?
#ifdef __CBM__
                 0x5F
#else
                 'v'
#endif
                 : '^');
        cprintf (" B2 = %c", (info.buttons & MOUSE_BTN_RIGHT) ?
#ifdef __CBM__
                 0x5F
#else
                 'v'
#endif
                 : '^');

        /* Handle user input */
        if (kbhit ()) {
            cclearxy (1, 9, 23);
            switch (tolower (C = cgetc ())) {
#ifndef NO_DEBUG
                case 'd':
                    BREAK();

                    /* The debugger might have changed the colors.
                    ** Restore them.
                    */
#ifdef __CBM__
                    (void) bordercolor (COLOR_GRAY2);
                    (void) bgcolor (COLOR_WHITE);
                    (void) textcolor (COLOR_GRAY1);
#else
                    (void) bordercolor (COLOR_BLUE);
                    (void) bgcolor (COLOR_WHITE);
                    (void) textcolor (COLOR_BLACK);
#endif

                    /* The debugger changed the screen; restore it. */
                    goto top;
#endif
                case 'h':
                    mouse_hide ();
                    ShowState (Jailed, ++Invisible);
                    break;

#ifndef NO_JAIL
                case 'j':
                    if (Jailed) {
                        mouse_setbox (&full_box);
                        Jailed = false;
                    } else {
                        small_box.minx = max (info.pos.x - 10, full_box.minx);
                        small_box.miny = max (info.pos.y - 10, full_box.miny);
                        small_box.maxx = min (info.pos.x + 10, full_box.maxx);
                        small_box.maxy = min (info.pos.y + 10, full_box.maxy);
                        mouse_setbox (&small_box);
                        Jailed = true;
                    }
                    ShowState (Jailed, Invisible);
                    break;
#endif
                case 's':
                    mouse_show ();
                    if (Invisible) {
                        ShowState (Jailed, --Invisible);
                    }
                    break;

                case 'q':
                    Done = true;
                    break;

                default:
                    gotoxy (1, 9);
                    cprintf ("Spurious character: $%02X", C);
            }
        }
    } while (!Done);

#if DYN_DRV
    /* Uninstall and unload the driver. */
    CheckError ("mouse_unload", mouse_unload ());
#else
    /* Uninstall the static driver. */
    CheckError ("mouse_uninstall", mouse_uninstall ());
#endif

    /* Say goodbye */
    cputsxy (0, height / 2 + 3, "Goodbye!");
    return EXIT_SUCCESS;
}
Пример #11
0
int main (void)
#endif
{
    struct mouse_info info;
    struct mouse_box full_box, small_box;
    unsigned char width, height;
    char C;
    bool Invisible = true, Done = false, Jailed = false;

    /* Initialize the debugger */
    DbgInit (0);

    /* Set dark-on-light colors.  Clear the screen. */
#ifdef __CBM__
    (void) bordercolor (COLOR_GRAY2);
    (void) bgcolor (COLOR_WHITE);
    (void) textcolor (COLOR_GRAY1);
#else
    (void) bordercolor (COLOR_BLUE);
    (void) bgcolor (COLOR_WHITE);
    (void) textcolor (COLOR_BLACK);
#endif
    cursor (0);
    clrscr ();

    /* If a lightpen driver is installed, then it can get a calibration value
    ** from this file (if it exists).  Or, the user can adjust the pen; and,
    ** the value will be put into this file, for the next time.
    ** (Other drivers will ignore this.)
    */
#if defined(__C64__) || defined(__C128__) || defined(__CBM510__)
    pen_adjust ("pen.dat");
#endif

#if DYN_DRV
    /* If a dynamically loadable driver is named on the command line,
    ** then use that driver instead of the standard one.
    */
    if (argc > 1) {
        mouse_name = argv[1];
    } else {
        /* Output a warning about the standard driver that is needed. */
        DoWarning ();
        mouse_name = mouse_stddrv;
    }

    /* Load and install the driver. */
    CheckError ("mouse_load_driver",
                mouse_load_driver (&mouse_def_callbacks, mouse_name));
#else
    /* Install the driver. */
    CheckError ("mouse_install",
                mouse_install (&mouse_def_callbacks,
#  ifdef MOUSE_DRIVER
                               MOUSE_DRIVER
#  else
                               mouse_static_stddrv
#  endif
                               ));
#endif

    /* Get the initial bounding box. */
    mouse_getbox (&full_box);

    screensize (&width, &height);

top:
    clrscr ();

    /* Print a help line */
    cputs (" d)ebug  h)ide   q)uit   s)how   j)ail");

    /* Put a cross at the center of the screen. */
    gotoxy (width / 2 - 3, height / 2 - 1);
#if defined(__CBM__)
    cprintf ("%3u,%3u\r\n%*s\xDB", width / 2 * 8 + 4, height / 2 * 8 + 4,
             width / 2, "");
#else
    cprintf ("%3u,%3u\r\n%*s+", width / 2 * 8 + 4, height / 2 * 8 + 4,
             width / 2, "");
#endif

    /* Test loop */
    ShowState (Jailed, Invisible);
    do {
        /* Get the current co-ordinates and button states; and, print them. */
        mouse_info (&info);
        gotoxy (0, 2);
        cprintf (" X  = %3d\r\n", info.pos.x);
        cprintf (" Y  = %3d\r\n", info.pos.y);
        cprintf (" B1 = %c\r\n", (info.buttons & MOUSE_BTN_LEFT) ?
#ifdef __CBM__
                 0x5F
#else
                 'v'
#endif
                 : '^');
        cprintf (" B2 = %c", (info.buttons & MOUSE_BTN_RIGHT) ?
#ifdef __CBM__
                 0x5F
#else
                 'v'
#endif
                 : '^');

        /* Handle user input */
        if (kbhit ()) {
            cclearxy (1, 9, 23);
            switch (tolower (C = cgetc ())) {
                case 'd':
                    BREAK();

                    /* The debugger might have changed the colors.
                    ** Restore them.
                    */
#ifdef __CBM__
                    (void) bordercolor (COLOR_GRAY2);
                    (void) bgcolor (COLOR_WHITE);
                    (void) textcolor (COLOR_GRAY1);
#else
                    (void) bordercolor (COLOR_BLUE);
                    (void) bgcolor (COLOR_WHITE);
                    (void) textcolor (COLOR_BLACK);
#endif

                    /* The debugger changed the screen; restore it. */
                    goto top;

                case 'h':
                    mouse_hide ();
                    ShowState (Jailed, ++Invisible);
                    break;

                case 'j':
                    if (Jailed) {
                        mouse_setbox (&full_box);
                        Jailed = false;
                    } else {
                        small_box.minx = max (info.pos.x - 10, full_box.minx);
                        small_box.miny = max (info.pos.y - 10, full_box.miny);
                        small_box.maxx = min (info.pos.x + 10, full_box.maxx);
                        small_box.maxy = min (info.pos.y + 10, full_box.maxy);
                        mouse_setbox (&small_box);
                        Jailed = true;
                    }
                    ShowState (Jailed, Invisible);
                    break;

                case 's':
                    mouse_show ();
                    if (Invisible) {
                        ShowState (Jailed, --Invisible);
                    }
                    break;

                case 'q':
                    Done = true;
                    break;

                default:
                    gotoxy (1, 9);
                    cprintf ("Spurious character: $%02X", C);
            }
        }
    } while (!Done);

#if DYN_DRV
    /* Uninstall and unload the driver. */
    CheckError ("mouse_unload", mouse_unload ());
#else
    /* Uninstall the static driver. */
    CheckError ("mouse_uninstall", mouse_uninstall ());
#endif

    /* Say goodbye */
    cputsxy (0, height / 2 + 3, "Goodbye!");
    return EXIT_SUCCESS;
}