Welcome, Guest. Please login or register.

Author Topic: Compiler for AmigaDOS scripts?  (Read 4079 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline AMIGA-FANTopic starter

  • Full Member
  • ***
  • Join Date: Jul 2002
  • Posts: 149
    • Show only replies by AMIGA-FAN
    • http://none
Compiler for AmigaDOS scripts?
« on: August 18, 2004, 12:14:10 PM »
Hi everybody, in a project I have under development, there are, as part of it, several (rather complex) AmigaDOS scripts that I need to execute.
These are mainly compilation tools for different comnpilers in order to build up a full SW program. Once completed, this project might well become a commercial product. Considering that these scripts are rather complicated, to avoid the possibility of them being modified mistakenly, was wondering if a compiler exists for AmigaDOS scripts (particularly for AmigaOS 3.9). I can't translate all those scripts into AREXX scripts (for which different compilers exist) also because of the different characteristics between the two languages. But I would really like to be able to translate them into executable and unmodifiable files instead.

Thanks in advance for any feedback.
 

Offline SamuraiCrow

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2280
  • Country: us
  • Gender: Male
    • Show only replies by SamuraiCrow
Re: Compiler for AmigaDOS scripts?
« Reply #1 on: August 18, 2004, 12:52:12 PM »
Sorry, I've only heard of UNIX shell scripts having compilers.  I don't think AmigaDOS supports compiling shell-scripts.  :-(
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Compiler for AmigaDOS scripts?
« Reply #2 on: August 18, 2004, 01:09:12 PM »
AmigaDOS scripts always execute commands (either resident or external).

Shell reads the script file line by line, and executes lines linear.  The only change of flow happens by IF and SKIP commands, IF skips to matching ENDIF if condition is false, and SKIP either skips forward or backwards.

Generating binary from the script doesn't make any sense.
 

Offline AMIGA-FANTopic starter

  • Full Member
  • ***
  • Join Date: Jul 2002
  • Posts: 149
    • Show only replies by AMIGA-FAN
    • http://none
Re: Compiler for AmigaDOS scripts?
« Reply #3 on: August 18, 2004, 03:20:52 PM »
Sorry but in my opinion it does make sense: even normal programs do
contain if condition and conditional branches for instance and DO GET
compiled. The purpose of compiling shell scripts is to make them quick
at running and unmodifiable by unexpert users that only need to work
with those programs, without necessarily knwoing what's going on
behind. There are also copyright issues involved: a good reason for
making compiled programs is TO HIDE source code to the user and the
alike.
Also, with shell-scripts that use internal (or external) AMigaDOS commands it is possible to achieve things that would be a lot more complicated to achieve with a dedicated (custom) program written,
for example, in "C". This is because at shell-level we use already-made (AmigaDOS) programs, therefore leaving behind all complexities that would have to be dealt with when writing a custom program that does the same things a shell script does. I have written several shell-scripts, some of which counting several hundreds lines. What these scripts achieve in a few hundreds lines would require thousands of lines of "C" code, not to mention the time required to develop such programs. So, if an AmigaDOS compiler existed, that, in my opinion, would be a great help for the Amiga SW development for particular applications, like mine.
 

Offline DanDude

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 505
    • Show only replies by DanDude
Re: Compiler for AmigaDOS scripts?
« Reply #4 on: August 18, 2004, 03:29:23 PM »
Why not use BlitzBasic, Amiga-E, C++ or other development applications?  They use compilers to finish your work.  I find BlitzBasic easier to use not to mention expandable. :-)
#AmIRC
mesra.dal.net or hotspeed.dal.net
irc2.beyondirc.net
 

Offline whabang

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 7270
    • Show only replies by whabang
Re: Compiler for AmigaDOS scripts?
« Reply #5 on: August 18, 2004, 03:30:39 PM »
I've never seen a batch-file compiler for AmigaOS, unfortunately. Isn't there a small basic-like language with the possibility to execute CLI-commands?
Beating the dead horse since 2002.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Compiler for AmigaDOS scripts?
« Reply #6 on: August 18, 2004, 03:32:14 PM »
@AMIGA-FAN
Quote
Sorry but in my opinion it does make sense: even normal programs do contain if condition and conditional branches for instance and DO GET compiled.

Yeah, but AmigaDOS scripts are no way normal programs. Shell has no DO GET or other direct loops anyway, you need to use LAB, IF and SKIP BACK.

Quote
The purpose of compiling shell scripts is to make them quick at running

Minimal time is spent on flow control. 99% of CPU time is spent on actually executing the commands.

Also, if you want 'execute' command to work the script MUST be executed from a script file as usual.

To get this thing going without a script file you'd need to implement 100% shell emulator, with emulated resident commands (if, else, endif, skip, lab, echo etc etc) and execute. And it would still be only marginally faster, as most of the time is actually spent on the external commands. It's not worth it.
 

Offline AMIGA-FANTopic starter

  • Full Member
  • ***
  • Join Date: Jul 2002
  • Posts: 149
    • Show only replies by AMIGA-FAN
    • http://none
Re: Compiler for AmigaDOS scripts?
« Reply #7 on: August 18, 2004, 03:59:47 PM »
Using a BASIC-like language capable of executing ANY DOS command
(which is one of my main issues) would be a possible solutionn, but
that would add more work at development phase. Nevertheless, if the
newly written program using this BASIC-like language allows for
source compilation, then that is what I'm looking for, otherwise I
would be stuck with the same problem, that is to avoid possible
modifications (either voluntary or not) to the source code AND to hide
my source code that I would want to keep undisclosed.
 

Offline AMIGA-FANTopic starter

  • Full Member
  • ***
  • Join Date: Jul 2002
  • Posts: 149
    • Show only replies by AMIGA-FAN
    • http://none
Re: Compiler for AmigaDOS scripts?
« Reply #8 on: August 18, 2004, 04:07:29 PM »
My scripts serve to the development of Realtime SW applications and
implement a very compilcated Realtime SW platform. Therefore perform
rather complicated operations, such as uniform SW compilation of
source code (in "C"), application building tasks, source code control
etc. A Realtime Scheduler is also under development and it's all part
of that package. I'm not going to further illustrate this here but I
can assure you that these script-based tasks are VERY complicated and
it would really be wonderful if I could protect this software ("C"
source code WILL be protected ;-) indeed) as well, but the main
purpose here is to avoid unvoluntary modifications (by a user) to
these scripts that would very likely cause malfunctions if one doesn't
know what is doing.


 

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: Compiler for AmigaDOS scripts?
« Reply #9 on: August 18, 2004, 04:31:34 PM »
Quote

