Beispiel #1
0
int report_chunk(struct chunk *ch)
{
  unsigned char type = ch->type;

  if (type == FirmwareVersion) {
    printf ("firmware '%s'\n", (char *)BUFFER(ch));
  } else if (type == HostName) {
    printf ("name '%s'\n", (char *)BUFFER(ch));
  } else if (type == Product) {
    printf ("board.shortname '%s'\n", (char *)BUFFER(ch));
  } else if (type == SystemId) {
    printf ("board.sysid 0x%x\n", NUMBER(ch));
  } else if (type == Essid) {
    printf ("wireless.ssid '%s'\n", (char *)BUFFER(ch));
  } else if (type == WirelessMode) {
    printf ("wmode 0x%02x\n", NUMBER(ch));
  } else if (type == Address) {
    char hwaddr[18];
    char ipv4[16];
    sprint_hwaddr(HWADDR(ch), hwaddr);
    sprint_ipv4(IPV4ADDR(ch), ipv4);
    printf ("address { hwaddr %s ipv4 %s }\n", hwaddr, ipv4);
  } else if (type == HwAddr) {
    char hwaddr[18];
    sprint_hwaddr(BUFFER(ch), hwaddr);
    printf("board.hwaddr: %s\n", hwaddr);
  } else if (type == UpTime) {
    printf ("uptime %d\n", NUMBER(ch));
  } else {
    printf("<unknown type: 0x%02x>\n", type);
  }
  return 0;
}
Beispiel #2
0
const char *
archive_liblz4_version(void)
{
#if defined(HAVE_LZ4_H) && defined(HAVE_LIBLZ4)
#define str(s) #s
#define NUMBER(x) str(x)
	return NUMBER(LZ4_VERSION_MAJOR) "." NUMBER(LZ4_VERSION_MINOR) "." NUMBER(LZ4_VERSION_RELEASE);
#undef NUMBER
#undef str
#else
	return NULL;
#endif
}
Beispiel #3
0
int decode_chunk(struct chunk *ch, unsigned char type, unsigned char *data, unsigned int len)
{
  switch(type) {
  case SystemId:		/* 16-bit integer */
  case WirelessMode:		/*  8-bit integer */
  case UpTime:		/* 32-bit integer */
    NUMBER(ch) = get_number(data, len);
    break;

  case FirmwareVersion:	/* readable string */
  case Product:
  case HostName:
  case Essid:
    BUFFER(ch) = strndup((char *)data, len);
    break;
    
  case HwAddr:
    BUFFER(ch) = malloc(len);
    memcpy(BUFFER(ch), data, len);
    break;

  case Address:
    BUFFER(ch) = malloc(sizeof(struct address));
    memcpy(HWADDR(ch), data, 6);
    memcpy(IPV4ADDR(ch), data+6, 4);
    break;

  default:
    break;
  }

  return 0;
}
Beispiel #4
0
static void gauss_first_guess(long trunc, double* vals)
{
	long i = 0, numVals;
	static double gvals[] =  {     2.4048255577E0,   5.5200781103E0,
			8.6537279129E0,   11.7915344391E0,  14.9309177086E0,
			18.0710639679E0,  21.2116366299E0,  24.3524715308E0,
			27.4934791320E0,  30.6346064684E0,  33.7758202136E0,
			36.9170983537E0,  40.0584257646E0,  43.1997917132E0,
			46.3411883717E0,  49.4826098974E0,  52.6240518411E0,
			55.7655107550E0,  58.9069839261E0,  62.0484691902E0,
			65.1899648002E0,  68.3314693299E0,  71.4729816036E0,
			74.6145006437E0,  77.7560256304E0,  80.8975558711E0,
			84.0390907769E0,  87.1806298436E0,  90.3221726372E0,
			93.4637187819E0,  96.6052679510E0,  99.7468198587E0,
			102.8883742542E0, 106.0299309165E0, 109.1714896498E0,
			112.3130502805E0, 115.4546126537E0, 118.5961766309E0,
			121.7377420880E0, 124.8793089132E0, 128.0208770059E0,
			131.1624462752E0, 134.3040166383E0, 137.4455880203E0,
			140.5871603528E0, 143.7287335737E0, 146.8703076258E0,
			150.0118824570E0, 153.1534580192E0, 156.2950342685E0, };

	numVals = NUMBER(gvals);
	for( i = 0; i < trunc; i++)
	{
		if(i < numVals)
			vals[i] = gvals[i];
		else
			vals[i] = vals[i-1] +  M_PI;
	}
}
Beispiel #5
0
grib_handle* grib_internal_template(grib_context* c,const char* name)
{
  int i;
  for(i = 0; i < NUMBER(templates); i++)
    if(strcmp(name,templates[i].name) == 0)
      return grib_handle_new_from_message_copy(c,templates[i].data,templates[i].size);
  return NULL;
}
Beispiel #6
0
CONS*
tick_time()
{
	time_t t;

	DBUG_ENTER("tick_time");
	time(&t);
	DBUG_RETURN NUMBER(t - time_base);
}
Beispiel #7
0
void Board::printMines() {
	for (int row = 0; row < m_rows; row ++) {
		for (int column = 0; column < m_columns; column ++) {
			if (MINE(row, column)) {
				printf("*");
			} else {
				printf("%d", NUMBER(row, column));
			}
		}
		printf("\n");
	}
}
Beispiel #8
0
void gribex_check(int err) {
  int i=0;
  if(err > 0) {
    char *e = "unknown";
    for(i = 0; i < NUMBER(gribex_errors); i++)
      if(gribex_errors[i].code == err)
        e = gribex_errors[i].message;

    fprintf(stderr,"GRIBEX error %d: %s\n",err,e);
    exit(err);
  }
}
Beispiel #9
0
void
start_ticker(CONFIG* cfg, int count)
{
	CONS* actor;
	CONS* state;
	CONS* msg;
	
	DBUG_ENTER("start_ticker");
	DBUG_PRINT("", ("count=%d", count));
	state = map_put(NIL, ATOM("count"), NUMBER(count));
	actor = CFG_ACTOR(cfg, each_second, state);
	
	state = map_put(NIL, ATOM("sec"), actor);
	msg = map_put(NIL, ATOM("time"), tick_time());
	CFG_SEND(cfg, CFG_ACTOR(cfg, time_ticker, state), msg);
	DBUG_RETURN;
}
Beispiel #10
0
void _FillAdjMatrix( CvGraph* graph, int** connected, int reverse )
{
    //assume all vertices are marked
    for( int i = 0; i < graph->total; i++ )
    {
        for( int j = 0; j < graph->total; j++ )
        {
            connected[i][j] = 0|reverse;
        }
        //memset( connected[i], 0, sizeof(int)*graph->total );
        CvGraphVtx* ver = cvGetGraphVtx( graph, i );
        if( ver )
        {
            connected[i][i] = 1;
            for( CvGraphEdge* e = ver->first; e ; e = CV_NEXT_GRAPH_EDGE( e, ver ) )
            {
               CvGraphVtx* v = CV_GET_ADJ_VTX( ver, e );
               connected[i][NUMBER(v)] = 1^reverse;
            }
        }
    }
}
Beispiel #11
0
/**
	a: ACTOR $challenge {n:$counter}
	SEND $a $a
**/
void
test_erlang_challenge(int counter)
{
    CONFIG* cfg;
    CONS* actor;
    int n;
    int m;

    DBUG_ENTER("test_erlang_challenge");
    cfg = new_configuration(10);
    actor = CFG_ACTOR(cfg, challenge, map_put(NIL, ATOM("n"), NUMBER(counter)));
    CFG_SEND(cfg, actor, actor);
    for (m = 1; m < 1000000; ++m) {
        n = run_configuration(cfg, 1000000);
        if (cfg->q_count <= 0) {
            /* queue empty */
            break;
        }
    }
    TRACE(printf("~%dM messages delivered.\n", m));
    report_actor_usage(cfg);
    DBUG_RETURN;
}
Beispiel #12
0
void
test_sample(CONFIG* cfg)
{
	CONS* actor;
	CONS* state;
	CONS* msg;

	DBUG_ENTER("test_sample");
	TRACE(printf("--test_sample--\n"));
	state = map_put(NIL, ATOM("text"), ATOM("Actor"));
	actor = CFG_ACTOR(cfg, say_hello, state);
	
	msg = map_put(NIL, ATOM("name"), ATOM("World!"));
	CFG_SEND(cfg, actor, msg);
	
	msg = NIL;
	msg = map_put(msg, ATOM("name"), NUMBER(42));
	msg = map_put(msg, ATOM("addr"), actor);
	CFG_SEND(cfg, actor, msg);
	
	report_configuration(cfg);
	DBUG_RETURN;
}
Beispiel #13
0
grib_nearest* grib_nearest_factory( grib_handle* h, grib_arguments* args)
{
  int i;
  int ret = GRIB_SUCCESS;
  char* type = (char*)grib_arguments_get_name(h,args,0);

  for(i = 0; i < NUMBER(table) ; i++)
    if(strcmp(type,table[i].type) == 0)
    {
      grib_nearest_class* c = *(table[i].cclass);
      grib_nearest*       it = (grib_nearest*) grib_context_malloc_clear(h->context,c->size);
      it->cclass              = c;
      ret = GRIB_SUCCESS;
      ret = grib_nearest_init(it,h,args);
      if(ret ==  GRIB_SUCCESS) return it;
      grib_context_log(h->context,GRIB_LOG_ERROR,"grib_nearest_factory: error %d instantiating nearest %s", ret, table[i].type);
      grib_nearest_delete(it);
      return NULL;
    }

  grib_context_log(h->context,GRIB_LOG_ERROR,"grib_nearest_factory : Unknown type : %s for nearest", type);

  return NULL;
}
grib_iterator* grib_iterator_factory( grib_handle* h, grib_arguments* args, unsigned long flags,int *ret)
{
  int i;
  char* type = (char*)grib_arguments_get_name(h,args,0);

  for(i = 0; i < NUMBER(table) ; i++)
    if(strcmp(type,table[i].type) == 0)
    {
      grib_iterator_class* c = *(table[i].cclass);
      grib_iterator*       it = (grib_iterator*) grib_context_malloc_clear(h->context,c->size);
      it->cclass              = c;
	  it->flags    = flags;
      *ret = GRIB_SUCCESS;
      *ret = grib_iterator_init(it,h,args);
      if(*ret ==  GRIB_SUCCESS) return it;
      grib_context_log(h->context,GRIB_LOG_DEBUG,"grib_iterator_factory: error %d instantiating iterator %s", *ret, table[i].type);
      grib_iterator_delete(it);
      return NULL;
    }

  grib_context_log(h->context,GRIB_LOG_ERROR,"grib_iterator_factory : Unknown type : %s for iterator", type);

  return NULL;
}
Beispiel #15
0
int main (void)
{

    List *f;
    List *t;
    IOString src_name;
    IOString src_version;
    IOString src_type;
    IOString tgt_name;
    IOString tgt_version;
    IOString tgt_type;

    gap_set_if_vectors(1);

    printf("Covert Project Database\nVersion 1.4, 28th May 1997\n");

#define NUMBER(A) ((int)(sizeof(A) / sizeof((A)[0])))
    get_db("Please enter database to convert:\n",src_types, NUMBER(src_types), src_name, src_version, src_type);
    get_db("Please enter database to create:\n",tgt_types, NUMBER(tgt_types), tgt_name, tgt_version, tgt_type);

    if (strcmp(src_type,tgt_type)==0)
	crash("Cannot convert a database to another of the same type\n");

    f = build_list (
		    atom_str(db_from),
		    build_list(
			       atom_str(db_name),
			       atom_str(src_name),
			       nil),
		    build_list(
			       atom_str(db_version),
			       atom_str(src_version),
			       nil),
		    build_list(
			       atom_str(db_type),
			       atom_str(src_type),
			       nil),
		    nil);

    t = build_list (
		    atom_str(db_to),
		    build_list(
			       atom_str(db_name),
			       atom_str(tgt_name),
			       nil),
		    build_list(
			       atom_str(db_version),
			       atom_str(tgt_version),
			       nil),
		    build_list(
			       atom_str(db_type),
			       atom_str(tgt_type),
			       nil),
		    nil);

    process (f,t);

    destroy_list(f);
    destroy_list(t);

    destroy_node_list(); /* garbage collect */

    printf("\nConversion completed\n");

    return 0;
}
Beispiel #16
0
    // Convert a rpc method and params to a request.
    // <-- { method: xyz, params: [... ] } or { error: ..., ... }
    Json::Value parseCommand (std::string strMethod, Json::Value jvParams, bool allowAnyCommand)
    {
        WriteLog (lsTRACE, RPCParser) << "RPC method:" << strMethod;
        WriteLog (lsTRACE, RPCParser) << "RPC params:" << jvParams;

        struct Command
        {
            const char*     pCommand;
            parseFuncPtr    pfpFunc;
            int             iMinParams;
            int             iMaxParams;
        };
        static Command commandsA[] =
        {
            // Request-response methods
            // - Returns an error, or the request.
            // - To modify the method, provide a new method in the request.
            {   "account_info",         &RPCParser::parseAccountItems,          1,  2   },
            {   "account_lines",        &RPCParser::parseAccountLines,          1,  3   },
            {   "account_offers",       &RPCParser::parseAccountItems,          1,  2   },
            {   "account_tx",           &RPCParser::parseAccountTransactions,   1,  8   },
            {   "book_offers",          &RPCParser::parseBookOffers,            2,  7   },
            {   "connect",              &RPCParser::parseConnect,               1,  2   },
            {   "consensus_info",       &RPCParser::parseAsIs,                  0,  0   },
            {   "feature",              &RPCParser::parseFeature,               0,  2   },
            {   "fetch_info",           &RPCParser::parseFetchInfo,             0,  1   },
            {   "get_counts",           &RPCParser::parseGetCounts,             0,  1   },
            {   "json",                 &RPCParser::parseJson,                  2,  2   },
            {   "ledger",               &RPCParser::parseLedger,                0,  2   },
            {   "ledger_accept",        &RPCParser::parseAsIs,                  0,  0   },
            {   "ledger_closed",        &RPCParser::parseAsIs,                  0,  0   },
            {   "ledger_current",       &RPCParser::parseAsIs,                  0,  0   },
            //      {   "ledger_entry",         &RPCParser::parseLedgerEntry,          -1, -1   },
            {   "ledger_header",        &RPCParser::parseLedgerId,              1,  1   },
            {   "log_level",            &RPCParser::parseLogLevel,              0,  2   },
            {   "logrotate",            &RPCParser::parseAsIs,                  0,  0   },
            //      {   "nickname_info",        &RPCParser::parseNicknameInfo,          1,  1   },
            {   "owner_info",           &RPCParser::parseAccountItems,          1,  2   },
            {   "peers",                &RPCParser::parseAsIs,                  0,  0   },
            {   "ping",                 &RPCParser::parseAsIs,                  0,  0   },
            //      {   "profile",              &RPCParser::parseProfile,               1,  9   },
            {   "proof_create",         &RPCParser::parseProofCreate,           0,  2   },
            {   "proof_solve",          &RPCParser::parseProofSolve,            1,  1   },
            {   "proof_verify",         &RPCParser::parseProofVerify,           2,  4   },
            {   "random",               &RPCParser::parseAsIs,                  0,  0   },
            {   "ripple_path_find",     &RPCParser::parseRipplePathFind,        1,  2   },
            {   "sign",                 &RPCParser::parseSignSubmit,            2,  3   },
            {   "sms",                  &RPCParser::parseSMS,                   1,  1   },
            {   "submit",               &RPCParser::parseSignSubmit,            1,  2   },
            {   "server_info",          &RPCParser::parseAsIs,                  0,  0   },
            {   "server_state",         &RPCParser::parseAsIs,                  0,  0   },
            {   "stop",                 &RPCParser::parseAsIs,                  0,  0   },
            //      {   "transaction_entry",    &RPCParser::parseTransactionEntry,     -1,  -1  },
            {   "tx",                   &RPCParser::parseTx,                    1,  2   },
            {   "tx_account",           &RPCParser::parseTxAccount,             1,  7   },
            {   "tx_history",           &RPCParser::parseTxHistory,             1,  1   },

            {   "unl_add",              &RPCParser::parseUnlAdd,                1,  2   },
            {   "unl_delete",           &RPCParser::parseUnlDelete,             1,  1   },
            {   "unl_list",             &RPCParser::parseAsIs,                  0,  0   },
            {   "unl_load",             &RPCParser::parseAsIs,                  0,  0   },
            {   "unl_network",          &RPCParser::parseAsIs,                  0,  0   },
            {   "unl_reset",            &RPCParser::parseAsIs,                  0,  0   },
            {   "unl_score",            &RPCParser::parseAsIs,                  0,  0   },

            {   "validation_create",    &RPCParser::parseValidationCreate,      0,  1   },
            {   "validation_seed",      &RPCParser::parseValidationSeed,        0,  1   },

            {   "wallet_accounts",      &RPCParser::parseWalletAccounts,        1,  1   },
            {   "wallet_propose",       &RPCParser::parseWalletPropose,         0,  1   },
            {   "wallet_seed",          &RPCParser::parseWalletSeed,            0,  1   },

            {   "internal",             &RPCParser::parseInternal,              1,  -1  },

    #if ENABLE_INSECURE
            // XXX Unnecessary commands which should be removed.
            {   "login",                &RPCParser::parseLogin,                 2,  2   },
            {   "data_delete",          &RPCParser::parseDataDelete,            1,  1   },
            {   "data_fetch",           &RPCParser::parseDataFetch,             1,  1   },
            {   "data_store",           &RPCParser::parseDataStore,             2,  2   },
    #endif

            // Evented methods
            {   "path_find",            &RPCParser::parseEvented,               -1, -1  },
            {   "subscribe",            &RPCParser::parseEvented,               -1, -1  },
            {   "unsubscribe",          &RPCParser::parseEvented,               -1, -1  },
        };

        int     i = NUMBER (commandsA);

        while (i-- && strMethod != commandsA[i].pCommand)
            ;

        if (i < 0)
        {
            if (!allowAnyCommand)
                return rpcError (rpcUNKNOWN_COMMAND);

            return parseAsIs (jvParams);
        }
        else if ((commandsA[i].iMinParams >= 0 && jvParams.size () < commandsA[i].iMinParams)
                 || (commandsA[i].iMaxParams >= 0 && jvParams.size () > commandsA[i].iMaxParams))
        {
            WriteLog (lsWARNING, RPCParser) << "Wrong number of parameters: minimum=" << commandsA[i].iMinParams
                                            << " maximum=" << commandsA[i].iMaxParams
                                            << " actual=" << jvParams.size ();

            return rpcError (rpcBAD_SYNTAX);
        }

        return (this->* (commandsA[i].pfpFunc)) (jvParams);
    }
