Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - blametroi

Pages: [1] 2
1
QB64 Discussion / Re: Bug REDIM _PRESERVE losing data?
« on: January 25, 2021, 11:11:44 am »
Thanks guys, I do love a good Heisenbug. I've got a couple of ideas how to get around this, but wanted to report it.

Regarding "more than you ever wanted to know" ... in professional life I was an assembly language programmer writing systems software. I don't go that deep anymore, but I'd like to think I can if I need to :)

I'll come up with a workaround I trust. Thanks again.

2
QB64 Discussion / Bug REDIM _PRESERVE losing data?
« on: January 25, 2021, 09:22:34 am »
I've a two dimensional string array that I redim _preserve and the contents of the second row are lost. Sample code attached.

Line 63 "REDIM _PRESERVE definingKeywords(i-1, 2) AS STRING" is the key. Comment this out, and the print of definingKeywords(i,2) in line 82 shows the data read in earlier in the program. Uncomment it, and there's nothing showing for definingKeywords(i,2). definingKeywords(i,1) is fine throughout.

I've tried to come  up with a test program that isn't pulled out of a current project, but of course the bug does not manifest in those attempts.

EDIT: This is with the 1.5 development build 2e309e8. Recent but not the latest.

Code: QB64: [Select]
  1. ' redim_error2.bas
  2. '==============================================================
  3. '
  4. '==============================================================
  5.  
  6. OPTION _EXPLICIT ' i prefer it this way
  7. OPTION BASE 1 ' god meant it to be this way
  8.  
  9. '==============================================================
  10. ' global definitions, declarations, and initialization
  11. '==============================================================
  12.  
  13. ON ERROR GOTO handleError
  14.  
  15. 'constants
  16. CONST START_SIZE = 500
  17. CONST INCREMENT_SIZE = 250
  18.  
  19. 'types
  20.  
  21. 'shared and work
  22. REDIM SHARED definingKeywords(START_SIZE, 2) AS STRING ' over allocate, will trim
  23. REDIM SHARED tagTypes(START_SIZE) AS STRING ' also over allocated
  24. DIM numDefiningKeywords AS INTEGER
  25. DIM numTagTypes AS INTEGER
  26. DIM pLabel AS INTEGER
  27. DIM pInclude AS INTEGER
  28. DIM pKeyword AS INTEGER
  29. DIM delimiters AS STRING
  30. DIM currentTagType AS STRING
  31. DIM currentKeyword AS STRING
  32.  
  33. '==============================================================
  34. ' mainline
  35. '==============================================================
  36. mainline:
  37.  
  38. '==============================================================
  39. ' load our definitions
  40. '==============================================================
  41. RESTORE dataTagTypes
  42. i = 1
  43.     READ currentTagType
  44.     IF currentTagType = "" THEN
  45.         REDIM _PRESERVE tagTypes(i - 1)
  46.         EXIT DO
  47.     END IF
  48.     tagTypes(i) = currentTagType
  49.     i = i + 1
  50. numTagTypes = i - 1
  51.  
  52. RESTORE dataDefiningKeywords
  53. i = 1
  54.     READ currentKeyword, currentTagType
  55.     IF currentKeyword = "" THEN
  56.         'todo: redim _preserve is losing the 2nd dimension? dup and report
  57.         'REDIM _PRESERVE definingKeywords(i - 1, 2) AS STRING
  58.         EXIT DO
  59.     END IF
  60.     definingKeywords(i, 1) = currentKeyword
  61.     definingKeywords(i, 2) = currentTagType
  62.     PRINT definingKeywords(i, 1), definingKeywords(i, 2)
  63.     IF currentKeyword = "<label>" THEN pLabel = i
  64.     IF currentKeyword = "'$INCLUDE:" THEN pInclude = i
  65.     i = i + 1
  66. numDefiningKeywords = i - 1
  67.  
  68. delimiters = " :;()-+*/\"
  69.  
  70. '===============================================================
  71. ' got data?
  72. '===============================================================
  73.  
  74. FOR i = 1 TO numDefiningKeywords
  75.     PRINT definingKeywords(i, 1); ":"; definingKeywords(i, 2)
  76.  
  77. '===============================================================
  78. ' close files, we're done
  79. '===============================================================
  80.  
  81.  
  82.  
  83. '==============================================================
  84. ' handle general runtime errors, can override. override
  85. ' handlers should be added after this one.
  86. '==============================================================
  87.  
  88. handleError:
  89.  
  90. PRINT "Error" + STR$(ERR) + " at line" + STR$(_ERRORLINE)
  91.  
  92.  
  93. '==============================================================
  94. ' data blocks. if you are using data, in qb64 it needs to be
  95. ' defined before any subs/functions, so group it all here. i
  96. ' wish we could put each block closer to its use.
  97. '==============================================================
  98.  
  99. dataBlocksHere:
  100. DATA -9999
  101.  
  102. '==============================================================
  103. ' qb64 keywords types.
  104. '==============================================================
  105.  
  106. dataTagTypes:
  107. DATA "constant"
  108. DATA "function"
  109. DATA "include"
  110. DATA "label"
  111. DATA "type"
  112. DATA "variable"
  113. DATA ""
  114.  
  115. '==============================================================
  116. ' qb64 keywords types.
  117. '
  118. ' these are mostly sorted but two word variants are put in
  119. ' front of a single word form, eg "dim shared" comes before
  120. ' "dim". this simplifies the search. the list is short enough
  121. ' that the search will be sequential.
  122. '
  123. ' format is keyword text in upper case, and what type of
  124. ' entity this defines.
  125. '==============================================================
  126.  
  127. dataDefiningKeywords:
  128. DATA "ALIAS ","type"
  129. DATA "COMMON SHARED ","variable"
  130. DATA "COMMON ","variable"
  131. DATA "CONST ","constant"
  132. DATA "DECLARE DYNAMIC LIBRARY ","type"
  133. DATA "DECLARE LIBRARY ","type"
  134. DATA "DIM SHARED ","variable"
  135. DATA "DIM ","variable"
  136. DATA "FUNCTION ","function"
  137. DATA "<label>","label": ' there is no actual keyword text, rather colon
  138. DATA "REDIM _PRESERVE ","variable"
  139. DATA "REDIM SHARED ","variable"
  140. DATA "REDIM ","variable"
  141. DATA "SHARED ","variable"
  142. DATA "STATIC ","variable"
  143. DATA "SUB ","function"
  144. DATA "TYPE ","type"
  145. DATA "'$INCLUDE:","include"
  146. DATA "",""
  147.  

