Path: news.cs.au.dk!not-for-mail From: "Sascha Kimmel" Newsgroups: comp.lang.beta Subject: RE: problems with processes Date: 28 Feb 1999 08:11:41 -0000 Organization: University of Aarhus, Department of Computer Science (DAIMI) Lines: 250 Approved: mailtonews@cs.au.dk Distribution: world Message-ID: <19990228081141.24335.qmail@noatun.mjolner.dk> Reply-To: "Sascha Kimmel" NNTP-Posting-Host: daimi.cs.au.dk X-Trace: xinwen.cs.au.dk 920189503 16272 255.255.255.255 (28 Feb 1999 08:11:43 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 28 Feb 1999 08:11:43 GMT Xref: news.cs.au.dk comp.lang.beta:11844 > -----Ursprüngliche Nachricht----- > Von: Arne Hueggenberg [mailto:zalaster@nef.wh.uni-dortmund.de] > Gesendet am: Sonntag, 28. Februar 1999 01:47 > An: Sascha Kimmel > Cc: usergroup@mjolner.dk > Betreff: RE: problems with processes > > >> > >> Hello everyone, > >> i have a problem im hoping someone here can me help with > >> Using the PE for Linux im trying to do something like this: > >> lprtest.bet: > > > >I'm using BETA 4.1 Pro on Win98 the most time, but sometimes also under > >Linux, but don't expect too much help for BETA under Linux from me ;-) > >But I'll try. > > As we are working on an system independent abstraction layer > (e.g. the BETA > Process Lib) that shouldnt matter. > Except that due to the unix way of combining several small tools for a > greater whole processes are much more usful on unix :-) Well, it matters, because not all parts of the Process Library are implemented on all platforms properly. Have a look at MIA 94-29 (1.2), page 22f. for details about that. > >> ORIGIN '~beta/basiclib/current/systemenv'; > >> INCLUDE 'lpr'; > >> > >> -- program:descriptor -- > >> systemenv > >> (# > >> TextToPrint: ^TEXT; > >> do > >> &text[]->TextToPrint[]; > >> 'this is a test'->TextToPrint.putline; > >> 'wonder if this works'->TextToPrint.putline; > > > >Haven't tried it this way, but it works the same way as 'this is a > >test'->TextToPrint.append , or am I totally wrong now? > >But doesn't PUTLINE always append a NEWLINE to a text string? > > yes it does, and the NEWLINE is intended > > >> TextToPrint[]->&lpr_process; > > > >Doesn't TextToPrint[]->lpr_process; do the stuff alone? > > it should, but it never hurts to be explicit does it? :-) No, it shouldn't hurt, but normally the BETA compiler inserts that automatically. > > >> #) > >> > >> > >> with lpr.bet being: > >> > >> ORIGIN '~beta/basiclib/current/systemenv'; > >> INCLUDE '~beta/process/current/processmanager'; > >> -- Systemlib: Attributes -- > >> lpr_process: Systemenv > >> (# > >> PrintMe: ^TEXT; > >> exec: > >> (# name: ^text; child: @process; > >> enter name[] > >> do > >> name[]->child.init; > >> printme[]->child.RedirectFromChannel; > >> child.start; > >> child.awaitStopped; > > > >Freezes the program until the process has finished. > > yep, but thats totally aceeptable for a small demo program isnt it? Yes, of course. But I thought this information would be useful for further programs :) > > >> #); > >> > >> enter PrintMe[] > >> do 'starting lpr_process'->putline; > >> ('/usr/bin/lpr')->exec; > >> #); > >> > >> > >> now what happens is that an execution of lprtest.bet results in: > >> > >> arne@darkwing:~/code > ./lprtest > >> > >> ******************************************************************* > >> * Note: This program was compiled using a Personal Edition of the * > >> * Mjolner BETA System and may not be used for commercial purposes * > >> ******************************************************************* > >> > >> > >> FORK FAILURE: Only newly created systems may be forked. > >> > >> # Beta execution aborted: Stop is called. > >> # Look at 'lprtest.dump' > >> > >> with the dump file being > >> > >> arne@darkwing:~/code > cat lprtest.dump > >> Beta execution aborted: Stop is called. > >> > >> Call chain: (linux) > >> > >> item in ~beta/basiclib/v1.6/private/betaenvbody > >> -- stop# in ~beta/basiclib/v1.6/betaenv > >> item in ~beta/basiclib/v1.6/betaenv > >> -- BETAENV-~ in ~beta/basiclib/v1.6/betaenv > >> item in ~beta/basiclib/v1.6/private/basicsystemenvbody > >> -- fork# in ~beta/basiclib/v1.6/basicsystemenv > >> item in ~beta/basiclib/v1.6/basicsystemenv > >> -- lpr_process#SystemEnv#SysHead# in /home/arne/code/lpr > >> item in ~beta/basiclib/v1.6/private/basicsystemenvbody > >> -- BASICSYSTEMENVPRIVATE-~ in > >> ~beta/basiclib/v1.6/private/basicsystemenvbody > >> item in > >> ~beta/basiclib/v1.6/private/basicsystemenvbody > >> -- lpr_process#SystemEnv#SysHead# in /home/arne/code/lpr > >> item lpr_process#SysHead# in > >> ~beta/basiclib/v1.6/basicsystemenv > >> -- BETAENV-~ in ~beta/basiclib/v1.6/betaenv > >> comp SystemEnv#SysHead# in /home/arne/code/lprtest > >> -- BETAENV-~ in ~beta/basiclib/v1.6/betaenv > >> > >> > >> item realValue# in > >> ~beta/basiclib/v1.6/private/basicsystemenvbody > >> -- BASICSYSTEMENVPRIVATE-~ in > >> ~beta/basiclib/v1.6/private/basicsystemenvbody > >> item <*>cycle# in ~beta/basiclib/v1.6/private/systemenv_unixbody > >> -- BASICSCHEDULER-~ in > >> ~beta/basiclib/v1.6/private/systemenv_unixbody > >> comp in > >> ~beta/basiclib/v1.6/private/systemenv_unixbody > >> -- PROGRAM-~SystemEnv#SysHead# in /home/arne/code/lprtest > >> > >> > >> basic component in ~beta/basiclib/v1.6/betaenv > >> > >> > >> and im dont quite understand why this doesent work as i expect. > >> > >> > >> > >> Also, when putting it all in one file it seems to work fine, except for > >> the fact that > >> > >> PrintMe[]->RedirectFromChannel; > >> > >> results in : > >> > >> # Beta execution aborted: Qualification error in reference assignment. > >> # Look at 'lpr.dump' > > > >It's obvious that if there's no process to which the string should be > >redirected to, there is a little problem. > >Try <child.RedirectFromChannel;>> > some checking is in order here, but remember, the code only serves to > demonstrate my problem Yes, but WHICH channel gets the PrintMe[]-Text-reference? Here it is simply NONE. > > in the second case, where i change lpr.bet so that everything > happens in it > there is a process, note that it dumps with an qualification > error (e.g. some > reference is passed wich is not properly qualified) not > ´reference is none´ > The qualification error is what has me wondering, as text is > stronger qualified > than stream it should be no problem to pass it to a method > expecting a stream. Yes, but the method is not bound to/by any process! The implementation (processmanager.bet) looks as follows: Process: (* Notice, this(Process) can only be executed once. * * Two program executions of the same Process, * can be executed by instantiating and executing two different BETA * objects from the same Process. *) (# [...] redirectFromChannel: (* redirect input to this(process) from inputChannel *) (# error:< ProcessManagerException; inputChannel: ^Stream; enter inputChannel[] <> #); [...] #); So you did not qualify the process to which the input should be redirected to. So that is a qualification error, I would say. > even changing the texts qualification to stream doesent help so > im guessing its > something else, but i dont understand what. Did you try PrintMe[]->child.RedirectFromChannel ? > >> trying to be clever i then did > >> > >> PrintMe[]->qua(# as::< stream #)->RedirectFromChannel; > >> > >> > >> but to no avail, still dumps with the same qualification error in > >> reference assignment > > > >See above. > see above :-) > >> > >> > >> > >> anyone know what im doing wrong? > >> > >> any help would be appreciated :-) > >> > >> Arne Hüggenberg > >> > > > >Hope this helps at least a bit :) > > > >Reagrds, > >Sascha Kimmel > >(kimmel@tricos.com) > > Arne Hueggenberg > Regards, Sascha Kimmel