<commit_before>/* Copyright 1986, 1989, 1990, 1995 by Abacus Research and
 * Development, Inc.  All rights reserved.
 */

/* Forward declarations in WindowMgr.h (DO NOT DELETE THIS LINE) */

#include "rsys/common.h"
#include "WindowMgr.h"
#include "OSUtil.h"
#include "MemoryMgr.h"

/* get {C}PORT_... accessors */
#include "rsys/cquick.h"
#include "rsys/wind.h"
#include "rsys/glue.h"

using namespace Executor;

void Executor::C_SetWTitle(WindowPtr w, StringPtr t)
{
    if(!w)
        return;
    PtrToXHand((Ptr)t, (Handle)WINDOW_TITLE(w), (LONGINT)t[0] + 1);

    ThePortGuard guard(MR(wmgr_port));
    WINDOW_TITLE_WIDTH_X(w) = CW(StringWidth(t));

    if(WINDOW_VISIBLE_X(w))
    {
        SetClip(WINDOW_STRUCT_REGION(w));
        ClipAbove((WindowPeek)w);
        WINDCALL(w, wDraw, 0);
    }
}

void Executor::C_GetWTitle(WindowPtr w, StringPtr t)
{
    if(!w)
        /*-->*/ return;
    str255assign(t, STARH(WINDOW_TITLE(w)));
}

WindowPeek Executor::ROMlib_firstvisible(WindowPtr w) /* INTERNAL */
{
    WindowPeek wp;

    for(wp = (WindowPeek)w;
        wp && (!WINDOW_VISIBLE_X(wp)
               || wp == (WindowPeek)MR(LM(GhostWindow)));
        wp = WINDOW_NEXT_WINDOW(wp))
        ;
    return wp;
}

WindowPtr Executor::C_FrontWindow()
{<commit_msg>don't crash on SetWTitle(window, NULL) (Think C seems to do this)<commit_after>/* Copyright 1986, 1989, 1990, 1995 by Abacus Research and
 * Development, Inc.  All rights reserved.
 */

/* Forward declarations in WindowMgr.h (DO NOT DELETE THIS LINE) */

#include "rsys/common.h"
#include "WindowMgr.h"
#include "OSUtil.h"
#include "MemoryMgr.h"

/* get {C}PORT_... accessors */
#include "rsys/cquick.h"
#include "rsys/wind.h"
#include "rsys/glue.h"

using namespace Executor;

void Executor::C_SetWTitle(WindowPtr w, StringPtr t)
{
    if(!w || !t)
        return;
    PtrToXHand((Ptr)t, (Handle)WINDOW_TITLE(w), (LONGINT)t[0] + 1);

    ThePortGuard guard(MR(wmgr_port));
    WINDOW_TITLE_WIDTH_X(w) = CW(StringWidth(t));

    if(WINDOW_VISIBLE_X(w))
    {
        SetClip(WINDOW_STRUCT_REGION(w));
        ClipAbove((WindowPeek)w);
        WINDCALL(w, wDraw, 0);
    }
}

void Executor::C_GetWTitle(WindowPtr w, StringPtr t)
{
    if(!w || !t)
        /*-->*/ return;
    str255assign(t, STARH(WINDOW_TITLE(w)));
}

WindowPeek Executor::ROMlib_firstvisible(WindowPtr w) /* INTERNAL */
{
    WindowPeek wp;

    for(wp = (WindowPeek)w;
        wp && (!WINDOW_VISIBLE_X(wp)
               || wp == (WindowPeek)MR(LM(GhostWindow)));
        wp = WINDOW_NEXT_WINDOW(wp))
        ;
    return wp;
}

WindowPtr Executor::C_FrontWindow()
{
{'fraction_non_alphanumeric': 0.15425940138142746, 'fraction_numerical': 0.01688411358403684, 'mean_word_length': 3.4261460101867574, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4077655', 'n_tokens_mistral': 1068, 'n_tokens_neox': 1000, 'n_words': 196}