1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-12 19:15:13 +00:00
Commit graph

2953 commits

Author SHA1 Message Date
Matthew Kilgore 83533dc319 Add support for optional function arguments
Currently functions only have very limited optional argument support,
this expands it so that we can have more complex sets of optional
arguments for functions, such as multiple arguments where not all need
to be provided. This will be used in the future for some upcoming
functionality.

Note that this does not support any generic optional argument format,
the commas always have to be provided unless an optional argument is at
the end of the parameter list. Thus, if you have a format with two
optional arguments and you want to omit the second, then you need to call
it as 'foo(2, , 3)`, rather than `foo(2, 3)`. This is important for
avoiding ambiguous situations, and is how many SUBs currently function.

The two functions that violate that requirement are INSTR() and
_INSTRREV(), which use the format `[?],?,?` and allow omitting the comma
for the first argument. This format is simply handled as a special case.

Fixes: #303
2023-02-12 22:38:50 -05:00
Matt Kilgore 47639507ff
Merge pull request #295 from mkilgore/fix-timer-first-run
Fix timers at program start, TIMER STOP, and Sleep with console
2023-02-12 22:08:55 -05:00
Matthew Kilgore d4ed371681 Stopped timers don't trigger on TIMER ON
If a timer expires while stopped, it should trigger when TIMER ON is
run. Instead, on QB64 it triggers randomly after the TIMER ON happens.

The basic issue is that `qbevent` needs to be set to trigger the timer,
but TIMER ON doesn't do that. The regular timer logic that does that
already set it when the timer expired while sleeping, so it won't set it
again. The simplest solution is to just alway set qbevent = 1 when TIMER
ON is done. It's slightly less efficent but doesn't hurt to set it even
when there are no timers that expired.

Fixes: #293
2023-02-12 21:27:25 -05:00
Matthew Kilgore f995f38e38 Using Sleep with Console programs does not trigger timers
The command Sleep is supposed to allow timers to trigger while the
program is sleeping on the delay. This is achieved in QB64 by having
commands that do delays manually call evnt() to trigger events if they
come up (of which timers are one).

Sleep has a custom implementation for console programs on Windows which
doesn't do this, so I redid the logic so that it calls evnt() at regular
intervals while waiting for input. Additionally, due to now calling
evnt() we also need to check if we should exit sleep early due to an
evnt() firing.

Fixes: #294
2023-02-12 21:27:25 -05:00
Matthew Kilgore 924472f5d6 Fix timers not firing at the start of the program
Timer's were not firing at the right time if they were started shortly
after the program started, instead they would fire at twice the interval
time (and then work correctly after that).

The issue was a mistaken assumption about `time_now`, with the idea that
if `last_time == 0` then `time_now` will be large enough such that the
interval check will pass. This is wrong because in most cases `time_now`
starts at zero at program start, so when `last_time == 0` it will take
one full interval of the timer before `time_now` is large enough for the
interval check to pass (at which point the timer is initialized and runs
normally).

This simply refactors the timer logic so that `last_time == 0` is
checked first, rather than if the interval has expired. This doesn't
change how the normal logic works, but ensures that the value of
`time_now` does not matter for initializing a timer.

