Page 1 of 1
New commands in version 3.91
Posted: Mon Apr 26, 2004 11:24 am
by omid-xp
Fred and Freak this topic is new popular commands for new version of PureBasic .
Dear users if you have other new commands please send it in this topic:
I know we can always use some of this commands by userlibrary or API but one power basic lanquage must have this commands in self for use.
New populer commands :
Getdiskpace() = get disk total space and free space
Unpackfile() = easy unpack packed files by AddPackFile()
Checkconnection() = check connection for online or offline
Checkfileexist() = check one file for exist
Checkdirexist() = check one dir for exist
Inusefile() = check in use file for is in use or not
Createshortcut() = create one shortcut of file or directory
Addregkey() = {Important} add one reg key or one value to registry
Delregkey() = {Important} delete one reg key of registry
Delkeysubkey() = {Important} delete one key and all subkeys in registry
Getregkey() = {Important} get and read one reg key in registry
Listregkey() = {Important} retrieve a list of keys and values from a selected KeyPath in the Registry.
IncludeRegistry = {Important} include one registry file ( *.reg ) in source and add all key in that by Addregkey(). this command use for more edit in registry.
Code: Select all
Sample for this command :
IncludeRegistry "Registry filename"
Addregkey("Registry filename")
This well be add all keys and subkeys in registry file to registry
Addinikey() = {Important} add one key in ini
Delinikey() = {Important} del one key of ini
Getinikey() = {Important} get one key in ini
Getfilemodified() = get last date modified file
Getfileversion() = get file version number
Drivetype() = get type of one drive name ( hard drive, cd-rom, floppy and ... )
ChangeFileAttributes() = Change one File or folder Attributes
Best regards.
Posted: Mon Apr 26, 2004 12:53 pm
by blueznl
well, if we start throwing wishLISTs
Code: Select all
; purebasic survival guide - pb3.90 sp1
; wishlist.pb - 21.04.2004 ejn (blueznl)
; http://www.xs4all.nl/~bluez/datatalk/pure1.htm
;
; - things i miss in purebasic...
; - or bugs that i know of...
; - or just the very nice to haves...
;
; obviously, this code won't run! :-)
;
;
; *** the not statement or function
;
; missing... still...
;
; <var> = Not( <iexp> )
; <var> = Not <iexp> ; preferred :-)
;
; b1 = 0
; b2 = Not(b1)
;
; ( x_not() )
;
;
; *** fixed lenght strings
;
; <varname> [ .c [ <stringlength> ] ]
;
; fixed.c[100] = "abc"
; zeroterm.s = "abc"
;
; If fixed = zeroterm
; Debug "this should be true"
; EndIf
;
; Structure d
; bytes.b[100]
; fixedstring.c[100]
; zerotermstring.s
; Endstructure
;
;
; *** the power operator
;
; every basic has it, why not pure?
;
; a = 2^2
;
;
; *** multiple case conditions on one line
;
; a = 2
; Select a
; Case 1,2
; Case 3
; Default
; EndSelect
;
; (please *not* in c-style)
;
; *** additional datatypes
;
; doublefloat.df
; double.d (64 bits) <-- especially this one!
; unsignedbyte.ub <-- and this one
; unsignedword.uw
; unsignedlong.ul
; unsigneddouble.ud
;
;
; *** compiler / debugger error reporting
;
; report proper line number and code etc. when running into an error in an included file
;
;
; *** bug: pointers in structs
;
; Structure x
; p.l
; *p
; EndStructure
;
; y.x
; y\p = 1
; y\*p = 2
;
;
; *** openfile options
;
; openfile( <nr> , <filename> [ , <flags> [ , <buffer> ] ] )
;
; flags (optional):
;
; #PB_FILE_READ
; #PB_FILE_WRITE
; #PB_FILE_SHARED
; #PB_FILE_NOCACHE
;
; ( x_openfile(), x_closefile(), etc... )
;
;
; and buffer (optional) sets the size of the Read ahead Buffer in memory (To speed up *reading* file access)
;
; writing to the file (when opened for r/w) should either update the cache, force it to be refreshed on the
; next read instructions, or caching should not be allowed in combination with r/w
;
; (why optional? you don't want the cache to give you old data when another program is writing into the file...)
;
;
; *** standardize syntax
;
; standardize or expand all those command variants (UseFile, UseWindow, WindowOutput()
; SpriteOutput() etc.) that have inconsistent syntax or cause unneccesary additional statements as 'usewhatever'
;
; best would be to support both variations
;
;
; *** regular basic functions
;
; Max()
; Min()
; SGN()
; Abs()
;
;
; ( x_abs(), x_sgn(), x_max(), x_min() )
;
;
; *** swap statement
;
; for vars as well as array elements
;
; Swap( <var1> , <var2> )
; Swap( a , b )
; Swap( b(10,1), b(11,1) )
;
; ( x_swap() )
;
;
; *** rfindstring
;
; RFindString( <string.s> , <search.s> )
;
; ( x_rfindstring() )
;
;
; *** limit on bytearrays in a structure
;
; is currently b.b[32767]... we want more...
;
;
; *** and more...
;
; - add '#nr' parameter To most file commands
; - delete / insert elements in arrays
; - defline To define style / thickness of drawn 2d graphics
; - VAL on hex and bin strings (detect $ and % character)
; - STR To accept floats, bytes etc. with specified nr. of decimals
; - SortList() function
;
; ( x_val() )
;
;
;
; *** and some icing on the cake :-)
;
; - depth parameters For createimage / loadimage etc.
; - bigger strings (actually, i would only need the fixed length strings to be larger
; (normal strings at 64k are good enough for me, might not be for others :-))
; - thread safe strings
; - commands to sync up multi threading (mutex stuff)
; - rendermovieframe() to render frames in bitmaps instead of on sprites
; - movieframeRate() function
; - step parameter for for/next loops
; - control over image depth when loading / creating
; - multi column sortarray() command (as in gfa)
;
;
; *** fulfilled wishes
;
; CountString()
Embedded Directives and Expansion of DECLS
Posted: Wed Apr 28, 2004 6:30 pm
by oldefoxx
I do not necessarily concur with the above -- for one thing, I don't think it is real smart to try to tweak the registry from within your programs, and what this would do in the hands of newbies, or even as a consequence of some false assumptions or coding errors is horrifying to consider. There has been some sample code written in this area, and I am more of a mind that only people in deep earnest about registry tweaks need apply.
On the other hand, bugs are bugs, so they should go in bug reports.
Embedded directives, on the other hand, ensure that code written for a specific need or having certain dependencies will always compile the same way and give the same result, such as producing either a DLL or an EXE file. It certainly helps with distributing source code suitable for immediate use on other machines. It also defines the dependencies required, so that the user can determine if the target machine is able to support the requirements.
DECLS allow for the inclusion of existing code, which for Blitz2D (and possibly BlitxPlus, though I haven't really looked at it) means that it is available in the IDE and in the produced executables, but where is the benefit if the programmer does not need it or use it? On the other hand, the programmer needs to know what the parameters are when calling it, and that means familiarity and use of the constants and structures associated with the parameters used by the defined functions. Consequently, I feel that the DECLS need to incorporate more syntax in support of the constants and structures commonly associated with DLLs, and that these likewise then be inherited in the IDE and the resulting programs that can be produced.
Posted: Wed Apr 28, 2004 6:56 pm
by freak
The suggested ini functions are allready there (see the Preferences library)
The suggested registry functions make no sense, because there is no registry on other Platforms.
Same for the shortcuts.
Blueznl: Your wishes are well known here i think
Timo
You've lost me
Posted: Wed Apr 28, 2004 7:30 pm
by oldefoxx
Hi Timo,
Youy've lost me. What Preference Library? What sort of .INI function reference? Figuring I likely missed something, I went looking again, but I don't find what you seem to be referring to.
Posted: Wed Apr 28, 2004 8:57 pm
by Num3
In PureBasic Help -> Under Preferences
(i edited this help so i should know)
Preference file contains user defined program parameters stored on the disk and read back when the program start again (like '.INI' files under Windows for example). PureBasic offers the possibility to create heriarchical preference file easely useable on any computer plateforms. The file format is in ascii with one preference per line, using the 'Keyword=Value' syntax. Groups can be created for better reading.
Revisit Embedded Directives
Posted: Thu Apr 29, 2004 5:27 am
by oldefoxx
An .INI file is fine for initializing an application, but I'm not sure if you understood my reference to embedded directives that can be placed in source code to control the compile process or not. For instance, the following would be examples of directives to change the manner in which PureBasic compiles a program:
[directive flag]COMPILE EXE
[directive flag]COMPILE DLL
[directive flag]ENABLE ASM
[directive flag]ENABLE ONERROR
[directive flag]ENABLE DEBUGGER
[directive flag]ENABLE ERRORLOG
[directive flag]ENABLE TRACE
[directive flag]IF <condition>
<whatever>
[directive flag]ELSEIF <condition>
<whatever>
[directive flag>ELSE
<whatever>
[directive flag>ENDIF
The directive flag is some symbol that is not confused by the compiler
with a program statement. Some compilers use a "#" or a "$" as the
directive flag, but it must be reserved for this purpose.
Directive flags can also be used for other purposes, such as
[directive flag]INCLUDE "include.constants.txt", or to include stubfiles
that contain critical statements or functions to be incorporated into a given program.
Directives can be extended to include the specification of paths for different needs (where to find source files, where to find DECLS, where to search for DLLs, where to write the EXE or DLL to, where to find include files, what project this code belongs to, what version of code this belongs to, which compiler version it is intended for, and on and on and on).
Consequently, directives can play a very powerful role in establishing and preserving the environment needed for both a successful compile and run of the programs that are produced. It aids in continuing development, while letting you quickly and easily determine what has to be done to revert to an earlier time when the code was under development and was then dependent on something that may have since changed, such as which compiler was being used, or if an earlier or alternate library was involved.
Step
Posted: Thu Apr 29, 2004 2:58 pm
by USCode
blueznl,
FYI - There is already a STEP parameter for for-next loops. At least that's 1 less off your list!

Posted: Thu Apr 29, 2004 3:15 pm
by blueznl
euh... oh
was that step with a var or a constant?
(trying to talk my way out of it, i never use steps with for / next)
Posted: Thu Dec 30, 2004 3:02 pm
by newbie
I second what Blueznl requested :
; *** fixed lenght strings
;
; <varname> [ .c [ <stringlength> ] ]
;
; fixed.c[100] = "abc"
; zeroterm.s = "abc"
;
; If fixed = zeroterm
; Debug "this should be true"
; EndIf
please include fixed length strings, so that for instance we can use them in structures (using Blueznl syntax):
Code: Select all
structure MyStruct
var1.l
fixed.c[100] ; <------ here : a fixed lentgh string of 100 bytes
unfixed.s
arrayunfixed.s[100]
EndStructure
Another vote for this feature so

Posted: Thu Dec 30, 2004 9:38 pm
by PB
> registry functions make no sense, because there is no registry on other Platforms
So what? The Registry is a MAJOR component of Windows and the ability to
manipulate/read it should be ESSENTIAL. I've been using Procedures to do
so but native commands are an absolute MUST, in my (and many others!)
opinions. There are quite a few Windows-only commands in PureBasic so
why should having Registry commands be any different? Don't be silly.

Posted: Tue Mar 08, 2005 9:46 am
by dagcrack
I vote for all the functions!
Posted: Tue Mar 08, 2005 11:47 am
by GedB
Oldefoxx,
I'm confused. PB already has compiler directives:
http://www.purebasic.com/documentation/
Just look at Examples\Sources\DLLSample for an example of their useage.
Have I misunderstood you?