Beispiel #17
0
// SRAM format:
// byte 0: number of puzzles
// byte 1: index of current puzzle
// byte 2: rows of puzzle 0
// byte 3: cols of puzzle 0
// byte 4: rows of puzzle 1
// byte 5: cols of puzzle 1
// ...
// at byte 1024:
//   puzzle 0, 1 byte per square
// at byte 2048:
//   puzzle 1, 1 byte per square
// ...
void load_to_sram() {
  
  sram_mem[0] = 10;
  sram_mem[1] = 0;
  
    sram_mem[2] = 7;
    sram_mem[3] = 7;
    
      
        sram_mem[1024] =
        WHITE;
      
        sram_mem[1025] =
        WHITE;
      
        sram_mem[1026] =
        WHITE;
      
        sram_mem[1027] =
        WHITE;
      
        sram_mem[1028] =
        WHITE;
      
        sram_mem[1029] =
        WHITE;
      
        sram_mem[1030] =
        NUMBER(1);
      
    
      
        sram_mem[1031] =
        WHITE;
      
        sram_mem[1032] =
        WHITE;
      
        sram_mem[1033] =
        WHITE;
      
        sram_mem[1034] =
        WHITE;
      
        sram_mem[1035] =
        NUMBER(1);
      
        sram_mem[1036] =
        WHITE;
      
        sram_mem[1037] =
        WHITE;
      
    
      
        sram_mem[1038] =
        WHITE;
      
        sram_mem[1039] =
        WHITE;
      
        sram_mem[1040] =
        WHITE;
      
        sram_mem[1041] =
        WHITE;
      
        sram_mem[1042] =
        WHITE;
      
        sram_mem[1043] =
        WHITE;
      
        sram_mem[1044] =
        NUMBER(2);
      
    
      
        sram_mem[1045] =
        NUMBER(1);
      
        sram_mem[1046] =
        WHITE;
      
        sram_mem[1047] =
        WHITE;
      
        sram_mem[1048] =
        WHITE;
      
        sram_mem[1049] =
        WHITE;
      
        sram_mem[1050] =
        WHITE;
      
        sram_mem[1051] =
        WHITE;
      
    
      
        sram_mem[1052] =
        WHITE;
      
        sram_mem[1053] =
        WHITE;
      
        sram_mem[1054] =
        WHITE;
      
        sram_mem[1055] =
        WHITE;
      
        sram_mem[1056] =
        WHITE;
      
        sram_mem[1057] =
        WHITE;
      
        sram_mem[1058] =
        WHITE;
      
    
      
        sram_mem[1059] =
        WHITE;
      
        sram_mem[1060] =
        WHITE;
      
        sram_mem[1061] =
        WHITE;
      
        sram_mem[1062] =
        WHITE;
      
        sram_mem[1063] =
        WHITE;
      
        sram_mem[1064] =
        WHITE;
      
        sram_mem[1065] =
        WHITE;
      
    
      
        sram_mem[1066] =
        WHITE;
      
        sram_mem[1067] =
        WHITE;
      
        sram_mem[1068] =
        NUMBER(3);
      
        sram_mem[1069] =
        WHITE;
      
        sram_mem[1070] =
        NUMBER(1);
      
        sram_mem[1071] =
        WHITE;
      
        sram_mem[1072] =
        NUMBER(11);
      
    
  
    sram_mem[4] = 7;
    sram_mem[5] = 7;
    
      
        sram_mem[2048] =
        NUMBER(2);
      
        sram_mem[2049] =
        WHITE;
      
        sram_mem[2050] =
        WHITE;
      
        sram_mem[2051] =
        NUMBER(7);
      
        sram_mem[2052] =
        WHITE;
      
        sram_mem[2053] =
        WHITE;
      
        sram_mem[2054] =
        NUMBER(2);
      
    
      
        sram_mem[2055] =
        WHITE;
      
        sram_mem[2056] =
        WHITE;
      
        sram_mem[2057] =
        WHITE;
      
        sram_mem[2058] =
        WHITE;
      
        sram_mem[2059] =
        WHITE;
      
        sram_mem[2060] =
        WHITE;
      
        sram_mem[2061] =
        WHITE;
      
    
      
        sram_mem[2062] =
        NUMBER(2);
      
        sram_mem[2063] =
        WHITE;
      
        sram_mem[2064] =
        WHITE;
      
        sram_mem[2065] =
        WHITE;
      
        sram_mem[2066] =
        WHITE;
      
        sram_mem[2067] =
        WHITE;
      
        sram_mem[2068] =
        WHITE;
      
    
      
        sram_mem[2069] =
        WHITE;
      
        sram_mem[2070] =
        WHITE;
      
        sram_mem[2071] =
        NUMBER(3);
      
        sram_mem[2072] =
        WHITE;
      
        sram_mem[2073] =
        WHITE;
      
        sram_mem[2074] =
        WHITE;
      
        sram_mem[2075] =
        WHITE;
      
    
      
        sram_mem[2076] =
        NUMBER(2);
      
        sram_mem[2077] =
        WHITE;
      
        sram_mem[2078] =
        WHITE;
      
        sram_mem[2079] =
        WHITE;
      
        sram_mem[2080] =
        WHITE;
      
        sram_mem[2081] =
        WHITE;
      
        sram_mem[2082] =
        WHITE;
      
    
      
        sram_mem[2083] =
        WHITE;
      
        sram_mem[2084] =
        WHITE;
      
        sram_mem[2085] =
        WHITE;
      
        sram_mem[2086] =
        WHITE;
      
        sram_mem[2087] =
        NUMBER(1);
      
        sram_mem[2088] =
        WHITE;
      
        sram_mem[2089] =
        WHITE;
      
    
      
        sram_mem[2090] =
        WHITE;
      
        sram_mem[2091] =
        WHITE;
      
        sram_mem[2092] =
        WHITE;
      
        sram_mem[2093] =
        WHITE;
      
        sram_mem[2094] =
        WHITE;
      
        sram_mem[2095] =
        WHITE;
      
        sram_mem[2096] =
        NUMBER(1);
      
    
  
    sram_mem[6] = 7;
    sram_mem[7] = 7;
    
      
        sram_mem[3072] =
        NUMBER(2);
      
        sram_mem[3073] =
        WHITE;
      
        sram_mem[3074] =
        WHITE;
      
        sram_mem[3075] =
        NUMBER(2);
      
        sram_mem[3076] =
        WHITE;
      
        sram_mem[3077] =
        NUMBER(2);
      
        sram_mem[3078] =
        WHITE;
      
    
      
        sram_mem[3079] =
        WHITE;
      
        sram_mem[3080] =
        WHITE;
      
        sram_mem[3081] =
        WHITE;
      
        sram_mem[3082] =
        WHITE;
      
        sram_mem[3083] =
        WHITE;
      
        sram_mem[3084] =
        WHITE;
      
        sram_mem[3085] =
        WHITE;
      
    
      
        sram_mem[3086] =
        NUMBER(3);
      
        sram_mem[3087] =
        WHITE;
      
        sram_mem[3088] =
        WHITE;
      
        sram_mem[3089] =
        WHITE;
      
        sram_mem[3090] =
        NUMBER(3);
      
        sram_mem[3091] =
        WHITE;
      
        sram_mem[3092] =
        NUMBER(3);
      
    
      
        sram_mem[3093] =
        WHITE;
      
        sram_mem[3094] =
        WHITE;
      
        sram_mem[3095] =
        WHITE;
      
        sram_mem[3096] =
        WHITE;
      
        sram_mem[3097] =
        WHITE;
      
        sram_mem[3098] =
        WHITE;
      
        sram_mem[3099] =
        WHITE;
      
    
      
        sram_mem[3100] =
        WHITE;
      
        sram_mem[3101] =
        WHITE;
      
        sram_mem[3102] =
        WHITE;
      
        sram_mem[3103] =
        WHITE;
      
        sram_mem[3104] =
        WHITE;
      
        sram_mem[3105] =
        WHITE;
      
        sram_mem[3106] =
        WHITE;
      
    
      
        sram_mem[3107] =
        WHITE;
      
        sram_mem[3108] =
        NUMBER(4);
      
        sram_mem[3109] =
        WHITE;
      
        sram_mem[3110] =
        WHITE;
      
        sram_mem[3111] =
        WHITE;
      
        sram_mem[3112] =
        WHITE;
      
        sram_mem[3113] =
        WHITE;
      
    
      
        sram_mem[3114] =
        WHITE;
      
        sram_mem[3115] =
        WHITE;
      
        sram_mem[3116] =
        WHITE;
      
        sram_mem[3117] =
        WHITE;
      
        sram_mem[3118] =
        NUMBER(1);
      
        sram_mem[3119] =
        WHITE;
      
        sram_mem[3120] =
        NUMBER(1);
      
    
  
    sram_mem[8] = 7;
    sram_mem[9] = 7;
    
      
        sram_mem[4096] =
        NUMBER(3);
      
        sram_mem[4097] =
        WHITE;
      
        sram_mem[4098] =
        NUMBER(3);
      
        sram_mem[4099] =
        WHITE;
      
        sram_mem[4100] =
        WHITE;
      
        sram_mem[4101] =
        WHITE;
      
        sram_mem[4102] =
        WHITE;
      
    
      
        sram_mem[4103] =
        WHITE;
      
        sram_mem[4104] =
        WHITE;
      
        sram_mem[4105] =
        WHITE;
      
        sram_mem[4106] =
        WHITE;
      
        sram_mem[4107] =
        WHITE;
      
        sram_mem[4108] =
        WHITE;
      
        sram_mem[4109] =
        WHITE;
      
    
      
        sram_mem[4110] =
        WHITE;
      
        sram_mem[4111] =
        WHITE;
      
        sram_mem[4112] =
        NUMBER(4);
      
        sram_mem[4113] =
        WHITE;
      
        sram_mem[4114] =
        WHITE;
      
        sram_mem[4115] =
        NUMBER(4);
      
        sram_mem[4116] =
        WHITE;
      
    
      
        sram_mem[4117] =
        WHITE;
      
        sram_mem[4118] =
        NUMBER(2);
      
        sram_mem[4119] =
        WHITE;
      
        sram_mem[4120] =
        WHITE;
      
        sram_mem[4121] =
        WHITE;
      
        sram_mem[4122] =
        WHITE;
      
        sram_mem[4123] =
        WHITE;
      
    
      
        sram_mem[4124] =
        WHITE;
      
        sram_mem[4125] =
        WHITE;
      
        sram_mem[4126] =
        WHITE;
      
        sram_mem[4127] =
        WHITE;
      
        sram_mem[4128] =
        WHITE;
      
        sram_mem[4129] =
        NUMBER(2);
      
        sram_mem[4130] =
        WHITE;
      
    
      
        sram_mem[4131] =
        WHITE;
      
        sram_mem[4132] =
        WHITE;
      
        sram_mem[4133] =
        WHITE;
      
        sram_mem[4134] =
        WHITE;
      
        sram_mem[4135] =
        WHITE;
      
        sram_mem[4136] =
        WHITE;
      
        sram_mem[4137] =
        WHITE;
      
    
      
        sram_mem[4138] =
        NUMBER(4);
      
        sram_mem[4139] =
        WHITE;
      
        sram_mem[4140] =
        WHITE;
      
        sram_mem[4141] =
        WHITE;
      
        sram_mem[4142] =
        WHITE;
      
        sram_mem[4143] =
        NUMBER(2);
      
        sram_mem[4144] =
        WHITE;
      
    
  
    sram_mem[10] = 7;
    sram_mem[11] = 7;
    
      
        sram_mem[5120] =
        NUMBER(2);
      
        sram_mem[5121] =
        WHITE;
      
        sram_mem[5122] =
        NUMBER(3);
      
        sram_mem[5123] =
        WHITE;
      
        sram_mem[5124] =
        WHITE;
      
        sram_mem[5125] =
        WHITE;
      
        sram_mem[5126] =
        NUMBER(2);
      
    
      
        sram_mem[5127] =
        WHITE;
      
        sram_mem[5128] =
        WHITE;
      
        sram_mem[5129] =
        WHITE;
      
        sram_mem[5130] =
        WHITE;
      
        sram_mem[5131] =
        WHITE;
      
        sram_mem[5132] =
        WHITE;
      
        sram_mem[5133] =
        WHITE;
      
    
      
        sram_mem[5134] =
        WHITE;
      
        sram_mem[5135] =
        NUMBER(4);
      
        sram_mem[5136] =
        WHITE;
      
        sram_mem[5137] =
        WHITE;
      
        sram_mem[5138] =
        NUMBER(3);
      
        sram_mem[5139] =
        WHITE;
      
        sram_mem[5140] =
        WHITE;
      
    
      
        sram_mem[5141] =
        WHITE;
      
        sram_mem[5142] =
        WHITE;
      
        sram_mem[5143] =
        WHITE;
      
        sram_mem[5144] =
        WHITE;
      
        sram_mem[5145] =
        WHITE;
      
        sram_mem[5146] =
        WHITE;
      
        sram_mem[5147] =
        WHITE;
      
    
      
        sram_mem[5148] =
        NUMBER(3);
      
        sram_mem[5149] =
        WHITE;
      
        sram_mem[5150] =
        WHITE;
      
        sram_mem[5151] =
        WHITE;
      
        sram_mem[5152] =
        NUMBER(3);
      
        sram_mem[5153] =
        WHITE;
      
        sram_mem[5154] =
        WHITE;
      
    
      
        sram_mem[5155] =
        WHITE;
      
        sram_mem[5156] =
        WHITE;
      
        sram_mem[5157] =
        WHITE;
      
        sram_mem[5158] =
        WHITE;
      
        sram_mem[5159] =
        WHITE;
      
        sram_mem[5160] =
        WHITE;
      
        sram_mem[5161] =
        WHITE;
      
    
      
        sram_mem[5162] =
        WHITE;
      
        sram_mem[5163] =
        WHITE;
      
        sram_mem[5164] =
        NUMBER(1);
      
        sram_mem[5165] =
        WHITE;
      
        sram_mem[5166] =
        WHITE;
      
        sram_mem[5167] =
        WHITE;
      
        sram_mem[5168] =
        WHITE;
      
    
  
    sram_mem[12] = 7;
    sram_mem[13] = 7;
    
      
        sram_mem[6144] =
        NUMBER(2);
      
        sram_mem[6145] =
        WHITE;
      
        sram_mem[6146] =
        WHITE;
      
        sram_mem[6147] =
        NUMBER(2);
      
        sram_mem[6148] =
        WHITE;
      
        sram_mem[6149] =
        NUMBER(2);
      
        sram_mem[6150] =
        WHITE;
      
    
      
        sram_mem[6151] =
        WHITE;
      
        sram_mem[6152] =
        WHITE;
      
        sram_mem[6153] =
        WHITE;
      
        sram_mem[6154] =
        WHITE;
      
        sram_mem[6155] =
        WHITE;
      
        sram_mem[6156] =
        WHITE;
      
        sram_mem[6157] =
        WHITE;
      
    
      
        sram_mem[6158] =
        NUMBER(5);
      
        sram_mem[6159] =
        WHITE;
      
        sram_mem[6160] =
        WHITE;
      
        sram_mem[6161] =
        WHITE;
      
        sram_mem[6162] =
        NUMBER(2);
      
        sram_mem[6163] =
        WHITE;
      
        sram_mem[6164] =
        WHITE;
      
    
      
        sram_mem[6165] =
        WHITE;
      
        sram_mem[6166] =
        WHITE;
      
        sram_mem[6167] =
        WHITE;
      
        sram_mem[6168] =
        WHITE;
      
        sram_mem[6169] =
        WHITE;
      
        sram_mem[6170] =
        WHITE;
      
        sram_mem[6171] =
        WHITE;
      
    
      
        sram_mem[6172] =
        WHITE;
      
        sram_mem[6173] =
        WHITE;
      
        sram_mem[6174] =
        WHITE;
      
        sram_mem[6175] =
        NUMBER(3);
      
        sram_mem[6176] =
        WHITE;
      
        sram_mem[6177] =
        WHITE;
      
        sram_mem[6178] =
        WHITE;
      
    
      
        sram_mem[6179] =
        NUMBER(2);
      
        sram_mem[6180] =
        WHITE;
      
        sram_mem[6181] =
        NUMBER(1);
      
        sram_mem[6182] =
        WHITE;
      
        sram_mem[6183] =
        WHITE;
      
        sram_mem[6184] =
        WHITE;
      
        sram_mem[6185] =
        WHITE;
      
    
      
        sram_mem[6186] =
        WHITE;
      
        sram_mem[6187] =
        WHITE;
      
        sram_mem[6188] =
        WHITE;
      
        sram_mem[6189] =
        WHITE;
      
        sram_mem[6190] =
        NUMBER(2);
      
        sram_mem[6191] =
        WHITE;
      
        sram_mem[6192] =
        WHITE;
      
    
  
    sram_mem[14] = 10;
    sram_mem[15] = 10;
    
      
        sram_mem[7168] =
        NUMBER(3);
      
        sram_mem[7169] =
        WHITE;
      
        sram_mem[7170] =
        NUMBER(3);
      
        sram_mem[7171] =
        WHITE;
      
        sram_mem[7172] =
        WHITE;
      
        sram_mem[7173] =
        NUMBER(3);
      
        sram_mem[7174] =
        WHITE;
      
        sram_mem[7175] =
        NUMBER(2);
      
        sram_mem[7176] =
        WHITE;
      
        sram_mem[7177] =
        NUMBER(4);
      
    
      
        sram_mem[7178] =
        WHITE;
      
        sram_mem[7179] =
        WHITE;
      
        sram_mem[7180] =
        WHITE;
      
        sram_mem[7181] =
        WHITE;
      
        sram_mem[7182] =
        WHITE;
      
        sram_mem[7183] =
        WHITE;
      
        sram_mem[7184] =
        WHITE;
      
        sram_mem[7185] =
        WHITE;
      
        sram_mem[7186] =
        WHITE;
      
        sram_mem[7187] =
        WHITE;
      
    
      
        sram_mem[7188] =
        WHITE;
      
        sram_mem[7189] =
        WHITE;
      
        sram_mem[7190] =
        NUMBER(3);
      
        sram_mem[7191] =
        WHITE;
      
        sram_mem[7192] =
        WHITE;
      
        sram_mem[7193] =
        WHITE;
      
        sram_mem[7194] =
        WHITE;
      
        sram_mem[7195] =
        WHITE;
      
        sram_mem[7196] =
        WHITE;
      
        sram_mem[7197] =
        WHITE;
      
    
      
        sram_mem[7198] =
        WHITE;
      
        sram_mem[7199] =
        WHITE;
      
        sram_mem[7200] =
        WHITE;
      
        sram_mem[7201] =
        WHITE;
      
        sram_mem[7202] =
        NUMBER(2);
      
        sram_mem[7203] =
        WHITE;
      
        sram_mem[7204] =
        NUMBER(7);
      
        sram_mem[7205] =
        WHITE;
      
        sram_mem[7206] =
        WHITE;
      
        sram_mem[7207] =
        WHITE;
      
    
      
        sram_mem[7208] =
        NUMBER(1);
      
        sram_mem[7209] =
        WHITE;
      
        sram_mem[7210] =
        WHITE;
      
        sram_mem[7211] =
        WHITE;
      
        sram_mem[7212] =
        WHITE;
      
        sram_mem[7213] =
        WHITE;
      
        sram_mem[7214] =
        WHITE;
      
        sram_mem[7215] =
        WHITE;
      
        sram_mem[7216] =
        WHITE;
      
        sram_mem[7217] =
        WHITE;
      
    
      
        sram_mem[7218] =
        WHITE;
      
        sram_mem[7219] =
        WHITE;
      
        sram_mem[7220] =
        WHITE;
      
        sram_mem[7221] =
        WHITE;
      
        sram_mem[7222] =
        WHITE;
      
        sram_mem[7223] =
        NUMBER(2);
      
        sram_mem[7224] =
        WHITE;
      
        sram_mem[7225] =
        WHITE;
      
        sram_mem[7226] =
        WHITE;
      
        sram_mem[7227] =
        WHITE;
      
    
      
        sram_mem[7228] =
        NUMBER(4);
      
        sram_mem[7229] =
        WHITE;
      
        sram_mem[7230] =
        NUMBER(4);
      
        sram_mem[7231] =
        WHITE;
      
        sram_mem[7232] =
        WHITE;
      
        sram_mem[7233] =
        WHITE;
      
        sram_mem[7234] =
        WHITE;
      
        sram_mem[7235] =
        WHITE;
      
        sram_mem[7236] =
        WHITE;
      
        sram_mem[7237] =
        WHITE;
      
    
      
        sram_mem[7238] =
        WHITE;
      
        sram_mem[7239] =
        WHITE;
      
        sram_mem[7240] =
        WHITE;
      
        sram_mem[7241] =
        WHITE;
      
        sram_mem[7242] =
        WHITE;
      
        sram_mem[7243] =
        WHITE;
      
        sram_mem[7244] =
        NUMBER(2);
      
        sram_mem[7245] =
        WHITE;
      
        sram_mem[7246] =
        WHITE;
      
        sram_mem[7247] =
        WHITE;
      
    
      
        sram_mem[7248] =
        WHITE;
      
        sram_mem[7249] =
        WHITE;
      
        sram_mem[7250] =
        WHITE;
      
        sram_mem[7251] =
        WHITE;
      
        sram_mem[7252] =
        WHITE;
      
        sram_mem[7253] =
        WHITE;
      
        sram_mem[7254] =
        WHITE;
      
        sram_mem[7255] =
        WHITE;
      
        sram_mem[7256] =
        WHITE;
      
        sram_mem[7257] =
        WHITE;
      
    
      
        sram_mem[7258] =
        WHITE;
      
        sram_mem[7259] =
        WHITE;
      
        sram_mem[7260] =
        WHITE;
      
        sram_mem[7261] =
        NUMBER(2);
      
        sram_mem[7262] =
        WHITE;
      
        sram_mem[7263] =
        WHITE;
      
        sram_mem[7264] =
        WHITE;
      
        sram_mem[7265] =
        WHITE;
      
        sram_mem[7266] =
        NUMBER(1);
      
        sram_mem[7267] =
        WHITE;
      
    
  
    sram_mem[16] = 10;
    sram_mem[17] = 10;
    
      
        sram_mem[8192] =
        WHITE;
      
        sram_mem[8193] =
        WHITE;
      
        sram_mem[8194] =
        WHITE;
      
        sram_mem[8195] =
        NUMBER(4);
      
        sram_mem[8196] =
        WHITE;
      
        sram_mem[8197] =
        WHITE;
      
        sram_mem[8198] =
        NUMBER(2);
      
        sram_mem[8199] =
        WHITE;
      
        sram_mem[8200] =
        NUMBER(4);
      
        sram_mem[8201] =
        WHITE;
      
    
      
        sram_mem[8202] =
        NUMBER(3);
      
        sram_mem[8203] =
        WHITE;
      
        sram_mem[8204] =
        WHITE;
      
        sram_mem[8205] =
        WHITE;
      
        sram_mem[8206] =
        WHITE;
      
        sram_mem[8207] =
        WHITE;
      
        sram_mem[8208] =
        WHITE;
      
        sram_mem[8209] =
        WHITE;
      
        sram_mem[8210] =
        WHITE;
      
        sram_mem[8211] =
        WHITE;
      
    
      
        sram_mem[8212] =
        WHITE;
      
        sram_mem[8213] =
        WHITE;
      
        sram_mem[8214] =
        WHITE;
      
        sram_mem[8215] =
        WHITE;
      
        sram_mem[8216] =
        WHITE;
      
        sram_mem[8217] =
        WHITE;
      
        sram_mem[8218] =
        WHITE;
      
        sram_mem[8219] =
        WHITE;
      
        sram_mem[8220] =
        WHITE;
      
        sram_mem[8221] =
        WHITE;
      
    
      
        sram_mem[8222] =
        NUMBER(5);
      
        sram_mem[8223] =
        WHITE;
      
        sram_mem[8224] =
        NUMBER(1);
      
        sram_mem[8225] =
        WHITE;
      
        sram_mem[8226] =
        WHITE;
      
        sram_mem[8227] =
        WHITE;
      
        sram_mem[8228] =
        NUMBER(3);
      
        sram_mem[8229] =
        WHITE;
      
        sram_mem[8230] =
        WHITE;
      
        sram_mem[8231] =
        WHITE;
      
    
      
        sram_mem[8232] =
        WHITE;
      
        sram_mem[8233] =
        WHITE;
      
        sram_mem[8234] =
        WHITE;
      
        sram_mem[8235] =
        NUMBER(1);
      
        sram_mem[8236] =
        WHITE;
      
        sram_mem[8237] =
        NUMBER(4);
      
        sram_mem[8238] =
        WHITE;
      
        sram_mem[8239] =
        WHITE;
      
        sram_mem[8240] =
        NUMBER(3);
      
        sram_mem[8241] =
        WHITE;
      
    
      
        sram_mem[8242] =
        WHITE;
      
        sram_mem[8243] =
        WHITE;
      
        sram_mem[8244] =
        WHITE;
      
        sram_mem[8245] =
        WHITE;
      
        sram_mem[8246] =
        WHITE;
      
        sram_mem[8247] =
        WHITE;
      
        sram_mem[8248] =
        WHITE;
      
        sram_mem[8249] =
        WHITE;
      
        sram_mem[8250] =
        WHITE;
      
        sram_mem[8251] =
        WHITE;
      
    
      
        sram_mem[8252] =
        WHITE;
      
        sram_mem[8253] =
        WHITE;
      
        sram_mem[8254] =
        NUMBER(4);
      
        sram_mem[8255] =
        WHITE;
      
        sram_mem[8256] =
        WHITE;
      
        sram_mem[8257] =
        WHITE;
      
        sram_mem[8258] =
        WHITE;
      
        sram_mem[8259] =
        WHITE;
      
        sram_mem[8260] =
        WHITE;
      
        sram_mem[8261] =
        WHITE;
      
    
      
        sram_mem[8262] =
        NUMBER(3);
      
        sram_mem[8263] =
        WHITE;
      
        sram_mem[8264] =
        WHITE;
      
        sram_mem[8265] =
        WHITE;
      
        sram_mem[8266] =
        WHITE;
      
        sram_mem[8267] =
        WHITE;
      
        sram_mem[8268] =
        WHITE;
      
        sram_mem[8269] =
        WHITE;
      
        sram_mem[8270] =
        WHITE;
      
        sram_mem[8271] =
        WHITE;
      
    
      
        sram_mem[8272] =
        WHITE;
      
        sram_mem[8273] =
        WHITE;
      
        sram_mem[8274] =
        WHITE;
      
        sram_mem[8275] =
        WHITE;
      
        sram_mem[8276] =
        WHITE;
      
        sram_mem[8277] =
        NUMBER(3);
      
        sram_mem[8278] =
        WHITE;
      
        sram_mem[8279] =
        WHITE;
      
        sram_mem[8280] =
        WHITE;
      
        sram_mem[8281] =
        NUMBER(1);
      
    
      
        sram_mem[8282] =
        WHITE;
      
        sram_mem[8283] =
        WHITE;
      
        sram_mem[8284] =
        WHITE;
      
        sram_mem[8285] =
        NUMBER(1);
      
        sram_mem[8286] =
        WHITE;
      
        sram_mem[8287] =
        WHITE;
      
        sram_mem[8288] =
        WHITE;
      
        sram_mem[8289] =
        WHITE;
      
        sram_mem[8290] =
        WHITE;
      
        sram_mem[8291] =
        WHITE;
      
    
  
    sram_mem[18] = 10;
    sram_mem[19] = 10;
    
      
        sram_mem[9216] =
        NUMBER(3);
      
        sram_mem[9217] =
        WHITE;
      
        sram_mem[9218] =
        NUMBER(1);
      
        sram_mem[9219] =
        WHITE;
      
        sram_mem[9220] =
        NUMBER(3);
      
        sram_mem[9221] =
        WHITE;
      
        sram_mem[9222] =
        WHITE;
      
        sram_mem[9223] =
        WHITE;
      
        sram_mem[9224] =
        NUMBER(5);
      
        sram_mem[9225] =
        WHITE;
      
    
      
        sram_mem[9226] =
        WHITE;
      
        sram_mem[9227] =
        WHITE;
      
        sram_mem[9228] =
        WHITE;
      
        sram_mem[9229] =
        WHITE;
      
        sram_mem[9230] =
        WHITE;
      
        sram_mem[9231] =
        WHITE;
      
        sram_mem[9232] =
        WHITE;
      
        sram_mem[9233] =
        WHITE;
      
        sram_mem[9234] =
        WHITE;
      
        sram_mem[9235] =
        WHITE;
      
    
      
        sram_mem[9236] =
        WHITE;
      
        sram_mem[9237] =
        WHITE;
      
        sram_mem[9238] =
        NUMBER(1);
      
        sram_mem[9239] =
        WHITE;
      
        sram_mem[9240] =
        NUMBER(6);
      
        sram_mem[9241] =
        WHITE;
      
        sram_mem[9242] =
        WHITE;
      
        sram_mem[9243] =
        WHITE;
      
        sram_mem[9244] =
        WHITE;
      
        sram_mem[9245] =
        WHITE;
      
    
      
        sram_mem[9246] =
        WHITE;
      
        sram_mem[9247] =
        NUMBER(2);
      
        sram_mem[9248] =
        WHITE;
      
        sram_mem[9249] =
        NUMBER(11);
      
        sram_mem[9250] =
        WHITE;
      
        sram_mem[9251] =
        WHITE;
      
        sram_mem[9252] =
        WHITE;
      
        sram_mem[9253] =
        WHITE;
      
        sram_mem[9254] =
        WHITE;
      
        sram_mem[9255] =
        WHITE;
      
    
      
        sram_mem[9256] =
        WHITE;
      
        sram_mem[9257] =
        WHITE;
      
        sram_mem[9258] =
        WHITE;
      
        sram_mem[9259] =
        WHITE;
      
        sram_mem[9260] =
        WHITE;
      
        sram_mem[9261] =
        WHITE;
      
        sram_mem[9262] =
        WHITE;
      
        sram_mem[9263] =
        WHITE;
      
        sram_mem[9264] =
        WHITE;
      
        sram_mem[9265] =
        NUMBER(1);
      
    
      
        sram_mem[9266] =
        WHITE;
      
        sram_mem[9267] =
        WHITE;
      
        sram_mem[9268] =
        WHITE;
      
        sram_mem[9269] =
        WHITE;
      
        sram_mem[9270] =
        WHITE;
      
        sram_mem[9271] =
        WHITE;
      
        sram_mem[9272] =
        WHITE;
      
        sram_mem[9273] =
        WHITE;
      
        sram_mem[9274] =
        WHITE;
      
        sram_mem[9275] =
        WHITE;
      
    
      
        sram_mem[9276] =
        NUMBER(3);
      
        sram_mem[9277] =
        WHITE;
      
        sram_mem[9278] =
        NUMBER(1);
      
        sram_mem[9279] =
        WHITE;
      
        sram_mem[9280] =
        WHITE;
      
        sram_mem[9281] =
        WHITE;
      
        sram_mem[9282] =
        WHITE;
      
        sram_mem[9283] =
        NUMBER(3);
      
        sram_mem[9284] =
        WHITE;
      
        sram_mem[9285] =
        WHITE;
      
    
      
        sram_mem[9286] =
        WHITE;
      
        sram_mem[9287] =
        WHITE;
      
        sram_mem[9288] =
        WHITE;
      
        sram_mem[9289] =
        NUMBER(2);
      
        sram_mem[9290] =
        WHITE;
      
        sram_mem[9291] =
        WHITE;
      
        sram_mem[9292] =
        WHITE;
      
        sram_mem[9293] =
        WHITE;
      
        sram_mem[9294] =
        WHITE;
      
        sram_mem[9295] =
        WHITE;
      
    
      
        sram_mem[9296] =
        WHITE;
      
        sram_mem[9297] =
        WHITE;
      
        sram_mem[9298] =
        WHITE;
      
        sram_mem[9299] =
        WHITE;
      
        sram_mem[9300] =
        WHITE;
      
        sram_mem[9301] =
        WHITE;
      
        sram_mem[9302] =
        WHITE;
      
        sram_mem[9303] =
        WHITE;
      
        sram_mem[9304] =
        WHITE;
      
        sram_mem[9305] =
        WHITE;
      
    
      
        sram_mem[9306] =
        NUMBER(2);
      
        sram_mem[9307] =
        WHITE;
      
        sram_mem[9308] =
        WHITE;
      
        sram_mem[9309] =
        WHITE;
      
        sram_mem[9310] =
        WHITE;
      
        sram_mem[9311] =
        WHITE;
      
        sram_mem[9312] =
        WHITE;
      
        sram_mem[9313] =
        WHITE;
      
        sram_mem[9314] =
        WHITE;
      
        sram_mem[9315] =
        WHITE;
      
    
  
    sram_mem[20] = 12;
    sram_mem[21] = 12;
    
      
        sram_mem[10240] =
        NUMBER(7);
      
        sram_mem[10241] =
        WHITE;
      
        sram_mem[10242] =
        NUMBER(2);
      
        sram_mem[10243] =
        WHITE;
      
        sram_mem[10244] =
        WHITE;
      
        sram_mem[10245] =
        NUMBER(2);
      
        sram_mem[10246] =
        WHITE;
      
        sram_mem[10247] =
        NUMBER(3);
      
        sram_mem[10248] =
        WHITE;
      
        sram_mem[10249] =
        WHITE;
      
        sram_mem[10250] =
        NUMBER(1);
      
        sram_mem[10251] =
        WHITE;
      
    
      
        sram_mem[10252] =
        WHITE;
      
        sram_mem[10253] =
        WHITE;
      
        sram_mem[10254] =
        WHITE;
      
        sram_mem[10255] =
        WHITE;
      
        sram_mem[10256] =
        WHITE;
      
        sram_mem[10257] =
        WHITE;
      
        sram_mem[10258] =
        WHITE;
      
        sram_mem[10259] =
        WHITE;
      
        sram_mem[10260] =
        WHITE;
      
        sram_mem[10261] =
        WHITE;
      
        sram_mem[10262] =
        WHITE;
      
        sram_mem[10263] =
        WHITE;
      
    
      
        sram_mem[10264] =
        WHITE;
      
        sram_mem[10265] =
        WHITE;
      
        sram_mem[10266] =
        WHITE;
      
        sram_mem[10267] =
        WHITE;
      
        sram_mem[10268] =
        WHITE;
      
        sram_mem[10269] =
        WHITE;
      
        sram_mem[10270] =
        NUMBER(1);
      
        sram_mem[10271] =
        WHITE;
      
        sram_mem[10272] =
        WHITE;
      
        sram_mem[10273] =
        NUMBER(2);
      
        sram_mem[10274] =
        WHITE;
      
        sram_mem[10275] =
        WHITE;
      
    
      
        sram_mem[10276] =
        WHITE;
      
        sram_mem[10277] =
        WHITE;
      
        sram_mem[10278] =
        WHITE;
      
        sram_mem[10279] =
        WHITE;
      
        sram_mem[10280] =
        WHITE;
      
        sram_mem[10281] =
        NUMBER(3);
      
        sram_mem[10282] =
        WHITE;
      
        sram_mem[10283] =
        WHITE;
      
        sram_mem[10284] =
        NUMBER(2);
      
        sram_mem[10285] =
        WHITE;
      
        sram_mem[10286] =
        WHITE;
      
        sram_mem[10287] =
        WHITE;
      
    
      
        sram_mem[10288] =
        NUMBER(2);
      
        sram_mem[10289] =
        WHITE;
      
        sram_mem[10290] =
        WHITE;
      
        sram_mem[10291] =
        WHITE;
      
        sram_mem[10292] =
        WHITE;
      
        sram_mem[10293] =
        WHITE;
      
        sram_mem[10294] =
        WHITE;
      
        sram_mem[10295] =
        WHITE;
      
        sram_mem[10296] =
        WHITE;
      
        sram_mem[10297] =
        WHITE;
      
        sram_mem[10298] =
        NUMBER(3);
      
        sram_mem[10299] =
        WHITE;
      
    
      
        sram_mem[10300] =
        WHITE;
      
        sram_mem[10301] =
        WHITE;
      
        sram_mem[10302] =
        NUMBER(3);
      
        sram_mem[10303] =
        WHITE;
      
        sram_mem[10304] =
        WHITE;
      
        sram_mem[10305] =
        WHITE;
      
        sram_mem[10306] =
        WHITE;
      
        sram_mem[10307] =
        WHITE;
      
        sram_mem[10308] =
        WHITE;
      
        sram_mem[10309] =
        WHITE;
      
        sram_mem[10310] =
        WHITE;
      
        sram_mem[10311] =
        WHITE;
      
    
      
        sram_mem[10312] =
        NUMBER(3);
      
        sram_mem[10313] =
        WHITE;
      
        sram_mem[10314] =
        WHITE;
      
        sram_mem[10315] =
        WHITE;
      
        sram_mem[10316] =
        WHITE;
      
        sram_mem[10317] =
        NUMBER(3);
      
        sram_mem[10318] =
        WHITE;
      
        sram_mem[10319] =
        WHITE;
      
        sram_mem[10320] =
        NUMBER(1);
      
        sram_mem[10321] =
        WHITE;
      
        sram_mem[10322] =
        NUMBER(3);
      
        sram_mem[10323] =
        WHITE;
      
    
      
        sram_mem[10324] =
        WHITE;
      
        sram_mem[10325] =
        WHITE;
      
        sram_mem[10326] =
        NUMBER(3);
      
        sram_mem[10327] =
        WHITE;
      
        sram_mem[10328] =
        WHITE;
      
        sram_mem[10329] =
        WHITE;
      
        sram_mem[10330] =
        WHITE;
      
        sram_mem[10331] =
        WHITE;
      
        sram_mem[10332] =
        WHITE;
      
        sram_mem[10333] =
        WHITE;
      
        sram_mem[10334] =
        WHITE;
      
        sram_mem[10335] =
        WHITE;
      
    
      
        sram_mem[10336] =
        WHITE;
      
        sram_mem[10337] =
        WHITE;
      
        sram_mem[10338] =
        WHITE;
      
        sram_mem[10339] =
        WHITE;
      
        sram_mem[10340] =
        WHITE;
      
        sram_mem[10341] =
        NUMBER(2);
      
        sram_mem[10342] =
        WHITE;
      
        sram_mem[10343] =
        NUMBER(6);
      
        sram_mem[10344] =
        WHITE;
      
        sram_mem[10345] =
        WHITE;
      
        sram_mem[10346] =
        WHITE;
      
        sram_mem[10347] =
        WHITE;
      
    
      
        sram_mem[10348] =
        WHITE;
      
        sram_mem[10349] =
        WHITE;
      
        sram_mem[10350] =
        WHITE;
      
        sram_mem[10351] =
        WHITE;
      
        sram_mem[10352] =
        WHITE;
      
        sram_mem[10353] =
        WHITE;
      
        sram_mem[10354] =
        WHITE;
      
        sram_mem[10355] =
        WHITE;
      
        sram_mem[10356] =
        WHITE;
      
        sram_mem[10357] =
        WHITE;
      
        sram_mem[10358] =
        WHITE;
      
        sram_mem[10359] =
        WHITE;
      
    
      
        sram_mem[10360] =
        NUMBER(5);
      
        sram_mem[10361] =
        WHITE;
      
        sram_mem[10362] =
        WHITE;
      
        sram_mem[10363] =
        NUMBER(2);
      
        sram_mem[10364] =
        WHITE;
      
        sram_mem[10365] =
        WHITE;
      
        sram_mem[10366] =
        NUMBER(1);
      
        sram_mem[10367] =
        WHITE;
      
        sram_mem[10368] =
        WHITE;
      
        sram_mem[10369] =
        WHITE;
      
        sram_mem[10370] =
        WHITE;
      
        sram_mem[10371] =
        WHITE;
      
    
      
        sram_mem[10372] =
        WHITE;
      
        sram_mem[10373] =
        WHITE;
      
        sram_mem[10374] =
        WHITE;
      
        sram_mem[10375] =
        WHITE;
      
        sram_mem[10376] =
        WHITE;
      
        sram_mem[10377] =
        WHITE;
      
        sram_mem[10378] =
        WHITE;
      
        sram_mem[10379] =
        WHITE;
      
        sram_mem[10380] =
        WHITE;
      
        sram_mem[10381] =
        WHITE;
      
        sram_mem[10382] =
        WHITE;
      
        sram_mem[10383] =
        WHITE;
      
    
  
}
Beispiel #18
0
Json::Value rpcError(int iError, Json::Value jvResult)
{
	static struct {
		int			iError;
		const char*	pToken;
		const char*	pMessage;
	} errorInfoA[] = {
		{ rpcACT_EXISTS,			"actExists",		"Account already exists."								},
		{ rpcACT_MALFORMED,			"actMalformed",		"Account malformed."									},
		{ rpcACT_NOT_FOUND,			"actNotFound",		"Account not found."									},
		{ rpcBAD_BLOB,				"badBlob",			"Blob must be a non-empty hex string."					},
		{ rpcBAD_SEED,				"badSeed",			"Disallowed seed."										},
		{ rpcBAD_SYNTAX,			"badSyntax",		"Syntax error."											},
		{ rpcCOMMAND_MISSING,		"commandMissing",	"Missing command entry."								},
		{ rpcDST_ACT_MALFORMED,		"dstActMalformed",	"Destination account is malformed."						},
		{ rpcDST_ACT_MISSING,		"dstActMissing",	"Destination account does not exists."					},
		{ rpcDST_AMT_MALFORMED,		"dstAmtMalformed",	"Destination amount/currency/issuer is malformed."		},
		{ rpcFORBIDDEN,				"forbidden",		"Bad credentials."										},
		{ rpcFAIL_GEN_DECRPYT,		"failGenDecrypt",	"Failed to decrypt generator."							},
		{ rpcGETS_ACT_MALFORMED,	"getsActMalformed",	"Gets account malformed."								},
		{ rpcGETS_AMT_MALFORMED,	"getsAmtMalformed",	"Gets amount malformed."								},
		{ rpcHOST_IP_MALFORMED,		"hostIpMalformed",	"Host IP is malformed."									},
		{ rpcINSUF_FUNDS,			"insufFunds",		"Insufficient funds."									},
		{ rpcINTERNAL,				"internal",			"Internal error."										},
		{ rpcINVALID_PARAMS,		"invalidParams",	"Invalid parameters."									},
		{ rpcJSON_RPC,				"json_rpc",			"JSON-RPC transport error."								},
		{ rpcLGR_IDXS_INVALID,		"lgrIdxsInvalid",	"Ledger indexes invalid."								},
		{ rpcLGR_IDX_MALFORMED,		"lgrIdxMalformed",	"Ledger index malformed."								},
		{ rpcLGR_NOT_FOUND,			"lgrNotFound",		"Ledger not found."										},
		{ rpcNICKNAME_MALFORMED,	"nicknameMalformed","Nickname is malformed."								},
		{ rpcNICKNAME_MISSING,		"nicknameMissing",	"Nickname does not exist."								},
		{ rpcNICKNAME_PERM,			"nicknamePerm",		"Account does not control nickname."					},
		{ rpcNOT_IMPL,				"notImpl",			"Not implemented."										},
		{ rpcNO_ACCOUNT,			"noAccount",		"No such account."										},
		{ rpcNO_CLOSED,				"noClosed",			"Closed ledger is unavailable."							},
		{ rpcNO_CURRENT,			"noCurrent",		"Current ledger is unavailable."						},
		{ rpcNO_EVENTS,				"noEvents",			"Current transport does not support events."			},
		{ rpcNO_GEN_DECRPYT,		"noGenDectypt",		"Password failed to decrypt master public generator."	},
		{ rpcNO_NETWORK,			"noNetwork",		"Network not available."								},
		{ rpcNO_PATH,				"noPath",			"Unable to find a ripple path."							},
		{ rpcNO_PERMISSION,			"noPermission",		"You don't have permission for this command."			},
		{ rpcNOT_STANDALONE,		"notStandAlone",	"Operation valid in debug mode only."					},
		{ rpcNOT_SUPPORTED,			"notSupported",		"Operation not supported."								},
		{ rpcPASSWD_CHANGED,		"passwdChanged",	"Wrong key, password changed."							},
		{ rpcPAYS_ACT_MALFORMED,	"paysActMalformed",	"Pays account malformed."								},
		{ rpcPAYS_AMT_MALFORMED,	"paysAmtMalformed",	"Pays amount malformed."								},
		{ rpcPORT_MALFORMED,		"portMalformed",	"Port is malformed."									},
		{ rpcPUBLIC_MALFORMED,		"publicMalformed",	"Public key is malformed."								},
		{ rpcQUALITY_MALFORMED,		"qualityMalformed",	"Quality malformed."									},
		{ rpcSRC_ACT_MALFORMED,		"srcActMalformed",	"Source account is malformed."							},
		{ rpcSRC_ACT_MISSING,		"srcActMissing",	"Source account not provided."							},
		{ rpcSRC_ACT_NOT_FOUND,		"srcActNotFound",	"Source amount not found."								},
		{ rpcSRC_AMT_MALFORMED,		"srcAmtMalformed",	"Source amount/currency/issuer is malformed."			},
		{ rpcSRC_CUR_MALFORMED,		"srcCurMalformed",	"Source currency is malformed."							},
		{ rpcSRC_ISR_MALFORMED,		"srcIsrMalformed",	"Source issuer is malformed."							},
		{ rpcSRC_UNCLAIMED,			"srcUnclaimed",		"Source account is not claimed."						},
		{ rpcTXN_NOT_FOUND,			"txnNotFound",		"Transaction not found."								},
		{ rpcUNKNOWN_COMMAND,		"unknownCmd",		"Unknown method."										},
		{ rpcWRONG_SEED,			"wrongSeed",		"The regular key does not point as the master key."		},
	};

	int		i;

	for (i=NUMBER(errorInfoA); i-- && errorInfoA[i].iError != iError;)
		;

	jvResult["error"]			= i >= 0 ? errorInfoA[i].pToken : lexical_cast_i(iError);
	jvResult["error_message"]	= i >= 0 ? errorInfoA[i].pMessage : lexical_cast_i(iError);
	jvResult["error_code"]		= iError;

	if (i >= 0)
	{
		cLog(lsDEBUG) << "rpcError: "
			<< errorInfoA[i].pToken << ": " << errorInfoA[i].pMessage << std::endl;
	}

	return jvResult;
}
Beispiel #19
0
Json::Value RPCHandler::doCommand (const Json::Value& params, int iRole, Resource::Charge& loadType)
{
    if (iRole != Config::ADMIN)
    {
        // VFALCO NOTE Should we also add up the jtRPC jobs?
        //
        int jc = getApp().getJobQueue ().getJobCountGE (jtCLIENT);

        if (jc > 500)
        {
            WriteLog (lsDEBUG, RPCHandler) << "Too busy for command: " << jc;
            return rpcError (rpcTOO_BUSY);
        }
    }

    if (!params.isMember ("command"))
        return rpcError (rpcCOMMAND_MISSING);

    std::string     strCommand  = params[jss::command].asString ();

    WriteLog (lsTRACE, RPCHandler) << "COMMAND:" << strCommand;
    WriteLog (lsTRACE, RPCHandler) << "REQUEST:" << params;

    mRole   = iRole;

    static struct
    {
        const char*     pCommand;
        doFuncPtr       dfpFunc;
        bool            bAdminRequired;
        unsigned int    iOptions;
    } commandsA[] =
    {
        // Request-response methods
        {   "account_info",         &RPCHandler::doAccountInfo,         false,  optCurrent  },
        {   "account_currencies",   &RPCHandler::doAccountCurrencies,   false,  optCurrent  },
        {   "account_lines",        &RPCHandler::doAccountLines,        false,  optCurrent  },
        {   "account_offers",       &RPCHandler::doAccountOffers,       false,  optCurrent  },
        {   "account_tx",           &RPCHandler::doAccountTxSwitch,     false,  optNetwork  },
        {   "blacklist",            &RPCHandler::doBlackList,           true,   optNone     },
        {   "book_offers",          &RPCHandler::doBookOffers,          false,  optCurrent  },
        {   "connect",              &RPCHandler::doConnect,             true,   optNone     },
        {   "consensus_info",       &RPCHandler::doConsensusInfo,       true,   optNone     },
        {   "get_counts",           &RPCHandler::doGetCounts,           true,   optNone     },
		{	"inflate",				&RPCHandler::doInflate,				false,	optNone		},
        {   "internal",             &RPCHandler::doInternal,            true,   optNone     },
        {   "feature",              &RPCHandler::doFeature,             true,   optNone     },
        {   "fetch_info",           &RPCHandler::doFetchInfo,           true,   optNone     },
        {   "ledger",               &RPCHandler::doLedger,              false,  optNetwork  },
        {   "ledger_accept",        &RPCHandler::doLedgerAccept,        false,   optCurrent  },
        {   "ledger_cleaner",       &RPCHandler::doLedgerCleaner,       true,   optNetwork  },
        {   "ledger_closed",        &RPCHandler::doLedgerClosed,        false,  optClosed   },
        {   "ledger_current",       &RPCHandler::doLedgerCurrent,       false,  optCurrent  },
        {   "ledger_data",          &RPCHandler::doLedgerData,          false,  optCurrent  },
        {   "ledger_entry",         &RPCHandler::doLedgerEntry,         false,  optCurrent  },
        {   "ledger_header",        &RPCHandler::doLedgerHeader,        false,  optCurrent  },
        {   "log_level",            &RPCHandler::doLogLevel,            true,   optNone     },
        {   "logrotate",            &RPCHandler::doLogRotate,           true,   optNone     },
//      {   "nickname_info",        &RPCHandler::doNicknameInfo,        false,  optCurrent  },
        {   "owner_info",           &RPCHandler::doOwnerInfo,           false,  optCurrent  },
        {   "peers",                &RPCHandler::doPeers,               true,   optNone     },
        {   "find_path",            &RPCHandler::doPathFind,            false,  optCurrent  },
        {   "ping",                 &RPCHandler::doPing,                false,  optNone     },
        {   "print",                &RPCHandler::doPrint,               true,   optNone     },
//      {   "profile",              &RPCHandler::doProfile,             false,  optCurrent  },
        {   "proof_create",         &RPCHandler::doProofCreate,         true,   optNone     },
        {   "proof_solve",          &RPCHandler::doProofSolve,          true,   optNone     },
        {   "proof_verify",         &RPCHandler::doProofVerify,         true,   optNone     },
        {   "random",               &RPCHandler::doRandom,              false,  optNone     },
        {   "static_path_find",     &RPCHandler::doRipplePathFind,      false,  optCurrent  },
        {   "sign",                 &RPCHandler::doSign,                false,  optNone     },
        {   "submit",               &RPCHandler::doSubmit,              false,  optCurrent  },
        {   "server_info",          &RPCHandler::doServerInfo,          false,  optNone     },
        {   "server_state",         &RPCHandler::doServerState,         false,  optNone     },
        {   "sms",                  &RPCHandler::doSMS,                 true,   optNone     },
        {   "stop",                 &RPCHandler::doStop,                true,   optNone     },
        {   "transaction_entry",    &RPCHandler::doTransactionEntry,    false,  optCurrent  },
        {   "tx",                   &RPCHandler::doTx,                  false,  optNetwork  },
        {   "tx_history",           &RPCHandler::doTxHistory,           false,  optNone     },
        {   "unl_add",              &RPCHandler::doUnlAdd,              true,   optNone     },
        {   "unl_delete",           &RPCHandler::doUnlDelete,           true,   optNone     },
        {   "unl_list",             &RPCHandler::doUnlList,             true,   optNone     },
        {   "unl_load",             &RPCHandler::doUnlLoad,             true,   optNone     },
        {   "unl_network",          &RPCHandler::doUnlNetwork,          true,   optNone     },
        {   "unl_reset",            &RPCHandler::doUnlReset,            true,   optNone     },
        {   "unl_score",            &RPCHandler::doUnlScore,            true,   optNone     },
        {   "validation_create",    &RPCHandler::doValidationCreate,    true,   optNone     },
        {   "validation_seed",      &RPCHandler::doValidationSeed,      true,   optNone     },
        {   "wallet_accounts",      &RPCHandler::doWalletAccounts,      false,  optCurrent  },
        {   "create_keys",       &RPCHandler::doWalletPropose,       false,   optNone     },
        {   "wallet_seed",          &RPCHandler::doWalletSeed,          true,   optNone     },

        // Evented methods
        {   "subscribe",            &RPCHandler::doSubscribe,           false,  optNone     },
        {   "unsubscribe",          &RPCHandler::doUnsubscribe,         false,  optNone     },
    };

    int     i = NUMBER (commandsA);

    while (i-- && strCommand != commandsA[i].pCommand)
        ;

    if (i < 0)
    {
        return rpcError (rpcUNKNOWN_COMMAND);
    }
    else if (commandsA[i].bAdminRequired && mRole != Config::ADMIN)
    {
        return rpcError (rpcNO_PERMISSION);
    }

    {
        Application::ScopedLockType lock (getApp().getMasterLock ());

        if ((commandsA[i].iOptions & optNetwork) && (mNetOps->getOperatingMode () < NetworkOPs::omSYNCING))
        {
            WriteLog (lsINFO, RPCHandler) << "Insufficient network mode for RPC: " << mNetOps->strOperatingMode ();

            return rpcError (rpcNO_NETWORK);
        }

        if (!getConfig ().RUN_STANDALONE && (commandsA[i].iOptions & optCurrent) && (getApp().getLedgerMaster().getValidatedLedgerAge() > 120))
        {
            return rpcError (rpcNO_CURRENT);
        }
        else if ((commandsA[i].iOptions & optClosed) && !mNetOps->getClosedLedger ())
        {
            return rpcError (rpcNO_CLOSED);
        }
        else
        {
            try
            {
                LoadEvent::autoptr ev   = getApp().getJobQueue().getLoadEventAP(
                    jtGENERIC, std::string("cmd:") + strCommand);
                Json::Value jvRaw       = (this->* (commandsA[i].dfpFunc)) (params, loadType, lock);

                // Regularize result.
                if (jvRaw.isObject ())
                {
                    // Got an object.
                    return jvRaw;
                }
                else
                {
                    // Probably got a string.
                    Json::Value jvResult (Json::objectValue);

                    jvResult[jss::message] = jvRaw;

                    return jvResult;
                }
            }
            catch (std::exception& e)
            {
                WriteLog (lsINFO, RPCHandler) << "Caught throw: " << e.what ();

                if (loadType == Resource::feeReferenceRPC)
                    loadType = Resource::feeExceptionRPC;

                return rpcError (rpcINTERNAL);
            }
        }
    }
}
Beispiel #20
0
static void read_config(void)
{
  FILE *fp;
  char file[MAX_PATH + 1];
  char line[MAX_LINE];
  char *key, *val, *p;
  long n;
  int story_matches = 1;

  zterp_os_rcfile(file, sizeof file);

  fp = fopen(file, "r");
  if(fp == NULL) return;

  while(fgets(line, sizeof line, fp) != NULL)
  {
    line[strcspn(line, "#\n")] = 0;
    if(line[0] == 0) continue;

    if(line[0] == '[')
    {
      p = strrchr(line, ']');
      if(p != NULL && p[1] == 0)
      {
        *p = 0;

        story_matches = 0;
        for(p = strtok(line + 1, " ,"); p != NULL; p = strtok(NULL, " ,"))
        {
          if(is_story(p)) story_matches = 1;
        }
      }

      continue;
    }

    if(!story_matches) continue;

    key = strtok(line, " \t=");
    if(key == NULL) continue;
    val = strtok(NULL, "=");
    if(val == NULL) continue;

    /* Trim whitespace. */
    while(isspace((unsigned char)*val)) val++;
    if(*val == 0) continue;
    p = val + strlen(val) - 1;
    while(isspace((unsigned char)*p)) *p-- = 0;

    n = strtol(val, NULL, 10);

#define BOOL(name)	else if(strcmp(key, #name) == 0) options.name = (n != 0)
#define NUMBER(name)	else if(strcmp(key, #name) == 0) options.name = n
#define STRING(name)	else if(strcmp(key, #name) == 0) do { free(options.name); options.name = xstrdup(val); } while(0)
#define CHAR(name)	else if(strcmp(key, #name) == 0) options.name = val[0]
#ifdef GARGLK
#define COLOR(name, num)else if(strcmp(key, "color_" #name) == 0) update_color(num, strtol(val, NULL, 16))
#else
#define COLOR(name, num)else if(0)
#endif

    if(0);

    NUMBER(eval_stack_size);
    NUMBER(call_stack_size);
    BOOL  (disable_color);
    BOOL  (disable_timed);
    BOOL  (disable_sound);
    BOOL  (enable_escape);
    STRING(escape_string);
    BOOL  (disable_fixed);
    BOOL  (assume_fixed);
    BOOL  (disable_graphics_font);
    BOOL  (enable_alt_graphics);
    BOOL  (disable_term_keys);
    BOOL  (disable_utf8);
    BOOL  (force_utf8);
    BOOL  (disable_meta_commands);
    NUMBER(max_saves);
    BOOL  (disable_undo_compression);
    NUMBER(int_number);
    CHAR  (int_version);
    BOOL  (replay_on);
    STRING(replay_name);
    BOOL  (record_on);
    STRING(record_name);
    BOOL  (transcript_on);
    STRING(transcript_name);
    BOOL  (disable_abbreviations);
    BOOL  (enable_censorship);
    BOOL  (overwrite_transcript);
    NUMBER(random_seed);
    STRING(random_device);

    COLOR(black,   2);
    COLOR(red,     3);
    COLOR(green,   4);
    COLOR(yellow,  5);
    COLOR(blue,    6);
    COLOR(magenta, 7);
    COLOR(cyan,    8);
    COLOR(white,   9);

#ifndef ZTERP_NO_CHEAT
    else if(strcmp(key, "cheat") == 0) cheat(val);
#endif

#undef BOOL
#undef NUMBER
#undef STRING
#undef CHAR
#undef COLOR
  }
Beispiel #21
0
int Board::number(int row, int column) { return NUMBER(row, column); }
Stream_t *XdfOpen(struct device *dev, char *name,
		  int mode, char *errmsg, struct xdf_info *info)
{
	Xdf_t *This;
	off_t begin, end;
	struct bootsector *boot;
	int type;

	if(dev && (!SHOULD_USE_XDF(dev) || check_geom(dev, 0, 0)))
		return NULL;

	This = New(Xdf_t);
	if (!This)
		return NULL;

	This->Class = &XdfClass;
	This->sector_size = 512;
	This->stretch = 0;

	precmd(dev);
	This->fd = open(name, mode | dev->mode | O_EXCL | O_NDELAY);
	if(This->fd < 0) {
#ifdef HAVE_SNPRINTF
		snprintf(errmsg,199,"xdf floppy: open: \"%s\"", strerror(errno));
#else
		sprintf(errmsg,"xdf floppy: open: \"%s\"", strerror(errno));
#endif
		goto exit_0;
	}
	closeExec(This->fd);

	This->drive = GET_DRIVE(This->fd);
	if(This->drive < 0)
		goto exit_1;

	/* allocate buffer */
	This->buffer = (char *) malloc(96 * 512);
	if (!This->buffer)
		goto exit_1;

	This->current_track = -1;
	This->track_map = (TrackMap_t *)
		calloc(96, sizeof(TrackMap_t));
	if(!This->track_map)
		goto exit_2;

	/* lock the device on writes */
	if (lock_dev(This->fd, mode == O_RDWR, dev)) {
#ifdef HAVE_SNPRINTF
		snprintf(errmsg,199,"xdf floppy: device \"%s\" busy:", 
			dev->name);
#else
		sprintf(errmsg,"xdf floppy: device \"%s\" busy:", 
			dev->name);
#endif
		goto exit_3;
	}

	/* Before reading the boot sector, assume dummy values suitable
	 * for reading at least the boot sector */
	This->track_size = 11;
	This->track0_size = 6;
	This->rate = 0;
	This->FatSize = 9;
	This->RootDirSize = 1;
	decompose(This, 0, 512, &begin, &end, 0);
	if (load_data(This, 0, 1, 1) < 0 ) {
		This->rate = 0x43;
		if(load_data(This, 0, 1, 1) < 0)
			goto exit_3;
	}

	boot = (struct bootsector *) This->buffer;
	This->FatSize = WORD(fatlen);
	This->RootDirSize = WORD(dirents)/16;
	This->track_size = WORD(nsect);
	for(type=0; type < NUMBER(xdf_table); type++) {
		if(xdf_table[type].track_size == This->track_size) {
			This->map = xdf_table[type].map;
			This->track0_size = xdf_table[type].track0_size;
			This->rootskip = xdf_table[type].rootskip;
			break;
		}
	}
	if(type == NUMBER(xdf_table))
		goto exit_3;

	if(info) {
		info->RootDirSize = This->RootDirSize;
		info->FatSize = This->FatSize;
		info->BadSectors = 5;
	}
	decompose(This, 0, 512, &begin, &end, 1);

	This->refs = 1;
	This->Next = 0;
	This->Buffer = 0;
	if(dev)
		set_geom(boot, dev);
	return (Stream_t *) This;

exit_3:
	Free(This->track_map);
exit_2:
	Free(This->buffer);
exit_1:
	close(This->fd);
exit_0:
	Free(This);
	return NULL;
}
bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman)
{
	static struct {
		TER				terCode;
		const char*		cpToken;
		const char*		cpHuman;
	} transResultInfoA[] = {
		{	tecCLAIM,				"tecCLAIM",					"Fee claimed. Sequence used. No action."				},
		{	tecDIR_FULL,			"tecDIR_FULL",				"Can not add entry to full directory."					},
		{	tecINSUF_RESERVE_LINE,	"tecINSUF_RESERVE_LINE",	"Insufficent reserve to add trust line."				},
		{	tecINSUF_RESERVE_OFFER,	"tecINSUF_RESERVE_OFFER",	"Insufficent reserve to create offer."					},
		{	tecNO_DST,				"tecNO_DST",				"Destination does not exist. Send XRP to create it."	},
		{	tecNO_DST_INSUF_XRP,	"tecNO_DST_INSUF_XRP",		"Destination does not exist. Too little XRP sent to create it."		},
		{	tecNO_LINE_INSUF_RESERVE,	"tecNO_LINE_INSUF_RESERVE",	"No such line. Too little reserve to create it."	},
		{	tecNO_LINE_REDUNDANT,	"tecNO_LINE_REDUNDANT",		"Can't set non-existant line to default."				},
		{	tecPATH_DRY,			"tecPATH_DRY",				"Path could not send partial amount."					},
		{	tecPATH_PARTIAL,		"tecPATH_PARTIAL",			"Path could not send full amount."						},

		{	tecUNFUNDED,			"tecUNFUNDED",				"One of _ADD, _OFFER, or _SEND. Deprecated."			},
		{	tecUNFUNDED_ADD,		"tecUNFUNDED_ADD",			"Insufficient XRP balance for WalletAdd."				},
		{	tecUNFUNDED_OFFER,		"tecUNFUNDED_OFFER",		"Insufficient balance to fund created offer."			},
		{	tecUNFUNDED_PAYMENT,	"tecUNFUNDED_PAYMENT",		"Insufficient XRP balance to send."						},

		{	tefFAILURE,				"tefFAILURE",				"Failed to apply."										},
		{	tefALREADY,				"tefALREADY",				"The exact transaction was already in this ledger."		},
		{	tefBAD_ADD_AUTH,		"tefBAD_ADD_AUTH",			"Not authorized to add account."						},
		{	tefBAD_AUTH,			"tefBAD_AUTH",				"Transaction's public key is not authorized."			},
		{	tefBAD_CLAIM_ID,		"tefBAD_CLAIM_ID",			"Malformed: Bad claim id."								},
		{	tefBAD_GEN_AUTH,		"tefBAD_GEN_AUTH",			"Not authorized to claim generator."					},
		{	tefBAD_LEDGER,			"tefBAD_LEDGER",			"Ledger in unexpected state."							},
		{	tefCLAIMED,				"tefCLAIMED",				"Can not claim a previously claimed account."			},
		{	tefEXCEPTION,			"tefEXCEPTION",				"Unexpected program state."								},
		{	tefCREATED,				"tefCREATED",				"Can't add an already created account."					},
		{	tefGEN_IN_USE,			"tefGEN_IN_USE",			"Generator already in use."								},
		{	tefNO_AUTH_REQUIRED,	"tefNO_AUTH_REQUIRED",		"Auth is not required."									},
		{	tefPAST_SEQ,			"tefPAST_SEQ",				"This sequence number has already past."				},

		{	telLOCAL_ERROR,			"telLOCAL_ERROR",			"Local failure."										},
		{	telBAD_DOMAIN,			"telBAD_DOMAIN",			"Domain too long."										},
		{	telBAD_PATH_COUNT,		"telBAD_PATH_COUNT",		"Malformed: Too many paths."							},
		{	telBAD_PUBLIC_KEY,		"telBAD_PUBLIC_KEY",		"Public key too long."									},
		{	telINSUF_FEE_P,			"telINSUF_FEE_P",			"Fee insufficient."										},
		{	telNO_DST_PARTIAL,		"telNO_DST_PARTIAL",		"Partial payment to create account not allowed."		},

		{	temMALFORMED,			"temMALFORMED",				"Malformed transaction."								},
		{	temBAD_AMOUNT,			"temBAD_AMOUNT",			"Can only send positive amounts."						},
		{	temBAD_AUTH_MASTER,		"temBAD_AUTH_MASTER",		"Auth for unclaimed account needs correct master key."	},
		{	temBAD_FEE,				"temBAD_FEE",				"Invalid fee, negative or not XRP."						},
		{	temBAD_EXPIRATION,		"temBAD_EXPIRATION",		"Malformed: Bad expiration."							},
		{	temBAD_ISSUER,			"temBAD_ISSUER",			"Malformed: Bad issuer."								},
		{	temBAD_LIMIT,			"temBAD_LIMIT",				"Limits must be non-negative."							},
		{	temBAD_OFFER,			"temBAD_OFFER",				"Malformed: Bad offer."									},
		{	temBAD_PATH,			"temBAD_PATH",				"Malformed: Bad path."									},
		{	temBAD_PATH_LOOP,		"temBAD_PATH_LOOP",			"Malformed: Loop in path."								},
		{	temBAD_PUBLISH,			"temBAD_PUBLISH",			"Malformed: Bad publish."								},
		{	temBAD_SIGNATURE,		"temBAD_SIGNATURE",			"Malformed: Bad signature."								},
		{	temBAD_SRC_ACCOUNT,		"temBAD_SRC_ACCOUNT",		"Malformed: Bad source account."						},
		{	temBAD_TRANSFER_RATE,	"temBAD_TRANSFER_RATE",		"Malformed: Transfer rate must be >= 1.0"				},
		{	temBAD_SEQUENCE,		"temBAD_SEQUENCE",			"Malformed: Sequence is not in the past."				},
		{	temBAD_SEND_XRP_LIMIT,		"temBAD_SEND_XRP_LIMIT",		"Malformed: Limit quality is not allowed for XRP to XRP."		},
		{	temBAD_SEND_XRP_MAX,		"temBAD_SEND_XRP_MAX",			"Malformed: Send max is not allowed for XRP to XRP."			},
		{	temBAD_SEND_XRP_NO_DIRECT,	"temBAD_SEND_XRP_NO_DIRECT",	"Malformed: No Ripple direct is not allowed for XRP to XRP."	},
		{	temBAD_SEND_XRP_PARTIAL,	"temBAD_SEND_XRP_PARTIAL",		"Malformed: Partial payment is not allowed for XRP to XRP."		},
		{	temBAD_SEND_XRP_PATHS,		"temBAD_SEND_XRP_PATHS",		"Malformed: Paths are not allowed for XRP to XRP."				},
		{	temDST_IS_SRC,			"temDST_IS_SRC",			"Destination may not be source."						},
		{	temDST_NEEDED,			"temDST_NEEDED",			"Destination not specified."							},
		{	temDST_TAG_NEEDED,		"temDST_TAG_NEEDED",		"Destination tag required."								},
		{	temINVALID,				"temINVALID",				"The transaction is ill-formed."						},
		{	temINVALID_FLAG,		"temINVALID_FLAG",			"The transaction has an invalid flag."					},
		{	temREDUNDANT,			"temREDUNDANT",				"Sends same currency to self."							},
		{	temREDUNDANT_SEND_MAX,	"temREDUNDANT_SEND_MAX",	"Send max is redundant."								},
		{	temRIPPLE_EMPTY,		"temRIPPLE_EMPTY",			"PathSet with no paths."								},
		{	temUNCERTAIN,			"temUNCERTAIN",				"In process of determining result. Never returned."		},
		{	temUNKNOWN,				"temUNKNOWN",				"The transactions requires logic not implemented yet."	},

		{	terRETRY,				"terRETRY",					"Retry transaction."									},
		{	terFUNDS_SPENT,			"terFUNDS_SPENT",			"Can't set password, password set funds already spent."	},
		{	terINSUF_FEE_B,			"terINSUF_FEE_B",			"Account balance can't pay fee."						},
		{	terNO_ACCOUNT,			"terNO_ACCOUNT",			"The source account does not exist."					},
		{	terNO_LINE,				"terNO_LINE",				"No such line."											},
		{	terPRE_SEQ,				"terPRE_SEQ",				"Missing/inapplicable prior transaction."				},
		{	terOWNERS,				"terOWNERS",				"Non-zero owner count."									},

		{	tesSUCCESS,				"tesSUCCESS",				"The transaction was applied."							},
	};

	int	iIndex	= NUMBER(transResultInfoA);

	while (iIndex-- && transResultInfoA[iIndex].terCode != terCode)
		;

	if (iIndex >= 0)
	{
		strToken	= transResultInfoA[iIndex].cpToken;
		strHuman	= transResultInfoA[iIndex].cpHuman;
	}

	return iIndex >= 0;
}
Beispiel #24
0
/*****************************************************************************
 Function name	: orc_ReturnNumberOfAdapters
 Description	: This function will scan PCI bus to get all Orchid card
 Input		: None.
 Output		: None.
 Return		: SUCCESSFUL	- Successful scan
		  ohterwise	- No drives founded
*****************************************************************************/
int orc_ReturnNumberOfAdapters(void)
{
	unsigned int i, iAdapters;

	iAdapters = 0;
	/*
	 * PCI-bus probe.
	 */
	if (pcibios_present()) {
		struct {
			unsigned short vendor_id;
			unsigned short device_id;
		} const inia100_pci_devices[] =
		{
			{ORC_VENDOR_ID, I920_DEVICE_ID},
			{ORC_VENDOR_ID, ORC_DEVICE_ID}
		};

		unsigned int dRegValue;
		unsigned short command;
		WORD wBIOS, wBASE;
		BYTE bPCIBusNum, bInterrupt, bPCIDeviceNum;

#ifdef MMAPIO
		unsigned long page_offset, base;
#endif

#if LINUX_VERSION_CODE > CVT_LINUX_VERSION(2,1,92)
		struct pci_dev *pdev = NULL;
#else
		int index;
		unsigned char pci_bus, pci_devfn;
#endif

		bPCIBusNum = 0;
		bPCIDeviceNum = 0;
		init_inia100Adapter_table();
		for (i = 0; i < NUMBER(inia100_pci_devices); i++) {
#if LINUX_VERSION_CODE > CVT_LINUX_VERSION(2,1,92)
			pdev = NULL;
			while ((pdev = pci_find_device(inia100_pci_devices[i].vendor_id,
					inia100_pci_devices[i].device_id,
						       pdev)))
#else
			index = 0;
			while (!(pcibios_find_device(inia100_pci_devices[i].vendor_id,
					inia100_pci_devices[i].device_id,
					 index++, &pci_bus, &pci_devfn)))
#endif
			{
				if (iAdapters >= MAX_SUPPORTED_ADAPTERS)
					break;	/* Never greater than maximum   */

				if (i == 0) {
					/*
					   printk("inia100: The RAID controller is not supported by\n");
					   printk("inia100:         this driver, we are ignoring it.\n");
					 */
				} else {
					/*
					 * Read sundry information from PCI BIOS.
					 */
#if LINUX_VERSION_CODE > CVT_LINUX_VERSION(2,1,92)
					bPCIBusNum = pdev->bus->number;
					bPCIDeviceNum = pdev->devfn;
					dRegValue = pdev->base_address[0];
					if (dRegValue == -1) {	/* Check return code            */
						printk("\n\rinia100: orchid read configuration error.\n");
						return (0);	/* Read configuration space error  */
					}
					/* <02> read from base address + 0x50 offset to get the wBIOS balue. */
					wBASE = (WORD) dRegValue;

					/* Now read the interrupt line  */
					dRegValue = pdev->irq;
					bInterrupt = dRegValue & 0xFF;	/* Assign interrupt line      */
					pci_read_config_word(pdev, PCI_COMMAND, &command);
					pci_write_config_word(pdev, PCI_COMMAND,
							      command | PCI_COMMAND_MASTER | PCI_COMMAND_IO);

#else
					bPCIBusNum = pci_bus;
					bPCIDeviceNum = pci_devfn;
					pcibios_read_config_dword(pci_bus, pci_devfn, PCI_BASE_ADDRESS_0,
							     &dRegValue);
					if (dRegValue == -1) {	/* Check return code            */
						printk("\n\rinia100: Orchid read configuration error.\n");
						return (0);	/* Read configuration space error  */
					}
					/* <02> read from base address + 0x50 offset to get the wBIOS balue. */
					wBASE = (WORD) dRegValue;

					/* Now read the interrupt line  */
					pcibios_read_config_dword(pci_bus, pci_devfn, PCI_INTERRUPT_LINE,
							     &dRegValue);
					bInterrupt = dRegValue & 0xFF;	/* Assign interrupt line      */
					pcibios_read_config_word(pci_bus, pci_devfn, PCI_COMMAND, &command);
					pcibios_write_config_word(pci_bus, pci_devfn, PCI_COMMAND,
								  command | PCI_COMMAND_MASTER | PCI_COMMAND_IO);
#endif
					wBASE &= PCI_BASE_ADDRESS_IO_MASK;
					wBIOS = ORC_RDWORD(wBASE, 0x50);

#ifdef MMAPIO
					base = wBASE & PAGE_MASK;
					page_offset = wBASE - base;

					/*
					 * replace the next line with this one if you are using 2.1.x:
					 * temp_p->maddr = ioremap(base, page_offset + 256);
					 */
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,0)
					wBASE = ioremap(base, page_offset + 256);
#else
					wBASE = (WORD) vremap(base, page_offset + 256);
#endif
					if (wBASE) {
						wBASE += page_offset;
					}
#endif

					if (Addinia100_into_Adapter_table(wBIOS, wBASE, bInterrupt, bPCIBusNum,
					    bPCIDeviceNum) == SUCCESSFUL)
						iAdapters++;
				}
			}	/* while(pdev=....) */
		}		/* for PCI_DEVICES */
	}			/* PCI BIOS present */
	return (iAdapters);
}
Beispiel #25
0
    long expires;
