Article View: comp.sys.amiga.tech
Article #6351Re: Tags - How do they work.
From: Matthew Dillon
Date: Thu, 01 Nov 1990 21:02
Date: Thu, 01 Nov 1990 21:02
85 lines
2809 bytes
2809 bytes
It turns out that it is extremely easy to implement stack-based tags,
as someone on BIX pointed out to me. Under 2.0, the Amiga.Lib already
has routines to do this for some commands.... for example,
OpenWindowTags() -stack based tags method, tags are
individual arguments to the routine
OpenWindowTagList() -pointer to array of tags method, you
pass a pointer to the tags array.
One can easily implement one's own routine to convert a stack based
tags list into an array pointer tags list using VAR ARGS. For
example, the implementation of SystemTags() would be:
#include <stdio.h>
#include <stdarg.h>
long
SystemTags(cmd, ...)
char *cmd;
{
va_list va;
long error;
va_start(va, cmd);
error = System(cmd, va);
va_end(va);
return(error);
}
The messages:
In article <15486@cbmvax.commodore.com> ken@cbmvax.commodore.com (Ken Farinsky - CATS) writes:
>I posted this the other day, which turned out to be wrong (as System()
>will not handle tags on the stack...)
>
>>>rc = System(argv[1],
>>> SYS_Input, infile,
>>> SYS_Output, outfile,
>>> SYS_Asynch, FALSE,
>>> TAG_DONE
>>> );
>
>Ewout sent me some mail, as follows:
>
>>>Ken, System() is tag, not stack based. So he'd have to do something like
>>>
>>>struct TagItem tag[5];
>>>
>>>tag[0].ti_Tag = SYS_Input;
>>>tag[0].ti_Data = infile;
>>> .
>>> .
>>>tag[4].ti_Tag = TAG_END;
>>>
>>>But the whole thing that guy is trying to do is wrong anyway since you cannot
>>>use a level 2 filehandle as an AmigaDOS BPTR filehandle.
>>>---
>>>Ewout Walraven - CATS Commodore Business Machines, Inc.
>>>215-431-9426 {uunet|rutgers}!cbmvax!ewout
>
>So, you have to put the tags into an array, then call System() with a
>pointer to the name of the command and a pointer to the tag array.
>Live and learn.
>
>> Russell McOrmond rwm@atronx.UUCP {fts1,alzabo}!atronx!rwm
>> FidoNet 1:163/109 Net Support: (613) 230-2282
>> Amiga-Fidonet Support 1:1/109
>--
>--
>Ken Farinsky - CATS - (215) 431-9421 - Commodore Business Machines
>uucp: ken@cbmvax.commodore.com or ...{uunet,rutgers}!cbmvax!ken
>bix: kfarinsky
--
-Matt
Matthew Dillon dillon@Overload.Berkeley.CA.US
891 Regal Rd. uunet.uu.net!overload!dillon
Berkeley, Ca. 94708
USA
Technical Details
Message-ID:
<dillon.6960@overload.Berkeley.CA.US>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!overload!dillonReferences:
<53246.657345554@atronx.UUCP> <15486@cbmvax.commodore.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!overload!dillon From: dillon@overload.Berkeley.CA.US (Matthew Dillon) Newsgroups: comp.sys.amiga.tech Subject: Re: Tags - How do they work. Message-ID: <dillon.6960@overload.Berkeley.CA.US> Date: 1 Nov 90 21:02:20 GMT References: <53246.657345554@atronx.UUCP> <15486@cbmvax.commodore.com> Lines: 85