Giter Site home page Giter Site logo

Add U8NUMFN and U32NUMFN about m2tklib HOT 10 CLOSED

fraser125 avatar fraser125 commented on July 23, 2024
Add U8NUMFN and U32NUMFN

from m2tklib.

Comments (10)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
This is badly needed!

Original comment by [email protected] on 26 Jan 2012 at 2:04

from m2tklib.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
implementation started:

uint8_t u8_x = 2;

uint8_t u8_cb(m2_el_fnarg_p fnarg, uint8_t msg, uint8_t val)
{
  if ( msg == M2_U8_MSG_SET_VALUE )
    u8_x = val;
  return u8_x;
}

#define M2_U8_MSG_GET_VALUE 0
#define M2_U8_MSG_SET_VALUE 1

M2_U8NUMFN(el,fmt,min,max,fn)

documentation: SET_VALUE is only called, if value has really changed

Original comment by [email protected] on 26 Jan 2012 at 10:34

  • Changed state: Started

from m2tklib.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
changed first arg to the element pointer (to be consistent between u8 and u32)
started with u32 (testing needed)

Original comment by [email protected] on 27 Jan 2012 at 5:53

from m2tklib.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
- write u32 test case, check the code 
- rewrite u8 procedure, remove el_data, use runtime object type identification 
as in u32 code

Original comment by [email protected] on 27 Jan 2012 at 8:16

from m2tklib.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
implemented, documentation needs to be done

Original comment by [email protected] on 27 Jan 2012 at 9:33

from m2tklib.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
done

Original comment by [email protected] on 28 Jan 2012 at 8:26

  • Changed state: Verified

from m2tklib.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
Seem to make problems with classes - get error: "a pointer to a bound function 
my only be used to call the function"

This works:

uint8_t u8_cb(m2_rom_void_p element, uint8_t msg, uint8_t val)
{
  if ( msg == M2_U8_MSG_SET_VALUE )
    global_value = val;
  return global_value;
}
M2_U8NUMFN(el_Frost_aktiv_num,"c2", 1, 20, u8_cb );



This does not work:


class testclass {

public:
    uint8_t u8_cb(m2_rom_void_p element, uint8_t msg, uint8_t val);
};

uint8_t testclass::u8_cb(m2_rom_void_p element, uint8_t msg, uint8_t val)
{
  if ( msg == M2_U8_MSG_SET_VALUE )
    global_value = val;
  return global_value;
}

testclass test;

M2_U8NUMFN(el_Frost_aktiv_num,"c2", 1, 20, test.u8_cb );


Any ideas?

Original comment by [email protected] on 30 Jan 2012 at 2:14

from m2tklib.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
This is not possible:
http://www.parashift.com/c++-faq-lite/pointers-to-members.html

Original comment by [email protected] on 30 Jan 2012 at 3:54

from m2tklib.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
This will not work. Member functions be not be passed directly (see also the 
C++ FAQ)

Original comment by [email protected] on 30 Jan 2012 at 4:02

from m2tklib.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
OK I got it - Thanks

Original comment by [email protected] on 30 Jan 2012 at 4:18

from m2tklib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.