Re: [Gems-users] Regd using externally declared enumerations in the slicc files


Date: Tue, 31 May 2005 12:27:51 -0500 (CDT)
From: Mike Marty <mikem@xxxxxxxxxxx>
Subject: Re: [Gems-users] Regd using externally declared enumerations in the slicc files
Yes.  Create a class that inherits from Consumer and implement the
wakeup() method.

If the system has a single instance of your module, you can instantiate
your class in the ruby/System.h class by simply adding it as a private
member variable.

Here is an example of something similar I did not to long ago that wakes
up every TIMER_PERIOD and calls g_system_ptr->triggerTimeout()

MyTimer.h
-----------------

class MyTimer : public Consumer {
public:
  MyTimer();
  void wakeup();
};

MyTimer.C
---------------------

#include "MyTimer.h"
#include "System.h"

MyTimer::MyTimer()
{
  g_eventQueue_ptr->scheduleEvent(this, TIMER_PERIOD);
}

void MyTimer::wakeup()
{
  g_eventQueue_ptr->scheduleEvent(this, TIMER_PERIOD);
  g_system_ptr->triggerTimeout();
}


--Mike



> Thanks Mike. I used the enumeration that i declared in
> the slicc file in my external module as you suggested
> and included the generated .h file in my module :-).
>
> On another note - is there any way for me to regularly
> schedule a call to my external module every cycle from
> the ruby main event scheduler.
>
> Thanks
> Brinda
>
> --- Mike Marty <mikem@xxxxxxxxxxx> wrote:
> > I think you will need to declare an enumeration in
> > Slicc itself.  There
> > are a bunch of enumerations defined in
> > RubySlicc_Exports.sm.  These will
> > generation a .h file that can be used by both Slicc
> > and Ruby.  If you need
> > to use the enums defined in  your .h file, you can
> > create a one-to-one
> > mapping function.
> >
> > --Mike
> >
> > >
> > > I am trying to perform a function call from within
> > the
> > > directory controller to an external function. My
> > > external function requires as one of its arguments
> > an
> > > enum type which is defined in an include file.
> > >
> > > Could you please tell me how I should declare this
> > > enumeration so that the slicc parser does not
> > throw up
> > > an error nor does it cause a compilation error
> > when
> > > building ruby?
> > >
> > > I have tried declaring the enumeration as an
> > external
> > > type but that seems to be incompatible. I have
> > also
> > > tried declaring it in the rubyconfig.defaults in
> > the
> > > form of a #define - but that also causes the
> > initial
> > > slicc parsing to fail.
> > >
> > > I would really appreciate any help or pointers
> > about
> > > how to fix this
> > > Thanks
> > > Brinda
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> ___________________________________________________________
> > > Yahoo! Messenger - NEW crystal clear PC to PC
> > calling worldwide with voicemail
> > http://uk.messenger.yahoo.com
> > > _______________________________________________
> > > Gems-users mailing list
> > > Gems-users@xxxxxxxxxxx
> > >
> >
> https://lists.cs.wisc.edu/mailman/listinfo/gems-users
> > >
> > _______________________________________________
> > Gems-users mailing list
> > Gems-users@xxxxxxxxxxx
> >
> https://lists.cs.wisc.edu/mailman/listinfo/gems-users
> >
>
>
>
>
>
> ___________________________________________________________
> Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
> _______________________________________________
> Gems-users mailing list
> Gems-users@xxxxxxxxxxx
> https://lists.cs.wisc.edu/mailman/listinfo/gems-users
>
[← Prev in Thread] Current Thread [Next in Thread→]