Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Programming IT Technology

Solaris Pascal on Linux? 11

Wim Borgers asks: "In our company we're trying to get rid of an old Sun machine before it lease expires and has to be replaced by another one (very soon). Since they are very expensive, we would like to use a Linux box instead. After weeks of trying to convert the Pascal programs, we finally reached a point where we think that it is impossible to migrate the machine: apparently the dialect of Sun Pascal is very specific and cannot be recompiled in Linux without complete rewriting the code... (and we lack the time to make such an undertaking). I think we better save those resources to convert to more decent working programs in the middle to long term. Does anyone have an idea how to get it these things run anyway?"

"The department that uses the machine does a lot of text processing using older Pascal and Cobol programs that were developed during the past years in Sun Workshop. Since we would like to start using XML, and Pascal is less used these days, we also have some viable reasons not to invest in a new Sun machine.

Instead of using Linux we also considered using the free Solaris binaries, but the (older) workshop we need is not released on Intel, but only SPARC and the new Forte programs didn't include the necessary compiler.

Eternal thanks to any who can help us!"

This discussion has been archived. No new comments can be posted.

Solaris Pascal on Linux?

Comments Filter:
  • Doesn't sound like you're a big enough shop to convince Sun to port their compiler to x86. Does the old version of the compiler you're using run on newer sun hardware? Assuming that the hardware is as obsolete as you make it sound, there are low-end Sun boxes that aren't priced much higher than good x86 hardware (the Blade starts at $950 and the Ultra 5 at $2000)

    If you're certain that porting the software would be too much work, perhaps you could get some other interested people involved in adding another dialect of Pascal to the GNU Pascal translator. This could be simpler than porting the whole app over. (hrmm... I just remembered.. there's a second Pascal implementation for Linux, freePascal or something (I think it's aiming for TurboPascal compatability, tho) have you tried both?)

    The third option is to bite the bullet and undertake the process of porting it. Since it's a "text processing" app, Perl would be prime candidate (and, in theory, simpler to write in than other languages), Java would be another option for getting the rewrite off quickly (and due to it's multi-platform support would, again in theory, help prevent you from future vendor lock-in). Part of the reason I mention these languages is that they both have large libraries of platform independant code (Java's vast API and Perls massive collection of libraries) available for them, and that could possibly cut down the time it takes to port. Of course, a straight-across port, maintaining backwards compatability isn't even neccessary, as long as you provide a method to translate any existing data file from one format to another.
  • Could x86 solaris be an option?

    Also what about the possibility of buying a [few?] cheap sun boxes on ebay etc. This would allow you to keep running your current apps whilst figuring out your medium to long term solution

    • Quoth you:
      Could x86 solaris be an option?

      Quoth the "Ask Slashdot":
      Instead of using Linux we also considered using the free Solaris binaries, but the (older) workshop we need is not released on Intel...

      Me:
      Ahem, no.

      Quoth you:
      Also what about the possibility of buying a [few?] [sic] cheap sun boxes on ebay etc. This would allow you to keep running your current apps whilst figuring out your medium to long term solution

      Me: I would like to extend this idea. I am familiar with sun HW and I extend to you at least my help (as I am sure other posters will help). Please list the arcitecture you are running on right now. If it's a sparc 2, then I think we can help you get HW at a reasonable price - probably cheaper than the x86 HW you would have used for solaris x86. What are your price limitations? If you are sub $100 no matter what HW or SW, then that needs to be taken into account. There is no point worry about the things we can not change, like the required platform for your SW develop (4m vs 4u vs x86), and worry about the things you can change, like what platform you have post lease. Another thing to factor into your cost benefit analysis of this migration is if your development software has not been migrated in the directions have already considered, do you feel it is worth continuing along this line if further down the road you may be forced into no choice but total software migration?
    • Umm.... Read the post... Instead of using Linux we also considered using the free Solaris binaries, but the (older) workshop we need is not released on Intel , but only SPARC and the new Forte programs didn't include the necessary compiler. duh!
  • the buyouts (Score:2, Informative)

    by ReidMaynard ( 161608 )
    of leased computers are usually pretty cheap.

    We had dozens of 3 year leased Sun Ultra 20's and the buyout was only about $400 per at the end of the lease.

    It sounds like just buying the box would be the least expensive & least painfull solution.

    As an interesting note, they were all leased with 20" sun monitors, and the leasing company didn't even want them back.
  • A couple things you could do:

    1. Write a library to make the code that is invalid in whatever Pascal compiler you want to use valid. (i.e. emulate missing built-in funcions)

    2. Automate translating code from one version to another. For instance, maybe the Sun Pascal has OO extensions, and you could automate translating the Sun object declarations to Objective Pascal (that's a language, right?) style declarations.

    3. There is surely a Free (or at least open) Pascal compiler that you could modify to compile the Sun style code.

    I'd bet that the best bet is a bit of all three.

    It also seems that Pascal and C should translate almost exactly 1-1. There is a Pascal to C conversion script out there, you might be able to write a Sun Pascal to C conversion script faster than any of the other suggestions.

    Good luck!

    -Peter
    • 1. Write a library to make the code that is invalid in whatever Pascal compiler you want to use valid. (i.e. emulate missing built-in funcions)
      I think that biggest problem that this person is facing is time, or the lack there of.

      2. Automate translating code from one version to another. For instance, maybe the Sun Pascal has OO extensions, and you could automate translating the Sun object declarations to Objective Pascal (that's a language, right?) style declarations.
      See above

      3. There is surely a Free (or at least open) Pascal compiler that you could modify to compile the Sun style code.
      I searched Sun's site for pascal, and this came up [sun.com]
      Maybe it's something to look into, it is built for solaris 2.6, 7 for x86
      Free Pascal [freepascal.org]
      I couldn't find any info on here about Sun Pascal. Quite frankly I didn't even know it existed until I read this.

      What about Kylix? [borland.com] It does object pascal, but who knows if it can read/compile Sun stuff.

      It also seems that Pascal and C should translate almost exactly 1-1. There is a Pascal to C conversion script out there, you might be able to write a Sun Pascal to C conversion script faster than any of the other suggestions.
      I *really* like this suggestion, it gets you out of vendor lock in and minimal time used.

      Just how much of the code is sun specific? If it's not that much, then try and port, otherwise you seem to be SOL
  • Surely the Sun Pascal syntax differs from the "standard" in a regular manner. In such a case it would be a fairly straightforward problem to write a program that takes Sun-flavored Pascal as its input and spits out Linux-flavored Pascal as its output.
  • A couple of years back, I worked on a project where we had a very similar problem, (actually, we went from PDP-11 Pascal to Sun Pascal to HP Pascal). It was much too big a program to rewrite by hand, but it turned out that converting it with awk and sed wasn't. I'd recommend using perl now, it is probably better than any other language for this kind of problem.

    The process in short was 1) define or find the Pascal compiler and Linux box environment you want to use (the target). 2) Attempt to compile & run the code. 3) When it fails, rather than fix it by hand, analyze a little further and write (awk/sed/perl) code to translate the source program into something that does compile/work. 4) Repeat until it compiles & runs.

    You'll find that although it is very hard at a theoretical level, at a practical level, it is very doable - you don't have to solve for the general case, just for the limited case of your one program. It helps a lot if the original program had some disciplined coding conventions, but this is not a hard requirement. I think we had 50,000 lines of Pascal that translated with a couple of hundred lines of awk & sed. We also did this with a 100,000 line Fortran program as well. It's not instantaneous, but it's much, much faster than rewriting, and it does not require that you know the code at the same level of detail that writing a significant extension would require, for example. In some cases, may will have to write some extra functions to handle either library mismatches or language features the new compiler doesn't handle. In our case, the maintenance of the program was done on the original code, and it was translated at build time (mainly because another organization maintained the original program, and we maintained the rehosted derivative).

  • Borland offers Borland Kylix

    http://www.borland.com/kylix/

    which is a full, native Object Pascal compiler with a RAD IDE, and an excellent debugger, for Linux.

    There is a variety of options, from a free Open Edition to a Client/Server edition.

    Contrary to what one might think, Object Pascal is in heavy use.

If a thing's worth doing, it is worth doing badly. -- G.K. Chesterton

Working...