Fixes: #273
2023-02-12 21:27:25 -05:00
github-actions[bot] a3ccfbc6db Automatic update of ./internal/source 2023-02-12 23:39:33 +00:00
Roland Heyder 0568d73fd8
Merge pull request #308 from QB64-Phoenix-Edition/wiki-dev 2023-02-13 00:21:15 +01:00
Roland Heyder 275ca24c9a General refactoring
- things not fitting into the previous commits
2023-02-12 19:47:01 +01:00
Roland Heyder b1c9733420 Removes old code
- unused (commented) code
- no longer needed HTML tag handling (eliminated from Wiki pages)
- #toc/#top link filters removed (those links are supported now)
2023-02-12 19:41:25 +01:00
Roland Heyder dacff9e1b8 Improve local linking for #toc/#top links
- designate the help page header as target for #toc/#top links (Return to Top, Return to Table of Contents in the Wiki)
- include bottom {{PageNavigation}} links
- implement <h4> headings (==== in the Wiki), used as letter anchors in the alphabetic index
2023-02-12 19:32:47 +01:00
Roland Heyder 08b000b71c Skip more useless line feeds
- ignore line feeds after HTML comments and <br> and <br /> tags
2023-02-12 19:20:50 +01:00
Roland Heyder dfa65b8fdd Add more Entities/UTF-8 chars
- adds some 20+ more chars to the list
- re-grouping and some comment changes
2023-02-12 19:13:05 +01:00
Roland Heyder 174a95b052 Change flow logic (Entity/UTF-8 related)
- targets especially links, templates and centered text
- every char must properly run through the Entity/UTF-8 substitution stage
2023-02-12 15:01:21 +01:00
Roland Heyder 6399068293 Change line end detection
- use color bit 7 instead of the CR char to mark the end of a help line
2023-02-12 14:37:51 +01:00
github-actions[bot] b3044016f7 Automatic update of ./internal/source 2023-02-06 18:26:09 +00:00
Samuel Gomes 75db7abd59
Merge pull request #304 from a740g/main
Tiny PR that corrects the arg. count for _SNDNEW and type for _COLORCHOOSERDIALOG
2023-02-06 23:38:40 +05:30
Samuel Gomes 4c548822d3 Fix arg count for _SNDNEW and type for _COLORCHOOSERDIALOG 2023-02-06 18:50:03 +05:30
github-actions[bot] 837eee255a Automatic update of ./internal/source 2023-02-02 10:25:48 +00:00
Roland Heyder 7020a5e7b4
Merge pull request #302 from QB64-Phoenix-Edition/wiki-dev
Wiki dev
2023-02-02 11:09:16 +01:00
Roland Heyder 9c7e067990 Improve Entity/UTF-8 handling
- UTF-8 handling changed to signal missing/unknown chars
- old entity handling (see 1st commit) removed and replaced by a similar method as UTF-8 handling incl. signalling missing/unknown entities
- added dynamic warnings at the top of pages which are using missing/unknown entities or UTF-8
2023-02-02 00:10:31 +01:00
Roland Heyder 01ed59c1d3 Add Interwiki link support
- wikipedia pages can be linked simply as Winkipedia:page instead of the full URL
- advantage: the new syntax can be used in internal links as well and will automatically expanded into external links when clicked
2023-02-02 00:02:05 +01:00
Roland Heyder ceb3d18c1e General refactoring 2023-02-01 23:52:13 +01:00
Roland Heyder 61513cbcd8 Remove obsolete code
- wiki pages have been fixed, so the handling for these old things is no longer required
2023-02-01 23:48:43 +01:00
Matt Kilgore 6b9274e642
Merge pull request #296 from mkilgore/fix-build-high-sierra
Fix build on MacOS High Sierra
2023-01-21 13:32:55 -05:00
Matthew Kilgore 42bded9ba9 Fix build on MacOS High Sierra
Fairly simple, MacOS High Sierra's libcurl version is too old and not
have `CURLINFO_CONTENT_LENGTH_DOWNLOAD_T`. This adds a version check to
use the older version of that command which gives back a double instead.