#endif
    bool ignore_root;
    long minimum_uid;
    char *program;
};

#define K(name) (#name), offsetof(struct pam_config, name)

/* The rules specifying the configuration options. */
static struct option options[] = {
    { K(cells),       true,  LIST   (NULL)  },
    { K(debug),       true,  BOOL   (false) },
    { K(expires),     true,  TIME   (10)    },
    { K(ignore_root), false, BOOL   (true)  },
    { K(minimum_uid), true,  NUMBER (0)     },
    { K(program),     true,  STRING (NULL)  },
};
static const size_t optlen = sizeof(options) / sizeof(options[0]);

/*
 * A macro used to parse the various ways of spelling booleans.  This reuses
 * the argv_bool variable, setting it to the first value provided and then
 * calling putil_args_parse() on it.  It then checks whether the provided
 * config option is set to the expected value.
 */
#define TEST_BOOL(a, c, v)                                              \
    do {                                                                \
        argv_bool[0] = (a);                                             \
        status = putil_args_parse(args, 1, argv_bool, options, optlen); \
        ok(status, "Parse of %s", (a));                                 \
Beispiel #26
0
 TrackPickerItem(K3ListView *parent, const KTRMResult &result) :
     K3ListViewItem(parent, parent->lastChild(),
                   result.title(), result.artist(), result.album(),
                   NUMBER(result.track()), NUMBER(result.year())),
     m_result(result) {}
Beispiel #27
0
int
main(int argc, char **argv)
{
    char *log_file = NULL;
    char *queue_dir = NULL;
    char *list[2];
    int num_to_send = DEFAULT_NUM, chunk;
    int fd;
    FTS *fts;
    FTSENT *ftsent;
    int piece, npieces;
    char filename[PATH_MAX];

    err_prog_name(argv[0]);

    OPTIONS("[-l log] [-n num] queuedir")
	NUMBER('n', num_to_send)
	STRING('l', log_file)
    ENDOPTS

    if (argc != 2)
	usage();

    if (log_file)
	err_set_log(log_file);

    queue_dir = argv[1];
    list[0] = queue_dir;
    list[1] = NULL;

    fts = fts_open(list, FTS_PHYSICAL|FTS_COMFOLLOW, fts_sort);
    if (fts == NULL)
    {
	err("fts failed on `%s'", queue_dir);
	exit(1);
    }

    ftsent = fts_read(fts);
    if (ftsent == NULL || ftsent->fts_info != FTS_D)
    {
	err("not a directory: %s", queue_dir);
	exit(1);
    }

    ftsent = fts_children(fts, 0);
    if (ftsent == NULL && errno)
    {
	err("*ftschildren failed");
	exit(1);
    }

    for (chunk = 1; ftsent != NULL; ftsent = ftsent->fts_link)
    {
	/*
	 * Skip non-files and ctm_smail tmp files (ones starting with `.')
	 */
	if (ftsent->fts_info != FTS_F || ftsent->fts_name[0] == '.')
	    continue;

	sprintf(filename, "%s/%s", queue_dir, ftsent->fts_name);
	fd = open(filename, O_RDONLY);
	if (fd < 0)
	{
	    err("*open: %s", filename);
	    exit(1);
	}

	if (run_sendmail(fd))
	    exit(1);

	close(fd);
	
	if (unlink(filename) < 0)
	{
	    err("*unlink: %s", filename);
	    exit(1);
	}
	
	/*
	 * Deduce the delta, piece number, and number of pieces from
	 * the name of the file in the queue.  Ideally, we should be
	 * able to get the mail alias name too.
	 *
	 * NOTE: This depends intimately on the queue name used in ctm_smail.
	 */
	npieces = atoi(&ftsent->fts_name[ftsent->fts_namelen-3]);
	piece = atoi(&ftsent->fts_name[ftsent->fts_namelen-7]);
	err("%.*s %d/%d sent", ftsent->fts_namelen-8, ftsent->fts_name,
		piece, npieces);

	if (chunk++ == num_to_send)
	    break;
    }

    fts_close(fts);

    return(0);
}