473,883 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c event handling - how?

Hi,
How do I generate an event and got it handled by a handler? I know
how to do it in C++ or Java but I got no idea how to do it in C. What
is the best approach to write a function that will take a function
pointer, a pointer to user data (what is it?) and then I notify it
when a certain event happens?

I'm new to C, btw :-)

Thanks a lot for helping.
Nov 13 '05
18 24859
buddy

in c u can use the setvect and getvect functions to apture standard
interrupts and make them point to your code thus making event handling
much simpler....but do remember to call the original isr at the end of
your routine so that the interrupt is not lost and also set the vector
to the original pointer at the end of your program unless you want to
reboot every time your program ends...
u did not specify the type of event handling you are looking for..
do contact me if you need more information on this topic

hp*****@vcustom er.net
Nov 13 '05 #11
Anuj Heer <hp*****@vcusto mer.net> scribbled the following:
buddy in c u can use the setvect and getvect functions to apture standard
interrupts and make them point to your code thus making event handling
much simpler....but do remember to call the original isr at the end of
your routine so that the interrupt is not lost and also set the vector
to the original pointer at the end of your program unless you want to
reboot every time your program ends...
u did not specify the type of event handling you are looking for..
do contact me if you need more information on this topic hp*****@vcustom er.net


The C language does not define setvect, getvect, isr or anything
like that. You want a system-specific newsgroup.

