Пример #1
0
// Get Memory card info.
Err mem_card_info(FormPtr form) {
  UInt16 numCards;
  Err err;
  MemPtr startStack, endStack;
  Boolean stackOk;
  Char tmp_text[100];

  // Update the stack label text.
  stackOk = SysGetStackInfo(&startStack, &endStack);
  StrPrintF(tmp_text, "Addr: [%x,...,%x]", startStack, endStack);
  show_lab(form, labelID_stack_addr, tmp_text);

  if (stackOk)
    StrPrintF(tmp_text, "Size: %lu Kb.", (((UInt32)endStack)-((UInt32)startStack))/1024);
  else
    StrPrintF(tmp_text, "Size: %lu Kb. OVERFLOW", (((UInt32)endStack)-((UInt32)startStack)+1)/1024);
  show_lab(form, labelID_stack_size, tmp_text);

  // Show number of cards
  numCards = MemNumCards();
  StrPrintF(tmp_text, "NumCards: %u.", numCards);
  show_lab(form, labelID_card_no, tmp_text);

  return err;
}
Пример #2
0
void get_default_username(Char *buf, Short max_len)
{
  Char *tmp, *first_wspace;
  VoidHand h;
  tmp = md_malloc(sizeof(Char) * (dlkMaxUserNameLength + 1));
  DlkGetSyncInfo(NULL, NULL, NULL, tmp, NULL, NULL);
  /* if it's too long, use the first name only */
  //  if (StrLen(tmp) > max_len-1) {
  if (StrLen(tmp) > 8) {
    first_wspace = StrChr(tmp, spaceChr);
    if (first_wspace)
      *(first_wspace) = '\0';
    else
      tmp[max_len-1] = '\0';
  }
  if (StrLen(tmp))
    StrNCopy(buf, tmp, max_len);
  else {
    Short t = rund(3);
    switch(t) {
    case 0:  StrPrintF(buf, "Noman"); break;
    case 1:  StrPrintF(buf, "Outis"); break; // "no man" in greek, says the web
    default: StrPrintF(buf, "Metis"); break; // "no one"/"cunning" pun in greek
    }
  }
  h = MemPtrRecoverHandle(tmp);
  if (h) MemHandleFree(h);  
}
Пример #3
0
/*
 * This function is based on the DrawIntro and DrawBlinds
 * functions in Vexed, a Cool GPL Palm Game by
 * "James McCombe" <*****@*****.**>
 * http://spacetube.tsx.org
 */
