Forum Suggestion Expand code syntax beyond the web languages.

Discussion in 'Feedback and Suggestions' started by HunterDX77M, Mar 12, 2016.

  1. HunterDX77M

    Thread Starter Active Member

    Sep 28, 2011
    104
    2
    The code block insertion tool is helpful but the only languages that it seems to understand the syntax of are PHP, JavaScript, HTML and CSS. These are all browser and web development languages and it's unlikely people would use them on this forum. Other than that, there's the catch all "General Code" which just puts the code in monospace font.

    I think it makes more sense to recognize the syntax of C at least since many mcu programs are written in C. Another useful syntax would be the Arduino sketch syntax. Bash is probably good, too.
     
  2. WBahn

    Moderator

    Mar 31, 2012
    17,763
    4,800
    I thought that it originally did support C, but it doesn't seem to anymore.
     
  3. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,348
  4. WBahn

    Moderator

    Mar 31, 2012
    17,763
    4,800
    How do we tell it which language? I thought it was [CODE = C], but that doesn't work.
     
  5. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,348
    Hello,

    That is the way, but no spaces between the code = and language.

    Bertus
     
  6. WBahn

    Moderator

    Mar 31, 2012
    17,763
    4,800
    Thanks.

    Trial:

    Code (C):
    1.  
    2. #include <stdio.h>
    3.  
    4. #define IMAX (10)
    5.  
    6. int main(void)
    7. {
    8.    int i = 0;
    9.  
    10.    while (i++ < IMAX)
    11.       printf("Hello World #%i\n", i);
    12.  
    13.    return 0;
    14. }
    15.  
    Yep. Works.
     
  7. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,648
    764
    Prueba

    Code (ASM):
    1.    CLRF DIG_BCD_4
    2.     CLRF DIG_BCD_1
    3.     IFDEF RANGE_IS_LOW
    4.         LOADREG DIG_BCD_3,FREQ_INI_U
    5.         LOADREG DIG_BCD_2,FREQ_INI_H
    6.         LOADREG DIG_BCD_1,FREQ_INI_L
    7.         LOADREG CNTR_DIG_BCD,3
    8.     ELSE
    9.         LOADREG DIG_BCD_4,FREQ_INI_U
    10.         LOADREG DIG_BCD_3,FREQ_INI_H
    11.         LOADREG DIG_BCD_2,FREQ_INI_L
    12.         LOADREG CNTR_DIG_BCD,4      
    13.     ENDIF
    14.  
    15.     MOVFF CNTR_DIG_BCD,BUFF_CNTR_DIG;save No. of digits of the FR_SINE value
    16.     RCALL FR_SINE_TO_DISP_BUF       ;data is ready for sending to LCD display
    17.  
    18.     RCALL CONV_BCD5_NOT_PACKED_BIN16;convert input (BCD)
    19.     MOVFF NROBIN_H,FR_SINE_H        ;into binary,
    Finally....!
     
  8. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    It also understands Microchip Assembler if you use MPASM as the token.
     
Loading...