예제 #1
0
int main() {
  struct _type_t var1, var2, var3, *var4;
  _i32 i = 10, j = 20;

  ast.env.n_vars = 0;
  new_var(&ast, &var1, "variable1", 1, &i);
  new_var(&ast, &var2, "variable2", 1, &j);
  new_var(&ast, &var3, "str", STR, "hello world");

  PRINT_INTEGER(var1);
  PRINT_INTEGER(var2);
  PRINT_STR(var3);

  if (get_var(&ast, &var4, "variable1")) {
    PRINT_VAR((*var4));
  } else {
    printf("failed to get variable\n");
  }

  assign(&ast, "variable1", 15);

  PRINT_VAR(var1);

  assign(&ast, "variable1", 20);

  PRINT_VAR(var1);
  
  return 0;
}
예제 #2
0
int dump_unit(int unitId)
{
    uint32_t unitsPtr;
    uint32_t unitValid, unitValidPtr;
    uint32_t unitPtr, unitPtrPtr;
    if (!ReadC3CMemory(UNITS_BEGIN_ADDR, &unitsPtr, sizeof(uint32_t))) {
        return 1;
    }
    unitValidPtr = unitsPtr + unitId * 2 * sizeof(uint32_t);
    if (!ReadC3CMemory(unitValidPtr, &unitValid, sizeof(uint32_t))) {
        return 1;
    }
    unitPtrPtr = unitValidPtr + sizeof(uint32_t);
    if (unitValid != 0xffffffff) {
        fprintf(stderr, "Invalid unit id: %d\n", unitId);
        return 1;
    } else {
        Unit unit;
        if (!ReadC3CMemory(unitPtrPtr, &unitPtr, sizeof(uint32_t))) {
            return 1;
        }
        if (!unitPtr) {
            fprintf(stderr, "Error: NULL pointer\n");
            return 1;
        }
        if (!ReadC3CMemory(unitPtr, &unit, sizeof(Unit))) {
            return 1;
        }
        PRINT_FIELD(unit, no_idea_1, "%p");
        PRINT_FIELD(unit, id, "%d");
        PRINT_FIELD(unit, x, "%d");
        PRINT_FIELD(unit, y, "%d");
        PRINT_FIELD(unit, prevx, "%d");
        PRINT_FIELD(unit, prevy, "%d");
        PRINT_FIELD(unit, owner, "%d");
        PRINT_FIELD(unit, nationality, "%d");
        PRINT_FIELD(unit, no_idea_3, "%d");
        PRINT_FIELD(unit, type, "%d");
        PRINT_FIELD(unit, experience, "%d");
        PRINT_FIELD(unit, no_idea_4, "%d");
        PRINT_FIELD(unit, damage, "%d");
        PRINT_FIELD(unit, usedMovement, "%d");
        PRINT_FIELD(unit, no_idea_5, "%d");
        PRINT_FIELD(unit, workerAction, "%d");
        PRINT_FIELD_BUF(unit, no_idea_6, "%d");
        PRINT_FIELD(unit, fortified, "%d");
        PRINT_FIELD(unit, endTurn, "%d");
        PRINT_FIELD_BUF(unit, no_idea_7, "%d");
        PRINT_STR(unit, name);
        PRINT_FIELD_BUF(unit, no_idea_8, "%d");
        PRINT_FIELD_BUF(unit, no_idea_9, "%d");
    }
    return 0;
}
예제 #3
0
int dump_lead(int leadId)
{
    Leader lead;
    if (!ReadC3CMemory(LEADERS_BEGIN_ADDR + leadId * sizeof(Leader),
                       &lead, sizeof(Leader))) {
        return 1;
    }
    PRINT_STR(lead, LEAD);
    PRINT_FIELD_BUF(lead, no_idea_1, "%p");
    PRINT_FIELD(lead, id, "%d");
    PRINT_FIELD(lead, nationality, "%d");
    PRINT_FIELD_BUF(lead, no_idea_2, "%p");
    PRINT_FIELD(lead, capitalCityId, "%d");
    PRINT_FIELD_BUF(lead, no_idea_3, "%p");
    PRINT_FIELD(lead, posGold, "%d");
    PRINT_FIELD(lead, negGold, "%d");
    PRINT_FIELD_BUF(lead, no_idea_4, "%p");
    PRINT_FIELD(lead, govt, "%d");
    PRINT_FIELD_BUF(lead, no_idea_5, "%p");
    PRINT_FIELD(lead, beakers, "%d");
    PRINT_FIELD(lead, researchTech, "%d");
    PRINT_FIELD_BUF(lead, no_idea_6, "%p");
    PRINT_FIELD(lead, nUnits, "%d");
    PRINT_FIELD_BUF(lead, no_idea_7, "%p");
    PRINT_FIELD(lead, luxury, "%d");
    PRINT_FIELD(lead, science, "%d");
    PRINT_FIELD(lead, tax, "%d");
    PRINT_FIELD_BUF(lead, no_idea_8, "%p");
    PRINT_FIELD_BUF(lead, contacts, "%d");
    PRINT_FIELD_BUF(lead, no_idea_9, "%p");
    PRINT_FIELD(lead, color, "%d");
    PRINT_FIELD(lead, leaderName, "%s");
    PRINT_FIELD(lead, leaderTitle, "%s");
    PRINT_FIELD(lead, civName, "%s");
    PRINT_FIELD(lead, noun, "%s");
    PRINT_FIELD(lead, adjective, "%s");
    PRINT_FIELD_BUF(lead, no_idea_10, "%p");
    PRINT_FIELD_BUF(lead, no_idea_11, "%p");
    PRINT_FIELD_BUF(lead, no_idea_12, "%p");
    PRINT_FIELD(lead, password, "%s");
    PRINT_FIELD_BUF(lead, no_idea_13, "%p");
    return 0;
}
예제 #4
0
void ShowQuery_DEBUG()
{
    qtss_printf("======REQUEST #%"_U32BITARG_"======\n",++sRequestCount);
    StrPtrLen*  aStr;
    aStr = sQueryPtr->GetURL();
    qtss_printf("URL="); PRINT_STR(aStr); 

    aStr = sQueryPtr->GetQuery();
    qtss_printf("Query="); PRINT_STR(aStr); 

    aStr = sQueryPtr->GetParameters();
    qtss_printf("Parameters="); PRINT_STR(aStr); 

    aStr = sQueryPtr->GetCommand();
    qtss_printf("Command="); PRINT_STR(aStr); 
    qtss_printf("CommandID=%"_S32BITARG_" \n",sQueryPtr->GetCommandID());
    aStr = sQueryPtr->GetValue();
    qtss_printf("Value="); PRINT_STR(aStr); 
    aStr = sQueryPtr->GetType();
    qtss_printf("Type="); PRINT_STR(aStr); 
    aStr = sQueryPtr->GetAccess();
    qtss_printf("Access="); PRINT_STR(aStr); 
}       
예제 #5
0
파일: test.c 프로젝트: ACSOP/android_sdk
void start()
{
  // Set the stack pointer
  asm("  mov r13,#0x200000");
  PRINT_STR("hello\n");
  TRACE_INIT_NAME(701, "proc_foo");
  TRACE_INIT_NAME(702, "proc_bar");
  TRACE_SWITCH(701);
  if (global++ > 0)
      global++;
  foo1();
  TRACE_SWITCH(702);
  if (global++ > 0)
      global++;
  bar();
  TRACE_SWITCH(701);
  if (global++ > 0)
      global++;
  foo2();
  TRACE_SWITCH(703);
  if (global++ > 0)
      global++;
  foo1();
  TRACE_SWITCH(701);
  if (global++ > 0)
      global++;
  foo1();

  TRACE_SWITCH(704);
  if (global++ > 0)
      global++;
  foo1();

  TRACE_SWITCH(701);
  if (global++ > 0)
      global++;
  foo1();

  TRACE_SWITCH(705);
  if (global++ > 0)
      global++;
  foo1();

  TRACE_SWITCH(701);
  if (global++ > 0)
      global++;
  foo1();

  TRACE_SWITCH(706);
  if (global++ > 0)
      global++;
  foo1();

  TRACE_SWITCH(701);
  if (global++ > 0)
      global++;
  foo1();

  TRACE_SWITCH(707);
  if (global++ > 0)
      global++;
  foo1();

  TRACE_SWITCH(701);
  if (global++ > 0)
      global++;
  foo1();

  TRACE_SWITCH(708);
  if (global++ > 0)
      global++;
  foo1();

  TRACE_SWITCH(701);
  if (global++ > 0)
      global++;
  foo1();

  TRACE_SWITCH(709);
  if (global++ > 0)
      global++;
  foo1();

  TRACE_SWITCH(701);
  if (global++ > 0)
      global++;
  foo1();

  TRACE_SWITCH(710);
  if (global++ > 0)
      global++;
  foo1();

  TRACE_STOP_EMU();
}
예제 #6
0
int dump_bic()
{
    Bic bic;

    if (!ReadC3CMemory(BIC_ADDR, &bic, sizeof(Bic))) {
        return 1;
    }

    PRINT_STR(bic, BIC);
    PRINT_FIELD_BUF(bic, no_idea_1, "%p");
    PRINT_FIELD(bic, biqFilenamePtr, "%p");
    PRINT_FIELD_BUF(bic, no_idea_2, "%p");
    PRINT_STR(bic, pathNoExt);
    PRINT_STR(bic, pathWithExt);
    PRINT_STR(bic, c3cPath);
    PRINT_STR(bic, ptwPath);
    PRINT_FIELD_BUF(bic, no_idea_3, "%p");
    PRINT_STR(bic, saveTmp);
    PRINT_STR(bic, no_idea_4);
    PRINT_FIELD_BUF(bic, no_idea_5, "%p");
    PRINT_FIELD(bic, nTechs, "%d");
    PRINT_FIELD(bic, nUnits, "%d");
    PRINT_FIELD(bic, nBuildings, "%d");
    PRINT_FIELD(bic, no_idea_6, "%d");
    PRINT_FIELD(bic, nCitizens, "%d");
    PRINT_FIELD(bic, no_idea_6b, "%d");
    PRINT_FIELD(bic, nCulturalOpinions, "%d");
    PRINT_FIELD(bic, nDifficultyLevels, "%d");
    PRINT_FIELD_BUF(bic, no_idea_6c, "%d");
    PRINT_FIELD(bic, nResources, "%d");
    PRINT_FIELD(bic, no_idea_7, "%d");
    PRINT_FIELD(bic, nPlayers, "%d");
    PRINT_FIELD_BUF(bic, no_idea_8, "%d");
    PRINT_STR(bic, description);
    PRINT_STR(bic, scenarioTitle);
    PRINT_FIELD(bic, no_idea_9, "%p");
    PRINT_FIELD(bic, buildingsPtr, "%p");
    PRINT_FIELD(bic, citizensPtr, "%p");
    PRINT_FIELD(bic, cityNamesPtr, "%p");
    PRINT_FIELD(bic, no_idea_10, "%p");
    PRINT_FIELD(bic, culturePtr, "%p");
    PRINT_FIELD(bic, difficultyPtr, "%p");
    PRINT_FIELD(bic, erasPtr, "%p");
    PRINT_FIELD(bic, espionagePtr, "%p");
    PRINT_FIELD(bic, experiencePtr, "%p");
    PRINT_FIELD_BUF(bic, no_idea_11, "%p");
    PRINT_FIELD(bic, no_idea_12_ptr, "%p");
    PRINT_FIELD(bic, no_idea_13_ptr, "%p");
    PRINT_FIELD_BUF(bic, no_idea_14, "%p");
    PRINT_FIELD(bic, autoPlaceCaptureUnits, "%d");
    PRINT_FIELD(bic, autoPlaceKingUnits, "%d");
    PRINT_FIELD(bic, autoPlaceVictoryLocations, "%d");
    PRINT_FIELD(bic, useDebugMode, "%d");
    PRINT_FIELD(bic, useTimeLimits, "%d");
    PRINT_FIELD(bic, baseTimeUnit, "%d");
    PRINT_FIELD(bic, startMonth, "%d");
    PRINT_FIELD(bic, startWeek, "%d");
    PRINT_FIELD(bic, startYear, "%d");
    PRINT_FIELD(bic, timeLimitMinutes, "%d");
    PRINT_FIELD(bic, timeLimitTurns, "%d");
    PRINT_FIELD_BUF(bic, timeScaleTurns, "%d");
    PRINT_FIELD_BUF(bic, timeScaleUnits, "%d");
    PRINT_FIELD(bic, victoryPointLimit, "%d");
    PRINT_FIELD(bic, cityEliminationCount, "%d");
    PRINT_FIELD(bic, cultureVictoryCity, "%d");
    PRINT_FIELD(bic, cultureVictoryCiv, "%d");
    PRINT_FIELD(bic, terrainForDomination, "%d");
    PRINT_FIELD(bic, populationForDomination, "%d");
    PRINT_FIELD(bic, wonderVP, "%d");
    PRINT_FIELD(bic, defeatUnitVP, "%d");
    PRINT_FIELD(bic, advanceVP, "%d");
    PRINT_FIELD(bic, cityConquestVP, "%d");
    PRINT_FIELD(bic, victoryPointLocationVP, "%d");
    PRINT_FIELD(bic, captureUnitVP, "%d");
    PRINT_FIELD(bic, captureUnitGold, "%d");
    PRINT_FIELD(bic, no_idea_15, "%d");
    PRINT_STR(bic, scenarioSearchFolders);
    PRINT_FIELD_BUF(bic, no_idea_16, "%p");
    PRINT_STR(bic, alliance1Name);
    PRINT_STR(bic, alliance2Name);
    PRINT_STR(bic, alliance3Name);
    PRINT_STR(bic, alliance4Name);
    PRINT_FIELD_BUF(bic, no_idea_17, "%p");
    PRINT_STR(bic, scenarioTitle2);
    PRINT_FIELD_BUF(bic, no_idea_18, "%p");
    PRINT_FIELD(bic, racesPtr, "%p");
    PRINT_FIELD(bic, resourcesPtr, "%p");
    PRINT_FIELD(bic, govtsPtr, "%p");
    PRINT_FIELD(bic, playersPtr, "%p");
    PRINT_FIELD(bic, unitsPtr, "%p");
    PRINT_FIELD(bic, menuArtPtr, "%p");
    PRINT_FIELD(bic, no_idea_19, "%p");
    PRINT_STR(bic, citySize1);
    PRINT_STR(bic, citySize2);
    PRINT_STR(bic, citySize3);
    PRINT_FIELD_BUF(bic, no_idea_20, "%p");
    PRINT_FIELD(bic, culturalLevelsPtr, "%p");
    PRINT_FIELD(bic, levelMultiplier, "%d");
    PRINT_FIELD(bic, nCulturalLevels, "%d");
    PRINT_FIELD(bic, borderFactor, "%d");
    PRINT_FIELD(bic, futureTechCost, "%d");
    PRINT_FIELD_BUF(bic, no_idea_21, "%p");
    PRINT_FIELD(bic, techsPtr, "%p");
    PRINT_FIELD(bic, workerJobsPtr, "%p");
    PRINT_FIELD(bic, terrainPtr, "%p");
    PRINT_FIELD(bic, no_idea_22_ptr, "%p");
    PRINT_FIELD(bic, worldSizesPtr, "%p");
    PRINT_FIELD(bic, flavorsPtrPtr, "%p");
    PRINT_FIELD(bic, screenWidthPixels, "%d");
    PRINT_FIELD(bic, screenHeightPixels, "%d");
    PRINT_FIELD(bic, no_idea_24, "%p");
    return 0;
}