void
DrawIntro () {
  VoidHand Title_Handle;
  BitmapPtr Title;
  char text[40];
  SWord penx, peny;
  Boolean bstate;

  /* If a game is on, don't do the splash */
  if( stor.currplayer >= 0 ) return;

  // load bitmap resource and get handle
  Title_Handle = DmGet1Resource ('Tbmp', bmpTitle);
  // lock the bitmap resource into memory and get a pointer to it
  Title = MemHandleLock (Title_Handle);

  // draw the bitmap ( 160x160 )
  WinDrawBitmap (Title, 0, 0);

  /* Text Strings */
  StrPrintF (text, IntroVersionString, VERSION);
  WinDrawChars (text, StrLen (text), 5, 6);

  StrPrintF (text, IntroForPalmString, 153);
  WinDrawChars (text, StrLen (text), 52, 50);

  StrPrintF (text, IntroTapHereString, VERSION);
  WinDrawChars (text, StrLen (text), 45, 85);

  // unload the bitmap from memory (unlock)
  MemHandleUnlock (Title_Handle);

  // Loop till screen is tapped
  while (bstate)
    EvtGetPen (&penx, &peny, &bstate);
  while (!bstate)
    EvtGetPen (&penx, &peny, &bstate);

  /* If the user clicked in the drawing area, then
   * do a Draw Blinds and clear the PenQueue.
   */
  if( peny < 160 ) {
    // DrawBlinds
    int i, x;
    float delay;

    EvtFlushPenQueue();

    delay = .01 * SysTicksPerSecond();

    for (i = 0; i < 16; i++) {
      for (x = i; x < 160; x += 16) {
        WinEraseLine( 0,x, 159,x );
      }
      SysTaskDelay(delay);
    }
  } /* if( peny < 160 ) */

}
Пример #4
0
Char* AdjustNote(Int16 iconNumber, Char* note)
{
    extern Char gAppErrStr[];
    Char *p, *q;

    noteTempBuffer[0] = 0;
    
    if (!note) {
        // 지금 가지고 있는 게 없을 경우
        StrPrintF(noteTempBuffer, "ICON: %d\n#AN\n", iconNumber);
    }
    else {
        // note field에 내용이 있는 경우
        if ( (p= StrStr(note, "#AN\n")) ) {
            // AN string을 가지고 있는 경우
            
            if (iconNumber < 0) {
                // 있는 ICON: 을 제거
                q = StrStr(note, "ICON:");

                if (q == note) {
                    q = StrStr(p, "\n");
                    StrNCopy(noteTempBuffer, q+1, 4096);
                }
                else {
                    StrNCopy(noteTempBuffer, note, q-note);
                    q = StrStr(q, "\n");
                    StrNCat(noteTempBuffer, q+1, 4096);
                }
            }
            else {
                // 있는 ICON: 변경
                q = StrStr(note, "ICON:");
                if (q) {
                    StrNCopy(noteTempBuffer, note, q-note);
                    q = StrStr(q, "\n") + 1;
                }
                else {
                    StrNCopy(noteTempBuffer, note, p-note);
                    q = p;
                }

                StrPrintF(gAppErrStr, "ICON: %d\n", iconNumber);
                StrNCat(noteTempBuffer, gAppErrStr, 4096);

                StrNCat(noteTempBuffer, q, 4096);
            }
        }
        else {
            StrPrintF(noteTempBuffer, "ICON: %d\n#AN\n", iconNumber);
            StrNCat(noteTempBuffer, note, 4096);
        }
        
        
    }
    return noteTempBuffer;
}
Пример #5
0
void  CBiddingForm::InitDisplay() {

	UInt16 player_names[] = {BiddingP0NameField, BiddingP1NameField, BiddingP2NameField, BiddingP3NameField };
	UInt16 player_bids[] = {BiddingP0BidField, BiddingP1BidField, BiddingP2BidField, BiddingP3BidField };

	if ( gManager->CutThroat() == true ) {
		player_names[2] = player_names[3];
		player_bids[2] = player_bids[3];

		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), BiddingEWScoreField ) );
		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), BiddingUnnamed1011Label ) );
		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), BiddingNSScoreField ) );
		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), BiddingLabel1Label ) );


		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), BiddingP2NameField ) );
		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), BiddingP2BidField ) );
	}

	for ( Int16 i = 0; i < gManager->numPlayers; i++ ) {

		bids[i].Attach(this, player_bids[i]);
		names[i].Attach(this, player_names[i]);
		
		if ( gManager->CutThroat() == true ) {
			CString foo;
			foo.Format("%d", gManager->scores[i]);
			CString tmp = gManager->players[i]->getName() + ": " + foo;
			names[i].Replace( tmp );
		}
		else {
			names[i].Replace( (const char *)gManager->players[i]->getName() );
		}

	}


	if ( gManager->CutThroat() == false ) {
		ns_score.Attach(this, BiddingNSScoreField);
		ew_score.Attach(this, BiddingEWScoreField);

		char score0str[4];
		char score1str[4];

		StrPrintF(score0str, "%d", gManager->scores[0]);
		StrPrintF(score1str, "%d", gManager->scores[1]);

		ns_score.Replace( score0str );
		ew_score.Replace( score1str );
	}

	player_hand.Attach(this, PlayerBidPlayerHandGadget );
	player_hand.CurrentPlayer(gManager->players[gManager->humanIndex]);

	bid_winner.Attach(this, BidWinnerField);
}
Пример #6
0
Err show_heap_info() {

  Err err;
  UInt16 numHeaps, numRAMHeaps, version;
  UInt16 heapNo, heapId;
  UInt32 free, max, heapSize;
  Char tmp_text[100], tmp_textd1[100], tmp_textd2[100];
  FormPtr form;

  // Initialize the form.
  form = FrmInitForm(formID_heap_info);

  // Initialize the form.
  if (cardNo > MemNumCards()) {
    FrmAlert(alertID_no_card);
    return err;
  }

  numHeaps = MemNumHeaps(cardNo-1);
  StrPrintF(tmp_text, "Num. heaps: %u", numHeaps);
  show_lab(form, labelID_num_heaps, tmp_text);
  numRAMHeaps = MemNumRAMHeaps(cardNo-1);
  StrPrintF(tmp_text, "Num. RAM heaps: %u", numRAMHeaps);
  show_lab(form, labelID_num_RAM_heaps, tmp_text);

  for (heapNo=0; heapNo < numHeaps && heapNo < 3; heapNo++) {
      heapId = MemHeapID(cardNo-1,heapNo);
      heapSize = MemHeapSize(heapId);
      err = MemHeapFreeBytes(heapId, &free, &max);
      if (err) return err;
      if (heapNo < numRAMHeaps) {
	StrPrintF(tmp_text,
		  "RAM Heap %d is %s", 
		  heapNo, (MemHeapDynamic(heapId))?("dynamic"):("non-dynamic"));
	StrPrintF(tmp_textd1, "Free: %lu Kb.", free);
	StrPrintF(tmp_textd2, "Max. chunk: %lu Kb.", max);
      }
      else {
	StrPrintF(tmp_text, "ROM Heap %d", heapNo);
	StrPrintF(tmp_textd1, "Free: %lu Kb.", free);
	StrPrintF(tmp_textd2, "Max chunk: %lu Kb.", max);
      }
      switch (heapNo) {
      case 0: 
	show_lab(form, labelID_heap1, tmp_text);
	show_lab(form, labelID_heap1d1, tmp_textd1);
	show_lab(form, labelID_heap1d2, tmp_textd2);	
      case 1: 
	show_lab(form, labelID_heap2, tmp_text);
	show_lab(form, labelID_heap2d1, tmp_textd1);
	show_lab(form, labelID_heap2d2, tmp_textd2);
      default: 
	show_lab(form, labelID_heap3, tmp_text);
	show_lab(form, labelID_heap3d1, tmp_textd1);
	show_lab(form, labelID_heap3d2, tmp_textd2);
      }
  }
  display_modal_form(form);
  return err;
}
Пример #7
0
void DrawState()
{
    Short x;
    Char msg[MaxName+4];

    DrawCurrScore();

    // Fill the fields
    x = 0;
    if ( stor.currplayer > -1 ) {
        // If there is a game on, fill in the names and scores
        for ( ; x < stor.numplayers ; x++ ) {
            StrPrintF( msg, "%d. %s", x+1, stor.player[x].name, NULL );
            SetFieldTextFromStr( fieldNamePlayer[x], msg );
            DrawPlayerScore( x );
        }
    }
    // Clears the rest if the fields
    for ( ; x < MaxPlayers ; x++ ) {
        ClearFieldText( fieldNamePlayer[x] );
        ClearFieldText( fieldScorePlayer[x] );
        ClearFieldText( fieldMarkPlayer[x] );
    }

    for ( x = 0 ; x < NumCubes ; x++ ) {
        DrawCube(x);
        DrawKeepBit(x);
    }

    DrawStayButton();
    DrawRollButton();
    DrawStatus();
    DrawTopStatusButton();
}
Пример #8
0
void DEBUGBOX(char *ARGSTR1, char *ARGSTR2) {
  char buf[1000];
  int l=0;
  l+=StrPrintF(buf+l, "debugbox - %s %s:%d\n", 
     __FUNCTION__, __FILE__, __LINE__);
  FrmCustomAlert(alertInfo, buf, ARGSTR1, ARGSTR2);
}
Пример #9
0
static void doPenAction(int e, int x, int y, int endx, int endy)
{

   switch(e){
   case penDownEvent:
   case penMoveEvent:

     /* doing dialog debug box on penUp gives us infinate loop */
     if (0){
       char buf[1000];
       int l=0;
       l+=StrPrintF(buf+l, "event: %d x,y %d,%d end x,y %d,%d\n",
		    e, x, y, endx, endy);
       buf[l]=0;
       DEBUGBOX("doPenAction",buf);
     }

     // Middle C is 262Hz
     // playFreq(sndCmdFrqOn,x*20,y*10,stopWatchPrefs.vol); // freq,maxdur, amp(0 - sndMaxAmp)
     // this could possibly get annoying

     break;

   case penUpEvent:
       // stopFreq();
     break;
         
   }
}
Пример #10
0
void f_printbyte( FieldPtr fld, BYTE b )
{
	BYTE sprintb[10];

	StrPrintF( sprintb, "%x", b );
	AppendField( fld, sprintb+6, 2 );
}
Пример #11
0
// Function throws an Exception
void runtimeThrow(const char* file, int line,
                  const char* function,
                  long error)
{
    ASSERT(NULL != file, "runtimeThrow");
    ASSERT(0 < line, "runtimeThrow");
    ASSERT(NULL != function, "runtimeThrow");
    ASSERT(0 != error, "runtimeThrow");

    while (runtimeLast
           && runtimeLast->autorelease)
        runtimeCleanup(runtimeLast);

    if (!runtimeLast) {
        char buffer[128];
        StrPrintF(buffer, "%s: Unhandled "
                          "exception %08lX "
                          "(%s:%i)",
                  function, error, file, line);
        ErrAlertCustom(0, buffer, "", "");
        SysReset();
    }

    runtimeLast->file = file;
    runtimeLast->line = line;
    runtimeLast->error = error;
    runtimeLast->function = function;
    ErrLongJump(runtimeLast->jumpbuf, 1);
};
Пример #12
0
void panicN(Char* errorStr, UInt32 n) { 
  char tmp_text[100];
  StrPrintF(tmp_text, "[%lu] ", n);
  StrCat(tmp_text,errorStr);
  FrmCustomAlert(alertID_panic,tmp_text,"","");
  //exit(-1); //How do we exit the application, NH
}
Пример #13
0
static void PrvFormatBytes(char* buffer, UInt32 size)
{
    // TOD: more "intelligent" display (bytes, kB, MB)
    size += 512;
    size /= 1024;
    StrPrintF(buffer, "%lukB", size);
}
Пример #14
0
void draw_histogram(int from_idx, int to_idx) {
  int i, y;
  char tmp_text[200];

  // Draw everything if scaling has changed.
  if (old_scaling != scaling) {
    from_idx = 0;
    to_idx = region_stack_idx;
  }
    
  // Draw regions as horizontal lines.
  for (i=from_idx;i<=to_idx;i=i+1) {
    y = 160-(int)(90.0*region_stat[i]/scaling);
    if (y<70) {
	StrPrintF(tmp_text, "scaling with y=%i, region_sta[i]=%lu and scaling %lu",y, region_stat[i],(UInt32)scaling);
	panic(tmp_text);
    }
    if (i == max_reg_idx)
      WinDrawLine (i*2, y, i*2, 159);
    else
      WinDrawGrayLine (i*2, y, i*2, 159);
    WinEraseLine(i*2, 70, i*2, y-1);
  }
  if (old_max_reg_idx != max_reg_idx) {
    // Draw old max idx
    y = 160-(90*region_stat[old_max_reg_idx]/scaling);
    WinDrawGrayLine (old_max_reg_idx*2, y, old_max_reg_idx*2, 159);
    WinEraseLine(old_max_reg_idx*2, 70, old_max_reg_idx*2, y-1);
    // Draw new max idx
    y = 160-(90*region_stat[max_reg_idx]/scaling);
    WinDrawLine (max_reg_idx*2, y, max_reg_idx*2, 159);
    WinEraseLine(max_reg_idx*2, 70, max_reg_idx*2, y-1);
  }
}
Пример #15
0
const void updateSprite(SpritePtr sprite){
  sprite->x += sprite->dx;
  sprite->y += sprite->dy;
  if(sprite->x > 150 || sprite->x < 20){ sprite->dx *= -1; }
  if(sprite->y > 150 || sprite->y < 20){ sprite->dy *= -1; }
  StrPrintF(sprite->letter, " %c ", sentence[offset]);
}
Пример #16
0
void update_form_main_ri_sim() {
  Char tmp_text[100];
  FormPtr form;
  

  form = FrmGetActiveForm(); // FrmGetFormPtr(formID_main_ri_sim);
  StrPrintF(tmp_text, "Alloc: %lu b. #Reg: %lu.", total_alloc*4, region_stack_idx);
  show_lab(form, labelID_total_alloc, tmp_text);
  StrPrintF(tmp_text, "#AllocReg: %lu #DeallocReg: %lu", num_alloc_reg, num_dealloc_reg);
  show_lab(form, labelID_stat1, tmp_text);  
  StrPrintF(tmp_text, "#AllocInReg: %lu #ResetReg: %lu", num_alloc_in_reg, num_reset_reg);
  show_lab(form, labelID_stat2, tmp_text);
  StrPrintF(tmp_text, "#DeallocUntil: %lu", num_dealloc_until);
  show_lab(form, labelID_stat3, tmp_text);

  draw_histogram(from_idx, to_idx);
}
Пример #17
0
/*       -1 if object could not be found (but was paid) */
static Short dopayobj(bill_t *bp)
{
  obj_t *obj;
  Long ltmp;

  /* find the object on one of the lists */
  obj = bp_to_obj(bp);

  if (!obj) {
    message("BUG: Shopkeeper administration out of order.");
    setpaid();	/* be nice to the player */
    return 0;
  }

  if (!(obj->bitflags & O_IS_UNPAID) && !bp->useup) {
    message("BUG: Paid object on bill??");
    return 1;
  }
  obj->bitflags &= ~O_IS_UNPAID;
  ltmp = bp->price * bp->bquantity;
  if (ANGRY(shopkeeper)) ltmp += ltmp/3;
  if (you.ugold < ltmp) {
    StrPrintF(ScratchBuffer, "You don't have gold enough to pay %s.",
	      doname(obj));
    message(ScratchBuffer);
    obj->bitflags |= O_IS_UNPAID;
    return 0;
  }
  pay(ltmp, shopkeeper);
  StrPrintF(ScratchBuffer, "You bought %s for %ld gold piece%s",
	    doname(obj), ltmp, (ltmp == 1 ? "." : "s."));
  message(ScratchBuffer);
  if (bp->useup) {
    obj_t *otmp = billobjs;
    if (obj == billobjs)
      billobjs = obj->nobj;
    else {
      while (otmp && otmp->nobj != obj) otmp = otmp->nobj;
      if (otmp) otmp->nobj = obj->nobj;
      else message("BUG: Error in shopkeeper administration.");
    }
    free_me((VoidPtr) obj);
  }
  return 1;
}
Пример #18
0
static void UpdatePos(DmOpenRef db)
{
	FormPtr form = FrmGetActiveForm();
	if (FormIsNot(form, FormMain)) return;
	char posbuf[20];
	StrPrintF(posbuf, "%d/%d", GetCurrentIndex() + 1,
		(UInt16) GetSMSCount(db, g_SelectedCategory));
	FrmCopyLabel(form, LabelPosition, posbuf);
}
Пример #19
0
static void UpdateUnread(DmOpenRef db)
{
	FormPtr form = FrmGetActiveForm();
	if (FormIsNot(form, FormMain)) return;

	char unreadbuf[20];
	StrPrintF(unreadbuf, "%d unread", (UInt16) CountUnread(db));
	FrmCopyLabel(form, LabelUnread, unreadbuf);
}
Пример #20
0
void CIRexxApp::doAbout()
{
   char info[40];
   CForm frmAbout(AboutForm);
   CLabel(frmAbout, AboutVersionLabel).CopyLabel(Interpreter::getYaxxVersion());
 	StrPrintF(info, getRexxAppMessage(msgRexxInfo), (unsigned long)queryMemory());
   CLabel(frmAbout, AboutInfoLabel).CopyLabel(info);
   frmAbout.DoDialog();
   return;
}
Пример #21
0
static void displayLoseDialog(int usershape)
{
  char buf[1000];
  int l=0; int i;

  l+=StrPrintF(buf+l, "Shape number: %d\n", keepEupEShapeListLast);
  
  l+=StrPrintF(buf+l, "Shapes: ");
  for(i=0;i<keepEupEShapeListLast;i++)
     l+=StrPrintF(buf+l, "%d,", keepEupEShapeList[i]);
  l+=StrPrintF(buf+l, "\n");
  
  buf[l]=0;

  FrmCustomAlert(alertInfo, 
                   "You lose!\n"
                   "Bummer!\n",
                   buf, "");
}
Пример #22
0
/* Get a VFS volume label, replacing with a fake one if there is an error
   getting the real one. */
