1. Euphoria file types
- Posted by vmars Mar 05, 2009
- 1398 views
- Last edited Mar 06, 2009
Please,where can I find info on Euphoria file tpyes? No help on google. The Search on "OpenEuphoria: Euphoria v4.0" isn't working. Thanks! ...Vern
2. Re: Euphoria file types
- Posted by jeremy (admin) Mar 05, 2009
- 1390 views
- Last edited Mar 06, 2009
What do you mean file types?
Jeremy
3. Re: Euphoria file types
- Posted by Kat Mar 05, 2009
- 1434 views
- Last edited Mar 06, 2009
I think you want the reference manual. Or, for how to use files, try searching the archives for code examples at:
http://rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=file+type
useless
4. Re: Euphoria file types
- Posted by DanM Mar 06, 2009
- 1386 views
Please,where can I find info on Euphoria file tpyes? No help on google. The Search on "OpenEuphoria: Euphoria v4.0" isn't working. Thanks! ...Vern
On this forum, click on "Manual",
scroll down to section 5.12, "I/O", click on "5.12 I/O",
scroll down to "5.12.2.6 open", click on it,
scroll down to "Possible modes are:"
That section should answer your questions.
Alternatively, for in my opinion WAY better documentation,
goto the regular Euphoria html doc section in your computer,
click on "refman.htm",
scroll down to the better described, "File and Device I/O ",
scroll down to the better described, "open - open a file or device ",
and the info there should also answer your questions.
Dan
5. Re: Euphoria file types
- Posted by SDPringle Mar 06, 2009
- 1389 views
I think it is planned to keep the assignments in Windows:
.exw for exwc for the Windows version. and .ex for ex.exe DOS version.
The .e, .ew files are libraries and are not to be run. Do we want all general EUPHORIA files to be run on the DOS interpreter? Shall we make a distinction between DOS EUPHORIA program extensions and General EUPHORIA program extensions?
Perhaps we can leave it up to the user whether to use the Windows interpreter exwc for .ex programs or the DOS one in an install program.
Shawn Pringle
6. Re: Euphoria file types
- Posted by jeremy (admin) Mar 06, 2009
- 1374 views
I see it differently.
Extension | Interpreter | Reason |
---|---|---|
.ex | exwc, exu | console/server application |
.exw | exw, exu | windowed (as in GUI, not as in Windows) application |
.exd | ex | DOS application |
.e | - | include file |
My thinking on these lines is:
- DOS is the odd ball now. Maybe 10 years ago it was the standard, but times have changed. Yes, some people still use DOS but I can find 10,000 people who use Windows/Linux/OS X for every 1 that uses DOS.
- Euphoria is a cross platform language and is growing so even more. With 4.0 we now have OS X support.
- For those scripts that are platform dependent, do we really want the extension to indicate this? It has no enforcement. For instance, I can run exwu myfile.txt, or exw hello.ruby. As long as it's Euphoria code, Euphoria does not care about extension of the source file, so an extension enforces nothing. Further, do we really want ex=DOS, exw=Windows, exu=Unix/Linux, exfb=FreeBSD (it is different than Linux), exosx=OS X. Further, being cross a cross platform language, many of these applications could care less what platform they are running on.
- Euphoria scripts can easily check what platform they are running on and if they do not support OS X or they require Windows, then the application should state so in code, as the application executes.
- Many applications now use cross-platform GUI libraries. We have Gtk, wxWidgets, Iup and even EuQT (just a start, but it is already more functional than other languages Qt wrappings). These applications are "windowed" or "GUI" application but will run on Windows, Linux, FreeBSD and OS X w/o change.
- Euphoria, as far as I know, has been the only language to make the distinction of platform in their file extensions. For instance, you do not have luad (DOS), luaw (Windows), luao (OSX), luau (Unix), etc.. Nor rbd, rbw, rbo, rbu for Ruby, or pyd, pyw, ... for Python.
- We need to make some distinction because we have three interpreters on the Windows platform (DOS (ex), Console (exwc), No Console (exw)).
The above plan makes the standard extensions hit the widest target.
Jeremy
7. Re: Euphoria file types
- Posted by Kat Mar 06, 2009
- 1325 views
<snip>
Further, being cross a cross platform language, many of these applications could care less what platform they are running on.
<snip>
Jeremy
I disagree, they care so little about that that they couldn't care less.
useless
8. Re: Euphoria file types
- Posted by bernie Mar 06, 2009
- 1410 views
- Last edited Mar 07, 2009
I see it differently.
Extension | Interpreter | Reason |
---|---|---|
.ex | exwc, exu | console/server application |
.exw | exw, exu | windowed (as in GUI, not as in Windows) application |
.exd | ex | DOS application |
.e | - | include file |
Jeremey:
I think that the include files should be.
.e | - | General include file |
.ew | - | Windows only include file |
.eu | - | Linux only include file |
Bernie
9. Re: Euphoria file types
- Posted by jeremy (admin) Mar 06, 2009
- 1352 views
- Last edited Mar 07, 2009
Bernie, what about FreeBSD only? OS X only? They are different and there will be includes that work only on FreeBSD or only on OS X. Further, what happens with 4.1 when we support AIX, Solaris and others? They also will have includes that only work on them. In fact, I may work a bit on making it work on Solaris before 4.0 final.
Then, we have another issue. What happens when we go to 64bit and this include only works on 64bit linux? .eu64? what if an include doesn't work on 64bit, .eu32 ? The list could go on and on. I do not think the extension should be the indication of what platform/environment the file will work on except in the case of which file is linked ex.exe, exwc.exe and exw.exe.
Jeremy
10. Re: Euphoria file types
- Posted by jeremy (admin) Mar 06, 2009
- 1344 views
- Last edited Mar 07, 2009
Oh, I wanted to say, here's how an include should work:
ifdef !WIN32 then crash("MyLib v1.0 only works on Windows 32") end ifdef -- code -- code -- code
This is the only way of really doing what is the file needs to have done.
Jeremy
11. Re: Euphoria file types
- Posted by SDPringle Mar 07, 2009
- 1332 views
I fully agree with the ideas you have put forward for the extensions and the reasons for them. Non MS OSes have only one interpreter so they fortunately don't need to worry about extensions. I think the Non-MS OSes work like exwc instead of exw.
Why do we have both an exw and exwc? Why not just have an option for when you want the interpreter to create a new console instead?
exwc foo.ex ( runs in the current console like ) exwc -nc foo.ex ( could be made to creates a new console )
exu foo.ex ( runs in current console ) exu -nc foo.ex ( opens a new console and runs foo.ex in it. )
And it is so inconsistent to have to put -CON in order to supress the creation of a new console Window on a translated application on one platform but then to not do so by default on the other.
Shawn Pringle
12. Re: Euphoria file types
- Posted by jimcbrown (admin) Mar 07, 2009
- 1346 views
I fully agree with the ideas you have put forward for the extensions and the reasons for them. Non MS OSes have only one interpreter so they fortunately don't need to worry about extensions. I think the Non-MS OSes work like exwc instead of exw.
Why do we have both an exw and exwc? Why not just have an option for when you want the interpreter to create a new console instead?
Windows stupidity. The PE header has a stub that specifies whether it is an app that uses the console subsystem or the gui subsystem. You can't switch between the two dynamically, it has to be choosen at load time. (It is possible to achieve this by writing your own stub. This is low level enough that you can't use the C library to help you here.)
A console subsystem app can't tell if it was started from another console or if it was given a brand new one. It just sees a console, and thats it. A gui subsystem app can't tell if it was started from a console or not. It just sees no console, and will have to create a new one using AllocConsole().
To be perfectly clear:
There is no way to start a console subsystem app without a console. If its not given one to share by the parent, it creates a new one. Whether you want it to or not.
There is no way to share the parent process's console with a gui subsystem app. If it wants a console, it has to make a new one. (XP and later can use AttachConsole() but this has its own disadvantages, such as having to deal with two apps reading the console input simulatenously.)
exwc foo.ex ( runs in the current console like ) exwc -nc foo.ex ( could be made to creates a new console )
I think exwc -nc could be made to work, by having it be a console subsystem app but then call FreeConsole() to release it and then calling AllocConsole() again to create a new one. Of course, if exwc was called from a GUI app that had no console (e.g. Start->Run) then we'll see a flicker as the default console is destroyed before its replacement is created.
exu foo.ex ( runs in current console ) exu -nc foo.ex ( opens a new console and runs foo.ex in it. )
Huh? What is a "new console" for exu?
And it is so inconsistent to have to put -CON in order to supress the creation of a new console Window on a translated application on one platform but then to not do so by default on the other.
Shawn Pringle
Only one platform supports the concept of console windows. Other platforms handle this saner, so the issue doesn't need to arise there.
13. Re: Euphoria file types
- Posted by robcraig Mar 07, 2009
- 1330 views
Oh, I wanted to say, here's how an include should work:
ifdef !WIN32 then crash("MyLib v1.0 only works on Windows 32") end ifdef -- code -- code -- code
This is the only way of really doing what is the file needs to have done.
Jeremy
Why introduce a new symbol "!", when Euphoria already has the keyword "not" for this purpose?
Rob
14. Re: Euphoria file types
- Posted by jimcbrown (admin) Mar 07, 2009
- 1335 views
Why introduce a new symbol "!", when Euphoria already has the keyword "not" for this purpose?
Rob
We'd need to make it clear that the keywords 'or' and 'and' do not work between an ifdef....then
15. Re: Euphoria file types
- Posted by robcraig Mar 07, 2009
- 1354 views
Why introduce a new symbol "!", when Euphoria already has the keyword "not" for this purpose?
Rob
We'd need to make it clear that the keywords 'or' and 'and' do not work between an ifdef....then
Why not document that fact for now, and leave open the possible future support of "or" and "and"?
Rob
16. Re: Euphoria file types
- Posted by jeremy (admin) Mar 07, 2009
- 1319 views
Why introduce a new symbol "!", when Euphoria already has the keyword "not" for this purpose?
I'll change it to read not. You are right.
Jeremy
17. Re: Euphoria file types
- Posted by vmars Mar 07, 2009
- 1379 views
- Last edited Mar 08, 2009
Oops, By 'file types' I mean 'file extensions'.
From this Forum I got:
.ex exwc, exu console/server application .exw exw, exu windowed (as in GUI, not as in Windows) application .exd ex DOS application .e - include file .exw for exwc for the Windows version. and .ex for ex.exe DOS version.
From DOCS:
"CON" - the console (screen) "AUX" - the serial auxiliary port "COM1" - serial port 1 "COM2" - serial port 2 "PRN" - the printer on the parallel port "NUL" - a non-existent device that accepts and discards output Close a file or device when done with it, flushing out any still-buffered characters prior.
From DOCS:
"r" - open text file for reading "rb" - open binary file for reading "w" - create text file for writing "wb" - create binary file for writing "u" - open text file for update (reading and writing) "ub" - open binary file for update "a" - open text file for appending "ab" - open binary file for appending
I finally did find the following at:
http://openeuphoria.org/docs/eu400_0009.html#_34_Euphoriaprograms
2.1.5 Running a Program To run a Euphoria program you type the name of the interpreter followed by the filename of the program you want to run. Such as: ex example.ex What you just typed is known as the command-line. Depending on the platform you are using the interpreter could be called:
ex
exw
exwc
exu
The command-line may contain extra information. Following your program filename you may add extra words (known as arguments) that can used in your program to customize its behavior. These arguments are read within your program by the built-in function command_line(). Optionally, you may also use command line switches that are typed between the interpreter name and the program name. Command line switches customize how the interpreter itself behaves. Unlike many other compilers and interpreters, there is no obligation for any special command-line options for ex, exw or exu. Only the name of you Euphoria file is expected, and if you don't supply it, you will be prompted for it. The DOS32 version of the Euphoria interpreter is called ex.exe. The WIN32 version is called exw.exe and the WIN32 console version is called exwc.exe. The Linux/FreeBSD version is called exu. Euphoria is forgiving about your choice of file extensions. By convention, main Euphoria files have an extension of .ex, .exw, or .exu. Other Euphoria files, that are meant to be included in a larger program, end in .e or sometimes .ew or .eu. To save typing, you can leave off the ".ex", and the ex command will supply it for you automatically. exw.exe will supply ".exw", and exu will supply ".exu". Each will try the other possible extensions as well if the default fails. If the file can't be found in the current directory, your PATH will be searched (using the most likely extension, then the others). You can redirect standard input and standard output when you run a Euphoria program, for example: ex filesort.ex < raw.txt > sorted.txt or simply, ex filesort < raw.txt > sorted.txt
Under Windows, you will need to use Start -> Run... facility if you need to enter command line switches or other arguments to a .exw program.
For frequently-used programs under DOS/Windows you might want to make a small .bat (batch) file, perhaps called myprog.bat, containing two statements like:
@echo off
ex myprog.ex %1 %2 %3 %4 %5 %6 %7 %8 %9
The first statement turns off echoing of commands to the screen. The second runs ex myprog.ex with up to 9 command-line arguments. See command_line() for an example of how to read these arguments. Having a .bat file will save you the minor inconvenience of typing ex (or exw) all the time; i.e., you can just type: myprog instead of: ex myprog Unfortunately DOS will not allow redirection of standard input and output when you use a .bat file. However, this works in a Windows DOS box. Under Linux/FreeBSD, you can type the path to the Euphoria interpreter on the first line of your main file, e.g. if your program is called foo.exu:
- !/home/rob/euphoria/bin/exu procedure foo() ? 2+2 end procedure foo() Then if you make your file executable: chmod +x foo.exu You can just type: foo.exu to run your program. You could even shorten the name to simply "foo". Euphoria ignores the first line when it starts with #!. Be careful though that your first line ends with the Linux/FreeBSD-style \n, and not the DOS/Windows-style \r\n, or the Linux/FreeBSD shell might get confused. If your file is shrouded, you must give the path to backendu, not exu. You can also run bind.bat (DOS32), or bindw.bat (WIN32) or bindu (Linux/FreeBSD) to combine your Euphoria program with ex.exe, exw.exe or exu, to make a stand-alone executable file (.exe file on DOS/Windows). With a stand-alone .exe file you can redirect standard input and output. Binding is discussed further in Distributing a Program. Using the Euphoria to C Translator, you can also make a stand-alone .exe file, and it will normally run much faster than a bound program. exu, ex.exe, exw.exe and exwc will be in the euphoria\bin directory which must be on your search path. The environment variable EUDIR should be set to the main Euphoria directory, e.g. c:\euphoria. 2.1.6 Running under Windows You can run Euphoria programs directly from the Windows environment, or from a DOS shell that you have opened from Windows. By "associating" .ex files with ex.exe, and .exw files with exw.exe you can simply double-click on a .ex or .exw file to run it. Under Windows you would define a new file type for .ex, by clicking on My Computer / view / options / file types. It is possible to have several Euphoria programs active in different windows. If you turn your program into a .exe file, you can simply double-click on it to run it.
18. Re: Euphoria file types
- Posted by CraigWelch Mar 26, 2009
- 1279 views
Many applications now use cross-platform GUI libraries. We have Gtk, wxWidgets, Iup and even EuQT (just a start, but it is already more functional than other languages Qt wrappings).
We have a QT wrapper somewhere? I've not seen it ... your post is the only reference to Euphoria and QT that I can find.
Craig
19. Re: Euphoria file types
- Posted by ne1uno Mar 26, 2009
- 1291 views
Many applications now use cross-platform GUI libraries. We have Gtk, wxWidgets, Iup and even EuQT (just a start, but it is already more functional than other languages Qt wrappings).
We have a QT wrapper somewhere? I've not seen it ... your post is the only reference to Euphoria and QT that I can find.
probably jeremy didn't want to announce it untill it has some more testing and wrapping, but since he let it slip.
I found this accidentally the other morning, qt euphoria wrapping proof of concept. euqt svn
should work with any recent euphoria version 4.x
also need Qt 4.x or 4.5 source or binaries from http://www.qtsoftware.com