Function strings for interrupt functions starting with @interrupt

Function strings for interrupt functions starting with @interrupt

2
NewbieNewbie
2

    Mar 10, 2009#1

    With my embedded Cosmic C compiler, interrupt functions are preceded by @interrupt. With this prefix, UEStudio does not show these functions in the function list. I attempted to modify the wordfile adding "@" to the regular expressions like so:

    Code: Select all

    /Function String = "%^([@_a-zA-Z_0-9^[^]*]+^)[ ^t]+([^p*&:, ^t^[^]a-zA-Z_0-9.!]++)[~;]"
    /Function String 1 = "%[@_a-zA-Z_0-9*]*::^([a-zA-Z_0-9^~]+^)[ ^t^p]++([^p*&:, ^t^[^]/*^-'=:&a-zA-Z_0-9./(!]++)[~;]"
    /Function String 2 = "%[@_a-zA-Z_0-9][a-zA-Z_0-9^[^]]+[ ^t*]+^([a-zA-Z_0-9]+^)[ ^t]++([^p*&:, ^t^[^]a-zA-Z_0-9./(!]++)[~;]"
    /Function String 3 = "%[@_a-zA-Z_0-9*&$^[^]*]+[ ^t]+[a-zA-Z_0-9*&$^[^]]+[ ^t*]+^([a-zA-Z_0-9]+^)[ ^t]++([^p*&:, ^t^[^]a-zA-Z_0-9./(!]++)[~;]"
    /Function String 4 = "%[@_a-z_0-9^[^]*]++ [a-z_0-9*^[^]]+[ ^t]++[a-z_0-9*^[^]]+[ ^t]++^([*a-z_0-9]+^)[ ^t]++([^p*&:, ^t^[^]a-z_0-9./(!]++)[~;]"
    /Function String 5 = "%^([@_a-zA-Z_0-9^[^]*]+^)[ ^t]++([^p*&:, ^t^[^]a-zA-Z_0-9./()!]++)[~;]"
    I'm not great with regular expressions and would appreciate any help.

    Below is my function used for receiving messages from a data bus and placing them in a queue. Normal program execution is interrupted when a message is received by the hardware buffer and calls this function.

    Code: Select all

    @interrupt void can_rx(void)   
    {
      volatile unsigned char received_length;
      volatile unsigned char count;
    
      if (QUEUE_RX.q_count >= MAXQUEUE)
      {
        goto end;  //Queue is full
      }
      else
      {
    
        QUEUE_RX.q_count++;
        QUEUE_RX.q_rear = (QUEUE_RX.q_rear + 1) % MAXQUEUE;
    
        QUEUE_RX.Store_RX[QUEUE_RX.q_rear].IDR0 = CANRXFG[0];
        QUEUE_RX.Store_RX[QUEUE_RX.q_rear].IDR1 = CANRXFG[1];
        QUEUE_RX.Store_RX[QUEUE_RX.q_rear].IDR2 = CANRXFG[2];
        QUEUE_RX.Store_RX[QUEUE_RX.q_rear].IDR3 = CANRXFG[3];
    
        QUEUE_RX.Store_RX[QUEUE_RX.q_rear].DLC = (CANRXFG[12] & 0x0f);  // Lower nibble
        received_length = (QUEUE_RX.Store_RX[QUEUE_RX.q_rear].DLC);
    
        for (count = 0; count < received_length; count++)
        {
          QUEUE_RX.Store_RX[QUEUE_RX.q_rear].Data[count] = CANRXFG[count+4];
        }
      }
    end:
      CANRFLG = CANRFLG | 0x01;
      
    }
    Thanks!

    6,675585
    Grand MasterGrand Master
    6,675585

      Mar 11, 2009#2

      Function String 3 finds your interrupt function. But I think the function string set can be optimized by using this set:

      Code: Select all

      /Function String = "%^([a-zA-Z_0-9^[^]*]+^)[ ^t]++([^p*&:, ^t^[^]a-zA-Z_0-9./()!]++)[~;]"
      /Function String 1 = "%[a-zA-Z_0-9][a-zA-Z_0-9^[^]]+[ ^t*]+^([a-zA-Z_0-9]+^)[ ^t]++([^p*&:, ^t^[^]a-zA-Z_0-9./(!]++)[~;]"
      /Function String 2 = "%[@a-zA-Z_0-9*&$^[^]]+[ ^t]+[a-zA-Z_0-9*&$^[^]]+[ ^t*]+^([a-zA-Z_0-9]+^)[ ^t]++([^p*&:, ^t^[^]a-zA-Z_0-9./(!]++)[~;]"
      /Function String 3 = "%[a-z_0-9^[^]*]++ [a-z_0-9*^[^]]+[ ^t]++[a-z_0-9*^[^]]+[ ^t]++^([*a-z_0-9]+^)[ ^t]++([^p*&:, ^t^[^]a-z_0-9./(!]++)[~;]"
      Function String 5 = is now Function String = because standard Function String = is just a more restricted version of Function String 5 =.

      Function String 1 = is deleted because it is for C++ only (syntax classname::function) and therefore not needed for 'C'. The other 2 function strings are just renumbered.

      The duplicate underscore in first [] is removed on all function strings as well as the duplicate * in Function String 2 =.

      I have added @ on Function String 2 = which is for "word word functionname(parameters)" and so finds

      @interrupt void can_rx(void)
      unsigned int foo1()
      unsigned long* foo2()
      unsigned char foo3 ( int size /*comment*/)
      ...

      If you can't see your interrupt function, disable setting Use Function Tips data (if available) for Function List at Configuration - IDE - IntelliTips - Function Tips.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Mar 11, 2009#3

        Thanks Mofi! Works like a charm.