--
/-- Joona Palaste (pa*****@cc.hel sinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"I am looking for myself. Have you seen me somewhere?"
- Anon
Nov 13 '05 #12
Anuj Heer wrote:
buddy

in c u can use the setvect and getvect functions to apture standard
interrupts


C has no functions called setvect or getvect.

--
Richard Heathfield : bi****@eton.pow ernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 13 '05 #13

"Anuj Heer" <hp*****@vcusto mer.net> wrote in message
news:86******** *************** ***@posting.goo gle.com...
buddy

in c u can use the setvect and getvect functions to apture standard
interrupts and make them point to your code thus making event handling
much simpler....but do remember to call the original isr at the end of
your routine so that the interrupt is not lost and also set the vector
to the original pointer at the end of your program unless you want to
reboot every time your program ends...
u did not specify the type of event handling you are looking for..
do contact me if you need more information on this topic


Sigh. Yet another "all the world's an Intel box" person.
Please read the FAQ.

-Mike
Nov 13 '05 #14
Anuj Heer wrote:

in c u can use the setvect and getvect functions to apture standard
interrupts and make them point to your code thus making event handling
much simpler....but do remember to call the original isr at the end of
your routine so that the interrupt is not lost and also set the vector
to the original pointer at the end of your program unless you want to
reboot every time your program ends...


Please stop giving such erroneous information. There is a saying
about keeping silent and allowing people to wonder if you are an
idiot, and speaking up and confirming their suspicions.

It is bad enough that someone may actually use your
misinformation, but in addition you are causing all sorts of extra
traffic here simply to correct and warn about it.

--
Chuck F (cb********@yah oo.com) (cb********@wor ldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net> USE worldnet address!
Nov 13 '05 #15
In <2p************ ******@newsread 1.news.pas.eart hlink.net> "Mike Wahler" <mk******@mkwah ler.net> writes:

"Anuj Heer" <hp*****@vcusto mer.net> wrote in message
news:86******* *************** ****@posting.go ogle.com...
buddy

in c u can use the setvect and getvect functions to apture standard
interrupts and make them point to your code thus making event handling


Sigh. Yet another "all the world's an Intel box" person.


Well, I'm using an Intel box too, but I can't find any trace of setvect
or getvect on it. I must be missing something...

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #16
Dan Pop <Da*****@cern.c h> scribbled the following:
In <2p************ ******@newsread 1.news.pas.eart hlink.net> "Mike Wahler" <mk******@mkwah ler.net> writes:
"Anuj Heer" <hp*****@vcusto mer.net> wrote in message
news:86****** *************** *****@posting.g oogle.com...
buddy

in c u can use the setvect and getvect functions to apture standard
interrupts and make them point to your code thus making event handling
Sigh. Yet another "all the world's an Intel box" person.

Well, I'm using an Intel box too, but I can't find any trace of setvect
or getvect on it. I must be missing something...


So all the world is not just an Intel box, it's a very special kind of
Intel box, then.

--
/-- Joona Palaste (pa*****@cc.hel sinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"We sorcerers don't like to eat our words, so to say."
- Sparrowhawk
Nov 13 '05 #17
On Fri, 21 Nov 2003 15:43:53 -0500, Lew Pitcher <Le*********@td .com>
wrote:
<snip>
Specifically, signal() accepts a pointer to the function to be "called
back", and a value indicating the signal that will invoke the callback.

raise() accepts a value that will be used as the value of a signal. When
raise() is invoked, the signal is "sent", and asychronously, the callback
function associated to that signal by a previous signal() call will be called.
Handling of raise'd signals (and abort) is synchronous; 7.14.2.1p2. It
is signals caused from outside the process, or at least thread -- in
particular, in a POSIX environment, by kill -- that can be
asynchronous, but that is out of scope of standard C and clc.
There are limitations on what the callback function can and cannot do, so
don't go coding complex logic into it (i.e. no printf() statements, etc.).


A signal handler only called for/by a raise'd signal (or abort) can do
anything (an ordinary function can) because those can only have
occurred in user code. A handler for a "true" signal like SIGSEGV is
not guaranteed to be able to use anything in the library, although in
practice the purely computational stuff like string.h, ctype.h, *abs
and *div, and probably math.h, complex.h and tgmath.h, will work, as
almost certainly will stdarg.h and the compile-time stuff. But in at
least some environments a program can't prevent asynchronous
occurrence of a handled signal, so the handler must always be safe.

- David.Thompson1 at worldnet.att.ne t
Nov 13 '05 #18
In article <b4************ *************** *****@4ax.com>,
Dave Thompson <da************ *@worldnet.att. net> wrote:
On Fri, 21 Nov 2003 15:43:53 -0500, Lew Pitcher <Le*********@td .com>
wrote:

There are limitations on what the callback function can and cannot do, so
don't go coding complex logic into it (i.e. no printf() statements, etc.).


A signal handler only called for/by a raise'd signal (or abort) can do
anything (an ordinary function can) because those can only have
occurred in user code.


Except call raise() (N869 7.14.1.1#4).

(I'm not sure whether a "reasonable implementation" would have problems
with this - the obvious way of implementing it is to do something
like "sighandler_fun cs[signum](signum);" (except in POSIXish systems,
where the man pages I have access to document it as being equivalent to
"kill(getpid(), sig)"), but something that does weird stuff inside raise()
need not jump through hoops to make it reentrant.)
dave

--
Nov 13 '05 #19

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1757
by: hillcountry74 | last post by:
Hi, I'm a newbie and trying to understand event handling in c#. I have understood handling events using delelgate objects. But not this method- "Event handling by overriding the virtual protected method of the base class". Can someone please explain this with a sample code? Thanks a lot.
3
2083
by: Ashok Kumar K | last post by:
Hi all, Where can I get some insight on using the __hook, __unhook, event_source and event_receiver for specifically COM events. The documentation given in MSDN is very minimal. I have the following scenario Server (COM event source) is written in VC++ 6.0 using ATL (event interfaces can be either dispinterface / IDispatch based) Client (COM event receiver) is written in VC++ 2003 using attributed programming and unified event handling
9
2342
by: Sridhar | last post by:
Hi, I have created a web page which includes a place holder. I also have a dropdown list in that webpage. when I select one of the choices in that dropdown list, It will load a user control into the place holder. This is done dynamically based on the choice they selected. This user control has a datagrid in it that supports paging. When I click on the next or prev buttons of the datagrid in a user control it should display the next page...
2
2141
by: Paul E. Orman | last post by:
I have a piece of VB code (.NET 1.1 - VB 2003) that loads data from a database through a timer. So the timer is setup and from it I call the procedure that loads the latest records from the database. This works fine. However, I attempt to notify the user when data accesses occur. The way I attempt to accomplish this is by changing the background color of a label on the form the user is looking at. I use red for when the database is...
3
1478
by: johncee | last post by:
Greetings, I created a base class that has a datagrid. I've made it generic as possible so that any derived classes pass some info to the base constructor (including a SQL select stmt) & through the base class, any db table can be displayed/maintained in the grid. I've made some of the base class' event-handling subs overridable and in some of the derived classes using the base, the subs are being overridden:
4
2099
by: reggiestyles | last post by:
Hi, I've got a question about prototype and event handling. I've got several div's (dynamic number) on a page that I want to set as active or inactive (basically, I'm using scriptaculous' Effects to set Opacity to 1 for the active div and 0.5 for the inactive ones). Using prototype's event handling, I can see two ways to get this done:
2
2889
by: a | last post by:
Hi I have a 3-column listview. It has to return the value of the cell when the user click the listview. The SelectedIndexChanged event and ItemSelectionChanged Event only return the row information (ListViewItem). If I want to return the cell value of the second and the third column, which event should I use? Thanks
3
2005
by: a | last post by:
Hi, I have a 3-column listview. It has to return the value of the cell when the user click the listview. The SelectedIndexChanged event and ItemSelectionChanged Event only return the row information (ListViewItem). If I want to return the cell value of the second and the third column, which event should I use? Let say, if the user select row 2, column 3, which event handling
1
1688
by: stmfc | last post by:
hi, for an event handling mechanism, we need an event object. (the object where the event actually occur) and we need an event handler, and we need a registration of the event handler to the event object(generator) in java, we can create a generator class by extending EventObject class. we can create an event handler class by implementing EventListener interface. for registration we can provide some registration method (e.g...
5
4305
by: Klaudiusz Bryja | last post by:
Hi, This is for NetCF 2.0. I need to create event handling code which using reflection. I have some parameters in XML which describe how event should be handled. I have code to create delegate: public class DelegateEx {
0
9944
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10757
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10860
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7975
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7134
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5804
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6002
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4225
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3239
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.