3
QB64 Discussion / Re: QB64 Game Jam
« on: January 21, 2021, 08:02:35 am »
I've run QB64 on WSL using VcXsrv and it works OK. There are tearing effects when I move or resize windows. Since I could fall back to native windows, I never dug in deeper.

4
QB64 Discussion / Re: RAM Disk for temp/work files
« on: January 19, 2021, 11:02:47 pm »
@Richard, MKLINK is a little known bit of Windows. For a command reference I usually go to  ss64 for information. https://ss64.com/nt/mklink.html

MD H:\QB64\TEMP
MD H:\QB64\TEMP2
...
MKLINK /D E:\QB64\internal\temp H:\QB64\TEMP
MKLINK /D E:\QB64\internal\temp2 H:\QB64\TEMP2
...

I discovered MKLINK when I started storing all of my config files for linux and windows in a directory and put the repo up on github. So, one .vimrc to rule them all :)

For temp, I've changed the environment variables (I find two in my system), for TEMP and TMP. I point both at my physical drive. I had each of these in both the system and user level environment variables, but I don't know off hand if that's normal or an artifact of my messing around in the past.

I've left the swap/page stuff alone. I've got a 16gb system and I only see paging if I've done something really stupid :)

5
QB64 Discussion / Re: RAM Disk for temp/work files
« on: January 19, 2021, 04:57:42 pm »
I had forgotten @Richard's concern. I only have my OS and a few games on my system drive, an SSD, and keep everything else on an actual spinning hard drive.

As a quick test, I removed all the TEMP directories under INTERNAL and created links (via the mklink command) to my RAM drive.

No sign of problems but no obvious performance benefit at compile time. So, fwiw, it looks as this might be a possible workaround. I'm going to test with some larger programs but based on @FellippeHeitor's replies I don't expect any problems.

6
QB64 Discussion / Re: RAM Disk for temp/work files
« on: January 19, 2021, 01:52:28 pm »
Right now it looks to me that QB64 creates work files under internal/temp. I know that some of those files need to be persistent (bookmarks.bin) but others probably don't need to reside on permanent storage.

