Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 323 online users. » 0 Member(s) | 320 Guest(s) Applebot, Bing, Google
|
Latest Threads |
.tap file code not execut...
Forum: Help & Support
Last Post: Zoran
04-28-2025, 10:59 AM
» Replies: 4
» Views: 264
|
Exit from more than one l...
Forum: Wishlist
Last Post: Duefectu
04-23-2025, 10:06 PM
» Replies: 3
» Views: 279
|
put small ASM programs li...
Forum: How-To & Tutorials
Last Post: Zoran
04-18-2025, 02:02 PM
» Replies: 6
» Views: 1,569
|
Creating +3 Menus - Loadi...
Forum: Help & Support
Last Post: merlinkv
04-16-2025, 02:08 PM
» Replies: 6
» Views: 532
|
Randomize not very random...
Forum: Help & Support
Last Post: Zoran
04-08-2025, 10:40 AM
» Replies: 4
» Views: 430
|
Scope rules
Forum: Bug Reports
Last Post: Zoran
04-04-2025, 09:46 AM
» Replies: 2
» Views: 302
|
Using constants not allow...
Forum: Bug Reports
Last Post: baltasarq
03-19-2025, 10:00 PM
» Replies: 8
» Views: 1,056
|
404 page not found
Forum: Documentation
Last Post: boriel
03-08-2025, 07:16 PM
» Replies: 5
» Views: 2,880
|
Spectrum keywords codes
Forum: Bug Reports
Last Post: boriel
03-08-2025, 11:00 AM
» Replies: 1
» Views: 416
|
ZXodus][Engine
Forum: ZX Basic Compiler
Last Post: boriel
02-19-2025, 11:43 PM
» Replies: 69
» Views: 213,733
|
|
|
how to #include files with relative path to the current one? |
Posted by: programandala.net - 06-19-2010, 12:25 PM - Forum: Help & Support
- Replies (4)
|
 |
#include <file> includes from the library; in order to include from the directory of the including file, the main program, i tried #include <./file> but it doesn't work. Even #include <~/path_to_the_project/file> doesn't work.
The only solution I've found is: #include </home/user/path_to_the_project/file>, that is, including the whole path from the file system root.
Is there any way to configure the including directories? It would be great to include files with relative path from the current directory if they exist, and from the library if they don't exist.
|
|
|
Suggestion about the functions and the brackets |
Posted by: programandala.net - 06-18-2010, 04:52 PM - Forum: Documentation
- Replies (3)
|
 |
I suggest to always use brackets with functions, both in the Syntax and Examples sections, and everywhere in the docs.
I suggest to include a note in the language reference page in order to explain that brackets are optional in functions for the sake of compatibility with Sinclair BASIC (and maybe FreeBASIC in some cases). But that's all.
I think the code is much more clear with brackets; they help to avoid bugs too. And it's the standard beside a good practice, isn't it? On the other hand, it's good to have a clear convention to write the docs.
|
|
|
Suggestion for the Syntax section |
Posted by: programandala.net - 06-18-2010, 04:42 PM - Forum: Documentation
- Replies (20)
|
 |
Hi all,
I've been thinking how to simplify and homogenize the docs; and also how to make them easier to create and mantain.
I'm preparing a list of detailed suggestions for your consideration, but the first one is ready:
I suggest for the Syntax section:
- to use <freebasic></freebasic>. I think it's easier to write and to read, and it looks nicer and more clear. The current combination of bold and italic is not comfortable to edit (besides, I think their Mediawiki notation is unhandy and hard to read).
- to show syntax variants simply one after another, without "or" or any kind of comment; simply one line of code per variant (no need to mark optional parameters). No text in the section, only clear code with proper parameter names.
- to use lowercase (it's a fact it's easier to read and to write) for everything (keywords and parameters).
- to use camelCase for parameters with compound names (they cannot be reserved words anymore, because of <freebasic>).
You can see and example in the peek page I just rearranged. Note I left both syntax layouts for you to compare. Also the rest of the page is changed to illustrate some of my future suggestions.
|
|
|
RND doesn't accept brackets (*solved*) |
Posted by: programandala.net - 06-18-2010, 02:53 PM - Forum: Bug Reports
- Replies (3)
|
 |
I've just realized RND() is not accepted ("Unexpected token '(' <LP>"), but only RND. I know it doesn't have parameters in Sinclair BASIC, but it's a function anyway. In fact, both INKEY and INKEY() are accepted, and the case is analogous.
I took a look at the functions list of the original ZX Spectrum manual (page 198, Spanish edition), and realized that PI is there! I never thougth it was a function, but a constant. Well, I tried PI() in ZX BASIC and it's not accepted, not a surprise.
It's clear PI is a constant (that's the description in the wiki), but what's the difference between RND and INKEY? They both are functions that need no parameter. I think RND() should be accepted, if only for syntax coherence.
(I've just read the FreeBASIC's RND syntax. It's accepted without brackets, but can have an optional parameter, the seed.)
|
|
|
String Adress wrong (*solved*) |
Posted by: LCD - 06-18-2010, 12:36 PM - Forum: Bug Reports
- Replies (4)
|
 |
Strangely my proportional Print SUB from Tips section, with example, does not work anymore with the latest development version of ZXBC, because the address of text in b$ is returned incorrectly (in ROM).
Code: DIM b$ AS STRING
b$="test"
PRINT PEEK(Uinteger,@b$)+2
It does not return the correct address and compiled program says "A Invalid argument" at the end.
Code: DIM b$ AS STRING
dim adr as uinteger
b$="test"
adr=PEEK(Uinteger,@b$)+2
print adr
Does not change anything.
comes with a "Undefined label '_test_b'." if used in SUBs
|
|
|
strings initialized? |
Posted by: programandala.net - 06-18-2010, 12:34 PM - Forum: Help & Support
- Replies (6)
|
 |
Yesterday I experienced a kind of coding poltergeist with the following simple function:
Code: function strings(times as ubyte, text as string ) as string
dim i as ubyte
dim result as string
for i = 1 to times
let result = result + text
next i
return result
end function
The program did strange things when printing the string returned by strings(): it printed other strings of the program that had nothing to do, and then froze. The reason was I had supposed the DIMed strings were initialized to an empty string but they are not; it took time to find out. When I added a simple line, everything worked as expected:
Code: dim result as string
let result = ""
I've searched in the forum, but found no reference about this. The DIM wiki page doesn't mention string initialitazion. I just want to confirm this issue before updating the wiki. Are strings not initialized to empty strings because of a technical issue or simply because it's not implemented yet? Is this definitive or will it change in the future?
|
|
|
typo in library comment |
Posted by: programandala.net - 06-17-2010, 08:48 PM - Forum: Bug Reports
- Replies (1)
|
 |
This is not a bug but an innocuous typo. The following lines in library/csrlin.bas:
Code: dim maxy as ubyte at 23683: REM 'Max COL position + 1 (default 33)
dim ny as ubyte at 23689 : REM current maxx - column screen position
Should read:
Quote: dim maxy as ubyte at 23683: REM 'Max LIN position + 1 (default 24)
dim ny as ubyte at 23689 : REM current maxy - line screen position
I guess they were copied and pasted from library/pos.bas
|
|
|
|