🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
7 messages
7 total messages Started by VanguardLH Wed, 25 Dec 2013 22:00
40tude Dialog: Which programming language used for scripts?
#256568
Author: VanguardLH
Date: Wed, 25 Dec 2013 22:00
14 lines
2065 bytes
Over the years, I've use pre-written scripts to alter or add behaviors
or functionality to 40tude Dialog.  Alas, some of them sometimes
generate "index out of bounds" errors.  I think it has to do when
walking through the characters in strings, like the author started
walking from an incorrect indexed character in the string.

In what programming language are scripts written?  I thought it was
Delphi (aka Object Pascal).  If so, doesn't the zeroth element (index 0)
of a string hold the length of the string and is not part of the string
itself?  

In C and for a string on N characters in length, you would walk through
indexes 0 to N-1 to look at each character in the string.  For Pascal,
don't you use 1 to N?
Re: 40tude Dialog: Which programming language used for scripts?
#256570
Author: Sqwertz
Date: Thu, 26 Dec 2013 07:29
19 lines
2212 bytes
On Wed, 25 Dec 2013 16:00:15 -0600, VanguardLH wrote:

> In what programming language are scripts written?  I thought it was
> Delphi (aka Object Pascal).  If so, doesn't the zeroth element (index 0)
> of a string hold the length of the string and is not part of the string
> itself? 
>  
> In C and for a string on N characters in length, you would walk through
> indexes 0 to N-1 to look at each character in the string.  For Pascal,
> don't you use 1 to N?

No.  You use 0 to N-1.  Just like in C and every other language I've
used (except some old ROM-based versions of BASIC didn't have a [0]
element to arrays).

Disclaimer: I don't claim to be a Delphi guru (hate it, in fact), but
I do have some scripts that do a bunch of string manipulation.

-sw
Re: 40tude Dialog: Which programming language used for scripts?
#256572
Author: Sqwertz
Date: Thu, 26 Dec 2013 07:54
31 lines
2785 bytes
On Thu, 26 Dec 2013 01:29:48 -0600, Sqwertz wrote:

> On Wed, 25 Dec 2013 16:00:15 -0600, VanguardLH wrote:
> 
>> In what programming language are scripts written?  I thought it was
>> Delphi (aka Object Pascal).  If so, doesn't the zeroth element (index 0)
>> of a string hold the length of the string and is not part of the string
>> itself? 
>>  
>> In C and for a string on N characters in length, you would walk through
>> indexes 0 to N-1 to look at each character in the string.  For Pascal,
>> don't you use 1 to N?
> 
> No.  You use 0 to N-1.  Just like in C and every other language I've
> used (except some old ROM-based versions of BASIC didn't have a [0]
> element to arrays).
> 
> Disclaimer: I don't claim to be a Delphi guru (hate it, in fact), but
> I do have some scripts that do a bunch of string manipulation.

I started second-guessing myself and looked at some code.  It appears
the length IS stored in [0] only for ShortString data types - mainly
used in older versions of Delphi.  I assume Dialog is built with the
newer and default Unicode string formats.

If you declare a string with a constant as in string[1-255] it looks
like you may get a ShortString data type.

Disclaimer still applies :-)

-sw
Re: 40tude Dialog: Which programming language used for scripts?
#256573
Author: Mike Easter
Date: Thu, 26 Dec 2013 22:34
29 lines
2124 bytes
VanguardLH wrote:
> Over the years, I've use pre-written scripts to alter or add behaviors
> or functionality to 40tude Dialog.  Alas, some of them sometimes
> generate "index out of bounds" errors.  I think it has to do when
> walking through the characters in strings, like the author started
> walking from an incorrect indexed character in the string.
>
> In what programming language are scripts written?  I thought it was
> Delphi (aka Object Pascal).  If so, doesn't the zeroth element (index 0)
> of a string hold the length of the string and is not part of the string
> itself?
>
> In C and for a string on N characters in length, you would walk through
> indexes 0 to N-1 to look at each character in the string.  For Pascal,
> don't you use 1 to N?