AMIGA-FAN wrote:
Using a BASIC-like language capable of executing ANY DOS command
(which is one of my main issues) would be a possible solutionn, but
that would add more work at development phase. Nevertheless, if the
newly written program using this BASIC-like language allows for
source compilation, then that is what I'm looking for, otherwise I
would be stuck with the same problem, that is to avoid possible
modifications (either voluntary or not) to the source code AND to hide
my source code that I would want to keep undisclosed.


Why not just write a new "Execute" command that can decript and execute encripted script files?

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: Compiler for AmigaDOS scripts?
« Reply #10 on: August 18, 2004, 04:37:53 PM »
@Matt

That would seem a more obvious solution. Any kind of compiled AmigaDOS script would ultimately have to call DOS commands etc and someone would be able to pull the thing apart anyway, unless he actually intends to include the DOS commands he uses into the exe that is. However, I would be doubtful of the legality of that.

My advice would be to simpy write ones own simple scripting language that can be compiled into a binary form readable by some simple interpreter. It could create its own process and IO and call system dos commands if that is essential (via C's system() function or whatever).
int p; // A
 

Online Thomas

Re: Compiler for AmigaDOS scripts?
« Reply #11 on: August 18, 2004, 04:38:03 PM »

Why not just put the entire script into a C string constant and Execute() it ?

Bye,
Thomas

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: Compiler for AmigaDOS scripts?
« Reply #12 on: August 18, 2004, 04:41:04 PM »
@Thomas

Aye, there is that :-)

One could also encrypt a string with a simple proggy so the included constant is encrypted. It can be decoded at runtime and Execute() an as you describe. That way its virtually immune to basic reverse engineering.
int p; // A
 

Offline AMIGA-FANTopic starter

  • Full Member
  • ***
  • Join Date: Jul 2002
  • Posts: 149
    • Show only replies by AMIGA-FAN
    • http://none
Re: Compiler for AmigaDOS scripts?
« Reply #13 on: August 18, 2004, 05:34:12 PM »
>>> However I would be doubtful of the legality of that.

Legality? If you can put together simple DOS commands or whatever and
build a complex shell-script that you can use without copyright
issues, why would you not be able to do the same thing from within an
executable file, i.e. a binary, obtained by just compiling this
script? You are just making use of DOS commands/external programs that
you are eligible to use as a owner of the AmigaOS. At least this is my
opinion.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Compiler for AmigaDOS scripts?
« Reply #14 on: August 18, 2004, 05:57:17 PM »
@AMIGA-FAN
Quote
Legality?

You can't redistribute AmigaOS parts, such as C commands ("unless he actually intends to include the DOS commands he uses into the exe that is. However, I would be doubtful of the legality of that."). You couldn't for example upload such compiled binaries to Aminet.