Jump to content
IGNORED

Effectus suggestions and bug reports


Recommended Posts

MEMO: core.pas, room for refactor, ReplaceKey approach.

 

       if procName = 'PRINT' then begin
         temp := '  Write(' + params2 + ');';
         code.Add(temp);
       end
       else if procName = 'PRINTE' then begin
         //writeln('params[0] = ', Trim(params[0]), '*');
         if (params[0] = '""') or (UpperCase(params[0]) = 'PRINTE()') then begin
           //writeln('2.) params[0] = ', params[0], '**');
           params2 := QuotedStr('');
         end;
         temp := '  Writeln(' + params2 + ');';
         code.Add(temp);
       end
       else if procName = 'PRINTB' then begin
         temp := '  Write(' + params2 + ');';
         code.Add(temp);
       end
       else if procName = 'PRINTBE' then begin
         temp := '  Writeln(' + params2 + ');';
         code.Add(temp);
       end
       else if procName = 'PRINTI' then begin
         temp := '  Write(' + params2 + ');';
         code.Add(temp);
       end
       else if procName = 'PRINTIE' then begin
         temp := '  Writeln(' + params2 + ');';
         code.Add(temp);
       end
       else if procName = 'PRINTC' then begin
         temp := '  Write(' + params2 + ');';
         code.Add(temp);
       end
       else if procName = 'PRINTCE' then begin
         temp := '  Writeln(' + params2 + ');';
         code.Add(temp);
       end
       else if procName = 'PUTE' then begin
         temp := '  Writeln(' + QuotedStr(params2) + ');';
         code.Add(temp);
       end
       else if procName = 'GRAPHICS' then begin
         temp := '';

 

Edited by zbyti
Link to comment
Share on other sites

  _MP_DEVICE_SYSUTILS: array [0..8] of string =
       ('OPEN','CLOSE','PUTD','PRINTD','PRINTBD','PRINTCD','PRINTID',
       'GETD','INPUTSD');
  _MP_STICK: array [0..3] of string =
       ('STICK','STRIG','PADDLE','PTRIG');
  _MP_GRAPHICS: array [0..4] of string =
       ('GRAPHICS','PLOT','DRAWTO','COLOR','FILL');
  _MP_SYSUTILS: array [0..5] of string =
       ('STRB','STRC','STRI','VALB','VALC','VALI');

        if IsArrayElementInString(_MP_DEVICE_SYSUTILS, tempxy.strings[i]) then
           begin
             devicePtr.isDevice := true;
             devicePtr.isSySutils := true;
           end;
        if IsArrayElementInString(_MP_STICK, tempxy.strings[i]) then
             devicePtr.isStick := true;
        if IsArrayElementInString(_MP_GRAPHICS, tempxy.strings[i]) then
             devicePtr.isGraphics := true;
        if IsArrayElementInString(_MP_SYSUTILS, tempxy.strings[i]) then
             devicePtr.isSySutils := true;

Because tempxy.strings contains whole source: Pos('Put', source) > 0 will be true for _MP_DEVICE_SYSUTILS etc.

We need better solution.

 

It's not true :D

 

I don't know :P 

 

We need better solution :D

Edited by zbyti
We need better solution
  • Like 1
Link to comment
Share on other sites

and what are the advantages of this additional new command?
- less memory ??
- faster execution ??

 

does the effort make sense?

there is nothing more important and effectus
to make it more effective?
there are so many other vulnerabilities.

 

i don't see the meaning of it.

 

 

how can you save a Data.bin from a specific address and load it again?

Edited by funkheld
  • Confused 1
Link to comment
Share on other sites

???

Funkheld... I don't see the meaning of nonsense you are talking about. The above code shows a standard command of Action! language library. The purpose of Effectus is simulating Action! as close as possible. And if you feel something is missing, go get a copy of Effectus source code and add missing features and fix existing bugs, nobody stops you from doing it.

 

  • Like 1
Link to comment
Share on other sites

22 hours ago, zbyti said:

@Gury Please make a 'dev' branch because throwing changes to the 'master' is not a good idea ;)

Hi, do you mean dev branch on my repo?

I am aware of the risk to merge directly on master, but I always re-think twice before I commit changes :) Luckily, GitHub automatically generates new commits on any changes, so all can be reviewed what changes were merged vs previous versions.

 

Link to comment
Share on other sites

OK, as You wish ;)

 

----------

 

@Gury for some strange reasons, I came to the conclusion that POS is case insensitive and looks for substrings too, I was wrong :D

program Playground;

uses SySutils;

const
  _MP_DEVICE_SYSUTILS: array [0..8] of string =
       ('OPEN','CLOSE','PUTD','PRINTD','PRINTBD','PRINTCD','PRINTID',
       'GETD','INPUTSD');

