Shop OBEX P1 Docs P2 Docs Learn Events
doubly linked lists in spin — Parallax Forums

doubly linked lists in spin

sssidneysssidney Posts: 64
edited 2010-06-12 21:41 in Propeller 1
I haven't seen this anywhere so I thought I'd give it a shot. I use doubly linked lists in C all the time. I
used ctospin to do the initial hard part. Let me know what you think. I'll submit it to obex if it's worth it.

Comments

  • jazzedjazzed Posts: 11,803
    edited 2010-06-12 20:44
    Hello sssidney.

    I'm a fan of abstract data structures like this especially when it helps provide a
    clean solution to something otherwise difficult like the travelling salesman problem.

    One thing that stops me from trying it out is lack of the serial driver.
    I just don't keep MultiCogSerialDebug.spin in my library ...

    If you package the project using the File->archive feature, it will be easier to test.

    Method names enqueue and dequeue are very common and have clear meanings.
    I would certainly object to push/pop [noparse]:)[/noparse] Just my opinion though [noparse]:)[/noparse]

    Cheers,
    --Steve

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Pages: Propeller JVM
  • sssidneysssidney Posts: 64
    edited 2010-06-12 21:29
    · Here's the zip with the other objects.
  • jazzedjazzed Posts: 11,803
    edited 2010-06-12 21:41
    That works.

    I recommend adding "waitcnt" after debug.start though to give the user terminal time to open up.

    PUB main | tstPtr, delPtr
      debugSemID := locknew
      queSemID := locknew
      
      debug.start(serRecv,serXmit,0,speed,debugSemID)
      waitcnt(clkfreq+cnt) ' wait a second for user terminal to open
    
      que.initQueHead(@queHead)
      ' ....  
    
    


    Cheers,
    --Steve

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Pages: Propeller JVM
Sign In or Register to comment.