Announcement

Collapse
No announcement yet.

conditioned inherit

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • conditioned inherit

    I have a large software project that works with hardware adapters. I can connect up to five adapters to the uLCD70.
    In the software I have for each adapter.

    #inherit "counter.fnc"
    #inherit "rf_generator.fnc"
    #inherit "AVOmeter.fnc"
    etc...

    But, if i.e. AVOmeter is not connected, than is not necessary to include function #inherit "AVOmeter.fnc". For this purpose it could be useful to have a conditioned function loading, like

    if ( slot_2 == 1 )
    #inherit "AVOmeter.fnc"
    endif

    if ( slot_2 == 2 )
    #inherit "counter.fnc"
    endif

    but I am not sure if this is possible. If not, I would like know how to choose which function to load under a condition if ... endif.
    Last edited by JPL; 28 December 2021, 08:20 AM.

  • #2
    I found out from the manual "4D Graphics Language - Reference Manual", Rev. 6.1 from 04/11/2019, page 17, part 5.3 that #USE, #USING exist ...
    I think this can solve my problem ... but I don't know how to use this directive because as soon as I turn on the instrument and the program starts,
    the program first reads data from my setup. The data indicates which hardware adapter is present in an instrument slot. And based on this setup,
    I can use the #USE, #USING .. directive.
    From the main menu I can go to the setup menu and write there which adapter occupies which slot.
    In principle, this information could be automated; once the program has been started, it can test the slots and obtain information about adapters in each slot.
    My question is how to use the #USE directives at startup after this test.

    Comment


    • #3
      Hi,

      The '#inherit' and the '#USE' is preprocessor directives. Before the actual compilation, the preprocessor directives will run first to process some programs. The proper way to use these directives is to put them on the top of your source code.

      The '#USE' preprocessor directive is used to selectively include functions in the '#inherited' files, allowing you to build libraries of code, but only selectively inherit the functions required by the project as mentioned in the manual. This directive isn't able to select or deselect certain '#inherited''files during runtime.

      Best Regards

      Comment

      Working...
      X