gliethttpgliethttp.blog.chinaunix.net
gliethttp
全部博文(2005)
2014年(2)
2013年(2)
2012年(16)
2011年(66)
2010年(368)
2009年(743)
2008年(491)
2007年(317)
linux_zj
程睿
mzh2100
dogsun88
叶绍琛
kowems
gongping
chumojin
高泽然
xy7777
os123456
hiderhao
zahassio
byy6by
zxy11861
COVID_19
a1960048
swzswz
分类:
2008-08-07 22:44:23
ads1.2下c++测试源码
//main.cpp
#ifdef __cplusplus extern "C" { #endif int printf(const char *fmt,...); int isdigit (char c); #ifdef __cplusplus } #endif class leith_cobject { public: static volatile int timer_count; public: leith_cobject(int argc); void ontimer(int timer_id); static int irq_handler(int irq); int get_timer_count(void); int set_timer_count(int count); int get_ltimer_count(void); int set_ltimer_count(int count); private: int ltimer_count; __inline void printf_name(void); }; volatile int leith_cobject::timer_count = 666666; leith_cobject::leith_cobject(int argc) { int i; for(i = 0;i < argc;i++) { printf("%d, digit = %s\n", i, isdigit(i) ? "true":"false"); } ltimer_count = argc; printf_name(); } int leith_cobject::irq_handler(int irq) { printf("irq = %d\n", irq); return 0; } void leith_cobject::ontimer(int timer_id) { printf("timer_id = %d\n", timer_id); } int leith_cobject::get_timer_count(void) { return timer_count; } int leith_cobject::set_timer_count(int count) { return timer_count = count; } int leith_cobject::get_ltimer_count(void) { return ltimer_count; } int leith_cobject::set_ltimer_count(int count) { return ltimer_count = count; } void leith_cobject::printf_name(void) { //int (*func)(void); //func = this->get_timer_count; printf("0x%x\n", this); } int main(void) { leith_cobject leith(60); leith_cobject leith1(20); leith.ontimer(80); leith.ontimer(180); leith.ontimer(280); leith.ontimer(380); leith.irq_handler(8); leith_cobject::irq_handler(9); leith_cobject::irq_handler(10); printf("leith.timer = %d\n", leith.get_timer_count()); printf("leith.ltimer = %d\n", leith.get_ltimer_count()); leith.set_timer_count(5); leith.set_ltimer_count(6); printf("leith.timer = %d\n", leith.get_timer_count()); printf("leith.ltimer = %d\n", leith.get_ltimer_count()); printf("leith1.timer = %d\n", leith1.get_timer_count()); printf("leith1.ltimer = %d\n", leith1.get_ltimer_count()); leith1.set_timer_count(7); leith1.set_ltimer_count(8); printf("leith1.timer = %d\n", leith1.get_timer_count()); printf("leith1.ltimer = %d\n", leith1.get_ltimer_count()); }
上一篇:svn简易服务器的搭建ubuntu7.10
下一篇:2008北京奥运开幕式表演做得很爽
登录 注册