Ejemplo n.º 1
0
void valueButton(void){
	uint8 i;
    
	for(i = 0; i < buttonCount; i++)
    {
        if(buttons[i].type == ButtonTypeLowActive)
        {
            Gpio_read(buttons[i].port,buttons[i].pin) ? putVal(i,0): putVal(i,1);
        }
        else if(buttons[i].type == ButtonTypeLowActive)
        {
            Gpio_read(buttons[i].port,buttons[i].pin) ? putVal(i,1): putVal(i,0);
        }
	}
}
Ejemplo n.º 2
0
void LevelDBBlockStore::synchronousPut(const HashBlockStore::Key& key, const HashBlockStore::Value& value) {
  int size_byte = key.size() / 8;
  char* key_buf = new char[size_byte];
  BitsToByteArray(key_buf, size_byte, key);
  putVal(leveldb::Slice(key_buf, size_byte), value);
  delete[] key_buf;
}
Ejemplo n.º 3
0
bool idaapi outop(op_t& x)
{
  uchar warn = 0;

  switch ( x.type ) {
    case o_near:
      if ( x.ref ) ++warn;
      else {
        if ( outName(cmd.ea + x.offb, x.n, curSeg.startEA, x.addr, &warn) ) break;
        if ( warn ) goto badop;
      }
      if ( putVal(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN | OOFW_32, warn) ) break;
      //PASS THRU
    case o_void:
badop:
      return(false);

    case o_imm:
      if ( x.ref == 2 ) ++warn;
      if ( putVal(x, OOFW_IMM | OOF_NUMBER | (x.ref ? OOFS_NOSIGN : OOF_SIGNED ),
                warn)) break;
      goto badop;

    case o_mem:
      if ( jasmin() ) goto putVarNum;
      if ( x.ref ) {
putAddr:
        ++warn;
      } else {
        if ( outName(cmd.ea + x.offb, x.n, curSeg.DataBase, x.addr, &warn) ) break;
        if ( warn ) goto badop;
      }
putVarNum:
      if ( putVal(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN | OOFW_16, warn) ) break;
      goto badop;

    case o_cpool:
      if ( !x.cp_ind) OUT_KEYWORD("NULL" );
      else {
        if ( x.ref ) goto putAddr;
        if ( !OutConstant(x) ) goto badop;
      }
      break;

    case o_array:
      if ( !x.ref ) {
        int i = (uchar)x.cp_type - (T_BOOLEAN-1); // -1 - correct tp_decl
        if ( i < 0 || i > T_LONG - (T_BOOLEAN-1) || chkOutKeyword(tp_decl[i].str, tp_decl[i].size) )
          goto badop;
      } else {
        static const char tt_bogust[] = "BOGUST_TYPE-";

        if ( !checkLine(sizeof(tt_bogust) + 2) ) goto badop;
        out_tagon(COLOR_ERROR);
        outcnt += out_snprintf("%c%s%u", WARN_SYM, tt_bogust, (uchar)x.cp_type);
        out_tagoff(COLOR_ERROR);
      }
      break;

    default:
      warning("out: %a: bad optype %d", cmd.ip, x.type);
      break;
  }
  return(true);
}
Ejemplo n.º 4
0
//----------------------------------------------------------------------
uchar OutConstant(op_t& x, uchar impdsc)
{
  register uchar    savetype = x.dtyp;
  register fmt_t    fmt = fmt_dscr;
  register color_t  ntag;

  switch ( (uchar)x.cp_type ) {
    default:
      warning("OC: bad constant type %u", (uchar)x.cp_type);
      break;

    case CONSTANT_Long:
      x.dtyp = dt_qword;
      goto outNum;
    case CONSTANT_Double:
      x.dtyp = dt_double;
      goto outNum;
    case CONSTANT_Integer:
      x.dtyp = dt_dword;
      goto outNum;
    case CONSTANT_Float:
      x.dtyp = dt_float;
outNum:
      if ( putVal(x, OOF_NUMBER | OOF_SIGNED | OOFW_IMM, 0) ) break;
badconst:
      return(0);

    case CONSTANT_String:
      if ( OutUtf8(x._name, fmt_string, COLOR_STRING) ) goto badconst;
      break;

    case CONSTANT_Class:
#ifdef __BORLANDC__
#if ( fmt_cast+1) != fmt_classname || (fmt_classname+1 ) != fmt_fullname
#error
#endif
#endif
      if ( OutUtf8(x._name, (fmt_t )x.addr_shorts.high,
                 (   (fmt_t)x.addr_shorts.high < fmt_cast
                  || (fmt_t)x.addr_shorts.high > fmt_fullname) ?
                 COLOR_KEYWORD : (cmd.xtrn_ip == 0xFFFF ? COLOR_DNAME :
                                                          COLOR_IMPNAME)))
                                                                goto badconst;
      break;

    case CONSTANT_InterfaceMethodref:
    case CONSTANT_Methodref:
        fmt = fmt_retdscr;
    case CONSTANT_Fieldref:
#ifdef VIEW_WITHOUT_TYPE
        if ( impdsc )
#endif
          if ( !jasmin() && OutUtf8(x._dscr, fmt, COLOR_KEYWORD) ) goto badconst;
        out_tagon(ntag = (x._class == curClass.This.Dscr) ? COLOR_DNAME :
                                                            COLOR_IMPNAME);
        if ( jasmin() || (ntag == COLOR_IMPNAME && !impdsc) ) { // other class
          if ( OutUtf8(x._name, fmt_classname) || chkOutDot() ) goto badconst;
        }
        if ( OutUtf8(x._subnam, fmt_name) ) goto badconst; // Field
        out_tagoff(ntag);
        if ( jasmin() ) {
          if ( fmt == fmt_retdscr ) fmt = fmt_signature; // no space at end
          else if ( chkOutSpace() ) goto badconst;
        } else {
          if ( fmt != fmt_retdscr ) break;
          fmt = fmt_paramstr;
        }
        if ( OutUtf8(x._dscr, fmt, COLOR_KEYWORD) ) goto badconst;
        break;
  }
  x.dtyp = savetype;
  return(1);
}
Ejemplo n.º 5
0
//----------------------------------------------------------------------
uchar OutConstant(op_t& x, uchar impdsc)
{
  uchar savetype = x.dtyp;
  fmt_t fmt = fmt_dscr;
  color_t color;

  switch ( (uchar)x.cp_type )
  {
    default:
      warning("OC: bad constant type %u", (uchar)x.cp_type);
      break;

    case CONSTANT_Long:
      x.dtyp = dt_qword;
      goto outNum;
    case CONSTANT_Double:
      x.dtyp = dt_double;
      goto outNum;
    case CONSTANT_Integer:
      x.dtyp = dt_dword;
      goto outNum;
    case CONSTANT_Float:
      x.dtyp = dt_float;
outNum:
      if ( putVal(x, OOF_NUMBER | OOF_SIGNED | OOFW_IMM, 0) )
        break;
badconst:
      return 0;

    case CONSTANT_String:
      if ( OutUtf8(x._name, fmt_string, COLOR_STRING) )
        goto badconst;
      break;

    case CONSTANT_Class:
      CASSERT((fmt_cast+1) == fmt_classname && (fmt_classname+1) == fmt_fullname);
      {
        fmt_t f2 = (fmt_t )x.addr_shorts.high;
        color_t c2 = f2 < fmt_cast || f2 > fmt_fullname ? COLOR_KEYWORD
                   : cmd.xtrn_ip == 0xFFFF ? COLOR_DNAME : COLOR_IMPNAME;

        if ( OutUtf8(x._name, f2, c2) )
          goto badconst;
      }
      break;

    case CONSTANT_InterfaceMethodref:
    case CONSTANT_Methodref:
        fmt = fmt_retdscr;
    case CONSTANT_Fieldref:
#ifdef VIEW_WITHOUT_TYPE
        if ( impdsc )
#endif
          if ( !jasmin() && OutUtf8(x._dscr, fmt, COLOR_KEYWORD) )
            goto badconst;
        color = x._class == curClass.This.Dscr ? COLOR_DNAME : COLOR_IMPNAME;
        out_tagon(color);
        if ( jasmin() || (color == COLOR_IMPNAME && !impdsc) ) // other class
        {
          if ( OutUtf8(x._name, fmt_classname) || chkOutDot() )
            goto badconst;
        }
        if ( OutUtf8(x._subnam, fmt_name) )
          goto badconst; // Field
        out_tagoff(color);
        if ( jasmin() )
        {
          if ( fmt == fmt_retdscr )
            fmt = fmt_signature; // no space at end
          else if ( chkOutSpace() )
            goto badconst;
        }
        else
        {
          if ( fmt != fmt_retdscr )
            break;
          fmt = fmt_paramstr;
        }
        if ( OutUtf8(x._dscr, fmt, COLOR_KEYWORD) )
          goto badconst;
        break;
  }
  x.dtyp = savetype;
  return 1;
}
Ejemplo n.º 6
0
int execLib(char *C)
{
int i;
void * A;
short T=0;
    InExec = C;
    /* D_Trace(C); pas pour le moment */
    if (sigsetjmp(ENV_INT,1)) {
       interInfos("execLib",C);
       return 1;
    }
    if (InstallOn) {
      switch (InstallOn) {
        case 1 : /* lib first */
          A=libByName(C);
          if (A==VIDE) {
             A=fctByName(C);
             if (A!=VIDE) T=2;
          } else T=1;
          break;
        case 2 : /* user functions first */
          A=fctByName(C);
          if (A==VIDE) {
             A=libByName(C);
             if (A!=VIDE) T=1;
          } else T=2;
          break;
        case 3 : /* variables only */
          A=varByName(C);
          if (A!=VIDE) T=3;
          break;
        case 8 : /* df_init */
          A=fctByName(C);
          updDynFct(A,0);
          break;
        case 9 : /* df_start */
          A=fctByName(C);
          updDynFct(A,1);
          break;
        case 10 : /* df_stop */
          A=fctByName(C);
          updDynFct(A,2);
          break;
        default :
          break;
      }
      _MODIF_FCT_INST_(A);
      _MODIF_FCT_TYP_(T);
      InstallOn=0;
      return 1;
    }
    if ((VARS==2) && (IF_execVar(C))) return 1; /* VARS UP */
    if (IF_execFct(C)) return 1;
    for (i=0;i<NBFonc;i++) {
        /* printf("execLib : teste %s !\n", Fonctions[i].nam); */
        if (strcmp(C,Fonctions[i].nam) == 0) {
           switch (Fonctions[i].typ) {
            case 1:
              if (fctEnCours) Fonctions[i].fct();
              else messErr(13);
              break;
            case 2:
              if (fctEnCours) messErr(25);
              else Fonctions[i].fct();
              break;
            case 3: /* usr fct */
              break;
            default: /* typ = 0 */
              if (fctEnCours) {
                 if (strcmp(C,":") == 0) messErr(15);
                 else {
                    if (strcmp(C,"\"") == 0)  Fonctions[i].fct();
                    else makeFct(T_LIB,(void*)Fonctions[i].fct);
                 }
              } else Fonctions[i].fct();
              break;
           }
           return 1;
        }
    }
    if ((VARS==1) && (IF_execVar(C))) return 1; /* VARS DOWN */
    /* printf("execLib : appel putVal(%s)\n",C); */
    return(putVal(C));
}
Ejemplo n.º 7
0
void LevelDBBlockStore::putAddr(uint32_t addr, const HashBlockStore::Value& value) {
  putVal(leveldb::Slice((char*)&addr, sizeof(addr)), value);
}