Documentation of obsolete or considerably modified functions

Everything else that doesn't fall into one of the other PB categories.
Little John
Addict
Addict
Posts: 4770
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Documentation of obsolete or considerably modified functions

Post by Little John »

Hi all,

there is already a feature request for proper documentation of functions that do not exist anymore in the current PB version or that changed enough to break backwards compatibility.

Fortunately, the documentation of some (all?) obsolete functions is still available on the internet. However, the respective entries and links in the table of contents of the PureBasic Reference Manual have been removed. So I thought we can collect information about obsolete functions in this thread (until it will become part of the official documentation).
Here's a start:

Library: Packer

PackMemory()
Introduced in PB version: ?
Last PB version that supported this function: 5.00

PackerCallback()
Introduced in PB version: ?
Last PB version that supported this function: 5.00

UnpackMemory()
Introduced in PB version: ?
Last PB version that supported this function: 5.00

See also the tool "UnpackMemory".
Last edited by Little John on Wed May 29, 2013 4:13 pm, edited 1 time in total.
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Documentation of obsolete functions

Post by davido »

Thanks.
Looks good.
DE AA EB
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 796
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: Documentation of obsolete functions

Post by Zebuddi123 »

Packer Library Example. PB 5.00 and Older.

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - Compressor example file
;
;    (c) 2001 - Fantaisie Software
;
; ------------------------------------------------------------
;

If ReadFile(0, OpenFileRequester("Choose a file to compress", "", "*.*", 0))
  FileLength = Lof(0)
  
  ; Allocate the 2 memory buffers needed for compression..
  ;
  *Source = AllocateMemory(FileLength)
  *Target = AllocateMemory(FileLength+8)
  If FileLength And *Source And *Target
    ReadData(0, *Source, FileLength) ; Read the whole file in the memory buffer
    
    ; Compress our file, which is in memory (and use a timer to see the time spend by compression..)
    ;
    CompressedLength = PackMemory(*Source, *Target, FileLength)
    If CompressedLength

      DecompressedLength = UnpackMemory(*Target, *Source)
      If DecompressedLength = FileLength
        MessageRequester("Info", "De/Compression succeded:"+#LF$+#LF$+"Old size: "+Str(FileLength)+#LF$+"New size: "+Str(CompressedLength))
      EndIf
    Else
      MessageRequester("Error", "Can't compress the file")
    EndIf 
    
    FreeMemory(*Source)
    FreeMemory(*Target)    
    
  EndIf
  
  CloseFile(0)
EndIf

End

Zebuddi. :)
malleo, caput, bang. Ego, comprehendunt in tempore
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Documentation of obsolete functions

Post by IdeasVacuum »

Well, this idea needs the formal support of Fred, otherwise the links are vulnerable.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Little John
Addict
Addict
Posts: 4770
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Documentation of obsolete functions

Post by Little John »

Library: Network

SendNetworkFile()
Introduced in PB version: 2.00
Last PB version that supported this function: 5.00

ReceiveNetworkFile()
Introduced in PB version: 2.00
Last PB version that supported this function: 5.00

The functions have been removed in order to avoid possible security problems.

Now we have to write code for sending/receiving files on a network ourselves, using the basic built-in network functions,
see How send file using ReceiveNetworkData/SendNetworkData ?
Last edited by Little John on Sun May 12, 2013 6:23 pm, edited 1 time in total.
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Documentation of obsolete functions

Post by davido »

SendNetworkFile() & ReceiveNetworkFile()

Presumably they were introduced in this version:

12 November 2000

PureBasic V2.00 PR2 (Windows)

- Added: Library Sprite
- Added: Library Joystick
- Added: Library Keyboard
- Added: Library Sound
- Added: Library Network
- Added: Library Palette
- Added: An early version of Waponez II (Shoot-em-up) to test the game functions- Fixed: Tons of bugs. Thanks to all bug reporters :)
DE AA EB
Little John
Addict
Addict
Posts: 4770
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Documentation of obsolete functions

Post by Little John »

Thank you, davido!
I've changed the above post accordingly.
Little John
Addict
Addict
Posts: 4770
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Documentation of obsolete or considerably modified funct

Post by Little John »

Library: 2D Drawing

Line()
Considerably modified in PB version: 4.40

Width of 0 not allowed anymore. You might want to use LineXY() instead.

