diff --git a/(notes) b/(notes) index 71a6bbb..dc01ee9 100644 --- a/(notes) +++ b/(notes) @@ -245,3 +245,222 @@ GtkBox *get_CONTROL_box(){ return CONTROL_box; } */ + + + + +Legacy, again... + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +void fsm_poetic_engine() // 2024-08-31 +{ + int milliseconds = 100; + struct timespec rem; + struct timespec req= { + (int)(milliseconds / 1000), /* secs (Must be Non-Negative) */ + (milliseconds % 1000) * 1000000 /* nano (Must be in range of 0 to 999999999) */ + }; + while (true) { + printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | DO * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | D=-O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | D=-- -O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | =- - - O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | -- O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | - O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | O*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | (*O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | (*) O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | (*) O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | (*) O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | O . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | O . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | D . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | D- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | D =- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | D = --- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | D =-- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | D=- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + printf(" | D- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); + } +} + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////// + +My old engine in java... + +/////////////// +package engine; + +import java.lang.System.out; +import measures.MeasuresManager; +import resources.P; +import rule.FormulasManager; +import rule.FormulasManagerAccess; +import session.ViewControls; +import state.StateManager; +import state.StateManagerLocal; +import views.MODEL; +import views.ViewsManagerAccess; + +/* 2020-11 [prototype 0.0] + MonoThread executes a while(true) loop with two instructions: + (1) search a place where a transition can be done + (2) do the transition + + while (true) + if (session.MainView.isStartStopButtonSelected()) + { + state.StateManagerLocal.chooseLocalOrigin(false); + new SingleTransition(true); + } +*/ +public class SingleTransition { + + protected volatile boolean is_done = false; + protected volatile String elapsed; + public SingleTransition (boolean mono) {if (mono) perform_a_transition();} + + private synchronized static final void perform_a_transition() + { + // if (step_by_step) StateManagerLocal.circlePresentState(); + if(ViewControls.isDoSelected()) SingleTransition.execute_do (SingleTransition.prepare_do (false)); + else if(ViewControls.isUndoSelected()) SingleTransition.execute_undo(SingleTransition.prepare_undo(false)); + else if(ViewControls.isRedoSelected()) SingleTransition.execute_redo(SingleTransition.prepare_redo(false)); + // if (ViewControls.undo_buffer < UNDO_STACK_SIZE) ViewControls.setTimeBufferBar(ViewControls.undo_buffer); MainView.addElapsedTime(); + } + public static final int prepare_do (final boolean step_by_step) + { + // ThreadsManager.addCycle(); // {nb_cycles ++;} This cycle can be inefficient if no formula can be applied + selected_formula = FormulasManager.iterateToFindAFormula(); + // if(selected_formula > -1) out.println(" prepare_do "+ state.StateManagerLocal.getInfoDebug()); + return selected_formula; + } + public static final void execute_do (final int formula_key) { // formula.doActions(); out.print(" execute_do: formula key=" + formula_key +" "); + if (formula_key < 0) { if(StateManagerLocal.comment_origins) out.println("execute_do failure: formula key=" + formula_key); return;} + + MeasuresManager.startMeasuringAFormulaEffect(formula_key); // out.println("execute_do formula name = "+ FormulasManager.formula.get(formula_key).name); + FormulasManager.getFormula().get (formula_key) .doActions(); // {for (i = 0; i < action.length; i++) action[i].doAction (); StateManagerLocal.endRule(action_swap, action_name);} + MeasuresManager.endMeasuringAFormulaEffect(formula_key); + writePresentState (formula_key); + present ++; if (present == UNDO_STACK_SIZE) present = 0; // MainView.setStartStopButtonSelected(false);// if (present == 1); {MainView.setStartStopButtonSelected(false); } //out.println("MonoThread.execute_do > stop ! (present == 1)"); + ViewControls .execDo(); + doRepaint(); + if (DO_UNDO_REDO_comment) comment_do(formula_key); // if (MonoThreadTest.present == 12) MainView.setStartStopButtonSelected(false); + } + public static final int prepare_undo (final boolean step_by_step) { // MonoThreadTest.present --; return MonoThreadTest. f [MonoThreadTest.present]; + if (ViewControls.isUndoBufferEmpty()) {out.println("prepare_undo stop !");} // undo_buffer is always >= 0 + else {present --; if (present == -1) present = UNDO_STACK_SIZE -1; ViewControls.execUndo();} + final int formula_key = readPresentState(step_by_step); + // if (step_by_step) StateManagerLocal.circlePresentState(); + return formula_key; + } + public static final void execute_undo (final int formula_key) { // formula.unDoActions(); {for (i = 0; i < action.length; i++) ...} + FormulasManager.getFormula().get (formula_key) .unDoActions(); // {for (i = 0; i < action.length; i++) action[i].doAction (); StateManagerLocal.endRule(action_swap, action_name);} + ViewControls.setRedoSelected(); + // StateManagerLocal.circlePresentState(); + // ThreadsManager.removeEfficientCycle(); // {nb_effective_cycles --;} + doRepaint(); + if (DO_UNDO_REDO_comment) comment_undo(); + } + public static final int prepare_redo (final boolean step_by_step) { // return MonoThreadTest. f [MonoThreadTest.present]; + final int formula_key = readPresentState(step_by_step); + // ThreadsManager.addEfficientCycle(); // {nb_effective_cycles ++;} + // if (step_by_step) StateManagerLocal.circlePresentState(); + return formula_key; + } + public static final void execute_redo (final int formula_key) { // formula.doActions(); {for (i = 0; i < action.length; i++) ...} + // the redo_buffer is always >= 0 (if the re_do buffer is empty, the re_do button is deactivated) + if (! ViewControls.isRedoBufferEmpty()) { + FormulasManager.getFormula().get (formula_key).doActions(); // {for (i = 0; i < action.length; i++) action[i].doAction (); StateManagerLocal.endRule(action_swap, action_name);} + present ++; if (present == UNDO_STACK_SIZE) present = 0; + ViewControls.execRedo(); + } + ViewControls.setUndoSelected(); + doRepaint(); + if (DO_UNDO_REDO_comment) comment_redo(); + } + public final static void writePresentState (final int formula_key) { // x [present] = StateManagerLocal.local_space_origin_X; ... + + formula [present] = (short) formula_key; + o [present] = (byte) StateManagerLocal.getReferenceOrientation_1(); + switch(StateManager.space_dimension) { + case THREE: z [present] = (byte) StateManagerLocal.local_space_origin_Z; // no break; + case TWO: y [present] = (byte) StateManagerLocal.local_space_origin_Y; // no break; + case ONE: x [present] = (byte) StateManagerLocal.local_space_origin_X; // no break; + default:;} + } + private final static int readPresentState (final boolean step_by_step) { // StateManagerLocal.local_space_origin_X = x [present]; ... + + switch(StateManager.space_dimension) { + case THREE : StateManagerLocal.local_space_origin_Z = z [present]; // no break + case TWO : StateManagerLocal.local_space_origin_Y = y [present]; // no break + case ONE : StateManagerLocal.local_space_origin_X = x [present]; // no break; + default:;} + StateManagerLocal.setReferenceOrientation_1 (o [present]); + return formula[present]; + } + private final static void doRepaint() {ViewsManagerAccess.getView(MODEL.SPACE, "MonoThread.execute_do_undo_redo()").repaint(); } + public static int selected_formula; + public static int present = 0; + public final static int UNDO_STACK_SIZE = 3000; // resources.Parameters.UNDO_STACK_SIZE; // This parameter is also used by ViewControls to display the BufferProgressBarValue + protected final static short[] formula = new short [UNDO_STACK_SIZE]; + protected final static byte[] x = new byte [UNDO_STACK_SIZE]; + protected final static byte[] y = new byte [UNDO_STACK_SIZE]; + protected final static byte[] z = new byte [UNDO_STACK_SIZE]; + protected final static byte[] o = new byte [UNDO_STACK_SIZE]; + private final static byte s6 = 6, s2 = 2; + public final static boolean DO_UNDO_REDO_comment = false; // true false + protected final static void comment_do (int rank) + { + if (present == 0) present = UNDO_STACK_SIZE; + out.println(" do -----> "+ + P.aa(present,s6) + " ("+ P.aa(ViewControls.undo_buffer - 1,s2) +"+1="+ P.aa(ViewControls.undo_buffer,s2) +" /"+ + P.aa(ViewControls.redo_buffer,s2) +" -"+ P.aa(ViewControls.redo_buffer,s2) +") "+ + P.aa("xyzo ("+ P.aa(x[present - 1],2) +","+ P.aa(y[present - 1],2) +","+ P.aa(z[present - 1],2) +")",12) +" "+ o[present - 1] +" " + + // "from:"+ P.aa(from[present - 1],4) +" to:"+ P.aa(to[present - 1],4) + + " f="+ formula[present - 1] + + ""); + if (present == UNDO_STACK_SIZE) present = 0; + } + protected final static void comment_undo () { + // present ++; if (present == stack_size) present = 0; // This comment is triggered after present was decreased of one unit + out.println(" undo <--| "+ + P.aa(present,s6) + " ("+ P.aa(ViewControls.undo_buffer + 1,s2) +"-1="+ P.aa(ViewControls.undo_buffer,s2) +" /"+ + P.aa(ViewControls.redo_buffer - 1,s2) +"+1="+ P.aa(ViewControls.redo_buffer,s2) +") "+ + P.aa("xyzo ("+ P.aa(x[present],2) +","+ P.aa(y[present],2) +","+ P.aa(z[present],2) +")",12) +" "+ o[present] +" " + + // "from:"+ P.aa(from[present],4) +" to:"+ P.aa(to[present],4) + + " f="+ formula[present] + + ""); + } + protected final static void comment_redo () { + if (present == 0) present = UNDO_STACK_SIZE; + out.println(" redo |--> "+ + P.aa(present,s6) + " ("+P.aa(ViewControls.undo_buffer - 1,s2) +"+1="+ P.aa(ViewControls.undo_buffer,s2) + " /"+ + P.aa(ViewControls.redo_buffer + 1,s2) +"-1="+ P.aa(ViewControls.redo_buffer,s2) +") "+ + P.aa("xyzo ("+ P.aa(x[present - 1],2) +","+ P.aa(y[present - 1],2) +","+ P.aa(z[present - 1],2) +")",12) +" "+ o[present - 1] +" " + + // "from:"+ P.aa(from[present - 1],4) +" to:"+ P.aa(to[present - 1],4) + + " f="+ formula[present - 1] + + ""); + if (present == UNDO_STACK_SIZE) present = 0; + } +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + diff --git a/include/fsm.h b/include/fsm.h index dcea719..b3eaea3 100644 --- a/include/fsm.h +++ b/include/fsm.h @@ -102,10 +102,6 @@ void fsm_tools_list_test(); // def: measure/manage; call: measure/manage; void fsm_rule_trig_measure (int rule_id, int object_id, int measure_id); -// --------------------------------------------------------------- WIP ------ -void fsm_engine_init(); -void fsm_poetic_engine(); - // --------------------------------------------------------------- WIP ------ int fsm_journal_push (journal **jj, int v_value); int fsm_journal_pop (journal **jj); @@ -126,6 +122,3 @@ void fsm_disp_add_chart (disp_list d, int *p_chart); int fsm_disp_get_chart (disp_list d, int from, int to); void fsm_disp_remove_chart (disp_list d, int *p_chart); -// --------------------------------------------------------------- WIP ------ -void fsm_another_proto_engine (); -void *fsm_get_engine_page(); diff --git a/src/fsm/engine/engine.c b/src/fsm/engine/engine.c index 26ecb81..bb1558a 100644 --- a/src/fsm/engine/engine.c +++ b/src/fsm/engine/engine.c @@ -45,61 +45,4 @@ /* */ /******************************************************************************/ -static void listen (struct timespec rem, struct timespec req) -{ - printf("\n\x1b[1F\x1b[2K"); // move to the beginning of previous line and clear it - nanosleep(&req , &rem); -} -static void fsm_strange_engine() -{ - int milliseconds = 100; - struct timespec rem; - struct timespec req= { - (int)(milliseconds / 1000), // secs (Must be Non-Negative) - (milliseconds % 1000) * 1000000 // nano (Must be in range of 0 to 999999999) - }; - - printf("fsm mode_console 😇️ (see@ 'src/engine/engine.c\n"); - - int stop = 0; - while (! stop) { - printf(" | °°°°°°°°°°°°°°°° |"); listen (rem, req); - printf(" | ************* *************|"); listen (rem, req); -// stop = (getchar() == '\n'); - } -} - - -void fsm_engine_init() -{ - if (1) printf ("src/fsm/engine.c | src/fsm/engine.c fsm_engine_init()\n"); - fsm_strange_engine(); - printf("src/fsm/engine.c | src/fsm/engine.c fsm_strange_engine stopped\n"); - //fsm_another_proto_engine(); -} - -static GtkBox *engine_page; -static GtkBox *edit_a_new_engine_box; -static GtkWidget *factory; -static GtkWidget *btt_edit_a_new_engine; - - -void *fsm_get_engine_page() -{ - engine_page = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2)); - edit_a_new_engine_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); - factory = gtk_picture_new_for_filename - ("/home/jean/Gem-Graph/gem-graph-client/data/stamp/factory.png"); - btt_edit_a_new_engine = gtk_toggle_button_new_with_label ("edit a new engine"); - g_signal_connect (btt_edit_a_new_engine, "toggled", - G_CALLBACK (on_start_new_engine), NULL); - - gtk_box_append (edit_a_new_engine_box, GTK_WIDGET (factory)); - gtk_box_append (edit_a_new_engine_box, GTK_WIDGET (btt_edit_a_new_engine)); - gtk_box_append (engine_page, GTK_WIDGET (edit_a_new_engine_box)); - - gtk_widget_set_size_request (GTK_WIDGET (engine_page), 1000, 400); - - return engine_page; - } diff --git a/src/fsm/engine/engine.java b/src/fsm/engine/engine.java deleted file mode 100644 index d810ab5..0000000 --- a/src/fsm/engine/engine.java +++ /dev/null @@ -1,156 +0,0 @@ -package engine; - -import java.lang.System.out; -import measures.MeasuresManager; -import resources.P; -import rule.FormulasManager; -import rule.FormulasManagerAccess; -import session.ViewControls; -import state.StateManager; -import state.StateManagerLocal; -import views.MODEL; -import views.ViewsManagerAccess; - -/* 2020-11 [prototype 0.0] - MonoThread executes a while(true) loop with two instructions: - (1) search a place where a transition can be done - (2) do the transition - - while (true) - if (session.MainView.isStartStopButtonSelected()) - { - state.StateManagerLocal.chooseLocalOrigin(false); - new SingleTransition(true); - } -*/ -public class SingleTransition { - - protected volatile boolean is_done = false; - protected volatile String elapsed; - public SingleTransition (boolean mono) {if (mono) perform_a_transition();} - - private synchronized static final void perform_a_transition() - { - // if (step_by_step) StateManagerLocal.circlePresentState(); - if(ViewControls.isDoSelected()) SingleTransition.execute_do (SingleTransition.prepare_do (false)); - else if(ViewControls.isUndoSelected()) SingleTransition.execute_undo(SingleTransition.prepare_undo(false)); - else if(ViewControls.isRedoSelected()) SingleTransition.execute_redo(SingleTransition.prepare_redo(false)); - // if (ViewControls.undo_buffer < UNDO_STACK_SIZE) ViewControls.setTimeBufferBar(ViewControls.undo_buffer); MainView.addElapsedTime(); - } - public static final int prepare_do (final boolean step_by_step) - { - // ThreadsManager.addCycle(); // {nb_cycles ++;} This cycle can be inefficient if no formula can be applied - selected_formula = FormulasManager.iterateToFindAFormula(); - // if(selected_formula > -1) out.println(" prepare_do "+ state.StateManagerLocal.getInfoDebug()); - return selected_formula; - } - public static final void execute_do (final int formula_key) { // formula.doActions(); out.print(" execute_do: formula key=" + formula_key +" "); - if (formula_key < 0) { if(StateManagerLocal.comment_origins) out.println("execute_do failure: formula key=" + formula_key); return;} - - MeasuresManager.startMeasuringAFormulaEffect(formula_key); // out.println("execute_do formula name = "+ FormulasManager.formula.get(formula_key).name); - FormulasManager.getFormula().get (formula_key) .doActions(); // {for (i = 0; i < action.length; i++) action[i].doAction (); StateManagerLocal.endRule(action_swap, action_name);} - MeasuresManager.endMeasuringAFormulaEffect(formula_key); - writePresentState (formula_key); - present ++; if (present == UNDO_STACK_SIZE) present = 0; // MainView.setStartStopButtonSelected(false);// if (present == 1); {MainView.setStartStopButtonSelected(false); } //out.println("MonoThread.execute_do > stop ! (present == 1)"); - ViewControls .execDo(); - doRepaint(); - if (DO_UNDO_REDO_comment) comment_do(formula_key); // if (MonoThreadTest.present == 12) MainView.setStartStopButtonSelected(false); - } - public static final int prepare_undo (final boolean step_by_step) { // MonoThreadTest.present --; return MonoThreadTest. f [MonoThreadTest.present]; - if (ViewControls.isUndoBufferEmpty()) {out.println("prepare_undo stop !");} // undo_buffer is always >= 0 - else {present --; if (present == -1) present = UNDO_STACK_SIZE -1; ViewControls.execUndo();} - final int formula_key = readPresentState(step_by_step); - // if (step_by_step) StateManagerLocal.circlePresentState(); - return formula_key; - } - public static final void execute_undo (final int formula_key) { // formula.unDoActions(); {for (i = 0; i < action.length; i++) ...} - FormulasManager.getFormula().get (formula_key) .unDoActions(); // {for (i = 0; i < action.length; i++) action[i].doAction (); StateManagerLocal.endRule(action_swap, action_name);} - ViewControls.setRedoSelected(); - // StateManagerLocal.circlePresentState(); - // ThreadsManager.removeEfficientCycle(); // {nb_effective_cycles --;} - doRepaint(); - if (DO_UNDO_REDO_comment) comment_undo(); - } - public static final int prepare_redo (final boolean step_by_step) { // return MonoThreadTest. f [MonoThreadTest.present]; - final int formula_key = readPresentState(step_by_step); - // ThreadsManager.addEfficientCycle(); // {nb_effective_cycles ++;} - // if (step_by_step) StateManagerLocal.circlePresentState(); - return formula_key; - } - public static final void execute_redo (final int formula_key) { // formula.doActions(); {for (i = 0; i < action.length; i++) ...} - // the redo_buffer is always >= 0 (if the re_do buffer is empty, the re_do button is deactivated) - if (! ViewControls.isRedoBufferEmpty()) { - FormulasManager.getFormula().get (formula_key).doActions(); // {for (i = 0; i < action.length; i++) action[i].doAction (); StateManagerLocal.endRule(action_swap, action_name);} - present ++; if (present == UNDO_STACK_SIZE) present = 0; - ViewControls.execRedo(); - } - ViewControls.setUndoSelected(); - doRepaint(); - if (DO_UNDO_REDO_comment) comment_redo(); - } - public final static void writePresentState (final int formula_key) { // x [present] = StateManagerLocal.local_space_origin_X; ... - - formula [present] = (short) formula_key; - o [present] = (byte) StateManagerLocal.getReferenceOrientation_1(); - switch(StateManager.space_dimension) { - case THREE: z [present] = (byte) StateManagerLocal.local_space_origin_Z; // no break; - case TWO: y [present] = (byte) StateManagerLocal.local_space_origin_Y; // no break; - case ONE: x [present] = (byte) StateManagerLocal.local_space_origin_X; // no break; - default:;} - } - private final static int readPresentState (final boolean step_by_step) { // StateManagerLocal.local_space_origin_X = x [present]; ... - - switch(StateManager.space_dimension) { - case THREE : StateManagerLocal.local_space_origin_Z = z [present]; // no break - case TWO : StateManagerLocal.local_space_origin_Y = y [present]; // no break - case ONE : StateManagerLocal.local_space_origin_X = x [present]; // no break; - default:;} - StateManagerLocal.setReferenceOrientation_1 (o [present]); - return formula[present]; - } - private final static void doRepaint() {ViewsManagerAccess.getView(MODEL.SPACE, "MonoThread.execute_do_undo_redo()").repaint(); } - public static int selected_formula; - public static int present = 0; - public final static int UNDO_STACK_SIZE = 3000; // resources.Parameters.UNDO_STACK_SIZE; // This parameter is also used by ViewControls to display the BufferProgressBarValue - protected final static short[] formula = new short [UNDO_STACK_SIZE]; - protected final static byte[] x = new byte [UNDO_STACK_SIZE]; - protected final static byte[] y = new byte [UNDO_STACK_SIZE]; - protected final static byte[] z = new byte [UNDO_STACK_SIZE]; - protected final static byte[] o = new byte [UNDO_STACK_SIZE]; - private final static byte s6 = 6, s2 = 2; - public final static boolean DO_UNDO_REDO_comment = false; // true false - protected final static void comment_do (int rank) - { - if (present == 0) present = UNDO_STACK_SIZE; - out.println(" do -----> "+ - P.aa(present,s6) + " ("+ P.aa(ViewControls.undo_buffer - 1,s2) +"+1="+ P.aa(ViewControls.undo_buffer,s2) +" /"+ - P.aa(ViewControls.redo_buffer,s2) +" -"+ P.aa(ViewControls.redo_buffer,s2) +") "+ - P.aa("xyzo ("+ P.aa(x[present - 1],2) +","+ P.aa(y[present - 1],2) +","+ P.aa(z[present - 1],2) +")",12) +" "+ o[present - 1] +" " + - // "from:"+ P.aa(from[present - 1],4) +" to:"+ P.aa(to[present - 1],4) + - " f="+ formula[present - 1] + - ""); - if (present == UNDO_STACK_SIZE) present = 0; - } - protected final static void comment_undo () { - // present ++; if (present == stack_size) present = 0; // This comment is triggered after present was decreased of one unit - out.println(" undo <--| "+ - P.aa(present,s6) + " ("+ P.aa(ViewControls.undo_buffer + 1,s2) +"-1="+ P.aa(ViewControls.undo_buffer,s2) +" /"+ - P.aa(ViewControls.redo_buffer - 1,s2) +"+1="+ P.aa(ViewControls.redo_buffer,s2) +") "+ - P.aa("xyzo ("+ P.aa(x[present],2) +","+ P.aa(y[present],2) +","+ P.aa(z[present],2) +")",12) +" "+ o[present] +" " + - // "from:"+ P.aa(from[present],4) +" to:"+ P.aa(to[present],4) + - " f="+ formula[present] + - ""); - } - protected final static void comment_redo () { - if (present == 0) present = UNDO_STACK_SIZE; - out.println(" redo |--> "+ - P.aa(present,s6) + " ("+P.aa(ViewControls.undo_buffer - 1,s2) +"+1="+ P.aa(ViewControls.undo_buffer,s2) + " /"+ - P.aa(ViewControls.redo_buffer + 1,s2) +"-1="+ P.aa(ViewControls.redo_buffer,s2) +") "+ - P.aa("xyzo ("+ P.aa(x[present - 1],2) +","+ P.aa(y[present - 1],2) +","+ P.aa(z[present - 1],2) +")",12) +" "+ o[present - 1] +" " + - // "from:"+ P.aa(from[present - 1],4) +" to:"+ P.aa(to[present - 1],4) + - " f="+ formula[present - 1] + - ""); - if (present == UNDO_STACK_SIZE) present = 0; - } -} - diff --git a/src/fsm/engine/poetry.c b/src/fsm/engine/poetry.c deleted file mode 100644 index 9023231..0000000 --- a/src/fsm/engine/poetry.c +++ /dev/null @@ -1,90 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * -* * -* Gem-graph client * -* Finite State Machine Engine * -* ... a little touch of poetry ... * -* * -* Copyright © 2024 Jean Sirmai * -* * -* This file is part of Gem-graph and of the dreams it may reveal. * -* * -* This program is free software: you can redistribute it and/or modify it * -* under the terms of the GNU Affero General Public License * -* as published by the Free Software Foundation, * -* either version 3 of the License, * -* or (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; * -* without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. * -* See the GNU Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with this program. If not, see . * -* * -* * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include -#include -#include "../../../include/fsm.h" - - -/******************************************************************************/ -/* */ -/* OOOOOOOOOOO OOOOO OOO OOO */ -/* OO OO OO OOOO OOOO */ -/* OO OO OO OO OO OO */ -/* OOOOOO OO OO OO OO OO */ -/* OO OO OO OOO OO */ -/* OO OO OO OO */ -/* OO OO OOO OO OO */ -/* OO OOOOOO OO OO */ -/* */ -/******************************************************************************/ - -void fsm_poetic_engine() // 2024-08-31 -{ - int milliseconds = 100; - struct timespec rem; - struct timespec req= { - (int)(milliseconds / 1000), /* secs (Must be Non-Negative) */ - (milliseconds % 1000) * 1000000 /* nano (Must be in range of 0 to 999999999) */ - }; - while (true) { - printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | DO * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | D=-O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | D=-- -O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | =- - - O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | -- O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | - O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | O*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | (*O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | (*) O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | (*) O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | (*) O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | O . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | O . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | D . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | D- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | D =- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | D = --- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | D =-- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | D=- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - printf(" | D- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - } -} diff --git a/src/fsm/engine/to_name.c b/src/fsm/engine/to_name.c deleted file mode 100644 index dd3104a..0000000 --- a/src/fsm/engine/to_name.c +++ /dev/null @@ -1,78 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * -* * -* Gem-graph client * -* Finite State Machine Engine * -* * -* Copyright © 2024 Libre en Communs * -* Copyright © 2024 Jean Sirmai * -* * -* This file is part of Gem-graph. * -* * -* This program is free software: you can redistribute it and/or modify it * -* under the terms of the GNU Affero General Public License * -* as published by the Free Software Foundation, * -* either version 3 of the License, * -* or (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; * -* without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. * -* See the GNU Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with this program. If not, see . * -* * -* * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include -#include -#include "../../../include/fsm.h" - - -/******************************************************************************/ -/* */ -/* OOOOOOOOOOO OOOOO OOO OOO */ -/* OO OO OO OOOO OOOO */ -/* OO OO OO OO OO OO */ -/* OOOOOO OO OO OO OO OO */ -/* OO OO OO OOO OO */ -/* OO OO OO OO */ -/* OO OO OOO OO OO */ -/* OO OOOOOO OO OO */ -/* */ -/******************************************************************************/ - -static int l = 196; -static char t[200]; // = {'|',' ','-',' ','|',' ','-',' ','|',' ','-',' ','|',' ','-',' ','|'}; - -static void init() -{ - for (int i = 0; i < l; i++) { - if (i % 4 == 0) t[i] = 'O'; - if (i % 4 == 1) t[i] = ' '; - if (i % 4 == 2) t[i] = '-'; - if (i % 4 == 3) t[i] = ' '; - } -} - -static void console() -{ - int milliseconds = 100; - struct timespec rem; - struct timespec req= { - (int)(milliseconds / 1000), /* secs (Must be Non-Negative) */ - (milliseconds % 1000) * 1000000 /* nano (Must be in range of 0 to 999999999) */ - }; - printf("\n> "); - for (int i = 0; i < l; i++) printf("%c", t[i]); - printf("<\n\x1b[1F\x1b[2K"); - nanosleep(&req , &rem); -} - -void fsm_another_proto_engine () -{ - init(); - console(); -} - diff --git a/src/signal.c b/src/signal.c index 98c3125..2498c40 100644 --- a/src/signal.c +++ b/src/signal.c @@ -366,17 +366,8 @@ void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrol void on_clicked_topbar_right_measure (GtkWidget *btt, gpointer data) { // fsm_measures_sorted_list_do something (); - -// 2024-09-03 - experimental area - -// j'essaie d'interagir avec l'affichage console -// widget_get_measure_page() < demeure intact (valide) -// pour revenir en arrière, -// il n'y a qu'à remplacer fsm_get_engine_page() -// par widget_get_measure_page() dans l'instruction suivante. - gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()), - // GTK_WIDGET (widget_get_measure_page())); - GTK_WIDGET (fsm_get_engine_page())); + GTK_WIDGET (widget_get_measure_page())); } void on_start_new_measure (GtkWidget *btt, gpointer data) @@ -463,10 +454,3 @@ void on_measure_third_event_occurences_in_between (GtkWidget *btt, gpointer data GTK_WIDGET (widget_measure_third_event_occurences_in_between())); } -void on_start_new_engine (GtkWidget *btt, gpointer data) -{ - printf("src/signal.c | on_start_new_engine() > fsm_engine_init();\n"); - fsm_engine_init(); -} - - diff --git a/src/widget/topbar/left.c b/src/widget/topbar/left.c index 8fb1762..bff4d08 100644 --- a/src/widget/topbar/left.c +++ b/src/widget/topbar/left.c @@ -85,7 +85,6 @@ void window_design_topbar_left (GtkWidget *header_bar) #define YOU_WANT_TO_START_ON_ANOTHER_PAGE 0 -#define YOU_DON_T_WANT_THE_MODE_CONSOLE 0 /******************************************************************************/ /* use the next lineS to select the page that will be presented first */ /* it triggers <=> signal.on_toggle_state_rule_data (a btt_NAME) */ @@ -93,7 +92,6 @@ void window_design_topbar_left (GtkWidget *header_bar) /* the last one is the winner (and the winner takes it all !...) */ /* THE LAST ONE IS THE WINNER (AND THE WINNER TAKES IT ALL !...) */ /******************************************************************************/ - if (YOU_DON_T_WANT_THE_MODE_CONSOLE) gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_synth()), TRUE); if (YOU_WANT_TO_START_ON_ANOTHER_PAGE) { // select one gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_rules()), TRUE);