(unknown charset) Re: [BLACKBOX] ARRAY as CONSTANT

From: (unknown charset) [at]} <Aubrey.McIntosh{>
Date: Tue, 12 Feb 2008 20:36:32 -0600

nu.&I8}|ׯ{
z{mʗ{V
z{S}ĝxjǺThis seems like a very cumbersome way to do this.
Why not do it either of the ways that were suggested by people who
have experience with BlackBox?

Going back to your first message
...As you know, we can write in Delphi :
...
...CONST
... a: ARRAY [0..4] OF INTEGER = (1, 2, 3, 4, 5);



Can you put into words why you don't like the following solution?

MODULE PrivTestInits;

  VAR a- : ARRAY 5 OF INTEGER;

PROCEDURE InitOne (VAR fp: INTEGER; fv: INTEGER);
BEGIN fp := fv END InitOne;

PROCEDURE Init;
BEGIN
  InitOne (a[0], 1);
  InitOne (a[1], 2);
  InitOne (a[2], 3);
  InitOne (a[3], 4);
  InitOne (a[4], 5);
END Init;

BEGIN
 Init
END PrivTestInits.


At the assembly level, I expect that you will get something similar to
this. Have you looked at the assembly level for the Delphi code?

PROCEDURE InitOne
000CH: 55 push ebp
000DH: 8B EC mov ebp,esp
000FH: 8B 5D 08 mov ebx,8[ebp]
0012H: 66|8B 55 0C mov dx,12[ebp]
0016H: 66|89 13 mov 0[ebx],dx
0019H: 8B E5 mov esp,ebp
001BH: 5D pop ebp
001CH: C2 08 00 ret 8

PROCEDURE Init
001FH: 55 push ebp
0020H: 8B EC mov ebp,esp
0022H: 6A 01 push 1
0024H: 8D 1D F6 FF FF FF lea ebx,[-10]
002AH: 53 push ebx
002BH: E8 DC FF FF FF call -36 (0000000CH)
0030H: 6A 02 push 2
0032H: 8D 1D F8 FF FF FF lea ebx,[-8]
0038H: 53 push ebx
0039H: E8 CE FF FF FF call -50 (0000000CH)
003EH: 6A 03 push 3
0040H: 8D 1D FA FF FF FF lea ebx,[-6]
0046H: 53 push ebx
0047H: E8 C0 FF FF FF call -64 (0000000CH)
004CH: 6A 04 push 4
004EH: 8D 1D FC FF FF FF lea ebx,[-4]
0054H: 53 push ebx
0055H: E8 B2 FF FF FF call -78 (0000000CH)
005AH: 6A 05 push 5
005CH: 8D 1D FE FF FF FF lea ebx,[-2]
0062H: 53 push ebx
0063H: E8 A4 FF FF FF call -92 (0000000CH)
0068H: 8B E5 mov esp,ebp
006AH: 5D pop ebp
006BH: C3 ret



2008/2/12 Oleg N. Cher <allot{([at]})nowhere.xyet>:
> Dear Rene,
>
> Current problem I intend to decide by
> WinApi FindResource, LoadResource & LockResource.
> And link resource file to executable by
> DevLinker.Link
> bolder.exe := Bolder$ ... 1 bolder.res ~
>
> And to work with data by SYSTEM.GET(addr, byte)
>
> But I am interested in BlackBox not only for
> the decision of current problems, but also look at it
> as to an instrument for the decision of different
> of long time problems. And I would be pleasant
> to know that needed to me things in Component Pascal
> are herein present.
>
> It can appear that Component Pascal is not quite suitable
> (why to use files and resources wherein it is possible
> to treat only one simple by a constant array?) And I
> will use C++ ...
>
> ======= 2008-02-12, 17:43:37 : =======
>
> >Why do you have need of a constant array? Why not,
> >for instance, put the values in a file and create
> >an open array variable from it? What is the benefit?
>
>
> Oleg N. Cher,
> Colossoft Research.
> allot{([at]})nowhere.xy
> 2008-02-13
>
>



-- 
-- 
Aubrey McIntosh, Ph.D.
1502 Devon Circle
Austin TX 78723-1814
http://home.grandecom.net/~amcintosh/aubrey/Search/
nu.&I8}|ׯ{
z{mʗbqb
z{m}ޝxjǺ
z{Ch+bv!~)^{\rtf1\ansi\ansicpg1251\fromtext \deff0{\fonttbl
{\f0\fswiss\fcharset204 Arial;}
{\f1\fmodern Courier New;}
{\f2\fnil\fcharset2 Symbol;}
{\f3\fmodern\fcharset0 Courier New;}}
{\colortbl\red0\green0\blue0;\red0\green0\blue255;}
\uc1\pard\plain\deftab360 \f0\fs20 This seems like a very cumbersome way to do this.\par
Why not do it either of the ways that were suggested by people who\par
have experience with BlackBox?\par
\par
Going back to your first message\par
...As you know, we can write in Delphi :\par
...\par
...CONST\par
... a: ARRAY [0..4] OF INTEGER = (1, 2, 3, 4, 5);\par
\par
\par
\par
Can you put into words why you don't like the following solution?\par
\par
MODULE PrivTestInits;\par
\par
  VAR a- : ARRAY 5 OF INTEGER;\par
\par
PROCEDURE InitOne (VAR fp: INTEGER; fv: INTEGER);\par
BEGIN fp := fv END InitOne;\par
\par
PROCEDURE Init;\par
BEGIN\par
  InitOne (a[0], 1);\par
  InitOne (a[1], 2);\par
  InitOne (a[2], 3);\par
  InitOne (a[3], 4);\par
  InitOne (a[4], 5);\par
END Init;\par
\par
BEGIN\par
 Init\par
END PrivTestInits.\par
\par
\par
At the assembly level, I expect that you will get something similar to\par
this.  Have you looked at the assembly level for the Delphi code?\par
\par
PROCEDURE InitOne\par
000CH: 55                                  push    ebp\par
000DH: 8B EC                               mov     ebp,esp\par
000FH: 8B 5D 08                            mov     ebx,8[ebp]\par
0012H: 66|8B 55 0C                         mov     dx,12[ebp]\par
0016H: 66|89 13                            mov     0[ebx],dx\par
0019H: 8B E5                               mov     esp,ebp\par
001BH: 5D                                  pop     ebp\par
001CH: C2 08 00                            ret     8\par
\par
PROCEDURE Init\par
001FH: 55                                  push    ebp\par
0020H: 8B EC                               mov     ebp,esp\par
0022H: 6A 01                               push    1\par
0024H: 8D 1D F6 FF FF FF                   lea     ebx,[-10]\par
002AH: 53                                  push    ebx\par
002BH: E8 DC FF FF FF                      call    -36  (0000000CH)\par
0030H: 6A 02                               push    2\par
0032H: 8D 1D F8 FF FF FF                   lea     ebx,[-8]\par
0038H: 53                                  push    ebx\par
0039H: E8 CE FF FF FF                      call    -50  (0000000CH)\par
003EH: 6A 03                               push    3\par
0040H: 8D 1D FA FF FF FF                   lea     ebx,[-6]\par
0046H: 53                                  push    ebx\par
0047H: E8 C0 FF FF FF                      call    -64  (0000000CH)\par
004CH: 6A 04                               push    4\par
004EH: 8D 1D FC FF FF FF                   lea     ebx,[-4]\par
0054H: 53                                  push    ebx\par
0055H: E8 B2 FF FF FF                      call    -78  (0000000CH)\par
005AH: 6A 05                               push    5\par
005CH: 8D 1D FE FF FF FF                   lea     ebx,[-2]\par
0062H: 53                                  push    ebx\par
0063H: E8 A4 FF FF FF                      call    -92  (0000000CH)\par
0068H: 8B E5                               mov     esp,ebp\par
006AH: 5D                                  pop     ebp\par
006BH: C3                                  ret\par
\par
\par
\par
2008/2/12 Oleg N. Cher <allot{([at]})ukr.net>:\par
> Dear Rene,\par
>\par
> Current problem I intend to decide by\par
> WinApi FindResource, LoadResource & LockResource.\par
> And link resource file to executable by\par
> DevLinker.Link\par
> bolder.exe := Bolder$ ... 1 bolder.res ~\par
>\par
> And to work with data by SYSTEM.GET(addr, byte)\par
>\par
> But I am interested in BlackBox not only for\par
> the decision of current problems, but also look at it\par
> as to an instrument for the decision of different\par
> of long time problems. And I would be pleasant\par
> to know that needed to me things in Component Pascal\par
> are herein present.\par
>\par
> It can appear that Component Pascal is not quite suitable\par
> (why to use files and resources wherein it is possible\par
> to treat only one simple by a constant array?) And I\par
> will use C++ ...\par
>\par
> ======= 2008-02-12, 17:43:37 \'c2\'fb \'ef\'e8\'f1\'e0\'eb\'e8: =======\par
>\par
> >Why do you have need of a constant array? Why not,\par
> >for instance, put the values in a file and create\par
> >an open array variable from it? What is the benefit?\par
>\par
>\par
> Oleg N. Cher,\par
> Colossoft Research.\par
> allot{([at]})nowhere.xy> 2008-02-13\par
>\par
>\par
\par
\par
\par
-- \par
-- \par
Aubrey McIntosh, Ph.D.\par
1502 Devon Circle\par
Austin TX 78723-1814\par
http://home.grandecom.net/~amcintosh/aubrey/Search/}}nu.&I8}|ׯ{
Received on Wed Feb 13 2008 - 03:36:32 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:31:03 UTC