Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
85 user(s) are online (60 user(s) are browsing Forums)

Members: 0
Guests: 85

more...

Headlines

Forum Index


Board index » All Posts (thomas)




Re: ReadArgs()
Not too shy to talk
Not too shy to talk


@broadblues:

your code for CX_PRIORITY does not work. /N returns a pointer to a long, not a long.


@JosDuchIt:

here is a smaller example:

#include <proto/dos.h>

int main (void)

{
struct RDArgs *rdargs;
struct {
    
char *file;
    
char *pubscreen;
    
long *maxdepth;
    
long recursive;
    
char **modes;
    } 
args = {0};

rdargs ReadArgs ("FILE/A,PUBSCREEN/K,MAXDEPTH/N,RECURSIVE/S,MODES/M",(APTR)&args,NULL);

/*

/A -> required
/K -> keyword must be given
/N -> numeric
/S -> switch
/M -> multiple values

combinations like /A/N or /K/N or /A/K/N are allowed.

*/



if (!rdargs)    /* input does not match the template */
    
{
    
PrintFault (IoErr(),NULL);
    return (
RETURN_ERROR);
    }

Printf ("your arguments:\n");

Printf ("  file = %s\n",args.file);

if (
args.pubscreen/* optional argument */
    
Printf ("  pubscreen = %s\n",args.pubscreen);
else
    
Printf ("  no pubscreen given\n");

if (
args.maxdepth/* optional numeric argument */
    
Printf ("  maxdepth = %ld\n",*args.maxdepth);
else
    
Printf ("  no maxdepth given\n");

if (
args.recursive/* boolean argument */
    
Printf ("  recursive = Yes\n");
else
    
Printf ("  recursive = No\n");

if (
args.modes && *args.modes)
    {
    
char **tt;
    
long i 0;
    for (
tt args.modes; *tttt++)
        
Printf ("  mode %ld = %s\n",++i,*tt);
    }
else
    
Printf ("  no modes given\n");

FreeArgs (rdargs);
return (
RETURN_OK);
}


Less code for more clarity

Go to top


Re: Get WB params without using main() ?
Not too shy to talk
Not too shy to talk



Quote:
How could a program have a normal main() but not have access to the arguments or global variables?


I cannot imagine that too. But IMHO that's no reason to give an answer which has no relation to the question. Why didn't you simply ask him "how can that be"?

Go to top


Re: Get WB params without using main() ?
Not too shy to talk
Not too shy to talk


@colinw: you didn't even understand the problem, did you?

Go to top


Re: Get WB params without using main() ?
Not too shy to talk
Not too shy to talk



As you can see in the example code I've edited into my above post, the Workbech parameters are sent to your process' message port. The startup code fetches the message and stores it into argv and/or _WBStartup. If you don't have access to either, then it's lost.


Go to top


Re: Get WB params without using main() ?
Not too shy to talk
Not too shy to talk


It depends on what you want to do instead. If your program does not have a main() routine, then you need to handle the wb startup message on your own anyway.

With a main() routine, some compilers offer an external global variable called _WBStartup or something similar.

But the most common way is to check if argc == 0 and then use ((struct WBStartup *)argv).

Edit: example startup code if you link your program without the C runtime (i.e. if you don't have a main() routine): http://eab.abime.net/showpost.php?p=664723&postcount=18
and a similar example in Asm: http://eab.abime.net/showpost.php?p=671760&postcount=22


Go to top


Re: Scroll bars
Not too shy to talk
Not too shy to talk



I really wonder what you are trying to calculate there.

If you have 1000 pieces of whatever in your list, you set PGA_Total to 1000. If your window fits 200 of these pieces, you set PGA_Visible to 200 and if the 500th of these pieces currently is at the top of the window, you set PGA_Top to 500. Everything else is done by the propgadget. You don't need to mess around with pixels.

Go to top


Re: Public screen closing bug in OS4.1
Not too shy to talk
Not too shy to talk


Quote:
However, the OS4 Screens preferences program enables system created screens that are opened automatically whenever a program attempts to open on a screen with that name.


As I said, if there is such a mechanism, then this mechanism is responsible for closing the screen, just like any other application.

And it must be possible for that mechanisam and any other application to rely on the notification system (SA_PubSig, SA_PubTask) in order to know when the last visitor window disappears.

If Ringhio destroys the notification because it does not use the normal LockPubScreen/UnlockPubScreen and/or OpenWindow/CloseWindow functions, then it is just bad software and should be fixed.


Go to top


Re: Public screen closing bug in OS4.1
Not too shy to talk
Not too shy to talk


A screen, public or not, belongs to the application which opened it by a call to OpenScreen or OpenScreenTags. Only this application is allowed to close the screen by a call to CloseScreen. Visitor windows must not call CloseScreen on public screens.

If OS4 has a mechanism to open public screens automatically by a call to LockPubScreen, this mechanism is also responsible to close the screen. If it does not work, it is a bug. Usually LockPubScreen should not open a screen, but fail if the named screen does not exist or is not public.

A program which opened a screen and made it public must be aware that visitor windows can exist and that CloseScreen can fail. In this case it has to wait until all visitor windows are gone before it closes the screen. It must not quit before the screen is closed.

Go to top


Re: Precise timer, ticks
Not too shy to talk
Not too shy to talk


Quote:

JosDuchIt wrote:
@thomas
On OS4 version seems like a good idea


Sorry, I almost forgot about it. I now made an OS4 version and also added the option to use ticks instead of microseconds.

The link is still the same as above.

Go to top


Re: Precise timer, ticks
Not too shy to talk
Not too shy to talk



Forgot to mention that it's 68k yet. I could make an OS4-native version when I come home tonight.

Go to top


Re: Precise timer, ticks
Not too shy to talk
Not too shy to talk



Here is a little program to measure time differences:
http://mitglied.multimania.de/thomasrapp/download/PreciseTime.lha
(see TimeTest script for usage example).
Resolution is micro seconds.

Go to top


Re: Utilities/Find
Not too shy to talk
Not too shy to talk


Quote:

centaurz wrote:
it's a feature introduced by SFS


That's not true. The function first appeared in AFS (AmiFileSave), the predecessor of PFS. SFS just copied it with another name (AFS called it .deldir).


Go to top


Re: Utilities/Find
Not too shy to talk
Not too shy to talk



#?.(jpg|png)

less typing and more obvious that it's the extension which is important.


Go to top


Re: Size of win resize gadget?
Not too shy to talk
Not too shy to talk


Quote:

ChrisH wrote:
Does anyone know how to find the size of the window's WFLG_SIZEGADGET resize gadget *BEFORE* opening the window?



struct DrawInfo *drawinfo GetScreenDrawInfo (screen);
struct Image *sizeimg NewObject (NULL,"sysiclass",
    
SYSIA_DrawInfo,drawinfo,
    
SYSIA_Which,SIZEIMAGE,
    
TAG_END);

size_w sizeimg->Width;
size_h sizeimg->Height;

DisposeObject (sizeimg);
FreeScreenDrawInfo (screen,drawinfo);




Go to top


Re: Is there an AHI And Audio Datatype expert somewhere ?
Not too shy to talk
Not too shy to talk


I made a new example which plays a melody: http://thomas-rapp.homepage.t-online.de/examples/melody.c

Note that changing the playback period is documented only for OS 3.5 and above.

Edit: tried it and it also works on 3.1.


Edited by thomas on 2011/5/21 19:03:39
Go to top


Re: Is there an AHI And Audio Datatype expert somewhere ?
Not too shy to talk
Not too shy to talk


Quote:

freddix wrote:
I already use datatypes to open pictures/images without problems ...
Same for Audio ?

if it's the same, then the problem is now with AHI ...


You don't need to care about AHI. Datatypes.library plays the sample for you. You just call the trigger method.

Example: http://thomas-rapp.homepage.t-online.de/examples/dtplay.c


Go to top


Re: The GetEnv command
Not too shy to talk
Not too shy to talk


Quote:
Can I do something like this?


Yes, you can, exactly the way you wrote it, except that you need to use double quotes and the equal operand is EQ, not =.

copy $joe to ram:

if 
$joe EQ "bloggs"
  
info
endif


Also note that it compares the entire variable, not a substring, so "bloggs" does not match "bloggs1.os4.1".

Quote:
Also if the variable is in fact multi-lined is there a way the AmigaShell can say get line 2 of it?


There is no such thing like a multi-lined variable. You can have files in ENV: which have multi lines (and there is a dos.library function which can treat an env varaible as binary and such return the entire content) but they are not variables in the sense of setenv / getenv.

Quote:
Is there a script/way/command that can anyone can use to go through the 'fields' and print them to the screen or do anything else useful?


Not yet, you need to write your own program for this.

Perhaps you should consider using ARexx as scripting language for such a complex task. It has file and string operations as part of the language.


Go to top


Re: Public screen
Not too shy to talk
Not too shy to talk


Quote:

xenic wrote:
Does he need to lock the screen at all in that case? No other programs should be able to lock the screen if it's in PRIVATE status. He should be able to just open his window after opening the screen and then use PubScreenStatus to allow other programs to lock the screen before opening windows on it.



You are right. The owner of the screen does not need to lock it. Only visitors need to.

Go to top


Re: DMS files not supported by RunInUAE
Not too shy to talk
Not too shy to talk



Certainly. Every UAE can do this.


Go to top


Re: sockets suck...
Not too shy to talk
Not too shy to talk



httpget.c example can be found in million places on the net. Just use Google.

http://lmgtfy.com/?q=httpget.c


Go to top



TopTop
« 1 ... 4 5 6 (7) 8 9 10 ... 14 »




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project