Skip to content

Release 0.11.0

Choose a tag to compare

@boxgaming boxgaming released this 17 Jul 15:52

Try out the release online here: https://qbjs.org

Release Highlights

New Language Features

Import

This release includes a major update to Import functionality. The Import keyword provides the ability to include library modules from external source files. Prior to this release, Import statements could only be used in the main program. With this release that restriction has been removed and Import statements can appear in nested imported modules. The same library can now be imported multiple times. Support for relative import paths has also been included as part of the update.

Standard Library Additions

This release contains a significant number of additions to the standard QBJS extension libraries. Three new libraries: Array Utilities, Object Utilities, and the System Library, have been added to provide greater access to lower-level Javascript functionality using QBasic syntax. The Dom library has been greatly expanded to provide more event handling and process control.

Library Description Methods Added
FileSystem
lib/io/fs.bas
Extended functionality for input/output related to the virtual filesystem. GetFilename, GetParentPath, ReadText, WriteText
Array Utilities NEW
lib/lang/array.bas
Provides extended functionality for interacting with native JavaScript arrays. Add, At, Clear, Concat, Create, Every, Fill, Filter, IndexOf, Insert, Item, IsJSArray, IsQBArray, Join, LastIndexOf, Length, Pop, Push, Reduce, ReduceRight, Remove, Reverse, Shift, Slice, Sort, Splice, Unshift, ToQBArray
Object Utilities NEW
lib/lang/object.bas
Provides extended functionality for interacting with JavaScript objects. Assign, GetProperty, HasProperty, Keys, SetProperty, RemoveProperty
String Utilities
lib/lang/string.bas
Provides extended common string utility methods. FormatUsing
System Library NEW
lib/lang/system.bas
Provides low-level system access. Await, Call, Construct, IsRunning, SetTimeout, TypeOf, TimeInMillis, ToFloat, ToInteger, ToBoolean, ToString
Unit Testing NEW
lib/test/unit-test.bas
Provides methods for creating unit tests. AssertEquals, AssertTrue, AssertFalse
Dom
lib/web/dom.bas
Provides access to the current web page's document object model. DialogClose, DialogShow, DialogShowModal, Document, GetAttribute, GetAttributeNames, GetElementsByClassName, HasFocus, Focus, RequestAnimationFrame, RequestFullscreen, SelectAll, SetAttribute, StopPropagation, Window

Unit Test Framework

A new Unit Test library provides basic functionality to create unit tests using the simple assertion methods. A suite of unit tests has been developed using this library to regression test QBJS itself. The tests can be found in the project test directory. With each subsequent release more tests will be added to this suite to expand the test coverage.

Language/Compatibility Enhancements

This release contains a number of important language support updates to further enhance the compatibility of QBJS with QBasic and QB64.

  • Programs can now utilize the $Include metacommand to include source code from additional source files.
  • INPUT keyword will now utilize the virtual keyboard on mobile devices.
  • Outstanding Select Case features have now been implemented:
    • SELECT CASE [lowerValue] TO [upperValue]
    • SELECT EVERYCASE
    • EXIT SELECT
    • EXIT CASE
  • Support for PRINT USING
  • Additional miscellaneous keywords including:
    • COMMON, MKS$, MKD$, CVS, CVD

QB64PE Compatibility

For the first time, this release includes support for QB64PE-specific functionality. For some context, the QBJS project began during the period in which there was a single QB64 fork maintained by the QB64 Team. Since that time the QB64 Team was dissolved and new, separate forks were created to carry on QB64 maintenance and development. The goals of QBJS are to maintain compatibility with this core, QB64 functionality which is common between each of the descendants of the original QB64 project. Of the current forks, the QB64 Phoenix Edition has emerged as the only known fork with ongoing, active development. While full compatibility with descendent forks is not a stated goal of the QBJS project, for certain compelling use cases, keywords compatible with Phoenix Edition may be added.

This release now supports the following features which are present in the QB64PE fork:

  • Boolean operators _AndAlso, _OrElse, and _Negate
  • Support for the $IncludeOnce metacommand
  • The parser has also been updated to allow main module code between and after SUB and FUNCTION definitions.

Finally, a number of additional QB64PE-specific keywords can be supported via an optional include file. To enable this support, add the following line to the top of your program:

'$Include: 'lib/compatibility/qb64pe.bi'

Once included, the following additional methods will be available:

  • _BASE64ENCODE$, _BASE64DECODE$, _CLAMP, _ColorChooserDialog, _DECODEURL$, _ENCODEURL$,
    _FULLPATH$, _IIF, _INPUTBOX$, _LOGERROR, _LOGINFO, _LOGMINLEVEL, _LOGTRACE, _LOGWARN,
    _MAX, _MESSAGEBOX (statement), _MESSAGEBOX (function), _MIN, _MOUSEHIDDEN,
    _NOTIFYPOPUP, _READFILE$, _SAVEIMAGE, _TOSTR$, _WRITEFILE

Including this file will also make available additional QB64PE-specific constants.

Numerous other compatibility enhancements and fixes can be found in the full release notes below.

Release Notes

Language/Compatibility Updates

  • Added support for $Include directive (#64)
  • SELECT CASE enhancements
    • Added support for Select CASE [lowerValue] TO [upperValue] (#169) and EVERYCASE (#191)
    • Added support for "Exit Select" (#143)
    • Added support for "Exit Case" (#143)
  • Added support for PRINT USING (#107).
  • Added support for COMMON (#198)
  • Added support for remaining MKn$, CVn functions (#72)
  • Fix for #179 - Arithmetic expressions in a dim statement with arrays are not evaluated correctly
  • Round floating-point values when assigned to integer type variables (#186)
  • Updated all methods returning color values to return numeric version rather than hidden object representation (#190)
  • Enable virtual keyboard for INPUT on mobile (#66)
  • QB64PE
    • Added support for boolean operators: AndAlso, OrElse and Negate (#187)
    • Updated parser to allow main module code to appear between and after sub and function definitions (#194)
    • Added support for $IncludeOnce directive (#196)
    • Added include file to enable QB64PE-specific keywords:
      _BASE64ENCODE$, _BASE64DECODE$, _CLAMP, _ColorChooserDialog, _DECODEURL$, _ENCODEURL$, _FULLPATH$, _IIF, _INPUTBOX$, _LOGERROR, _LOGINFO, _LOGMINLEVEL, _LOGTRACE, _LOGWARN, _MAX, _MESSAGEBOX (statement), _MESSAGEBOX (function), _MIN, _MOUSEHIDDEN, _NOTIFYPOPUP, _READFILE$, _SAVEIMAGE, _TOSTR$, _UFONTHEIGHT, _UPRINTWIDTH, _WRITEFILE

New Language Features

  • Major updates to Import functionality to allow nested imports and relative import paths (#193)
  • Additions to existing standard libraries
    • Dom Library
      • Add event and process control methods to Dom extension library (#185)
      • Added accessor methods for window and document objects
      • Added Attribute access methods.
      • Added GetElementsByClassName.
    • String Library
      • Added explicit string conversion to all applicable methods
      • Added FormatUsing, a new utility function to the which uses the same formatting logic as "PRINT USING".
    • FS Library
      • Added new utility methods ReadText, WriteText, GetFilename, GetParentPath
  • New standard libraries
    • Array Library
      • Added standard library for interacting with native javascript arrays (#183)
    • System Library
      • Added system library to allow invocation of any javascript method as well as low-level utility methods
      • Added ability to create a new native Javascript object.
    • Object Library
      • Added new low-level library for working with objects. Updated compiler to be able to use imported libraries.
  • Added new unit test framework

IDE Updates

  • Fixed issue preventing focus from being correctly set back to the editor when selecting a method from the methods (f2) dialog.
  • IDE - Updated to escape html written to console as part of an error message
  • Added link in About dialog to wiki page with open source attributions and licenses. (#135)

General Fixes

  • Added missing FreeFile keyword implementation
  • Fixed typo in Tan method
  • Updated Hex$ and Oct$ methods to round any decimal input values
  • Fix to Val method to support lowercase numeric base prefixes: "&h", "&o", "&b"
  • Added logic to reduce chance of mis-identifying equals condition as variable assignment
  • Fixed bug with RmDir method
  • Fixed JS reserved words as method parameter issue (#199)
  • Fixed CSng and CDbl functions (#200)
  • IncludeJS will now wait for the Javascript to load before continuing execution, unless a callback method is specified.