see http://www.purebasic.fr/english/viewtop ... 03#p413703
moogle
Enthusiast
Enthusiast
Posts: 372
Joined: Tue Feb 14, 2006 9:27 pm
Location: London, UK

Re: Documentation of obsolete or considerably modified funct

Post by moogle »

Little John wrote:Hi all,

there is already a feature request for proper documentation of functions that do not exist anymore in the current PB version or that changed enough to break backwards compatibility.

Fortunately, the documentation of some (all?) obsolete functions is still available on the internet. However, the respective entries and links in the table of contents of the PureBasic Reference Manual have been removed. So I thought we can collect information about obsolete functions in this thread (until it will become part of the official documentation).
I suggested something like that 2 years earlier here, but as usual stuff that would help PB's image and beginners using old forum code gets ignored. Then people wonder why purebasic doesn't gain a larger following :|


The help file should keep those (removed) entries that way when the compiler tells you the function no longer exists the user can see the description of the arguments and find out how to convert it to use the replacement one.
Image
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Re: Documentation of obsolete or considerably modified funct

Post by rsts »

Not that there aren't a lot of good ideas, but with such a small team, there's only so much you can do.

cheers
Little John
Addict
Addict
Posts: 4770
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Documentation of obsolete or considerably modified funct

Post by Little John »

Hi,

the purpose of this thread is the documentation of functions that do not exist anymore in the current PB version or that changed enough to break backwards compatibility.

I would highly appreciate it, if there would be as few discussion here as possible. Too much discussion would make it harder to read the documentation collected in this thread. Thank you.
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Documentation of obsolete or considerably modified funct

Post by davido »

Hi Little John,

Might I suggest that the request be made that users delete their posts after their point has been made. Leaving only the one post for each function.

I will remove this post in the next day or so. Also the two previous posts I made have now become become 'clutter' and I will remove those if you so wish.
DE AA EB
Little John
Addict
Addict
Posts: 4770
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Documentation of obsolete or considerably modified funct

Post by Little John »

Library: Gadgets

ClearGadgetItemList()
Introduced in PB version: 2.30
Last PB version that supported this function: 4.20

The function has been renamed ClearGadgetItems().
Little John
Addict
Addict
Posts: 4770
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Documentation of obsolete or considerably modified funct

Post by Little John »

Category: Keywords

(X)IncludeFile, IncludeBinary
Considerably modified in PB version: 5.30

On principle, (X)IncludeFile (and IncludeBinary) can be used in 2 different ways:

1) XIncludeFile <absolute Path> e.g.

Code: Select all

XIncludeFile "C:\Users\Me\Desktop\hello.pbi"
XIncludeFile #PB_Compiler_Home + "..\libs\foo.pbi"
XIncludeFile #PB_Compiler_FilePath + "bar.pbi"
2) XIncludeFile <relative Path> e.g.

Code: Select all

XIncludeFile "this.pbi"
XIncludeFile "..\that.pbi"
The change in PB 5.30 affects (X)IncludeFile (and IncludeBinary), when used with a relative path:
In PB 5.2x LTS and earlier versions, a relative path after (X)IncludeFile is relative to the location of the main source code file.
In PB 5.30 and subsequent versions, a relative path after (X)IncludeFile is relative to the location of the file it is used in.

see http://www.purebasic.fr/english/viewtop ... =7&t=58746


Workaround

In order to make your "old" code compatible with PB 5.30+, add something like this at the beginning of any file that is used as main source code:

Code: Select all

CompilerIf #PB_Compiler_IsMainFile
   #Main_FilePath = #PB_Compiler_FilePath
CompilerEndIf
And change all (X)IncludeFile statements with a relative path to an absolute path, based on #Main_FilePath.

In other words, in all your source files
replace

Code: Select all

XIncludeFile
with

Code: Select all

XIncludeFile #Main_FilePath +
After applying these changes, (X)IncludeFile will work as before in PB 5.2x LTS and previous versions, and will work the same way in PB 5.30+.

//edit:
I think this simpler workaround will work as well:

Just add

Code: Select all

CompilerIf #PB_Compiler_IsMainFile
   IncludePath #PB_Compiler_FilePath
CompilerEndIf
at the beginning of any file that is used as main source code
(no other changes required).
Post Reply