Tapatalk

Indent don't work with this code... why?

Indent don't work with this code... why?

6
NewbieNewbie
6

    Jan 31, 2005#1

    Hi,

    May be I write not the appropriate syntax but this snippet of code don't ReIndent well.

    Code: Select all

    void NetRxChar(void)
    {
    	static ushort State;
    	static ushort Qte;
    	static ushort CheckSum;
    	static ushort *Ptr;
    	static ushort Ack;
    	static ushort InChar;
    
    	InChar = NET_UDR;
    
    	switch (State)
    	{
    		case RESET :
    			if (InChar == '>') State = START1;
    			else State = RESET;
    			break;
    			
    		case START1 :
    			if (InChar == '>') State = START2;
    			else State = RESET;
    			break;
    			
    		case START2 :
    			if (InChar == '>') State = NODEID;
    			else State = RESET;
    			break;
    					
    		case NODEID :
    			if      (InChar == NetAddress)       {State = QTE; Ack = TRUE;}
    			else if (InChar == BROADCASTACK)     {State = QTE; Ack = TRUE;}
    			else if (InChar == BROADCASTNOACK)   {State = QTE; Ack = FALSE;}
    			else if (InChar == BROADCASTDEVTYPE) {State = QTE; Ack = FALSE;}
    			else State = RESET;
    			break;
    						
    		case QTE :
    			Qte = InChar;
    			CheckSum = 0;
    			Ptr = &NetRxData[0];
    			State = DATA;
    			break;
    							
    		case DATA :
    			*Ptr = InChar;
    			CheckSum = CheckSum + *Ptr++;
    			if (Ptr > &NetRxData[NET_RXBUFFER]) State = RESET;
    			Qte--;
    			if (Qte == 0) State = CHECKSUM;
    			break;
    								
    		case CHECKSUM :
    			if ((InChar==CheckSum)&&(Ack==TRUE)) NetNextEvent(&NetSendACK);
    			if ((InChar==CheckSum)&&(Ack==FALSE))NetNextEvent(&NetAnalyseData);
    			*Ptr++ = 0x00;
    			State = RESET;
    			break;
    									
    		default :
    			State = RESET;
    	}
    	InChar = 0;
    }

    6,685587
    Grand MasterGrand Master
    6,685587

      Re: Indent don't work with this code... why?

      Jan 31, 2005#2

      Remove ":" in the syntax highlighting wordfile at /Indent Strings of your language. Then you will get a better result (switch cases are not indented anymore). The problem with indention of switch cases is, that no unindent string can be found by UltraEdit because it simply does not exist one.

      See Reindent Selection for details about reindent problems with UltraEdit.
      Best regards from an UC/UE/UES for Windows user from Austria

      46
      Basic UserBasic User
      46

        Re: Indent don't work with this code... why?

        Jan 31, 2005#3

        To indent/unindent switch cases you can try to put the case in both the /Indent Strings SOL and /Unindent Strings.
        This will give you a pretty good result.

        Regards,
        Alain
        Never forget: "Above the clouds, The sky is blue and the sun shine"

        6
        NewbieNewbie
        6

          Re: Indent don't work with this code... why?

          Jan 31, 2005#4

          Hi,

          Thanks to you, now it's work and the look is now fine.

          Yours truly
          Sylvain Bissonnette