ChatGPT and IRIX devlopment
#1
ChatGPT and IRIX devlopment
Curious if anyone had begun to leverage GenAI/prompt engineering for IRIX development.  Could be a good way to get some apps updated.  So far I've had great success in my spare time:

Prompts:

write a small program to compile in IRIX 6.5.22 that includes a motif window
add a log viewer window to the motif example code above
add the ability to open a log file to the program above
add a scroll bar to the log viewer widget
How to resize the window?

Prompts-debug:

there is a compile error in line 31 in this example. A declaration cannot appear after an executable statement in a block. please fix this error.
line 31 is also a declaration after an executable statement and causes a compile error

Code that compiles and runs:

#include <Xm/Xm.h>
#include <Xm/PushB.h>
#include <Xm/RowColumn.h>
#include <Xm/MainW.h>
#include <Xm/Text.h>
#include <Xm/FileSB.h>
#include <Xm/ScrolledW.h>
#include <stdio.h>
#include <stdlib.h>

/* Global log widget */
Widget log_text;

/* Function to append log text */
void append_log(const char *message) {
    XmTextPosition pos = XmTextGetLastPosition(log_text);
    XmTextInsert(log_text, pos, message);
    XmTextInsert(log_text, pos + strlen(message), "\n");
}

/* Function to read a log file and display its contents */
void load_log_file(const char *filename) {
    char buffer[256];
   
    FILE *file = fopen(filename, "r");
    if (!file) {
        append_log("Error: Could not open the file.");
        return;
    }

    /* Clear the current text in the log viewer */
    XmTextSetString(log_text, "");

    /* Read the file line by line and append it to the log text */
    while (fgets(buffer, sizeof(buffer), file)) {
        append_log(buffer);
    }

    fclose(file);
}

/* Callback function for the file selection dialog */
void file_ok_callback(Widget widget, XtPointer client_data, XtPointer call_data) {
    XmFileSelectionBoxCallbackStruct *cbs = (XmFileSelectionBoxCallbackStruct *) call_data;
    char *filename;

    /* Convert the selected file name to a string */
    if (XmStringGetLtoR(cbs->value, XmFONTLIST_DEFAULT_TAG, &filename)) {
        append_log("Loading log file...");
        load_log_file(filename);
        XtFree(filename);
    }
}

/* Callback function for the open file button */
void open_file_callback(Widget widget, XtPointer client_data, XtPointer call_data) {
    Widget file_dialog;

    file_dialog = XmCreateFileSelectionDialog(widget, "file_dialog", NULL, 0);

    XtAddCallback(file_dialog, XmNokCallback, file_ok_callback, NULL);
    XtManageChild(file_dialog);
}

/* Exit button callback */
void exit_callback(Widget widget, XtPointer client_data, XtPointer call_data) {
    append_log("Exit button clicked, exiting application.");
    exit(0);
}

int main(int argc, char *argv[]) {
    XtAppContext app;
    Widget top_wid, main_window, button, open_button, row_col, scrolled_window;

    /* Initialize the X Toolkit */
    top_wid = XtVaAppInitialize(&app, "MotifApp", NULL, 0, &argc, argv, NULL, NULL);

    /* Create a Main Window widget */
    main_window = XtVaCreateManagedWidget("main_window", xmMainWindowWidgetClass, top_wid,
                                          XmNwidth, 600, /* Set initial width */
                                          XmNheight, 400, /* Set initial height */
                                          NULL);

    /* Create a RowColumn widget to hold other widgets */
    row_col = XtVaCreateManagedWidget("row_col", xmRowColumnWidgetClass, main_window,
                                      XmNorientation, XmVERTICAL,
                                      XmNpacking, XmPACK_TIGHT,
                                      XmNresizeWidth, True,
                                      XmNresizeHeight, True,
                                      NULL);

    /* Create a Scrolled Window widget for the log viewer */
    scrolled_window = XtVaCreateManagedWidget("scrolled_window", xmScrolledWindowWidgetClass, row_col,
                                              XmNscrollingPolicy, XmAUTOMATIC,
                                              XmNwidth, 500, /* Optional, for better initial sizing */
                                              XmNheight, 300, /* Optional, for better initial sizing */
                                              XmNresizeWidth, True,
                                              XmNresizeHeight, True,
                                              NULL);

    /* Create the log viewer (XmText widget) */
    log_text = XtVaCreateManagedWidget("log_text", xmTextWidgetClass, scrolled_window,
                                      XmNrows, 10,
                                      XmNcolumns, 50,
                                      XmNeditMode, XmMULTI_LINE_EDIT,
                                      XmNscrollHorizontal, False,
                                      XmNeditable, False,
                                      XmNwordWrap, True,
                                      XmNresizeWidth, True,
                                      XmNresizeHeight, True,
                                      NULL);

    /* Add some initial log message */
    append_log("Application started.");

    /* Create an Open File button */
    open_button = XtVaCreateManagedWidget("Open Log File", xmPushButtonWidgetClass, row_col, NULL);
    XtAddCallback(open_button, XmNactivateCallback, open_file_callback, NULL);

    /* Create an Exit button */
    button = XtVaCreateManagedWidget("Exit", xmPushButtonWidgetClass, row_col, NULL);
    XtAddCallback(button, XmNactivateCallback, exit_callback, NULL);

    /* Realize the widgets (create the window) */
    XtRealizeWidget(top_wid);

    /* Enter the event processing loop */
    XtAppMainLoop(app);

    return 0;
}
(This post was last modified: 10-07-2024, 05:06 PM by jgunnoe.)
jgunnoe
O2

Trade Count: (0)
Posts: 11
Threads: 2
Joined: Apr 2023
Location: Earth
Find Reply
10-07-2024, 05:05 PM
#2
RE: ChatGPT and IRIX devlopment
Mixed success for me.
(keeping in mind I am a beginner)

For example, to glue Obj-C with C, and touches of display postscript, for my nextstep workstation, no idea. It just loops, repeats suggestions, gives completely bizarre ideas from the get-go. It really has no idea of what to do.

On the other hand, I was playing with HP-UX and managed to get a basic SIMD function working with MAX extensions that actually compiled - real life got on the way and I couldn't test.

Some good luck I've had with pasting descriptive documentation and asking for it to give me code examples - the code hardly ever works, but it is always a very good first step.

As expected, the more obscure and documented on the internet your issue is, the worst gpt will be.
Shiunbird
Administrator

Trade Count: (1)
Posts: 553
Threads: 45
Joined: Mar 2021
Location: Czech Republic
Find Reply
10-07-2024, 05:31 PM
#3
RE: ChatGPT and IRIX devlopment
I have considered it but I haven't had the time to sit down and look at anything. I don't think AI generated code is that good anyways or can it be necessarily liberally licensed because you might have your code being trained on something else

I'm the system admin of this site. Private security technician, licensed locksmith, hack of a c developer and vintage computer enthusiast. 

https://contrib.irixnet.org/raion/ -- contributions and pieces that I'm working on currently. 

https://codeberg.org/SolusRaion -- Code repos I control

Technical problems should be sent my way.
Raion
Chief IRIX Officer

Trade Count: (9)
Posts: 4,240
Threads: 533
Joined: Nov 2017
Location: Eastern Virginia
Website Find Reply
10-08-2024, 02:14 AM
#4
RE: ChatGPT and IRIX devlopment
It is a healthy habit to never incorporate anything directly, I think.

But I must say it is helpful.
Shiunbird
Administrator

Trade Count: (1)
Posts: 553
Threads: 45
Joined: Mar 2021
Location: Czech Republic
Find Reply
10-08-2024, 04:07 PM
#5
RE: ChatGPT and IRIX devlopment
Yeah, I get it. I agree. Thanks for the responses. Certainly not advocating wholesale GPT-IT style. I wouldn't (and didn't) subject any of the output to an appsec review. This is for my garage hobbies. Work is where I worry about devsecops and secure coding pipelines/SAST/SCA, as it is a quickly developing field with LLM's/GenAI platforms. Regardless, I do think there may be some opportunity to speed up the cross platform dev time using old/deprecated opensource libraries/toolchains combined with LLM's, etc. I also read an interview that indicated that there are dev teams within NVIDIA that are no longer allowed to write actual code, only use prompt engineering, training the (internal) LLM's to produce products based on their existing code repositories. Cool stuff.
jgunnoe
O2

Trade Count: (0)
Posts: 11
Threads: 2
Joined: Apr 2023
Location: Earth
Find Reply
10-09-2024, 12:05 AM
#6
RE: ChatGPT and IRIX devlopment
NVIDIA very much has what you'd call a "vested interest" in making code-by-ELIZA become A Thing, tho.

Computers: Amiga 1200, DEC VAXStation 4000/60, DEC MicroPDP-11/73
Synthesizers: Roland JX-10/SH-09/MT-32/D-50, Yamaha DX7-II/V50/TX7/TG33/FB-01, Korg MS-20 Mini/ARP Odyssey/DW-8000/X5DR, Ensoniq SQ-80, E-mu Proteus/2, Nord Lead 2, Behringer Model D
commodorejohn
PDP-X

Trade Count: (0)
Posts: 367
Threads: 7
Joined: May 2018
Find Reply
10-09-2024, 12:08 AM
#7
RE: ChatGPT and IRIX devlopment
Hey j, found my work on pcc at least partially. Did you want it before I trash it?

I'm the system admin of this site. Private security technician, licensed locksmith, hack of a c developer and vintage computer enthusiast. 

https://contrib.irixnet.org/raion/ -- contributions and pieces that I'm working on currently. 

https://codeberg.org/SolusRaion -- Code repos I control

Technical problems should be sent my way.
Raion
Chief IRIX Officer

Trade Count: (9)
Posts: 4,240
Threads: 533
Joined: Nov 2017
Location: Eastern Virginia
Website Find Reply
01-10-2025, 06:32 AM
#8
RE: ChatGPT and IRIX devlopment
there's a llama2 implementation that we played with on the discord.

Indigo2 IMPACT  : R10K-195MHz, 1GB RAM, 146GB 15K, CD-ROM, AudioDAT, MaxImpact w/ TRAM.  IRIX 6.5.22

O2 : R12K-400MHz, 1GB RAM, 300GB 15K, DVD-ROM, CRM Graphics, AV1/2 Media Boards & O2 Cam, DV-Link, FPA & SW1600.  IRIX 6.5.30

 : 2 x R14K-600MHz, 6GB RAM, V12 Graphics, PCI Shoebox.  IRIX 6.5.30

IBM  : 7012-39H, 7043-140

chulofiasco
Hardware Junkie

Trade Count: (0)
Posts: 328
Threads: 51
Joined: May 2019
Location: New York, NY
Website Find Reply
01-10-2025, 04:01 PM


Forum Jump:


Users browsing this thread: 1 Guest(s)