| How can I display a PIC variable created in TI-Basic?

Previous | TI-Basic and C | Next

Q: | Is it hard to display a PIC variable created from TI-Basic in C programs?

A:

No, it is easy. It is enough to locate the variable (using SymFind for example), and to display its content using BitmapPut (its contents are just as expected by BitmapPut function). To be more concrete, look at the following function:

    short show_picvar (SYM_STR SymName, short x, short y, short Attr)
    {
      SYM_ENTRY *sym_entry = SymFindPtr (SymName, 0);
      if (!sym_entry) return FALSE;
      if (peek (HToESI (sym_entry->handle)) != PIC_TAG) return FALSE;
      BitmapPut (x, y, HeapDeref (sym_entry->handle) + 2, ScrRect, Attr);
      return TRUE;
    }

The usage of this function is straightforward, for example:

    show_picvar (SYMSTR ("testpic"), 30, 30, A_NORMAL);

assuming that "testpic" is the name of the wanted PIC variable. This function returns TRUE if the operation was successful, else returns FALSE (i.e. the picvar does not exist, or it is not a PIC variable).