DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 26th June 2013
gpatrick gpatrick is offline
Shell Scout
 
Join Date: Nov 2009
Posts: 120
Thanked 0 Times in 0 Posts
Default NetRexx Programming

Quote:
NetRexx is a general-purpose programming language inspired by two very different programming languages, Rexx and Java. It is designed for people, not computers. In this respect it follows Rexx closely, with many of the concepts and most of the syntax taken directly from Rexx or its object-oriented version, Object Rexx. From Java it derives static typing, binary arithmetic, the object model, and exception handling. "A smart language designed for real people, and vice versa." Originally a product from the IBM Hursley Software Lab, NetRexx has always been free software and is free and open source since June 11th, 2011. It is the first alternative language for the Java Virtual Machine (JVM).
NetRexx 3.02 is released and available for download
Reply With Quote
  #2   (View Single Post)  
Old 26th June 2013
thirdm thirdm is offline
Package Pilot
 
Join Date: May 2009
Posts: 206
Thanked 3 Times in 3 Posts
Default

Does Rexx take long to learn?

I was half considering scouting around for a new scripting language, having an aversion to bourne shell for scripts longer than a few lines. Perl's fine or more than fine for a lot of things, of course, but unless I'm missing something, when you want to run Unix commands you have to make a call to system, which isn't much improvement over C in terms of brevity. Okay, when you're taking in the output of a command you have backticks and the open function, but sometimes you simply want to run a program and let it use stdout, stderr, and stdin rather than redirect them.

I like scsh for this, and like lisp, but it's barely maintained. I think there's not even really a solid amd64 build yet. I noticed a paper about something called Shcaml, based on ML, but though the idea of bringing static typing to shell scripting is appealing, unless I mistook the syntax, the notation for running a command isn't brief like /bin/sh or scsh, but inelegantly has you precede each one with command, giving the same notation problem (I think) Perl has.

Maybe Rexx would fit the bill.

Otherwise, has anyone tried plan 9's rc as a substitute to bourne, anyone who finds notations like 1>&2 or ${what%%the} squirrely?
Reply With Quote
  #3   (View Single Post)  
Old 26th June 2013
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,710
Thanked 214 Times in 189 Posts
Default

I used Rexx for scripting .... back in the early-mid 1980s. I recall it being a snap to learn and use. Unfortunately, that's really all I can remember about Rexx. It's been too many years since I used it.
Reply With Quote
  #4   (View Single Post)  
Old 26th June 2013
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,888
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by thirdm View Post
Does Rexx take long to learn?
Given your exposure to other languages, you shouldn't experience an undue learning curve. Rexx is similar in syntax to Modula-2 or Ada -- in other words, Pascal-ish.

Rexx comes from the IBM world circa 1970s' - '80's. As I recall, it was developed in the branch office in England, & proliferated to the point of becoming IBM's glue language used on all supported platforms. Flexible? Yes, but I don't think it ever gained much traction outside of the IBM world. In fact, I haven't heard much about Rexx ever since OS/2 faded into the sunset.

There are a number of tutorials which can be found online; one place to begin is Wikipedia's article:

http://en.wikipedia.org/wiki/Rexx

One of the more concise implementations of Tic-Tac-Toe I saw in one of Cowlishaw's books, but if I am recalling correctly, this wasn't necessarily due to anything inherent to Rexx, it simply was a nice, short implementation.
Quote:
I was half considering scouting around for a new scripting language...
While Rexx has been ported to a number of (non-IBM) environments, I don't see an OpenBSD port. I also have no idea as what would be required to see one of the existing implementations to run on OpenBSD.
Reply With Quote
  #5   (View Single Post)  
Old 26th June 2013
gpatrick gpatrick is offline
Shell Scout
 
Join Date: Nov 2009
Posts: 120
Thanked 0 Times in 0 Posts
Default

There are three different implementations of Rexx available for many platforms today. Classic Rexx which was originally developed in 1979 and later Object Rexx which has become ooRexx in the open source world, and in the early 1990s, NetRexx which allows one to use all of the Java class libraries.

The most popular Classic Rexx is Regina
This is the homepage of ooRexx and a link to sourceforge to download
The NetRexx homepage

All of them are actively maintained and ooRexx is currently in 4.1.3 beta. ooRexx is upwards compatible and can run all Classic Rexx code, and one can mix object oriented code with procedural code. I've used ooRexx to run Classic Rexx code, but find the syntax odd (for me) for oo programming. There is also ooDialog for Windows programming.