function IsArrayElementInString(seek : array of string; str : string) : boolean;
var
  i : integer;
begin
  Result := false;
  for i := Low(seek) to High(seek) do begin
    if Pos(seek[i], str) > 0 then begin
      Result := true;
      break;
    end
  end;
end;

begin
	Writeln(IsArrayElementInString(_MP_DEVICE_SYSUTILS,'PRINTBD'));
	Writeln(IsArrayElementInString(_MP_DEVICE_SYSUTILS,'PrintBD'));
	Writeln(IsArrayElementInString(_MP_DEVICE_SYSUTILS,'printbd'));
	Writeln(IsArrayElementInString(_MP_DEVICE_SYSUTILS,'PRINT'));
end.

; output
TRUE
FALSE
FALSE
FALSE

 

But I swear I had a issue with substrings:

         // doubled delimiter - to be sure ;)
         temp := ',' + procName + ',';

         // RAND, PEEK, PEEKC, VALB, VALC, VALI, GETD, INPUTBD, INPUTCD, INPUTID
         temp01 := '  ' + funcVar + ' := ' + _MARKER + '(' + params2 + ');';
         // INPUTB, INPUTC, INPUTI
         temp02 := '  ' + _MARKER + '(' + funcVar + ');';
         // STICK, STRIG, PADDLE, PTRIG
         temp03 := '  ' + funcVar + ' := ' + _MARKER + '[' + params2 + '];';
         // ReplaceKey function works on _REPLACMENT array
         temp04 := ReplaceKey(_MARKER, procName);

         if Pos(temp, ',RAND,PEEK,PEEKC,VALB,VALC,VALI,GETD,INPUTBD,INPUTCD,INPUTID,') > 0 then
           temp01 := ReplaceStr(temp01, _MARKER, temp04)
         else if Pos(temp, ',INPUTB,INPUTC,INPUTI,') > 0 then
           temp02 := ReplaceStr(temp02, _MARKER, temp04)
         else if Pos(temp, ',STICK,STRIG,PADDLE,PTRIG,') > 0 then
           temp03 := ReplaceStr(temp03, _MARKER, temp04);

and added doubled delimiter instead of space... :D :D :D I recheck this later ;)

-------------------

 

I have internet failure since yesterday, so I'll take advantage of the summer weather :D

Edited by zbyti
summer
Link to comment
Share on other sites

substrings, ok I get it why previous code (ElementInString) give BINGO :] 

program Playground;

uses SySutils;

begin
	if Pos('GET', 'RAND PEEK PEEKC VALB VALC VALI GETD INPUTBD INPUTCD INPUTID') > 0 then
		writeln('bingo') else writeln('miss');
	if Pos('GETD', 'RAND PEEK PEEKC VALB VALC VALI GETD INPUTBD INPUTCD INPUTID') > 0 then
		writeln('bingo') else writeln('miss');
	if Pos('getd', 'RAND PEEK PEEKC VALB VALC VALI GETD INPUTBD INPUTCD INPUTID') > 0 then
		writeln('bingo') else writeln('miss');
	if Pos('INPUT', 'RAND PEEK PEEKC VALB VALC VALI GETD INPUTBD INPUTCD INPUTID') > 0 then
		writeln('bingo') else writeln('miss');
	
	writeln('---->with delimiter<----');
	
	if Pos(',GET,', ',RAND,PEEK,PEEKC,VALB,VALC,VALI,GETD,INPUTBD,INPUTCD,INPUTID,') > 0 then
		writeln('bingo') else writeln('miss');
	if Pos(',GETd,', ',RAND,PEEK,PEEKC,VALB,VALC,VALI,GETD,INPUTBD,INPUTCD,INPUTID,') > 0 then
		writeln('bingo') else writeln('miss');
	if Pos(',GETD,', ',RAND,PEEK,PEEKC,VALB,VALC,VALI,GETD,INPUTBD,INPUTCD,INPUTID,') > 0 then
		writeln('bingo') else writeln('miss');			                      
end.

; output
bingo
bingo
miss
bingo
---->with delimiter<----
miss
miss
bingo

 

Edited by zbyti
bingo
Link to comment
Share on other sites

@Gury I think what UpperCase(str) is in too many places in the code, if we key words and proc/func replace with upper case during reading Action! source then we can drop this change in other places, what do you think? Or it's time to use regular expressions? ;)

Edited by zbyti
regexp
Link to comment
Share on other sites

Sunny day is over, we are near desk again :)

 

I agree with you completely, zbyti. It would be better to make all commands uppercase during reading source data. Then there no extra checking would be needed. Sometimes I just missed such thing and errors emerged.

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...