static void GetPluckerVolumeLabel
    (
    UInt16 volRefNum,
    Char*  volumeLabel,
    UInt16 length      /* must be at least large enough to hold fake name */
    )
{
    Err  err;
    err = VFSVolumeGetLabel( volRefNum, volumeLabel, length );
    if ( err != errNone )
        StrPrintF( volumeLabel, fakeVolumeNameFormat, volRefNum );
}        
Пример #23
0
void selftouch(Char *arg)
{
  if (uwep && uwep->otype == DEAD_COCKATRICE) {
    StrPrintF(ScratchBuffer, "%s touch the dead cockatrice.", arg);
    message(ScratchBuffer);
    message("You turn to stone.");
    // xxx goes by too fast, at least when reading a glove-destroying scroll.
    killer = oc_names + objects[uwep->otype].oc_name_offset;
    done("died");
    return;
  }
}
Пример #24
0
/* routine called after dying (or quitting) with nonempty bill */
void paybill()
{
  if (shlevel == dlevel && shopkeeper && ESHK(shopkeeper)->billct) {
    addupbill();
    if (total > you.ugold){
      shopkeeper->mgold += you.ugold;
      you.ugold = 0;
      StrPrintF(ScratchBuffer, "%s comes and takes all your possessions.",
		Monnam(shopkeeper));
      message(ScratchBuffer);
    } else {
      you.ugold -= total;
      shopkeeper->mgold += total;
      StrPrintF(ScratchBuffer,
		"%s comes and takes the %ld zorkmids you owed him.",
		Monnam(shopkeeper), total);
      message(ScratchBuffer);
    }
    setpaid();	/* in case we create bones */
  }
}
Пример #25
0
inline static Err WordLookupRenderStatusText(const char* word, ConnectionStage stage, UInt16 bytesReceived, const char* baseText, ExtensibleBuffer& statusText)
{
    Err error=errNone;
    char* text=TxtParamString(baseText, word, NULL, NULL, NULL);
    if (NULL==text)
        return memErrNotEnoughSpace;

    ebufResetWithStr(&statusText, text);
    MemPtrFree(text);
    if (stageReceivingResponse==stage)
    {
        static const UInt16 bytesBufferSize=28; // it will be placed in code segment, so no worry about globals
        char buffer[bytesBufferSize];
        Int16 bytesLen=0;
        if (bytesReceived<1024)
            bytesLen=StrPrintF(buffer, " %d bytes", bytesReceived);
        else
        {
            UInt16 bri=bytesReceived/1024;
            UInt16 brf=((bytesReceived%1024)+51)/102; // round to 1/10
            Assert(brf<=10);
            if (brf==10)
            {
                bri++;
                brf=0;
            }
            char formatString[10];
            StrCopy(formatString, " %d.%d kB");
            NumberFormatType numFormat=static_cast<NumberFormatType>(PrefGetPreference(prefNumberFormat));
            char dontCare;
            LocGetNumberSeparators(numFormat, &dontCare, formatString+3); // change decimal separator in place
            bytesLen=StrPrintF(buffer, formatString, bri, brf);                
        }
        Assert(bytesLen<bytesBufferSize);
        if (bytesLen>0)
            ebufAddStrN(&statusText, buffer, bytesLen);
    }
    ebufAddChar(&statusText, chrNull);
    return error;
}
Пример #26
0
static Boolean FlickrErrCallback(PrgCallbackData* data)
{
    DMSG("FlickrErrCallback(): enter; error: "); DNUM(data->error); DENDL;
    assert(errNone != data->error);
    const char* text = NULL;
    switch (data->error)
    {
        case memErrNotEnoughSpace:
        case exgMemError:
            text = "Not enough memory to complete operation.";
            break;

        case flickrErrHttpUnsupportedResponse:
            text = "Server returned malformed response.";
            break;

        case flickrErrUploadInvalidLogin:
            text = "Invalid flickr.com login. Please verify your email and password.";
            break;

        case flickrErrUploadFileTypeNotRecognized:
            text = "Server rejected this file type.";
            break;

        case flickrErrUploadExceededUploadLimit:
            text = "Exceeded flickr.com upload limit.";
            break;

        case flickrErrUploadFileSizeZero:
        case flickrErrUploadGeneralFailure:
        case flickrErrUploadNoPhoto:
        case flickrErrUploadUnknown:
            text = "Unable to complete operation: unknown flickr.com error.";
            break;

        case exgErrUserCancel:
            text = "Cancelled by user.";
            break;            

        default:
            if (data->error >= netErrorClass && data->error < netErrorClass + 0x100)
                text = "Unable to complete operation: network error.";
            else                
                text = "Unable to complete operation: unknown error.";
    }
    char buffer[32] = {chrNull};
    if (data->showDetails)
        StrPrintF(buffer, "\nError: %hu", data->error);
    PrvFillBuffer(data->textP, data->textLen, text, buffer);
    DMSG("FlickrErrCallback(): exit"); DENDL;
    return true;
}
Пример #27
0
void SetFieldFromInt ( UInt16 fieldID, int data ) {
	
	/* Temporary place in heap in order to store the string data */
	MemHandle txtH;
	
	txtH = MemHandleNew ( 10 );
	if ( !txtH) return;

	StrPrintF ( MemHandleLock(txtH), "%i", data);
	SetFieldFromHandle ( fieldID, txtH);
	MemHandleUnlock (txtH);

}
Пример #28
0
/* Initialize the main form */
static void FormInit( void )
{
    UInt16 i;

    form = FrmGetActiveForm();

    for ( i = 0; i < NUM_OF_BUTTONS; i++ ) {
        ButtonType* button;
        UInt32      records;
        UInt32      size;

        button = &buttonList[ i ];

        EnumerateData( button->creator, button->type, &records, &size );

        if ( records == 0 ) {
            HideNShow( button->recordIndex, button->sizeIndex,
                button->notFoundIndex );
            button->status = NOT_FOUND;
        } else {
            button->recordText = MemPtrNew( 255 );
            button->sizeText   = MemPtrNew( 255 );

            StrPrintF( button->recordText, "%ld", records );
            StrPrintF( button->sizeText, "%ld", size );

            FldSetTextPtr( FrmGetObjectPtr( form,
                FrmGetObjectIndex( form, button->recordIndex ) ),
                button->recordText );
            FldSetTextPtr( FrmGetObjectPtr( form,
                FrmGetObjectIndex( form, button->sizeIndex ) ),
                button->sizeText );

            button->status = VALID;
        }
    }

    FrmDrawForm( form );
}
Пример #29
0
void printarray2( FieldPtr fld, BYTE *name, int arraylen, BYTE *array )
{
	int i;
	BYTE sprintb[10];

	AppendField( fld, name, StrLen(name) );
	AppendField( fld, " ", 1 );
	for( i=0; i<arraylen; i++ ) {
		StrPrintF( sprintb, "%x", array[i] );
		AppendField( fld, sprintb+6, 2 );
	}
	AppendField( fld, "\n", 1 );
	FldDrawField(fld);
}
Пример #30
0
// ok, the SDOOR/SCORR part works.  however, none of the rest is tested
// (traps, mimics, swallowed, etc)
void do_search() // was dosearch
{
  Int8 x,y;
  trap_t *trap;
  monst_t *mtmp;
  UChar floor_type, tmp_type;

  if (you.uswallow) {
    message("What are you looking for? The exit?");
    return;
  }
  for (x = you.ux - 1 ; x <= you.ux + 1 ; x++)
    for (y = you.uy - 1 ; y <= you.uy + 1 ; y++) {
      if (x == you.ux && y == you.uy) continue;
      floor_type = get_cell_type(floor_info[x][y]);
      if (floor_type == SDOOR || floor_type == SCORR) {
	if (rund(7)) continue;
	tmp_type = (floor_type == SDOOR) ? DOOR : CORR;
	set_cell_type(floor_info[x][y], tmp_type);
	floor_info[x][y] &= ~SEEN_CELL;	/* force prl */
	prl(x,y);
	nomul(0);
      } else {
	/* Be careful not to find anything in an SCORR or SDOOR */
	mtmp = mon_at(x,y);
	if (mtmp && (mtmp->bitflags & M_IS_MIMIC)) {
	  see_mimic(mtmp);
	  message("You find a mimic.");
	  return;
	}
	for (trap = ftrap ; trap ; trap = trap->ntrap)
	  if (trap->tx == x && trap->ty == y &&
	      !(get_trap_seen(trap->trap_info)) && !rund(8)) {
	    nomul(0);
	    tmp_type = get_trap_type(trap->trap_info);
	    StrPrintF(ScratchBuffer, "You find a%s.", traps[tmp_type]);
	    message(ScratchBuffer);
	    if (tmp_type == PIERC) {
	      deltrap(trap);
	      makemon(PM_PIERCER, x, y);
	      return;
	    }
	    trap->trap_info |= SEEN_TRAP;
	    if (!vism_at(x,y))
	      print(x, y, '^');
	  }
      }
    }
}