• Welcome to Jose's Read Only Forum 2023.
 

PluriBASIC - Progress of the implementation for Oxygen

Started by Brian Alvarez, November 19, 2018, 07:46:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Brian Alvarez

#15
ARRAY SCAN array([startIndex&]) [FOR NumItems&] [, FROM firstChar& TO lastChar&] [, COLLATE {UCASE | charList$}], [= | < | >] stringExpression$, TO matchIndexNumber&

Complete... 90%

Still need to complete the COLLATE charlist$ feature, but its 2 am and im tired.

Brian Alvarez

ARRAY SORT mainArray([firstElement&]) [FOR lastElement&][, FROM startChar& TO endChar&][, COLLATE {UCASE | charList$}][, TAGARRAY taggedArray()], {ASCEND | DESCEND}

Complete. But still requires better code for faster execution. For now it will allow me to tets other areas.
It is ussing simple bubble sorting, but the module is open for more sophisticated algorithms.

It supports Arrays dimensioned with DIM. For not it supports the main data types: Strings, Integers and Floating point. The "Other" mode is not yet implemented,
but it will allow any array. Probably can be implemented by using typeof in the MACRO.

Again the COLLATE charlist$ is not complete.

Brian Alvarez


Brian Alvarez


Chris Chancellor


Brian Alvarez

JOIN$(MyArr$(), {BINARY | ""","""})

Complete... Almost. For now it is only for strings. NUmeric arrays will come later.

Note that it supports only arrays dimensioned with DIM.

@Chris, Thanks! Its coming along very well. :)

Brian Alvarez

Expanded CHR$.

Now it also takes string literals, for example:

? CHR$(40, 41, 40 TO 45, 45 TO 40, "Hello")

It does not take string variables, encapsulated string literals or  multi-part string literals yet though.

Brian Alvarez

CHR$$

Complete. It has the same functionality as CHR$, but returns a unicode string.

Brian Alvarez


Brian Alvarez


Equates (constants):

PluriBASIC supports 5 kinds of equates:

  • ENUM equates.
  • Numeric equates.
  • ANSI String equates.
  • Duplicate equates (given they use a different data type)
  • Unicode String equates.
The following 3 equates are acceptable, even when used in the same program:

%MYEQUATE = 1
$MYEQUATE = "Hello World"
$$MYEQUATE = "Hello Europe and Asia"


ANSI string equates cannot contain unicode strings, or unicode portions, as follows:

$ANSI_EQUATE = "Some unicode string"$$

But unicode equates can, so, the following syntax is valid:

$$UNICODE_EQUATE = "Some unicode string"$$

With String equates, you cannot use dynamic functions, but as long as you provide literals as parameters, you can use the functions that can be parsed at compilation time:

  •   CHR$
  •   SPACE$
  •   STRING$
  •   GUID$
Equates containing a GUID, are checked at compilation time, and it has to be a valid value. Note that CHR$$ cannot be used for equate creation, only its ANSI counterpart.

With numeric equates, the values are also calculated at compilation time, and they can consist of the following components:

  • Numeric Expressions (1)
  • HEXADECIMAL expressions (&h0001)
  • OCTADECIMAL expressions (&o0001)
  • BINARY expressions (&b0001)
  • Another equates
  • Aritmetic operators
ENUM equates are supported as well, the following syntax is addmitted:

ENUM EquatePrefix [SINGULAR] [BITS] [AS COM]
  EquateMember [= numeric_expression]
  EquateMember [= numeric_expression]
  [...]
END ENUM
When using the SINGULAR switch, the equates are generated without a prefix, but it still needs to be provided for internal diferentiation.

Currently the AS COM switch is supported, but does nothing. The resulting equates may look as follows:

%EquatePrefix.EquateMember

Equates can be used in conditional compilation as follows:

#IF %DEF(%SOMEQUATE)

#IF NOT %DEF(%SOMEQUATE)

#IF %SOMEQUATE = 1

#IF %SOMEQUATE = %ANOTHEREQUATE

#IF %SOMEQUATE => 3.1

Etc.

System equates:

Currently the following system equates are defined, and require no external declaration.

  • $NUL
  • $BEL
  • $BS
  • $TAB
  • $LF
  • $VT
  • $FF
  • $CR
  • $CRLF
  • $EOF
  • $ESC
  • $SPC
  • $DQ
  • $DQ2
  • $SQ
  • $SQ2
  • $QCQ
  • $WHITESPACE
  • %MAX_PATH
  • %FALSE
  • %TRUE
  • %NULL
  • $$NUL
Equates are not included in the final program unless used, just like MACROS, CLASSES, SUB, FUNCTION and UDTs.

Restrictions:
Equates defined inside a RAW segment are not taken into consideration for BASIC code outside the RAW sections, and they may conflict with system-generated equates.




Brian Alvarez

Developing PluriBASIC 6.0 using PluriBASIC 5.0
Message box displaying restored text from a UDT element, after successfully saving it and restoring it from a variant variable declared as a variant ptr.

Brian Alvarez

#26
TYPEOF(object)
TYPECODE(object)

Complete.

These are also available now for PowerBASIC 32 bit compilations.

Brian Alvarez

 Enhanced macros for all platforms. The MACRO blocks now allow child macros as well as parameter dependant code generation.
This applies to all available target platforms, including Android, PowerBASIC, PHP and Oxygen. Instead of explaining how it works,
i will post a picture.

Chris Chancellor

Hello Brian

Congratulations to you that you have mastered O2

Quote
Almost all the ideas i have had so far have been possible. With very few exceptions, i have
achieved most of the tasks i wanted! :)

Can you please provide some sample O2 codes in this forum as i have contributed mine ? 

this is to encourage more and more basic programmers to use O2 , we do need to increase
the users community here, more brains is better one or two
Thanxx a lot

Brian Alvarez

 Hello Chris, I have been posting the progress exactly for that reason. :)

Hopefully, soon i will try to port some of the existing examples. If everything goes as expected.
Right now i am finishing THREAD statements.