As asked, to run a system command in Rexx simply do this in your Rexx source:
Code:
'ls /tmp/junk'
$ rexx /tmp/ls.rex
a b
Here are some simple examples of Classic Rexx and NetRexx that I've done quickly.
Code:
string = '/path/to/filesystem host1(sync,rw,fsid=1) host2(sync,ro,fsid=2 host3(sync,ro,fsid=3) host4(sync,rw,fsid=4)'
do while string <> ''
 parse var string fs '' server '(' opts ')' string
   say opts
end
# rexx /tmp/exports.rex
sync,rw,fsid=1
sync,ro,fsid=2
sync,ro,fsid=3
sync,rw,fsid=4
Code:
host = InetAddress.getlocalHost()
parse host name '/' ip
say host
say 'HOST:' name
say 'IP: ' ip
# java hostn
myserver/192.168.1.100
HOST: myserver
IP: 192.168.1.100
Although they are very simple, it shows how easy it is to pickup Rexx and/or NetRexx.

I use both Rexx and NetRexx almost daily for my work as a Unix admin at a fortune 500 company. I've also used NetRexx for servlets.

The syntax is slightly different for the two, such as for arrays in Rexx one would do
Code:
book.0=3
book.1='title1'
book.2='title2'
book.3='title3'
do i=1 to book.0
 say book.i
end
$ rexx /tmp/book.rex
title1
title2
title3
While in NetRexx
Code:
method main(args=String[]) static
 book = Rexx('') 
 book[1]='title1'
 book[2]='title2'
 book[3]='title3'
 loop i=1 to 3
  books=book[i]
  say books
 end
$ java books
title1
title2
title3
Or if you don't know the number of elements in your array:
Code:
method main(args=String[]) static
 books=0
 books[1]='title1'
 books[2]='title2'
 books[3]='title3'
 loop i = 1 while books[i] <> 0
  say books[i]
 end
$ java books
title1
title2
title3
The Rexx family of languages is maintained by the Rexx Language Association

RexxLA also has an annual symposium. Next year it is to be held in Austin, Texas.

I have successfully built Regina on FreeBSD, NetBSD, OpenIndiana and SmartOS. I believe I also built it on OpenBSD but am not positive; although since it built on FreeBSD and NetBSD there is no reason to believe it would fail.

Open Object Rexx (ooRexx) runs on a number of platforms, but I have been unsuccessful in getting it to build for NetBSD, FreeBSD, OpenIndana and SmartOS. There is an older 3.2 version of ooRexx already built for Solaris that does run on OI and SmartOS though.

NetRexx will run if you have Java installed. Copy NetRexxC.jar to JAVA_HOME/lib and add it to your CLASSPATH, then copy nrc to PATH and you are set.

Last edited by gpatrick; 27th June 2013 at 01:00 PM.
Reply With Quote
  #6   (View Single Post)  
Old 27th June 2013
thirdm thirdm is offline
Package Pilot
 
Join Date: May 2009
Posts: 206
Thanked 3 Times in 3 Posts
Default

Thanks for the info everyone.

Now I'm torn whether to try rc or rexx first. rc appears to address some of the things that make me twitch about /bin/sh too and has some interesting features besides:

http://doc.cat-v.org/plan_9/4th_edition/papers/rc
Reply With Quote
  #7   (View Single Post)  
Old 28th October 2013
Martillo Martillo is offline
Semper deinceps corda
 
Join Date: Apr 2013
Location: Madrid, Spain
Posts: 65
Thanked 0 Times in 0 Posts
Default

I used to program in it in the last nineties when I worked in IBM. It was easy to learn and use, but for some reason did not catch in the M$ world, so when OS/2 failed...

I used it to glue C programs and DB2 calls.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
php programming in openbsd. bsdnewbie999 OpenBSD General 5 15th June 2009 03:03 AM
c programming - Modules corey_james Programming 3 6th November 2008 08:49 PM
Learning Programming Crypt Programming 35 27th October 2008 04:54 PM
GUI Programming bsdnewbie999 Programming 6 17th August 2008 12:19 AM
C programming - Lint corey_james Programming 14 16th May 2008 11:05 PM


All times are GMT. The time now is 01:45 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick