delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/12/00:40:09

From: "guthrie" <guthrie AT nbnet DOT nb DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: jump to case lable .. in djgpp
Date: Tue, 10 Aug 1999 21:27:31 -0300
Organization: NBTel Internet
Lines: 100
Message-ID: <7oqg14$sdd$1@garnet.nbnet.nb.ca>
NNTP-Posting-Host: pix142166195126.nbtel.net
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

this switch statement says gives the eroors of jump to case label for all
cases after the first it also says crosses initialization of both of the
bool variables in case 0:    (bool key_selected  and bool select_done)

whats going on?


here's the switch:

switch(hlite_pos)
        {
        case 0:                 // selecting a rotate left key

        int new_key;
        int new_key_shift;
        bool select_done = false;
        bool key_selected = false;
        int enter_key;

            while(!select_done) file://while a key hasn't been selected or
esc pressed
            {
            // flashing text
            textout (screen, font , disp1  , 400 , 125, color1);
            textout (screen, font , "            "  , 400 , 125, color1);

            delay(30);  file://flash delay time

            if(!key_selected)   file://if key hasn't been selected
            {
               if(keypressed())    // if a key is pressed
               {

               new_key = readkey();    file://read key from key buffer
               new_key_shift = (new_key >> 8);

               if(new_key_shift == 0x01) file://esc
               select_done = true;     file://go back to previous menu

               if(!select_done) file://only if a selection has not yet been
made
               {
                for(int i = 1 ; i < 13 ; i++) file://find the key in the
scancode list
                {                             // and set it to given
movement
                   if(new_key_shift == bkey[i].hex_val)
                   {
                   k_rot_left = bkey[i].hex_val;
                   disp1 = bkey[i].key_disp;
                   i = 15;    file://stop the for loop
                   }// end if
                }//end for
               }//end if
                key_selected = true;
               }// end if
            }// end if

        if(key_selected)   file://once key has been selected
        {
              if(keypressed())   file://wait til key pressed
              {
              enter_key = readkey();    file://read the key from the buffer

                   if(enter_key == 0x1c)     file://the enter key scancode
                   select_done = true;       file://if enter ..exit the loop
..key has been set
              }// end if
        } file://end if

           file://convert scancode and set movement key to new key

        }//end while
        break;

        case 1:

        break;

        case 2:

        break;

        case 3:

        break;

        case 4:

        break;

        default:;
        }//end of switch

Thanks

Tony



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019