Fixes: #287
2023-01-20 13:30:12 -05:00
github-actions[bot] 48bbcb618e Automatic update of ./internal/source 2023-01-20 01:15:36 +00:00
Roland Heyder 0ce0071a00
Merge pull request #300 from QB64-Phoenix-Edition/wiki-fixes
Wiki fixes
2023-01-20 01:59:06 +01:00
Roland Heyder 163f6eb6e2 Availability gallery
- add handling for the new separator image
2023-01-19 23:48:22 +01:00
Roland Heyder 12e63da7a4 Fix "Update all pages" process
- ignore local link targets here, only the page name is relevant for download
2023-01-19 23:46:51 +01:00
Roland Heyder 7ad57f5c30 Fix F1 key context help
- fully implements local link targets
2023-01-19 23:45:18 +01:00
Roland Heyder fbc6c128e7 Context work
- rewording of some labels for better spelling and context
2023-01-19 23:41:38 +01:00
Samuel Gomes c290aa5f69
Merge pull request #299 from a740g/main
Fix license info
2023-01-18 21:36:27 +05:30
Samuel Gomes 75823c49ad Fix license info 2023-01-18 18:18:24 +05:30
github-actions[bot] 474281133e Automatic update of ./internal/source 2023-01-17 20:48:07 +00:00
Roland Heyder 7003b8f21d
Merge pull request #298 from QB64-Phoenix-Edition/wiki-dev
Wiki dev
2023-01-17 21:34:31 +01:00
Roland Heyder c61757f689 Wiki download refactoring
- removed the old (commented out) curl stuff
- add another note to the error message
- simplified the libcurl download loop to use only EOF and not LOF anymore
- add a hidden external curl fallback option, read comments from line 1140 for more info
2023-01-17 18:41:44 +01:00
Roland Heyder af7dffb88c Local links support improved
- former versions did simply link to the top of the referenced page, ignoring the link anchor value (#)
- now links can point to any page section heading and the section (if found) is placed in the visible area
- to try use the links in the bottom nav section on the alphabetical index
2023-01-17 18:22:28 +01:00
Roland Heyder e2674f0157 Add code to handle Wiki galleries
- Availability sections will become icon galleries in the future
- as the IDE can't display it as images, we need to substitute it by text
2023-01-17 18:05:32 +01:00
Roland Heyder eeb6ca3f11 Fix some minor newline issues
- just a wrong branch
2023-01-17 17:58:29 +01:00
Steve McNeill 1a1a5d8300
Merge pull request #288 from SteveMcNeill/main
Add missing words to syntax highlighter
2023-01-10 13:28:30 -05:00
SteveMcNeill 9338d40921 Add missing words to syntax highlighter
_ScaledWidth and _ScaledHeight are two keywords which never got added to the syntax highlighter.  This corrects that.
2023-01-10 05:57:56 -05:00
github-actions[bot] c166e11460 Automatic update of ./internal/source 2023-01-09 03:58:25 +00:00
Matt Kilgore 3df271df7a
Merge pull request #285 from mkilgore/release-3.5.0
Version 3.5.0
2023-01-08 22:42:11 -05:00
Matthew Kilgore 95fa515aca Version 3.5.0 2023-01-08 21:56:40 -05:00
github-actions[bot] 638a5d0fa9 Automatic update of ./internal/source 2023-01-09 02:53:05 +00:00
Matt Kilgore 59e1713f36
Merge pull request #284 from mkilgore/fix-startup-time-delay
Fix startup time delay in QB64-PE programs
2023-01-08 21:34:22 -05:00
Matthew Kilgore 4a2808905c Delete qbx.o before every compile
This helps when compiling several files in a row very quickly, Mac OS
only has a one second accuracy on the file modification time which can
cause Make to not notice a file has been modified. With the changes to
avoid startup delays it's possible to have compiles happen that quickly
in succession now.
2023-01-08 20:24:25 -05:00
Matthew Kilgore f082889c1f Remove unused code from tinyfiledialogs.c 2023-01-08 20:24:25 -05:00
Matthew Kilgore f21ce09e2d Replace time() with std::chrono, fix startup delay
Currently main() includes logic that is intended to sync time() with
GetTicks() for the purpose of using GetTicks() to get millisecond
accuracy with time(), which only has second accuracy. Unfortunately, the
'syncing' up of these time sources results in an average of a half
second delay in starting a QB64-PE program.

This logic is easly replaced with std::chrono, which provides a real
time clock which is also millisecond accurate. That removes the need to
use time() and GetTicks() together to get millisecond accuracy, and
means the delay syncing them is no longer necessary.

I also separated most of the "delay" and "time" related functions into
datetime.cpp, and included the new std::chrono code into that file.

Since I needed to call some of the rounding functions in datetime.cpp I
also moved that stuff out into its own .cpp and header files to clean
things up a bit.

Fixes: #282
2023-01-08 20:24:25 -05:00
Matthew Kilgore a3cea42e0d Move icon image creation to sub__icon
The icon image creation is actually fairly expensive because the first
time you create a 32-bit image init_blend() is called, which is fairly
slow. Since only sub__icon makes use of these images (non-Windows
platforms and $Console:Only programs can't even use them) it's easy
enough to move the creation into sub__icon so the creation cost is
avoided on startup.
2023-01-08 20:24:25 -05:00