Shop OBEX P1 Docs P2 Docs Learn Events
a better Editor — Parallax Forums

a better Editor

SamTheManSamTheMan Posts: 43
edited 2009-06-01 22:19 in General Discussion
Who program and update·the SX editor?

I wish·he/she·to improve the editor so that the SUBs and FUNCs go to a different·pages(branches) and·do not stay·on the same program code page for easy access

right now every time I want to update a SUB, I have to look through the whole code line by line until I find the SUB. Unless there's·a feature·in the compuiler I don't know about it

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Comments

  • JonnyMacJonnyMac Posts: 9,213
    edited 2009-05-31 14:59
    Does the Find (Ctrl+F) dialog not work for you? I use it all the time. For example, I have a subroutine called SET_TRIS so I entered "SUB SET_TRIS" (without the quotes, of course) in the Find dialog and it took me right to it.
  • PJMontyPJMonty Posts: 983
    edited 2009-06-01 22:19
    SamTheMan,

    I'm afraid you'll just have to get used to the current editor. This style of program editor is extremely common. The vast majority of software is written in exactly the style you mention. The key is for you to organize your code better, to make it easier to find funcs and subs. For example, I have attached a section from one of the code examples in the help file. Note the use of long strings of "
    " to isolate sections vertically. The use of these can be on a per function basis. There's no limit since they are just comments and don't add anything to the compiled code size. Also note the the useful and brief descriptions to make it easier to find what you're looking for.

    Finally, as JonnyMac noted, the "find" function is your friend. Simply double click on any func or sub name and then hit CTRL-F. The name you double clicked will be in the find dialog, ready for you to search. Also, don't' forget F3 (search again), which will search for the last search term even with the dialog closed.

    Thanks,
    PeterM

    ' -------------------------------------------------------------------------
    ' Subroutine Declarations
    ' -------------------------------------------------------------------------
    
    GET_KEY     FUNC     1         ' get key from pad
    DELAY         SUB     1, 2         ' delay in milliseconds
    
    ' -------------------------------------------------------------------------
    ' Program Code
    ' -------------------------------------------------------------------------
    
    Start:
     LEDs = Dash ' dash in display
     
    
    Main:
      theKey = GET_KEY             ' get a key
      IF theKey < 16 THEN             ' was a key pressed?
        READ ReMap + theKey, theKey     ' yes, remap keypad
        READ Digits + theKey, LEDs         ' output to display
        DELAY 100
      ELSE
        LEDs = Dash
      ENDIF
      GOTO Main
    
    ' -------------------------------------------------------------------------
    ' Subroutine Code
    ' -------------------------------------------------------------------------
    
    ' This routine works by activating each row, then scanning each column.
    ' If a particular row/column junction is not active (pressed), the key
    ' value is incremented and the scan continues. As soon as a key is found,
    ' the routine exits. If no key is pressed the routine will exit with a key
    ' value of 16.
    '
    ' Use: aByte = GET_KEY
    ' -- scans keyboard and places key value into 'aByte'
    
    FUNC GET_KEY
      tmpB1 = 0                 ' reset keyboard value
      Keys = %0000_0111             ' activate first row
      TRIS_Keys = %1111_0000         ' refresh IO state
      PLP_Keys = %0000_1111         ' pull-up input pins
    
      FOR tmpB2 = 1 TO 4             ' scan four rows
        IF Col1 = Yes THEN EXIT         ' check buttons on column
        INC tmpB1                 ' update key value
        IF Col2 = Yes THEN EXIT
        INC tmpB1
        IF Col3 = Yes THEN EXIT
        INC tmpB1
        IF Col4 = Yes THEN EXIT
        INC tmpB1
        Keys = Keys >> 1             ' select next row
        Keys = Keys | %0000_1000         ' clear previous row
      NEXT
      RETURN tmpB1
    ENDFUNC
    
    ' -------------------------------------------------------------------------
    ' Use: DELAY ms
    ' -- 'ms' is delay in milliseconds, 1 - 65535
    
    SUB DELAY
      IF __PARAMCNT = 1 THEN
        tmpW1 = __PARAM1 ' save byte value
      ELSE
        tmpW1 = __WPARAM12 ' save word value
      ENDIF
      PAUSE tmpW1
    ENDSUB
    
    
Sign In or Register to comment.