Data setting tutorial video!
#3
(12-03-2022, 12:12 PM)mnrvovrfc Wrote: All I'm going to say is...

look at "QB64.BAS" out of the last SDL version. About the first 500 LOC or so have a bunch of variable declarations and/or assignments being mixed with executable statements. Compared to that, thousands of "DATA" statements is a wall that cannot be helped. It's better than using "zlib" compression like one of Dav's utilities, only for the sake of readability, but some insecure people want to make sure things cannot be read easily. Such as the ones requesting image and sound files embedded into Windows EXE's or the equivalent of the two popular Unix-like operating systems.

I'm sorry if I misled people while I said somewhere Freebasic allowed multiline strings, it doesn't, not even with its "macros". If any BASIC dialect had to support something like the "here strings" in Bash shell language, it might represent the end of readability without "REM" statements. It's because people are going to want to "pickle", to obfuscate and to do all sorts of wicked schemes with data which resides inside code.

I always thought a simple command like _EMBED DATA: Label, Size would be nice.

Basic usage would be like:

_EMBED DATA: Foo, 12
ABCDEFGHIJKL
_EMBED END

The IDE would read that, start on the line below, and read the next 12 characters as a string of unformatted data and save it in a string type variable called "Foo", which you can then _MEMPUT into whatever you need it to actually go into -- an array, an image handle, a sound block... whatever.  The END block is a safety check to make certain that the ide read the proper number of bytes that you told it to.  If it's not immediately the next thing that the IDE sees after reading the number of bytes you specified, it tosses an error for you -- "Incorrect number of bytes in embeded data on line XXX".

Sure, it'd look ugly (collapsable blocks would take care of that), but it'd be a nice easy way to embed large chunks of raw data directly into a QB64 program.  Wink
Reply


Messages In This Thread
Data setting tutorial video! - by johannhowitzer - 12-03-2022, 11:18 AM
RE: Data setting tutorial video! - by mnrvovrfc - 12-03-2022, 12:12 PM
RE: Data setting tutorial video! - by SMcNeill - 12-03-2022, 12:44 PM
RE: Data setting tutorial video! - by mnrvovrfc - 12-03-2022, 02:03 PM
RE: Data setting tutorial video! - by Pete - 12-03-2022, 04:03 PM



Users browsing this thread: 5 Guest(s)