Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
46 user(s) are online (24 user(s) are browsing Forums)

Members: 0
Guests: 46

more...

Headlines

 
  Register To Post  

« 1 ... 3 4 5 (6)
Re: wb2filer v0.8
Home away from home
Home away from home


See User information
@Joerg
Thanks, fixed all, only keep current way of SNprintF (it's just easy to understand what it does by looking on more "self-explained" version). At least for me of course when i will look at later :)

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: wb2filer v0.8
Home away from home
Home away from home


See User information
@All
New version:

Quote:

-- code cleaning based on Joergs suggestions, thanks!
-- first os4depot release


Grab it from os4depot's upload query.

Then next few things about which i think which probably can be good to implement is:

1). Qualifier key which, once held, will allow running the same original WB window even when dbl-click on icons. This one probably needs to be configurable (so anyone can set a key he wants).

2) tooltype's support (so to be real true amiga app)

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: wb2filer v0.8
Just popping in
Just popping in


See User information
@kas1e

In the description of the OS4Depot archive, you should mention, that Filer is required and provide a link. Since this is not part of AmigaOS 4.

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 550 / AmigaOS 4.1 Final Edition / MorphOS 3.17
Amiga1200 / Blizzard 1230 IV PiStorm32-lite / AmigaOS 3.9
Go to top
Re: wb2filer v0.8
Home away from home
Home away from home


See User information
@Primax
Quote:

In the description of the OS4Depot archive, you should mention, that Filer is required and provide a link. Since this is not part of AmigaOS 4.


Isn't the first phrase in the README self-explained ?:) :

Quote:

WB2Filer is a hack which patch Intuition's functions via SetMethod() to allow transparently run of the Filer binary pointing to the given partition on Workbench's
Desktop instead of original Workbench windows.


The ones who didn't know what Filer is it and where to get it, probably have no needs in this hack as well.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: wb2filer v0.8
Quite a regular
Quite a regular


See User information
@kas1e

I've noticed a small issue. Haven't read the chat so maybe it has been mentioned before.

Wb2filer doesn't work correctly for Usb media with space in its name. For example when I try to open a USB msd with "No name" as volume name then I get a popup asking me to insert volume "No:"

Maybe some can also answer me a question about filer itself. What is the purpose of the SOURCE and DESTINATION. How do you use it as source or destination?

Go to top
Re: wb2filer v0.8
Home away from home
Home away from home


See User information
@geennaam
Quote:

Wb2filer doesn't work correctly for Usb media with space in its name. For example, when I try to open a USB msd with "No name" as volume name then I get a popup asking me to insert volume "No:"


That happens when i made parsing of "title" instead of other methods (as it more easy and fits better into everything): i simple search in the title for the first space and just replace it on ":" + nulltermination :) So spaces in names didn't parsed properly indeed.

Instead it should be done as Joerg says before:

Quote:

Search for the last '%' (to make volume names with a '%' in it work, there might be file systems which allow such volume names) in the title. If none found, goto end:
From the position of the last '%' go back one by one char until you find a space. If there is none, goto end:
If the char before the found space is not an additional space, goto end:
Volume name = Fist chars until, but excluding, the 2nd space found + ':'.


So now i update it to be like Joerg says:

.
    for(
int a=0lena++) 
    {
        if(
icon_name[a] == '%')
            for(
int b=0ab++)
                if(
icon_name[a-b] == '\x20')
                    if(
icon_name[a-b-1] == '\x20') {
                        
icon_name[a-b-1] = ':';
                        
icon_name[a-b] = '\x00';
                        
a=len;
                    }
    }


It seems to work fine with spaces now, but i not sure maybe this can be coded a bit better/faster.. With some inverted logic maybe, etc.

Quote:

Maybe some can also answer me a question about filer itself. What is the purpose of the SOURCE and DESTINATION. How do you use it as source or destination?


It for copy/move purposes only, so you need 2 at minimum (but can be more 3,4, etc.) different filers running, and you navigate between them to chose from which to which doing copy/move when need it (like Dopus5 in other words)


Edited by kas1e on 2023/12/20 14:58:48
Edited by kas1e on 2023/12/20 15:06:37
Edited by kas1e on 2023/12/20 15:07:38
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: wb2filer v0.8
Just can't stay away
Just can't stay away


See User information
@kas1e
You are searching for the first instead of the last '%', try something like
BOOL DRIVE FALSE;

for(
int32 a lenaa--)
{
   if(
'%' == icon_name[a]) for(int32 b a-1bb--)
   {
       if(
>= && ' ' == icon_name[b] && ' ' == icon_name[b-1])
       {
          
icon_name[b-1] = ':';
          
icon_name[b] = 0;
          
DRIVE TRUE;
          break;
       }
   }
   if (
DRIVE) break;
}
To reduce code size add "static inline" to all functions, except for _start().


