Cross-platform scripting
Does anyone know of any resources/articles about cross-platform scripting languages that could be used to replace batch files on windows machines and shell scripts on unix machines? It doesn''t have to be anything that''s a full-force language, just something capable of executing programs/commands and input/output redirection and piping.
Thanks!
I lub Python. If you''re using Windows, get ActiveState''s Windows distribution of Python, which has more features specific to Windows than the one off of python.org.
Here is a link to a really good article on using Python as a scripting language.
http://www.gamasutra.com/features/20020821/dawson_01.htm
It talks a lot about what can be done with it and how it can be useful in a game engine.
http://www.gamasutra.com/features/20020821/dawson_01.htm
It talks a lot about what can be done with it and how it can be useful in a game engine.
Does anyone know of a fast scripting language. I''m looking for something that can compile to native code (x86) at runtime, but still be cross platform.
LinaInverse2010
LinaInverse2010
The way I understand it, languages like Python and Perl are full-force languages that happen to be interpreted. Can they serve the purpose of being platform independent "shell scripts?"
For example, from Perl, can I send some command to the OS and then direct the output to another command in a way that does not depend on the OS''s IO redirection capabilities?
Thanks for the info so far!
For example, from Perl, can I send some command to the OS and then direct the output to another command in a way that does not depend on the OS''s IO redirection capabilities?
Thanks for the info so far!
Even if you created a program that could run scripts the same on all oses, you would still need to compile it for each OS you want to use it on. And, if one of the oses is windows, you''ll have to find ports of all the programs you want to use cuz most windows programs don''t work on the standard input and output stream.
I would suggest you create a simple program in C/C++ that remaps stdout to a file, and then run the first program, and then remap stdin to that file and run the next program, etc so each program outputs to a file and reads input from the file the last program made.
The function you would use would be "freopen" which is a standard ANSI C function, so it should be OS independant.
I would suggest you create a simple program in C/C++ that remaps stdout to a file, and then run the first program, and then remap stdin to that file and run the next program, etc so each program outputs to a file and reads input from the file the last program made.
The function you would use would be "freopen" which is a standard ANSI C function, so it should be OS independant.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
I know we could write a program in any language to do it, but unfortunately "management" wants some kind of cross-platform scripting.
January 27, 2003 12:16 AM
Wow, there''s a lot of bad advice on these forums.
Perl was designed to do exactly what you want. Python can also easily do what you want.
Perl was designed to do exactly what you want. Python can also easily do what you want.
If you already have unix shell scripts written (I''m just guessing you might since you mentioned them) you could install Cygwin on the windows machines and they should be able to run bourne shell or bash shell scripts.
Otherwise, perl or python are probably your best bets. There are countless other scripting languages out there that are ported to many platforms.
You could always use lisp
Otherwise, perl or python are probably your best bets. There are countless other scripting languages out there that are ported to many platforms.
You could always use lisp
quote: Original post by Anonymous Poster
Wow, there''s a lot of bad advice on these forums.
Perl was designed to do exactly what you want. Python can also easily do what you want.
True, Perl was designed to do what he wants. However, I''ve seen Perl code that was supposedly well-written and well-architected that was so obfuscated that it made my nearly made my hair burst into fire while I tried to figure it out.
That being said, even though you can use Perl or Python as a scripting language on multiple platforms, remember that each platform has a seperate command set. Passing "ls -l" to a Windows box (unless you have a set of *nix-compatible tools installed) will generally not work.
Management may not understand what they want. True, they will get the advantage of a single code base, but any change will require double the testing (testing on PC and Unix). In addition, getting your scripts to work with the variances in the platforms could cause your code to grow to an unmanagable size.
Just my two cents.
RomSteady - Test Locally, Test Globally, Test Early, Test Often
Michael Russell / QA Manager, Ritual EntertainmentI used to play SimCity on a 1:1 scale.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement