Euphoria Trouble-Shooting Guide ------------------------------- If you get stuck, here are some things you can do: 1. type: GURU followed by some keywords associated with your problem. For example, guru declare global include 2. Check the list of common problems (below). 3. Read the relevant parts of the documentation, i.e. REFMAN.DOC or LIBRARY.DOC. 4. Try running your program with the statements: with trace trace(1) at the top of your main .ex file so you can see what's going on. 5. Post a message on the Euphoria mailing list (see WEB.DOC). Here are some commonly reported problems (P:) and their solutions (S:). P: How do I read/write ports? S: Get Jacques Deschenes' collection of machine-level and DOS system routines from the Euphoria Web page. See his file "ports.e". P: I'm having trouble running a graphics program. I hit control-break and now my system seems to be dead. S: Some graphics programs will not run unless you start them from DOS or from a full-screen window under Windows. Sometimes you have to edit the program source to use a lower resolution graphics mode, such as mode 18. You should stop a program using the method that the program documentation recommends. If you abort a program with control-C or control-Break you may find that your screen is left in a funny graphics mode using funny colors. When you type something, it may be difficult or even impossible to read what you are typing. The system may even appear dead, when in fact it is not. Try the following DOS commands, in the following order, until you clear things up: 1. type: cls Even when you can't see any keystrokes echoed on the screen this may clear the screen for you. 2. type: ex The Euphoria interpreter will try to restore a normal text mode screen for you. 3. type: exit If you are running under Windows, this will terminate the DOS session for you. 4. type: Control-Alt-Delete This will let you kill the current DOS session under Windows, or will soft-reboot your computer if you are running under DOS. 5. If all else fails, power your computer off and back on. You should immediately run SCANDISK or CHKDSK when the system comes back up. P: When I run my program from the editor and I hit control-C, the program dies with an operating system error. S: This is a known problem. Run your program from the command-line, outside the editor, if you might have to hit control-c or control-break. P: When I run my program there are no errors but nothing happens. S: You probably forgot to call your main procedure. You need a top-level statement that comes after your main procedure to call the main procedure and start execution. P: I'm trying to call a routine documented in library.doc, but it keeps saying the routine has not been declared. S: Did you remember to include the necessary .e file from the euphoria\include directory? If the syntax of the routine says for example, "include graphics.e", then your program must have "include graphics.e" (without the quotes) before the place where you first call the routine. P: I have an include file with a routine in it that I want to call, but when I try to call the routine it says the routine has not been declared. But it *has* been declared. S: Did you remember to define the routine with "global" in front of it in the include file? Without "global" the routine is not visible outside of its own file. P: After inputting a string from the user with gets(), the next line that comes out on the screen does not start at the left margin. S: Your program should output a new-line character e.g. puts(SCREEN, '\n') after you do a gets(). It does not happen automatically. P: It says I'm attempting to redefine my for-loop variable. S: For-loop variables are declared automatically. Apparently you already have a declaration with the same name earlier in your routine or your program. Remove that earlier declaration or change the name of your loop variable. P: I get the message "unknown escape character" on a line where I am trying to specify a file name. S: *Do not* say "C:\TMP\MYFILE". You need to say "C:\\TMP\\MYFILE". Backslash is used for escape characters such as \n or \t. To specify a single backslash in a string you need to type \\. P: I'm trying to use mouse input in a SVGA graphics mode but it just doesn't work. S: DOS does not support mouse input in modes beyond graphics mode 18 (640x480 16 color). DOS 7.0 (part of Windows 95) does seem to let you at least read the x-y coordinate and the buttons in high resolution modes, but you may have to draw your own mouse pointer in the high-res modes. See Peter Blue's solution on the Euphoria Web page. P: I'm trying to print a string using printf but only the first character comes out. S: See the printf description in library.doc. You may need to put braces around your string so it is seen as a single value to be printed, e.g. you wrote: printf(1, "Hello %s", mystring) where you should have said: printf(1, "Hello %s", {mystring}) P: It complains about my routine declaration, saying "a type is expected here". S: When declaring subroutine parameters, Euphoria requires you provide an explicit type for each parameter. e.g. procedure foo(integer x, y) -- WRONG procedure foo(integer x, integer y) -- RIGHT In all other contexts it is ok to make a list: atom a, b, c, d, e P: I'm declaring some variables in the middle of a routine and it gives me a syntax error. S: All of your private variable declarations must come at the beginning of your subroutine, before any executable statements. (At the top-level of a program, outside of any routine, it is ok to declare variables anywhere.)