SortStructuredArray() missing

Just starting out? Need help? Post your questions and find answers here.
User avatar
William Van Hoecke
Posts: 50
Joined: Tue Oct 22, 2019 12:09 pm

SortStructuredArray() missing

Post by William Van Hoecke »

Okeee
I am in the process of converting a program PB to SB and I am stuck again since SortStructuredArray() is missing :oops:
buiding a workarround will slow the program down.

Any Id someone

FlipCoordinates() is missing too in SB ??
Vectordrawing at more than one canvas is not working !!
Vectordrawing is not behaving same in PB as in SB

If there is no update comming any time soon I might have to quit the conversion process and stay with the desktop version.

....... IS THERE COMMING AN UPDATE ANY TIME SOON ????
User avatar
Paul
Posts: 195
Joined: Wed Feb 26, 2014 6:46 pm
Location: Canada
Contact:

Re: SortStructuredArray() missing

Post by Paul »

Maybe read Fred's list from 2016 of some differences between PureBasic and SpiderBasic
viewtopic.php?p=3438#p3438
... SortStructuredArray() is not implemented.
IS THERE COMMING AN UPDATE ANY TIME SOON ????
Only Fred knows the answer to this but history shows updates are few and far in between ;(


Differences against PureBasic:

- Bitwise operands like '<<', '>>', '^', '!' only works on 32-bit numbers
- Quads are not real 64-bit quads but 53-bit only.
- Float are handled like double (32-bit float doesn't exists)
- Integer type other than 'quad' and 'integer' are subject to slow casting to respect their range
- '?' operator to get the labels address is not supported
- 'Break' doesn't support a level parameter
- No 'Goto'
- No 'Gosub'
- No 'End'
- Removed ProcedureC/ProcedureDLL, ImportC
- ReDim doesn't support multiarray

Gadget:
- ScrollBar() not implemented
- MDIGadget() not implemented
- ExplorerGadgets() not implemented
- IPAddressGadget() not implemented
- ShortCutGadget() not implemented
- Get/SetGadgetItemColor() not implemented
- ProgressBar(): no vertical settings
- CalendarGadget(): colors not supported
- ComboBox has fixed height (font based)
- ButtonImageGadget(): no pressed image
- SpinGadget(): no Get/SetGadgetText(), numeric only
- TextGadget(): no border
- TrackBarGadget(): #PB_TrackBar_Ticks
- CheckBoxGadget(): #PB_CheckBox_InBetween not supported
- EditorGadget(): No item management

2DDrawing:
- Only outlined and standard mode supported for now
- Gradient functions not implemented
- Custom filter not implemented
- DrawingBuffer() not implemented
- DrawText() not implemented
- DrawRotatedText() not implemented
- AlphaBlend() not implemented
- DrawingFont() not implemented
- DrawAlphaImage() not implemented
- FillArea() not implemented
- GrabDrawingImage() not implemented
- TextHeight() not implemented
- TextWidth() not implemented

Date:
- ParseDate() not implemented

Image:
- CatchImage() not implemented
- EncodeImage() not implemented

Math:
- RandomData() not implemented

Requester:
- OpenFileRequester() signature has changed

Screen:
- ScreenOutput not implemented

Sort:
- SortStructuredList() and SortStructuredArray() are not implemented

String:
- StringByteLength() not implemented

ToolBar:
- ToolBarStandardButton() not implemented

Window:
- No window maximize/minimize buttons
- WindowOutput() not implemented
- Get/SetWindowState() not implemented
- Get/SetWindowColor() not implemented
- WindowEvent()/WaitWindowEvent() not supported (use BindEvent() instead)

XML:
- CatchXML() is not available
- CreateXMLNode() syntax is different
- SetXMLNodeName() is not available
- LoadXML(): new flags (PB_LocalFile)

JSON:
- CatchJSON() not available
- ExportJSON() not available
- ExportJSONSize() not available
- SaveJSON()
User avatar
William Van Hoecke
Posts: 50
Joined: Tue Oct 22, 2019 12:09 pm

Re: SortStructuredArray() missing

Post by William Van Hoecke »

Thanks Paul,
Should have read that in advance :(
However... since this list is from 2016 one would expect most of these items already implemented by now.... :(

I really love purebasic and all its capabilities... but I was blinded by the last sentence of the annoucement

SpiderBasic is based on the PureBasic syntax, and is compatible to some degree with it. If you are already familiar with PureBasic, using SpiderBasic should be an easy task. It's even possible to create a program which runs on the web, mobile and desktop using the same source code.


I will have to work arround and hope it doesn slow down the end result too much.
Thanks.
User avatar
William Van Hoecke
Posts: 50
Joined: Tue Oct 22, 2019 12:09 pm

Re: SortStructuredArray() missing

Post by William Van Hoecke »

Solved it like this...
used a quicksort algorithm .... works fine and quickly

Anyone care to tweak this code so it could be used universally for any kind of structure ??

Code: Select all

Procedure SortKastConfigArrayByIndex(dir.i,strt.i,stp.i)
  ; Structure Kastconfigstruct
  ;   index.i
  ;   type.i
  ;   confnr.i
  ;   level.i
  ;   text.s
  ;   stat.i          ; 0 = no error 
  ;   selected.i
  ; EndStructure
  L.i = strt
  R.i = stp
  compval.i = kastConfig((strt + stp)/2)\index
  While L < R
    Select dir
      Case 0 ;descending 
        While kastConfig(L)\index < compval
          L+1
        Wend
        While kastConfig(R)\index > compval 
          R-1
        Wend
      Case 1 ;ascending  
        While kastConfig(L)\index > compval
          L+1
        Wend
        While kastConfig(R)\index < compval 
          R-1
        Wend
    EndSelect    
    If L <= R
      Swap kastConfig(L)\confnr,kastConfig(R)\confnr
      Swap kastConfig(L)\index,kastConfig(R)\index
      Swap kastConfig(L)\level,kastConfig(R)\level
      Swap kastConfig(L)\selected,kastConfig(R)\selected
      Swap kastConfig(L)\stat,kastConfig(R)\stat
      Swap kastConfig(L)\text,kastConfig(R)\text
      Swap kastConfig(L)\type,kastConfig(R)\text
      L+1
      R-1
    EndIf
  Wend 
   If strt < R
     SortKastConfigArrayByIndex(dir,strt,R)
   EndIf
   If L < stp
     SortKastConfigArrayByIndex(dir,L,stp)
   EndIf  
EndProcedure  
Post Reply