I don't know if moving the various C++ fragment files to ramdisk would improve performance, but figured I'd bring up the idea.

7
QB64 Discussion / RAM Disk for temp/work files
« on: January 19, 2021, 01:27:38 pm »
Has any thought been given to allowing the various temp files for editing and compiling? I normally have one up and available. That may be a bit retro, but this is QB :)

8
QB64 Discussion / Re: Thanks for all the great upgrades to the IDE...
« on: January 17, 2021, 10:39:08 am »
Same here. I go away for a couple of years and come back and the first thing I noticed was how much the IDE felt improved. I trust it now.

Half the time I still want to use VIM as an editor, but that's an even split where before it was all VIM :)

Great work.

9
QB64 Discussion / Re: Problem with taking a break
« on: June 16, 2019, 04:17:19 am »
I don't see that behavior here. 1.3 on Windows 10 64 bit. I do get up and leave my desk and if I come back and start coding, the IDE is responsive.

10
QB64 Discussion / Re: INKEY$ in console mode
« on: June 12, 2019, 12:28:20 pm »
Meh. I know how to do the various alternatives, I was hoping to avoid breaking out of the core language. The doc on the wiki says it should work. This was a pretty common practice in BASIC programming back in the day.

I'll cast about and see if I can find the wndproc for the program window. I think it should pass the wm_keypress type messages on but seems not to do so.

11
QB64 Discussion / Re: QB64 v1.3 released!
« on: June 12, 2019, 08:42:08 am »
Hey guys, I know I'm late to the party but now that I've had a chance to install the latest and greatest I wanted to say thanks and good job. Some of my old code that I posted about several months back works now, so I'm happy :)

Keep up the good work, it's appreciated.

12
QB64 Discussion / INKEY$ in console mode
« on: June 12, 2019, 08:39:11 am »
I'm reviving some old text mode programs where I used INKEY$ to deal with single character input such as with a Y-or-N response to a question. When run to a console window, it doesn't work. I went over the wiki page and see a mention of using _DEST _CONSOLE but that doesn't seem to change anything.

Here's a minimal sample program using some of the INKEY$ code from the wiki. If the first two lines are uncommented, the program does not respond to any keypress.

It looks as if the program window, as opposed to console window, is intercepting the keypresses and not sending them through to the console. You can see this if you just use "$CONSOLE" instead of "$CONSOLE:ONLY". If you give the program window focus, the keypresses go through.

Any guidance? Thanks.

Code: QB64: [Select]
  1. '$CONSOLE:ONLY
  2. '_DEST _CONSOLE
  3.  
  4.     PRINT "Do you want to continue? (Y/N): "; 'semicolon saves position for user entry
  5.     DO: K$ = UCASE$(INKEY$) 'change any user key press to uppercase
  6.     LOOP UNTIL K$ = "Y" OR K$ = "N"
  7.     PRINT K$ 'print valid user entry
  8.     IF K$ = "N" THEN END
  9.  

13
QB64 Discussion / Re: something fun, something nastaligic to look at!
« on: December 30, 2018, 11:30:43 pm »
And CoCo III had an OS (purchased separately) don't remember at the moment, but I think it was called OS9???? I think? No?

OS 9, if you look for retro communities there is a rather active one for the CoCo and OS 9 has been recreated. It was pretty cool.

14
QB64 Discussion / Re: QB64 command line
« on: December 29, 2018, 07:43:42 pm »
But vim?  That's hardcore.  Nano is as far as I care to go with cli editors.

Kids these days ;) I did my first programming with a card punch. vim is high tech. Flawed, but high tech.

15
QB64 Discussion / Re: QB64 command line
« on: December 29, 2018, 04:41:09 pm »
Yeah, I've been tinkering with a vim extension (not mine originally) that compiles and runs from vim.

here's what I have from those scripts:

qb64 -c -o outputfilename inputfilename

switches

 -o    output exe filename
 -c    Compile file
 -x    As -c, but use the console instead of a graphical window for pr>
 -z    Do not compile generated C++ code.
 -q    Compile for Qloud.
 -g    Do not include graphics runtime (equivalent to $CONSOLE:ONLY)

All switches imply -c; -z and -q imply -x.

Options must proceed the filename.
 -- can be used as a dummy option to force the next thing to be a file

Pages: [1] 2