Difference between revisions of "Portability issues"

From RogueBasin
Jump to navigation Jump to search
(→‎Filesystem: some cleanup ; clarification of HFS+ case issue (it isn't inconsistent, just different - and *can* be case-sensitive if so desired, to boot))
Line 14: Line 14:
== Filesystem ==
== Filesystem ==


* Some [[Operating Systems]] (such as any derive from or copy [[Unix]], or follow the [[POSIX]] standards) are case-sensitive as far as filenames are concerned.  Others (like [[DOS]] or [[Windows]]) aren't.  Still others (like [[Mac OS X]]) are inconsistent in their case-sensitivity or preservation. So, one shouldn't rely on any one case behavior for maximum portability.
* Some [[Operating Systems]] (such as any that derive from or pattern [[UNIX]] or follow [[POSIX]] standards) are case-sensitive as far as filenames are concerned.  Others (like [[DOS]] or [[Windows]]) are case-insensitive.  Still others (like HFS+, in common use on [[OS X]]) preserve case but are insensitive to it. One shouldn't rely on any one case behavior to achieve maximum portability.
* There are [[Operating Systems]] that forbide using certain characters in the file names.
* There are [[Operating Systems]] that forbid use of certain characters within file names, most often path separators (e.g., colons in Classic MacOS). Other characters may require "escaping" in filename references.
* [[Operating Systems]] also can restrict the length of the filename or the total length of absolute path of file.
* [[Operating Systems]] may also restrict filename length or the total length of an absolute filepath.
* [[DOS]] and [[Windows]] use different [[path separator character]].a ''backslash'' ("\"). rather than the ''slash'' ("/") character defined in [[POSIX]].
* [[DOS]] and [[Windows]] differ in their [[path separator]] — a ''backslash'' ('\') — from the [[POSIX]] separator, the ''slash'' ('/').
* Note that most modern operating systems allow files with spaces in them.  This means if you pass arguments to another program you should be able to protect those arguments if they may contain spaces.  Ie, if a user names themselves "Foo Bar", your save file may be "Foo Bar.sav".  On Windows, it is highly likely that your path will have a space in it.
* Note that most modern operating systems allow files with spaces in them.  This means if you pass arguments to another program you should be able to protect those arguments if they may contain spaces.  Ie, if a user names themselves "Foo Bar", your save file may be "Foo Bar.sav".  On Windows, it is quite likely that your path will have a space in it, as several system-standard directories utilize this feature (e.g., "Program Files").


== Input ==
== Input ==

Revision as of 04:57, 17 May 2005

Portability Issues

The purpose of this article is to collect portability issues often encountered by roguelike programmers as well as possible solutions for these problems.

Memory

Display

  • Only the characters of the basic (7bit) ASCII character set are reasonably portable. Using characters from extended character sets (like the solid blocks from the IBM DOS character set) or characters which aren't classified as printable by the ASCII standard (like the smileys from IBM DOS) will probably cause problems.
    • Extensions to ASCII are not portable. Unicode is portable, though, plus it includes all the old IBM DOS characters, though not necessarily at the same code points.

Filesystem

  • Some Operating Systems (such as any that derive from or pattern UNIX or follow POSIX standards) are case-sensitive as far as filenames are concerned. Others (like DOS or Windows) are case-insensitive. Still others (like HFS+, in common use on OS X) preserve case but are insensitive to it. One shouldn't rely on any one case behavior to achieve maximum portability.
  • There are Operating Systems that forbid use of certain characters within file names, most often path separators (e.g., colons in Classic MacOS). Other characters may require "escaping" in filename references.
  • Operating Systems may also restrict filename length or the total length of an absolute filepath.
  • DOS and Windows differ in their path separator — a backslash ('\') — from the POSIX separator, the slash ('/').
  • Note that most modern operating systems allow files with spaces in them. This means if you pass arguments to another program you should be able to protect those arguments if they may contain spaces. Ie, if a user names themselves "Foo Bar", your save file may be "Foo Bar.sav". On Windows, it is quite likely that your path will have a space in it, as several system-standard directories utilize this feature (e.g., "Program Files").

Input

  • Use of the Escape key should be avoided, because escape is a special character for many of the terminals that roguelikes are traditionally played on. These terminals sometimes must hold up an escape key to see if it should be processed or passed on, and that causes annoying delays in a user interface that uses Escape.
  • Remember that there are more than one keyboard layout in the world. A lot of international keyboards have different mappings than the US version that most people take for granted. Shift-., for example, is ; on a Finnish keyboard and > on a US keyboard. See a survey on PreferredKeyControls

Mac OS X

  • The current version of the standard Mac OS X terminal (Terminal.app) only supports 8 colors. Early versions of Mac OS X curses library did not support color at all.

DOS

  • Filenames are limited to 8 characters + a 3 characters extension. Additionally filenames must not contain whitespace or DOS special characters.
  • Memory in the processor's real mode is tight and inconveniently segmented. Later models had a variety of schemes available for accessing expanded memory or extended memory, but being maximally portable to this platform means using less than 640KB of RAM.