Edited by joerg on 2023/12/20 18:49:19
Go to top
Re: wb2filer v0.8
Home away from home
Home away from home


See User information
@Joerg
Quote:

You are searching for the first instead of the last '%', try something like

Thanks, works well

Quote:

To reduce code size add "static inline" to all functions, except for _start().


Right, now it's 1kb less as well (through not only for _start() can't use static inline, but also for declaration of original functions to avoid warnings "warning: variable ‘Original_OpenWindowTagList’ declared ‘inline’", etc).

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: wb2filer v0.8
Home away from home
Home away from home


See User information
@All
New version:

Quote:

-- better parsing of the titles to handle spaces

-- better parsing of the Filer's path, which also may contain spaces

-- Added "static inline" in front of all functions (except _start and original functions) to reduce size of the binary even more.

Thanks joerg for all the points about!


There is: https://kas1e.mikendezign.com/aos4/wb2filer/WB2Filer_v10.lha

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: wb2filer v0.8
Just can't stay away
Just can't stay away


See User information
@kas1e
You can remove
if (!strstr_OS4(nw->Title,"  ") && !strstr_OS4(nw->Title,",") && !strstr_OS4(nw->Title,"%")) goto end;
The for (int32 a...) for(int32 b...) loop does the same, except for not checking for a ',' char.

if (!icon_name || !icon_name[0] || icon_name[IUtility->Strlen(icon_name)-1] != ':') goto end;
can be replaced by
if (!DRIVE) goto end;

If you want small code compile with -Os instead of -O3.

Go to top
Re: wb2filer v0.8
Quite a regular
Quite a regular


See User information
@kas1e
Additionally to what Joerg said:

- You're modifying nw-Title and not restoring it, this will likely break window title. The char *icon_name = nw->Title; line does not copy the string only sets a pointer to it, so writing through the pointer modifies the original string. I think what you want is calculate the length of the name in the title you want to copy then allocate enough space for filer command + quotes + spaces + dir name + colon + terminating '\0' and then copy the name from nw->Title to that allocated space and add the colon there leaving nw->Title unmodified. You'd need to constuct the first part up to the opening " with SNPrintf, then copy the title there (either with strncpy or with a loop if using strncpy is not allowed) then finish adding colon, quote and terminating '\0'.

- The if (DRIVE) break; line in the loop will never be true because you break from the loop after setting DRIVE to TRUE so this can only be reached with DRIVE=FALSE and therefore not needed. (Better call DRIVE as is_drive or similar as all caps names are usually used for macros by convenrion.)

- If you have strchr then strstr_OS4 may not be needed because two of those (!strstr_OS4(nw->Title,",") && !strstr_OS4(nw->Title,"%")) are just strchr(nw->Title. ','); strstr_OS4(Caller->tc_Node.ln_Name,"AsyncWB - textinput") is looking for the string at the beginning so it could use IUtility->Strnicmp instead and the only pleace really looking for substring is !strstr_OS4(nw->Title," ") but that's easy to replace with a for loop calling strchr(ptr, ' ') then check if next char is also ' ' so then the whole strstr_OS4 implementation can be dropped. I think Joerg said that simple str funcs are OK to use but if not strchr is just a loop comparing chars so simpler than strstr. (Actually you already have a loop looking for two spaces in looking for icon_name so maybe that strstr is als not needed. Also the loop looking for last '%' could be strrchr if that's OK to use or there's an AmigaOS native replacement.)

- In init() when opening a library that's not the first one fails you should close already opened libtaties so can't just return FALSE. Instead move init to after deinit, change deinit to return FALSE then call return deinit() on failure in init() so already opened libraries are cleaned up correctly. Why are you opening DOS.library separately in _start instead of calling init and if you do so why are you opening it again in init?

Go to top
Re: wb2filer v0.8
Just can't stay away
Just can't stay away


See User information
@balaton
Quote:
(either with strncpy or with a loop if using strncpy is not allowed)
He doesn't want to use C library functions to get smaller and faster executables (no main() with argv[] parsing, no C library stdio setup, no malloc setup, etc.).
AmigaOS doesn't include a strncpy() function outside of the C library, but it has a strlcpy() (IUtility->Strlcpy()).

Quote:
The if (DRIVE) break; line in the loop will never be true because you break from the loop after setting DRIVE to TRUE so this can only be reached with DRIVE=FALSE and therefore not needed.
It's not required, just some speed up: It's for breaking the outer for(a...) loop as well. Instead you could set a to 1 after DRIVE=TRUE in the inner for(b...) loop.

Quote:
(Better call DRIVE as is_drive or similar as all caps names are usually used for macros by convenrion.)
In AmigaOS code all caps names are often used for BOOL variables as well.

