Board index » delphi » Memory problem (I think), A little help?

Memory problem (I think), A little help?

Greetings all. I haven't posted to either of these groups in eons, but
am now posting because a program that I'm writing has encountered the
same bug/glitch that it encountered in the last version.

Last time I decided to avoid the bug by rewriting the program around
it, this time that isn't an option.

The bug is simple; in running an On-The-Fly menu function I can only
select an item once or twice before the program stops taking string
input. Last time I rewrote to use user input character menus, this
time I can't. The person for whom I am writing insists that I fix the
bug, citing that this time I have several months to iron out the bugs
instead of the week and a half he gave me last time.

The program is supposed to automate running an auction, and will, when
it is completed, support customization. For now, I can't continue to
write until I fix the menu problem, and the customization routines
that are needed for the one procedure that I've written are included
in the code as constants.

I think that the problem is memory related, but haven't been able to
fix it even by setting the memory requirements (minimums and stack
sizes) to almost not run on my P120.

Attached is a WinZipped version of the code as well as the one unit
that is external to Pascal but used. If anybody could take a run over
it and suggest how to fix it then I'd be grateful. Because people
don't like to download binaries before knowing what they're for it'll
be in a reply to this message that I'm about to send.

And sorry about the binary, but there is no way to guarantee that you
people will get the files you need if I were to post them on my
webpage. The program CANNOT run without the extra unit, since it
includes commands that were written in assembly and I can't duplicate.

Thanks in advance.

-RK :T
r-k-r-o-l...@-i-s-t-a-r-.-c-a

Spammers will be prosecuted to the full extent of
international law.

 

Re:Memory problem (I think), A little help?


Unzipped the files total 30K of disk space.
-RK :T
r-k-r-o-l...@-i-s-t-a-r-.-c-a

Spammers will be prosecuted to the full extent of
international law.

Re:Memory problem (I think), A little help?


Quote
Rob Kroll wrote:
> The bug is simple; in running an On-The-Fly menu function I can only
> select an item once or twice before the program stops taking string
> input. Last time I rewrote to use user input character menus, this
> time I can't. The person for whom I am writing insists that I fix the
> bug, citing that this time I have several months to iron out the bugs
> instead of the week and a half he gave me last time.

Before writing programs for others you should learn a bit more Pascal!
Have you heard of "case"?
You use
if ord(ink)=72 then ...
else if ord(ink)=75 then
else if ord(ink)=80 then
...

Use instead:
case ord(ink) of
72: begin ... end;
75: begin ... end;
80: begin ... end;
end;

And what about "Window" or a loop?
You use:
gotoxy(25,5); Write(...);
gotoxy(25,6); Write(...);
...

Use Window(25,1,80,25); and WriteLn(...)! or (better) completely rewrite
your program!

Quote
> I think that the problem is memory related, but haven't been able to
> fix it even by setting the memory requirements (minimums and stack
> sizes) to almost not run on my P120.

I don't think it's a memory problem since your program does NOT need
much memory. Your menu simply doesn't work.

Quote
> Attached is a WinZipped version of the code as well as the one unit

Why don't you just post the part of the program you are having problems
with? Then you don't have to zip it!

Quote
> The program CANNOT run without the extra unit, since it includes
> commands that were written in assembly and I can't duplicate.

The unit is not needed for your program because it just turns on and off
the cursor (I suppose). I didn't try it because I never execute binaries
posted into NGs. procedure ShowCursor could do anything!

If you are interested you can get a dialog-unit from me. There you can
simply add fields for input and get a menu that way. This unit is less
powerful than Turbo Vision but very very simple to use. It has mouse
support. Remove Y for private reply.

Wolf

Re:Memory problem (I think), A little help?


Wolf Behrenhoff skrev i meddelandet <37700078.A1972...@gmxY.net>...

Quote
>Before writing programs for others you should learn a bit more Pascal!

Why these hard words? (not just the one above, I mean your whole mail)
I think it was a verry polite and well formulated question.

And I promise you if someone asked me to make them a program, and I did know
how to do it and had the time (or was well paid :-)) I wouldnt hesitate a
second.
My problem is just that verry few people want to pay for someone to create
hello world programs :-)

Quote
>Use instead:
>case ord(ink) of
>72: begin ... end;
>75: begin ... end;
>80: begin ... end;
>end;

Tha was a nice helping but why al the barking?

Quote
>or (better) completely rewrite your program!

Did you wake up on the bad side of earth today?

Quote
>Your menu simply doesn't work.

Verry informative

Quote
>If you are interested you can get a dialog-unit from me. There you can
>simply add fields for input and get a menu that way. This unit is less
>powerful than Turbo Vision but very very simple to use. It has mouse
>support. Remove Y for private reply.

Now you ar beeing nice again... are you scitzofrenic :-)

Tim

Re:Memory problem (I think), A little help?


On Tue, 22 Jun 1999 23:30:32 +0200, Wolf Behrenhoff

Quote
<wolf.behrenh...@gmxY.net> wrote:
>Before writing programs for others you should learn a bit more Pascal!
>Have you heard of "case"?

And before you reply to this I would advise you to learn a bit more
about life and people. Have you ever heard of "social etiquette"?

Quote
>Use instead:
>case ord(ink) of
>72: begin ... end;
>75: begin ... end;
>80: begin ... end;
>end;

If that had worked in the first place I would have, but it didn't.

Quote
>And what about "Window" or a loop?
>You use:
>gotoxy(25,5); Write(...);
>gotoxy(25,6); Write(...);
>...

Nope. Doesn't quite work that way because of the customization that
will eventually be put in.

Quote
>I don't think it's a memory problem since your program does NOT need
>much memory. Your menu simply doesn't work.

Well duh! That's the whole point of the message friend. I'm still
struggling with the menu, and need to get it worked. I have write
arounds, but because I have the time I'm trying to get the menu to
work.

Quote
>> The program CANNOT run without the extra unit, since it includes
>> commands that were written in assembly and I can't duplicate.

>The unit is not needed for your program because it just turns on and off
>the cursor (I suppose). I didn't try it because I never execute binaries
>posted into NGs. procedure ShowCursor could do anything!

You clearly don't notice too much then. In the code there are 7
commands that simply do not exist in Pascal or as functions/procedures
in the code. When the program is completed there will be more. All of
them appear in the library.

Quote

>If you are interested you can get a dialog-unit from me. There you can
>simply add fields for input and get a menu that way. This unit is less
>powerful than Turbo Vision but very very simple to use. It has mouse
>support. Remove Y for private reply.

If I was interested in somebody else's libraries then I would have
used the SWAG archives, of which I have all on my computer. My own
unit works fine, has mouse support, and until I wrote this program had
a working on-the-fly menu routine.
-RK :T
r-k-r-o-l...@-i-s-t-a-r-.-c-a

Spammers will be prosecuted to the full extent of
international law.

Re:Memory problem (I think), A little help?


Quote
Rob Kroll wrote:
> On Tue, 22 Jun 1999 23:30:32 +0200, Wolf Behrenhoff
> <wolf.behrenh...@gmxY.net> wrote:

> >Before writing programs for others you should learn a bit more Pascal!
> >Have you heard of "case"?

> And before you reply to this I would advise you to learn a bit more
> about life and people. Have you ever heard of "social etiquette"?

Yes but on Tuesday I had a non-social day. Sorry.

Quote
> > [Advice to use case]
> If that had worked in the first place I would have, but it didn't.

If there are many places with 99% the same text in your source then
something can be done in an easyer way. So either try to use procedures
or loops.

Quote
> >> The program CANNOT run without the extra unit, since it includes
> >> commands that were written in assembly and I can't duplicate.

> >The unit is not needed for your program because it just turns on and off
> >the cursor (I suppose). I didn't try it because I never execute binaries
> >posted into NGs. procedure ShowCursor could do anything!

> You clearly don't notice too much then. In the code there are 7
> commands that simply do not exist in Pascal or as functions/procedures
> in the code. When the program is completed there will be more. All of
> them appear in the library.

Why do you need these functions?
OK: Show and HideCoursor -> Looks better, but not needed
Not OK: GetString -> Why do you have to read a string directly from the
screen - you highlight the menu. But that cannot be good. Try to use an
array and don't read directly from the screen: What if the string
doesn't fit on the screen: are the remaining chars truncated? (That
can't happen in your program but it is a general advice)

And now: The solution to your menu-problem is very simple:
Replace all: read -> readln
and it works fine.

Never use read in your programs. If you want a complete string or numer
then you should use Readln. Otherwise use Crt.ReadKey and try to write
an own "My_Read".

Hope this helps and sorry for my first posting.
The criticism to your program should be constructive (I hope).

Wolf

Re:Memory problem (I think), A little help?


In article <3773BB06.F8496...@gmxY.net>,
  Wolf Behrenhoff <wolf.behrenh...@gmxY.net> wrote:

Quote

> Yes but on Tuesday I had a non-social day. Sorry.

That's alright, we all have not so great days. I was a little tired and
impatient when I replied and probably shouldn't have said what I did.

Quote
> And now: The solution to your menu-problem is very simple:
> Replace all: read -> readln
> and it works fine.

> Never use read in your programs. If you want a complete string or
numer
> then you should use Readln. Otherwise use Crt.ReadKey and try to write
> an own "My_Read".

> Hope this helps and sorry for my first posting.
> The criticism to your program should be constructive (I hope).

Thank you for your help, I'll be sure to test it when first I can.
--

-RK :T

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Other Threads