Skip to content

What's New

Gambas Script edited this page Dec 28, 2021 · 42 revisions

Release 1.3.98

Updates to variable and function identifiers to correctly allow _ or $ as part of the name, be careful as a $ in front still caused the use of shell variables.
Added function objdef which will return the text class/type name of an object of variable.
Cleaned up using a variable as a function, parameter passing using $0...$n
Calls now return string[] one entry for each line returned

   $a = "for i as integer = 0 to 9\nprint i;;$0;;\nnext"
   ?? @a("This msg")
outputs:
   1 This msg 2 This msg 3 This msg 4 This msg 5 This msg 6 This msg 7 This msg 8 This msg 9 This msg

Cleaner, hopefully more complete update process

Extended editable datatypes, improved display of more, datatypes

Automated update process more completely

Corrected how gsh detected new updates, correctly updates the base subs and classes of the gsh environment.

ClearSubs and ClearClass , lsubs, lclass updated

clearsubs and clearclass both now prompt for unsaved classes lcass, lsub both now display in same formatted way

Cli command line can now be inline with Gambas/gsh statements

It is now possible to include a linux command line into a gambas statement with the use of back ticks ` as a simple example:

if `ls -l | tr [a-z] [A-Z] > $a` = 0 then
    print $a
else
    echo the command failed
endif

Unlike bash, csh and sh, back ticks return the exit code of the last command executed.

Added some Useful Plugins/commands

google - search for info online and display results in the firefox browser

google "New Socks"

toclipboard - Copy a file to the clipboard, this used the xclip cli to do this, it must be installed. There is an alias tcb that can be used as a short form.

tcb Thisfile                       ' Copy this file to the clipboard
toclipboard ThisFile

fromclipboard - copy the clipboard to the standard out. Useful for directing the clipboard to other tasks. The is a shortform alias fcb.

!fcb > "thisfile"                  ' copy to a file
!fcb | tc [a-z] [A-Z] | less       ' pass contents to a process
!fcb > $a                          ' To a global variable for use in a script
fromclipboard                      ' just print it to the terminal

browse - open the system default file browser at the current or specified directory

browse                             ' Opens the current directory with no wait
browse /                           ' Opens the browser at the root directory

Statement Seperator changed

Statement seperators have changed from : to :; as gambas now supports name spaces which use the : to separate namespace from contained variables.

Change in Linux cli variable passing

 {GambasVarName} - pass a gambas variable to the CLI
 $GshVariableName - pass gambas shell variable to the CLI

Parameterized Alias format changed

defined as :
alias ifor()='for i as integer = 0 to &1:&2:next'
Used as:
ifor(20,'print "this is an alias use";;i:print i+1')
Max of 20 parameters are allowed
parameters may be enclosed in '..' for complex information and may contain other aliases
colon is recognized in alias as statement separators.

lambda and parameterized lambda format update

Lambda functions are defined starting with begin..end, lambda..end, {...}
Are used in scripts to create an executable code block.. see documentation
define as:
begin
  dim a as string = "Test String"
  print a
  end
or with parameters:
begin(parm1)
  dim a as string = "This Parm"&param[0]
  print a
  end

Help now displays all of available help for gambas, gsh and plugins, first use is slow as it collects info

So a 'help str' will return:

NAME
Str$
String = Str$ ( Expression ) String = Str ( Expression )
Convert an expression into its printable string representation. It is the exact contrary of Val.
The current localization is used for converting numbers and dates.


Example
' Print on standard output or in a message
Public Const ON_STDOUT As Integer = 1
Public Const ON_MESSAGE As Integer = 2
Sub PrintOn(Where As Integer, What As Variant)
  If Where = ON_STDOUT Then
    Print What
  Else If Where = ON_MESSAGE Then
    Message(Str$(What))
  Endif
End

See also
    * Conversion_Functions
    * Localization_and_Translation_Functions
    * PRINT

Made cli inteface more regular

passing gambas variables etc to cli is much more regular

sub clidemo
dim a as string = "this string"
echo a
echo {a}
echo {(a)}
echo {10*20}
echo 10*20
echo {(10*20)}
echo $"m{0..5}fil"
end
'now run it with:
clidemo
Outputs:
a
this string
this string
10*20
10*20
200
m0fil m1fil m2fil m3fil m4fil m5fil

Expansion has been added As an example:

   for i as integer = 0 to 100
      echo count {i}  interates $"This{1..10}"
      next
or

  for each i as integer in $"0..100"
     echo {i}
     next
or 

  for each s as string in $"*/*"
    print "File name";; s;; "found"
    next

Clone this wiki locally