Para que veais que no estoy parado. Ando trabajando en el programa xemc; una interfaz grafica, aunque no lo parezca, tal que asi:

Al ser tan simple, se puede uno concentrar en lo importante.........los mecanismos internos.
Los siguiente es un mero avance del tema. No esta terminado ni de lejos y, tal como lo pongo, no vale para nada de nada............pero todo se andara.
Insisto............paciencia
*******************************************************************************************************************
XEMC como ejemplo de una GUI para EMC/LinuxCNC.
La GUI xemc fue originariamente escrita por "los padres fundadores" Proctor y Shackleford y adaptada a emc2 por Alex Joni. Contrariamente a la GUI's mas "modernas", esta escrita en C++ y utiliza las API's de X11 (X Toolkit), tambien en C/C++, para el interface grafico. Con ello, se evita tener que "lidiar" con mas de un lenguaje a la hora de "descifrar matrix"..aaaahhhhggg....
Ficheros de cabecera incluidos:
Estandar:
ctype.h // tipos caracter
fcntl.h // file control options. O_CREAT(Create file if it does not exist.)
inttypes.h // fixed size integer types.
limits.h // DBL_MAX, maybe
stdarg.h // handle variable argument list
stdint.h // integer types
stdio.h // standard buffered input/output
stdlib.h // standard library definitions
string.h // string operations
sys/stat.h // data returned by the stat() function struct stat, stat()
unistd.h // standard symbolic constants and types
values.h // Old compatibility names for <limits.h> and <float.h> constants. DBL_MAX, maybe.
Especificos:
rcs.hh // should be included with NML, CMS, libnml function.etime()
emc.hh // Declarations for EMC NML vocabulary
emc_nml.hh // Declarations for EMC NML vocabulary
emcglb.h // EMC_NMLFILE, TRAJ_MAX_VELOCITY, TOOL_TABLE_FILE. Declarations for EMC NML vocabulary
emccfg.h // DEFAULT_TRAJ_MAX_VELOCITY Declarations for globals found in emcglb.c
inifile.hh // INIFILE Declarations for INI file format functions
rcs_print.hh
nml_oi.hh // Defines Generic NML Message structures used to log errors and
interact with an Operator Interface from within an NML_MODULE.
timer.hh // A TIMER object lets you wait on the expiration of a cyclic
period, to the resolution of the system clock.
Cabeceras para X Toolkit:
Include <X11/Intrinsic.h> in your application programs. This header file automatically includes <X11/Xlib.h>, so all Xlib functions also are defined. It may also be necessary to include <X11/StringDefs.h > when setting up argument lists, as many of the XtNsome-thing definitions are only defined in this file.
X11/Intrinsic.h /* Intrinsics Definitions */
X11/StringDefs.h /* Standard Name-String definitions */
Widget: Objeto que proporciona una abstracción de interfaz de usuario (por ejemplo, un widget de barra de desplazamiento).
https://www.x.org/releases/X11R7.5/doc/libXaw/widgets.pdfCabeceras para widgets, todas en X11/Xaw/ (X Athena widgets):
Form.h //widget can contain an arbitrary number of children or subwidgets
Box.h // geometry management of arbitrary widgets in a box of a specified dimension.
Command.h // ‘‘push buttons.’’
Label.h // graphic displayed within a rectangular region of the screen
AsciiText.h // Text widget
MenuButton.h // pop up the menu named in the menuName resource
SimpleMenu.h // container for the menu entries
SmeBSB.h // reate a menu entry that contains a string, and optional bitmaps
SmeLine.h // add a horizontal line or menu separator to a menu.
Dialog.h // prompt for auxiliary input from a user.
Canales NML:
static *emcCommandBuffer, Clase RCS_CMD_CHANNEL
static *emcStatusBuffer, Clase RCS_STAT_CHANNEL
*emcStatus, Clase EMC_STAT
static *emcErrorBuffer, Clase NML
static char error_string[NML_ERROR_LEN] = "" (macro, 256)
static int emcCommandSerialNumber = 0;
the current command numbers, set up updateStatus(), used in main()
// forward decls for error popup
static void errorReturnAction(Widget w, XEvent *event, String *params, Cardinal *num_params);
static void errorDoneCB(Widget w, XtPointer client_data, XtPointer call_data);
static int createErrorShell();
creates a fresh error dialog widget
static int destroyErrorShell();
destruye un error dialog widget.
static void popupError(const char *fmt, …)__attribute__((format(printf,1,2)));
¿¿ widget Dialogo de error?
// forward decl for quit() function
static void quit();
// clean up NML buffers. // get rid of program file window string.
…..............Para continuar.......
Pseudo código.
Un pseudocodigo es una especie de “programa del programa” escrito en lenguaje 100% humano. Algo así como el plano del futuro programa, independiente del lenguaje de programacion escogido
Aqui va el pseudocodigo para la interfase de usuario xemc. Es una interfase limitada (solo 3 ejes), antigua y con acceso a librerias hoy obsoletas (aunque aun soportadas y funcionales) en Linux. El tabulado es MUY IMPORTANTE. Da el nivel de profundidad de ejecucion de cada uno de los pasos. Por ejemplo:
Si llueve
decidir si paraguas o impermeable
Si paraguas, terminar el proceso de decisión. Ir a listo:
En caso contrario (impermeable)
¿esta en el perchero?
No esta en el perchero
se fuerza paraguas. Ir a listo:
Si, esta en el perchero
Cogerlo
ir a listo:
listo:
Hala, a la calle a mojarse
La verdadera fiesta en xemc, como en todo programa C/C++, esta en la función main():
int main(int argc, char **argv)
Varias definiciones de variables locales, a saber:
t; contador en bucles
start; hora en el arranque

