reswrap(1)

πŸ’– reswrap(1) β€” the FOX Programmers Manual, but make it a group chat πŸ’–

okay bestie, sit down, hydrate, because we're about to talk about reswrap β€” a little icon-wrapping icon (pun fully intended, I'm hilarious) from the FOX Programmers Manual. yes it's a real manual page, no it's not boring, let me cook πŸ“


✨ NAME ✨

reswrap β€” wrap icon resources into C code πŸŽ€


🌸 SYNOPSIS 🌸

reswrap [options] [-o[a] outfile] files...

that's it. that's the whole vibe. options, an outfile if you want one, and a bunch of files. slay.


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so Reswrap is a tool that turns images, text, and other resource files into C++ data arrays. literally what it does. this lets all kinds of binary resources get embedded right into your source code and compiled into an application. no cap.

in development of graphical applications with FOX, it's used to embed icons and images for the user interface straight into the executable, which eliminates the need to distribute separate icon and image files. the way that it just… folds your whole asset folder into your binary? main character energy honestly. πŸ‘‘

Reswrap is typically invoked as a part of the build process to generate C++ source files from a collection of icons and images and other binary resources. so it's not a "run it once by hand" girlie, she's a build-pipeline girlie. iykyk.

by default reswrap will interpret the files listed as a stream of raw bytes and output them as an initialized data array to stdout. yes, to stdout. default behaviour, periodt.


πŸ’… OPTIONS πŸ’…

  • -o[a] outfile β€” write the result into the file outfile instead of writing to stdout. with -o the outfile will be overwritten with the data from the input. with the -oa option, the resulting code is appended to the output file, which lets multiple input files be placed into one single source file. overwrite vs append, choose wisely bestie 🫢
  • -h β€” print a short usage message. just a lil snack of help.
  • -v β€” just print out the version number and license information. no more, no less.
  • -d β€” write data as decimal numbers instead of using the default hexadecimal numbers.
  • -m β€” read files with MS-DOS mode (default is binary). this replaces "\r\n" with "\n" when reading the resource file. windows line endings found DEAD πŸ’€
  • -x β€” write data as hexadecimal numbers (this is the default, so it's giving "i'm just here to be explicit").
  • -t[a] β€” write data as a text string, with each byte represented as a hexadecimal escape sequence, as in "\x33".

note that the C++ compiler appends a nul-character at the end of the text string, thus making the data array one character longer than the file. iconic of the compiler honestly, adding a whole extra byte uninvited.

with the a option, printable ascii characters are passed unescaped, while special characters like tabs and newlines are given the usual escape codes. best of both worlds fr fr.

  • -e β€” places the storage modifier extern in front of the data array, ensuring that the data array can be linked with other compilation units. normally, constant declarations are not visible in other compilation units, so this is the one that opens the door. πŸ”₯
  • -i β€” instead of generating an array definition, only write a declaration, which can be included as a header file.
  • -k β€” this option causes reswrap to keep the file extension, replacing the "." with an underscore "_". usage of this option is recommended as it reduces errors when using the data arrays. she said recommended!! listen to her!!
  • -s β€” this option suppresses comments inserted by reswrap to indicate the original file name from which the data statement was generated. bye bye receipts πŸ™ˆ
  • -p prefix β€” prepend the given prefix in front of the name of the resource; this may be used to generate class names or namespace names in front of symbols.
  • -n namespace β€” generate all declarations inside the given C++ namespace declaration. using a namespace may be used to ensure that declarations are only accessible within the given scope, and thus won't clash with symbols. keep your names to yourself, queen 🌈
  • -c cols β€” writes cols columns instead of the default number of columns in the data statements generated by reswrap. the default number of columns for decimal and hex printout is 16 characters; the default for text string printout is 80 characters. (that 80 is giving very classic terminal, we love to see it.)
  • -u β€” force output as unsigned chars in text mode.
  • -z β€” output the size of the resource in the declaration of a resource-array. this allows the C++ sizeof() operator to return the correct size of the resource even for external declarations. note that in text mode, (-t option), an extra byte is added to the size for the end of string character. that extra byte again. she's consistent.
  • -r name β€” instead of using a resource name based on the filename, reswrap substitutes name for the resource name used in the declaration or definition for the following resource file. this is useful if the filename can not be used as an identifier, for example if the filename is a reserved word in C or C++, like "while". imagine naming your file while and expecting that to work. couldn't be me. 😭

⚠️ CAVEATS ⚠️

when using the text string mode, please remember the C compiler appends one nul-character after the string, making the data array one element longer than the resource file. so if your array is one bigger than you expected, that's not a bug bestie, that's just the compiler being the compiler. 🌸


πŸ‘‘ AUTHOR πŸ‘‘

this manpage was originally written by Torsten Landschoff (torsten@debian.org) for the Debian distribution of the FOX Toolkit, and is currently maintained by Jeroen van der Zijp (jeroen@fox-toolkit.org). legends, both of them, we stan. 🫢


Copyright Β© 1997,2005 Jeroen van der Zijp.

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. and they mean it!! no warranty at ALL, not even a lil one, so don't come for her if something breaks. 😭


πŸ” SEE ALSO πŸ”

the reswrap program is a part of the FOX GUI Toolkit. further information about reswrap can be found at:

http://www.fox-toolkit.org

the FOX Toolkit website includes detailed information about reswrap and its use. go read it, it's good for you. πŸ¦‹


and that's the whole page!! this manual page came to you from the FOX C++ GUI Toolkit, dated Sept 2005, and it is β€” say it with me β€” reswrap(1) πŸ’…βœ¨ go wrap some icons bestie, you've got this πŸŽ€πŸ«ΆπŸ’–