This article agrees with that/you:

http://www.roblocher.com/whitepapers/opascal.aspx  Major Differences 
Between the Syntax of C++ and Object Pascal

  Miscellaneous
  Feature -- C++ -- Object Pascal
  string constants -- "a string constant" (Note: zero based) -- 'a 
string constant' (Note: one based)


-- 
Mike Easter
Re: 40tude Dialog: Which programming language used for scripts?
#256576
Author: Pepi
Date: Fri, 27 Dec 2013 20:34
25 lines
2474 bytes
On Wed, 25 Dec 2013 16:00:15 -0600, VanguardLH wrote:

> Delphi (aka Object Pascal).

Doubtful. Delphi Object Pascal is a language that normally requires a 
compiler to make anything run, and it comes with its own syntax that is 
suitable for that particular purpose.

It might, however, be equipped with a subset of Pascal and using it as a 
script language, having support for creating user objects or not, I've 
seen that in a math program I used to use. But that was far from Delphi's 
Pascal. I used Delphi Object Pascal from 1995 to 2005. Nowadays, only 
Python.

I assume that a script language for a newsreader would be having special 
syntax to handle things unique for dealing with Usenet things, and not to 
create standalone computer programs.

As for your question about index 0 of a string:
http://delphi.about.com/od/beginners/l/aa071800a.htm
-- 
  ___      _            __S*P*A*M:_______________________________
-(o o)----/_/_--_--.---|            >Purge M$ products!<         |
-/ v \---/--/_'/_//----|           >Install free stuff!<         |
-\V V/--------/--------|       >Killfile a google grouper!<      |
Re: 40tude Dialog: Which programming language used for scripts?
#256579
Author: Jernej Simončič
Date: Sun, 29 Dec 2013 00:43
14 lines
1789 bytes
on Wed, 25 Dec 2013 16:00:15 -0600, VanguardLH wrote:

> In what programming language are scripts written?  I thought it was
> Delphi (aka Object Pascal).  If so, doesn't the zeroth element (index 0)
> of a string hold the length of the string and is not part of the string
> itself?

Dialog uses InnerFuse Pascal Script engine (now RemObjects Pascal Script) -
the same one Inno Setup uses (though Dialog's is obviously older version).

-- 
begin  .sig
< Jernej Simončič ><>◊<>< jernej|s-ng at eternallybored.org >
end
Re: 40tude Dialog: Which programming language used for scripts?
#256581
Author: VanguardLH
Date: Sun, 29 Dec 2013 02:32
31 lines
3290 bytes
Jernej Simončič <jernej@deepthought.ena.invalid> on 28/12/2013 wrote:

> on Wed, 25 Dec 2013 16:00:15 -0600, VanguardLH wrote:
> 
>> In what programming language are scripts written?  I thought it was
>> Delphi (aka Object Pascal).  If so, doesn't the zeroth element (index 0)
>> of a string hold the length of the string and is not part of the string
>> itself?
> 
> Dialog uses InnerFuse Pascal Script engine (now RemObjects Pascal Script) -
> the same one Inno Setup uses (though Dialog's is obviously older version).

I have to wonder about script interpretation within Dialog since too
often I get "index out of bound/range" errors.  Yet after looking at the
code, there is nothing that would be out of range (specifically the for
or while loops which use indexing to walk through lines in the message
or characters in each line).  Also, the some scripts where this error
occurs will run just fine for days or weeks and then get the error.  As
such, and even if there were a debug mode, like walking through the
script when the event fires that runs it (which there is not), you would
waste tons of time debugging an instance that won't error trying to
capture the one that dores.  Another script gets an out of range error
on every execute.  

It seems the scope or context of the scripts is incomplete or faulty.
There is no documentation on the context for the scripts, even to
describe what parameters can be passed to or from them.  Sometimes I see
scripts that have the 'program' block, a 'procedure' block, but no
'function' block that calls the 'procedure' block.  Other times all 3
code blocks are there.  Tis a pity scripting was a primarily an insider
feature.  
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads