2.8 version

Post Reply
User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

2.8 version

Post by Mr. Kibernetik »

Main theme of version 2.8 will be network access. Set of commands to transmit data over network will be implemented.
You can post your ideas and suggestions here.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.8 version

Post by Mr. Kibernetik »

New command will be added:

FILE n$ READDIM m
reads bytes in file [n$] to one-dimensional numeric array [m]. Size of array [m] changes to number of read bytes.

FILE n$ READDIM m, n
reads bytes in file [n$] to one-dimensional numeric array [m], and number of read bytes is stored to numeric variable [n]. Size of array [m] changes to number of read bytes.

FILE n$ READDIM m, n, k
reads [k] bytes from file [n$] to one-dimensional numeric array [m], and number of actually read bytes is stored to numeric variable [n]. Size of array [m] changes to number of read bytes.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.8 version

Post by Mr. Kibernetik »

New command will be added:

FILE n$ WRITEDIM m
writes contents of one-dimensional numeric array [m] as bytes to file [n$]. Array [m] must contain only values from 0 to 255.

FILE n$ WRITEDIM m, n
writes [n] elements of one-dimensional numeric array [m] as bytes to file [n$]. Array [m] must contain only values from 0 to 255.

FILE n$ WRITEDIM m, n, k
writes [n] elements of one-dimensional numeric array [m] starting with element number [k] as bytes to file [n$]. Array [m] must contain only values from 0 to 255. Command OPTION BASE has its effect on this command.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.8 version

Post by Mr. Kibernetik »

Command to delete non-existent file or directory will not rise runtime error.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.8 version

Post by Mr. Kibernetik »

New function will be added:

UNIQUE_STR$ ()
returns unique string. One of possible implementations: for generating temporary file names which should not accidentally coincide with any of existing file names.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.8 version

Post by Mr. Kibernetik »

New section "Networking" will be added:

If error prevents HTTP command from execution, then error message can be received by HTTP_ERROR$() function. If server returns response after execution of HTTP command, then this response can be received by HTTP_RESPONSE$() function. This can be useful when executing HTTP POST and HTTP POSTDIM commands, which send data to server and have no input parameters.

When executing HTTP commands it is optionally possible to set values which are present in HTTP request header. For this purpose one-dimensional string array in HEADER parameter of HTTP commands is used, elements of this array should be strings formatted as "header_field : value", for example:
s$ = "This is my message to server"
h$(1) = "content-type:text/html"
h$(2) = "content-length:"&len(s$)
HTTP "posttestserver.com/post.php" HEADER h$ POST s$
PRINT HTTP_RESPONSE$()

HTTP url$ HEADER h$ GET t$
performs HTTP GET request to address [url$] and stores server response to string variable [t$]. HEADER parameter defines contents of HTTP request header and is optional, but if used then [h$] must be one-dimensional string array; see its format details in preface.
Example:
HTTP "kibernetik.pro" GET t$
PRINT t$

HTTP url$ HEADER h$ GETDIM m, n
performs HTTP GET request to address [url$] and stores server response to one-dimensional numeric array [m]. Size of array [m] is changed according to amount of data received and is stored to numeric variable [n], which is optional. HEADER parameter defines contents of HTTP request header and is optional, but if used then [h$] must be one-dimensional string array; see its format details in preface.
Example:
HTTP "google.com/images/logo.png" GETDIM m
FILE "google.png" WRITEDIM m

HTTP url$ HEADER h$ HEAD t$
performs HTTP HEAD request to address [url$] and stores server response to string variable [t$]. HEADER parameter defines contents of HTTP request header and is optional, but if used then [h$] must be one-dimensional string array; see its format details in preface.
Example:
HTTP "apple.com" HEAD t$
PRINT t$

HTTP url$ HEADER h$ POST t$
performs HTTP POST request with contents of [t$] to address [url$]. HEADER parameter defines contents of HTTP request header and is optional, but if used then [h$] must be one-dimensional string array; see its format details in preface.

HTTP url$ HEADER h$ POSTDIM m, n
performs HTTP POST request to address [url$], contents of request is taken from one-dimensional numeric array [m] as [n] number of bytes. Array [m] must contain only values from 0 to 255. Number of bytes to send [n] can be omitted, so all contents of array [m] will be sent. HEADER parameter defines contents of HTTP request header and is optional, but if used then [h$] must be one-dimensional string array; see its format details in preface.
Example:
FILE "image.jpg" READDIM m,n
h$(1) = "content-type:image/jpeg"
h$(2) = "content-length:" & n
HTTP url$ HEADER h$ POSTDIM m

HTTP_ERROR$ ()
returns error message if error occurred when executing last HTTP command. If command was executed without errors then empty string "" is returned.

HTTP_RESPONSE$ ()
returns server response on last HTTP command. If server responded nothing then empty string "" is returned.
Example:
HTTP "posttestserver.com" POST "Help me!"
PRINT HTTP_RESPONSE$()

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: 2.8 version

Post by Mr. Kibernetik »

Object "browser" will be added with commands and functions:

BROWSER n$ DELETE
deletes browser [n$].

BROWSER n$ URL a$ AT x,y SIZE w,h
creates browser with name [n$] at point [x,y] with width [w], height [h] and loads web page with URL [a$]. Parameter URL is optional.
Example:
BROWSER "n" URL "kibernetik.pro" AT 0,0 SIZE SCREEN_WIDTH(),SCREEN_HEIGHT()

BROWSER n$ SET TEXT t$ URL a$
sets contents of web page in browser [n$] as string [t$]. Parameter URL is optional, it is used to specify URL of web page if its contents is address-dependent.

BROWSER n$ SET URL a$
loads web page with URL [a$] in browser [n$].

BROWSER_TEXT$ (n$, t$)
returns contents of current web page in browser [n$] using JavaScript string [t$].
Example:
BROWSER "n" URL "apple.com" AT 0,0 SIZE 0,0
PRINT "URL: " & BROWSER_TEXT$("n", "document.baseURI")
PRINT "Number of images: " & BROWSER_TEXT$("n", "document.images.length")
PRINT "First image: " & BROWSER_TEXT$("n", "document.images[0].src")

Post Reply