Menu

#316 Using History with Submachines does not work

QM
closed
QM 5.2.1 (1)
1
2023-01-10
2022-11-15
No

I'm trying to create a History in QM that points to a submachine. While QM allows that just fine (see image attached), it's when I compile that things go pear-shaped.

The submachine is called "bluetooth_2_0" and is of type "bluetooth". The error message I get is this:

error: cannot convert 'const AOUi::AOUi::SM_bluetooth*' to 'const QP::QMState*' in assignment

I circumvented the problem by slightly changing the source file:

// state history attributes
hist_app = &bluetooth_2_0_s.super;  // <<<--- was &bluetooth_2_0_s;

This way, it will compile. Naturally, this change will be lost when we rebuild the source from withing QM.

It does seem to work, though. Not sure if what I'm doing was ever intended, but since QM allows it, I assumed it would work. Hence this report.

Happy to provide more details.

1 Attachments

Discussion

  • Quantum Leaps

    Quantum Leaps - 2022-12-12

    Hi Sander,
    Thank you for reporting. I was able to reproduce the compilation problem.
    I'm not sure how to prioritize this bug. This seems to be a little esoteric use of history and sub-machine states.

    The change to add .super in the initialization of the history attribute seems to be working (both compiling and running the app). Are you sure that it does not work for you?

    The bug will be assigned to the next QM release.
    --MMS

     

    Last edit: Quantum Leaps 2022-12-13
  • Sander Huijsen

    Sander Huijsen - 2022-12-13

    Thanks for your response! I agree with you it is rather esoteric. :)

    The change to add .super to the initialisation of the history attribute did work indeed, but it is overwritten when the model is regenerated. Unless I missed something? (Maybe my explanation wasn't as clear as I'd hoped.)

    Thanks again,
    Sander

     
    • Quantum Leaps

      Quantum Leaps - 2022-12-13

      Yes, I agree. QM generates incorrect code in this special case, so yes, any manual changes in the generated code will be obviously overwritten.

      But at least it is clear how to fix the bug (by adding .super in case of a sub-machine state). The code without .super is for regular states.
      --MMS

       
      👍
      1
  • Quantum Leaps

    Quantum Leaps - 2023-01-10

    Fixed in QM 5.2.4 and QP/C/C++ 7.2.0. (Both are needed for the fix).
    --MMS

     
    👍
    1

Anonymous
Anonymous

Add attachments
Cancel