good; bandera (0/1)
string[80];
Varias de tipo Dimension (def. en intrinsic.h)
De tipo Font (tipo XID) (en X.h), posfont
****** PROCESADO DE LA LINEA DE COMANDOS
Procesar la linea de comandos con emcGetArgs()
Si error en linea de comandos
mensaje con rcs_print_error()
salida al sistema con status 1. Fin de la fiesta
****** PROCESADO DEL INI
Cargar y procesar fichero ini con iniLoad()
Varias definiciones de variables:
machine: nombre de la maquina cnc
version: version linuxcnc
displayString: cadena generica
Crear instancia inifile de clase IniFile (en inifile.hh)
Definicion de variables locales
Abrir ini con metodo inifile.Open() (en inifile.cc) . Si falla →
retornar -1
Buscar entrada MACHINE en seccion EMC (ver ini) con inifile.Find()
Si existe, copiar nombre en “machine”
Buscar entrada VERSION en seccion EMC (ver ini) con inifile.Find()
Si existe, mostrar maquina cnc y version linuxcnc
Buscar entrada DEBUG en seccion EMC (ver ini) con inifile.Find()
Si DEBUG, copiar valor en emc_debug (definida en emcglb.c)
Si no DEBUG, emc_debug = 0
Buscar entrada NML_FILE en seccion EMC (ver ini) con inifile.Find()
Si NML_FILE, copiarlo en emc_nmlfile (definida en emcglb.c)
Si no NML_FILE, emc_nmlfile por defecto (linuxcnc.nml)
Buscar entrada TOOL_TABLE en seccion EMCIO con inifile.Find()
Si TOOL_TABLE, copiarlo en tool_table_file
Si no TOOL_TABLE, tool_table_file=tool.tbl, por defecto
Buscar entrada PARAMETER_FILE en seccion RS274NGC con inifile.Find()
Si PARAMETER_FILE, copiarlo en PARAMETER_FILE
Si no PARAMETER_FILE, PARAMETER_FILE = rs274ngc.var
.
.
.
Asi con....(“entrada”, “seccion”)
"DEFAULT_VELOCITY", "TRAJ"
hacer jogSpeed = (traj_default_velocity * 60.0) + 0.5
"MAX_VELOCITY", "TRAJ"
hacer maxJogSpeed = (traj_max_velocity * 60.0) + 0.5;
"HELP_FILE", "DISPLAY"
"PROGRAM_PREFIX", "DISPLAY"
"PROGRAM_PREFIX", "TASK" (???no se especifica en documentacion)
"POSITION_OFFSET", "DISPLAY" (MACHINE, RELATIVE o ???ignorar)
"POSITION_FEEDBACK", "DISPLAY" (ACTUAL, COMMANDED)
"JOGGING_POLARITY”,”AXIS_0”

? No se encuentra JOGGING_POLARITY en documentacion) igual para AXIS_1 y AXIS_2. Xemc solo admite tres ejes.
"MAX_FEED_OVERRIDE", "DISPLAY"
"INPUT_SCALE", "AXIS_0"
Cerrar fichero ini con metodo inifile.Close()
Retornar 0
******* VERIFICACION DE FUNCIONAMIENTO DE MENSAJES NML
Definir RETRY_TIME=10.0 RETRY_INTERVAL=1.0 (segundos)
Si no se ha activado debug, inhibir mensajes de diagnostico
Inicializa variable start (posiblemente con la hora actual en arranque)
Inicializa bandera good = 0
Hacer en bucle do-while mientras no se alcance el valor RETY_TIME
emcTaskNmlGet() (intenta conectar a canales command y status de nml)
Si retorna 0, bandera good=1, ir a fin del bucle:
Si no se ha consumido el tiempo RETY_TIME
Detenerse durante RETY_INTERVAL segundos
Repetir bucle
RETY_TIME consumido
Fin del bucle:
Si good = 0
imprimir error con rcs_print_error()
salida al sistema con status 1. Fin de la fiesta
******* VENTANA DE TEXTO
Crear una ventana de PROGRAM_FW_NUM_LINES(10) x PROGRAM_FW_LEN_LINES(80)
Reservar memoria para 10x80 caracteres
Inicializar ventana con fwInit()
Si no éxito
imprimir error
salida al sistema con status 1. Fin de la fiesta
******* WIDGETS GRAFICOS (artilugios varios para ventanas)
Comentario: Los widgets siguen una jerarquia padres-hijos. Los widgets de mayor nivel pueden “albergan” a los de menor. Asi, el widget de mayor nivel, topLevel en este caso, albergara a los demas.
Asignar topLevel, tipo widget, con XtVaAppInitialize de Xt. El widget de mayor nivel.
Asignar topForm, XtVaCreateManagedWidget, llama a XtCreateWidget y XtManageChild.
Asignar barMenuForm, XtVaCreateManagedWidget
…........................ para continuar