Quote:
Why are you opening DOS.library separately in _start instead of calling init
For example for the
IDOS->Printf("can't init()\n");
but that's not required anyway: all libraries opened in init() are kickstart libraries which can't fail to open. If any of them couldn't be opened loading the wb2filer executable wouldn't be possible either...

Go to top
Re: wb2filer v0.8
Home away from home
Home away from home


See User information
@balaton
Quote:

You're modifying nw-Title and not restoring it, this will likely break window title.


But then we modified there a null terminated title, which modified only if it DISK, which title we use in Filer only as the one we construct , and while it null-terminated it should be ok ?

All the other opening of the same window, will do another openwindowtaglist() and if it filer again : then it ok to modify it, and not, then it will not go till that part.

The only problem probably, is that OS's code later free things, and Title can be less of size as original which can cause issues if cleaning code not good enough.

Or i miss some more issues with modified title like this ?


Quote:

Why are you opening DOS.library separately in _start instead of calling init

As joerg says that for making IDOS->Printf works, because i can't IDOS->Printf if it wasn't opened, which will cause a crash if by some reasons it can't be opened.

Quote:

but that's not required anyway: all libraries opened in init() are kickstart libraries which can't fail to open. If any of them couldn't be opened loading the wb2filer executable wouldn't be possible either...


Just more error check IMHO never hurt …

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: wb2filer v0.8
Quite a regular
Quite a regular


See User information
@joerg
Quote:

Quote:
The if (DRIVE) break; line in the loop will never be true because you break from the loop after setting DRIVE to TRUE so this can only be reached with DRIVE=FALSE and therefore not needed.
It's not required, just some speed up: It's for breaking the outer for(a...) loop as well. Instead you could set a to 1 after DRIVE=TRUE in the inner for(b...) loop.

Oh, there's an inner loop. I've missed that due to unusual indenting so maybe at least it should be indented better or maybe it's even better to do in two steps to make it more obvious: First find last '%', then in another loop find space backwards and check if it's preceeded by another space. You can define your own strrchr like function for that that also takes an additional parameter for where to start searching from then you could do:
static char *strrchrfrom(char *sint cint f)
{
  
char *p;
  for (
f>= sp--)
    if (*
== c) return p;
  return 
NULL;
}

// Find last '%'
char *strrchrfrom(nw->Title'%'len);
if (!
p) goto end;
// Look for "  " before last '%' and terminate string there if found
while (>= nw->Title) {
  
strrchrfrom(nw->Title' 'nw->Title);
  if (!
|| nw->Title 2) goto end;
  if (*--
== ' ') {
    
p[0] = ':';
    
p[1] = '\0';
    break;
  }
}

or something like that. And you can also then drop strstr_OS4 function. (Edit: Fixed return value in strrchrfrom function.)


Edited by balaton on 2023/12/22 19:33:08
Go to top
Re: wb2filer v0.8
Quite a regular
Quite a regular


See User information
@kas1e
Quote:
But then we modified there a null terminated title, which modified only if it DISK, which title we use in Filer only as the one we construct , and while it null-terminated it should be ok ?
...
The only problem probably, is that OS's code later free things, and Title can be less of size as original which can cause issues if cleaning code not good enough.

NULL termination does not matter here, the free function should consider allocated size and does not care what the memory contains so truncating string should not break that. If this is only done when calling filer command instead of using window title then it's OK I just did not follow that part.

Quote:
As joerg says that for making IDOS->Printf works, because i can't IDOS->Printf if it wasn't opened, which will cause a crash if by some reasons it can't be opened.
...
Just more error check IMHO never hurt …

But if these can't fail as these libs should always be resident or available then you don't need to check for them. If you check them then try to clean up properly.

Go to top
Re: wb2filer v0.8
Quite a regular
Quite a regular


See User information
@joerg
Quote:
AmigaOS doesn't include a strncpy() function outside of the C library, but it has a strlcpy() (IUtility->Strlcpy()).

That's not needed any more if we can modify the nw->Title directly. What would be needed to drop strstr_OS4 is replacement for strncmp at the only place it's used to compare caller name to "AsyncWB - textinput". Or maybe IUtility->Stricmp could be used with adding the missing part of the name if that's always the same. (Or do it in a loop or define own strncmp. If it does not have to find substring inside string just compare first n chars then it could be simpler than strstr.)

Go to top
Re: wb2filer v0.8
Just can't stay away
Just can't stay away


See User information
@balaton
For comparing strings AmigaOS has IUtility->Stricmp(), Strnicmp(), UTF8Stricmp() and UTF8Strnicmp(). Additionally a country collation specific locale.library function ILocale->StrnCmp().

Go to top

  Register To Post
« 1 ... 3 4 5 (6)

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project