English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 25 September 2019, 03:59   #1
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 208
[blitz] how to get names from ASL FileRequester (multiselect) using system functions?

Hi,
from FileRequester struct:
Code:
 struct WBArg *fr_ArgList;	      /* List of files selected	    */
and WBArg struct:
Code:
    {
        BPTR      wa_Lock;    /* a lock descriptor */
        BYTE *    wa_Name;    /* a string relative to that lock */
    };
How to get "wa_Name" as a string?
Everything I do gives me "...mismatched type.." error.

Thanks
peceha is offline  
Old 25 September 2019, 11:16   #2
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 4,352
I take it you're using Blitz 2 and not Amiblitz 3, yeah? AB3 has includes that neatly take care of all of this for you. If you're using Blitz 2 though, have a look at the AB3 ASL include anyway.

Ordinarily, string pointers can simple be PEEKed:

result$ = Peek.s(myStringPointer.l)

But in this case the string is represented by a byte, which clearly isn't a string pointer... I guess it's a relative offset that is understood by C compilers but not by Blitz, because C examples seem to simply treat it like a string.

Anyway, looking at the AB3 version, it appears to obtain the string pointers by PEEKing at the required locations as offsets from the *fr_ArgList pointer, rather than using the WBArg struct. It's a little ugly, but I've used the AB3 include in the past and it works well so I would expect it to work under Blitz 2 as well. The action part is:

*nextarg.l=Peek.l(*file_requ\fr_ArgList+(8*i)+4)

Bear in mind you'll also need all the previous supporting code to build up the file_requ struct content.
Daedalus is offline  
Old 25 September 2019, 11:38   #3
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 208

I spent so many time on this and couldn't proceed...
Thanks!!!

Yes, I'm using BB2, and I already have the code (i've been using just single file selection all the time because I couldn't find out how to read these names)
peceha is offline  
Old 25 September 2019, 16:44   #4
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 208
I took a look at the code you linked because I'm still experiencing some problems.

When #ASLFR_DOMultiSelect=True I can select more than one file but *fr\fr_NumArgs doesn't keep the number of selected files

But looking at their code mine looks just fine ...

Code:
DEFTYPE.Screen        *scr
DEFTYPE.FileRequester *fr
DEFTYPE.IntuitionBase *ibase
DEFTYPE.l             suc,lock
DEFTYPE.EasyStruct    es

Dim tags.TagItem(20)


*ibase=IntuitionBase
lock=LockIBase_(0)
*scr=*ibase\FirstScreen
While *scr
  If (*scr\Flags)&#SCREENTYPE=#WBENCHSCREEN
    Pop While:Goto jump_00
  EndIf
  *scr=*scr\NextScreen
Wend
End
jump_00:
UnlockIBase_(lock)



es_gad$           ="again|QUIT"
es\es_StructSize  =0
es\es_Flags       =0
es\es_GadgetFormat=&es_gad$


n.b=0
tags(n)\ti_Tag=#ASLFR_Screen         ,*scr             :n+1
tags(n)\ti_Tag=#ASLFR_InitialWidth   ,*scr\Width/2     :n+1
tags(n)\ti_Tag=#ASLFR_InitialHeight  ,*scr\Height/2    :n+1
tags(n)\ti_Tag=#ASLFR_InitialLeftEdge,0                :n+1
tags(n)\ti_Tag=#ASLFR_InitialTopEdge ,*scr\BarHeight+1 :n+1
tags(n)\ti_Tag=#ASLFR_RejectIcons    ,True             :n+1
tags(n)\ti_Tag=#ASLFR_DoMultiSelect  ,True             :n+1
tags(n)\ti_Tag=#TAG_DONE             ,False
*fr=AllocAslRequest_(#ASL_FileRequest,&tags(0))

tags(0)\ti_Tag=#TAG_DONE,False

Repeat
  If AslRequest_(*fr,0)
    txt$=UStr$(*fr\fr_NumArgs)
    es\es_TextFormat=&txt$
    suc=EasyRequestArgs_(0,&es,0,0)
    If suc=0
      Pop Repeat:End
    EndIf
  Else
    Pop Repeat:End
  EndIf
Forever

Last edited by peceha; 25 September 2019 at 16:51.
peceha is offline  
Old 25 September 2019, 16:55   #5
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 4,352
Hmmm, it does look ok, so I don't really know what's going on. I wonder if it's the difference between your *fr Newtype and the _TK version that AB3 uses?
Daedalus is offline  
Old 25 September 2019, 17:05   #6
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 208
I use amigalibs.res - do not remember where it comes from.
---EDIT----
would be nice if someone could run that code and report the result.
Assuming his/her amigalibs.res comes from different source and he/she gets correct results then mine is broken
------------------------------

Some observations:
DoMultiSelect=True
- \fr_NumArgs is just one huge number
- Peek$(Peek.l(*fr\fr_ArgList+(8*i)+4)) - is empty
- \fr_File keeps the name of the first file - don't know if this is correct

DoMultiSelect=False
- *fr\fr_NumArgs shows 0
- \fr_File keeps the name of selected file - so that works

Last edited by peceha; 25 September 2019 at 17:11.
peceha is offline  
Old 25 September 2019, 17:44   #7
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 4,352
Yeah, that sounds like mismatched pointers. It's possible that there's an error in amigalibs.res and the _TK version fixes that in AB3...

I probably won't have time to get near Blitz for the next while so I can't try it out unfortunately... but if I get a chance I'll let you know.
Daedalus is offline  
Old 25 September 2019, 17:59   #8
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 208
Quote:
Originally Posted by Daedalus View Post
.. that sounds like mismatched pointers...
You are right.
I just found something called amigalibsII.res
Now it works - I get exactly the number of selected files only...
some new types have slightly different names (.Screen became ._Screen)

Is there a way to manually edit (fix) such *.res file?
peceha is offline  
Old 25 September 2019, 18:29   #9
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 4,352
You can probably use the .res file from the AB3 distribution. AB3 contains the source of some of the resident files, but not of amigalibs.res unfortunately. The all.res file should contain everything that amigalibs does and more, and the source of that (in AB3 format) is available so you could use that as a starting point and edit it if it's also wrong in there.
Daedalus is offline  
Old 25 September 2019, 18:49   #10
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 208
All.res crashes my amiga when used with BB2. But once it gave me only yellow guru so I was able to se the result of above test program - unfortunately it was wrong.

I'll try to find AB3 source (as you said) of that all.res file and will just take out FileRequester and see what I can do with it.

Thanks
peceha is offline  
Old 25 September 2019, 18:59   #11
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 4,352
Hmmm, I guess it's been recompiled with AB3 and its FPU requirements then - shame.
Daedalus is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening system libraries in Blitz. peceha Coders. Blitz Basic 3 21 August 2018 13:10
FileRequester Replacements emufan support.Apps 19 23 November 2016 00:21
Arcadia Multiselect Roms ma693541 request.Old Rare Games 11 30 September 2015 21:12
Matching device names with volume names. Thorham Coders. System 2 27 July 2015 13:20
AWeb can't open asl.library carloratm support.Apps 11 03 June 2014 09:04

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:08.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.07451 seconds with 13 queries