<commit_before>#include "fitz.h"
#include "mupdf.h"
#include "muxps.h"
#include "mucbz.h"
#include "pdfapp.h"
#include <ctype.h>

/*
	A useful bit of bash script to call this is:
	for f in ../ghostpcl/tests_private/pdf/forms/v1.3/ *.pdf ; do g=${f%.*} ; echo $g ; win32/debug/mujstest-v8.exe -o $g-%d.png -p ../ghostpcl/ $g.mjs > $g.log 2>&1 ; done

	Remove the space from "/ *.pdf" before running - can't leave that
	in here, as it causes a warning about a possibly malformed comment.
*/

static pdfapp_t gapp;
static int file_open = 0;
static char filename[1024] = "";
static char *scriptname;
static char *output = NULL;
static char *prefix = NULL;
static int shotcount = 0;
static int verbosity = 0;

#define LONGLINE 4096

static char getline_buffer[LONGLINE];

void winwarn(pdfapp_t *app, char *msg)
{
	fprintf(stderr, "warning: %s", msg);
}

void winerror(pdfapp_t *app, char *msg)
{
	fprintf(stderr, "%s", msg);
	exit(1);
}

void winalert(pdfapp_t *app, fz_alert_event *alert)
{
	fprintf(stderr, "Alert %s: %s", alert->title, alert->message);
	switch (alert->button_group_type)
	{
	case FZ_ALERT_BUTTON_GROUP_OK:
	case FZ_ALERT_BUTTON_GROUP_OK_CANCEL:
		alert->button_pressed = FZ_ALERT_BUTTON_OK;<commit_msg>Bug 693392: Add \n to some printfs in mujstest.<commit_after>#include "fitz.h"
#include "mupdf.h"
#include "muxps.h"
#include "mucbz.h"
#include "pdfapp.h"
#include <ctype.h>

/*
	A useful bit of bash script to call this is:
	for f in ../ghostpcl/tests_private/pdf/forms/v1.3/ *.pdf ; do g=${f%.*} ; echo $g ; win32/debug/mujstest-v8.exe -o $g-%d.png -p ../ghostpcl/ $g.mjs > $g.log 2>&1 ; done

	Remove the space from "/ *.pdf" before running - can't leave that
	in here, as it causes a warning about a possibly malformed comment.
*/

static pdfapp_t gapp;
static int file_open = 0;
static char filename[1024] = "";
static char *scriptname;
static char *output = NULL;
static char *prefix = NULL;
static int shotcount = 0;
static int verbosity = 0;

#define LONGLINE 4096

static char getline_buffer[LONGLINE];

void winwarn(pdfapp_t *app, char *msg)
{
	fprintf(stderr, "warning: %s\n", msg);
}

void winerror(pdfapp_t *app, char *msg)
{
	fprintf(stderr, "%s\n", msg);
	exit(1);
}

void winalert(pdfapp_t *app, fz_alert_event *alert)
{
	fprintf(stderr, "Alert %s: %s", alert->title, alert->message);
	switch (alert->button_group_type)
	{
	case FZ_ALERT_BUTTON_GROUP_OK:
	case FZ_ALERT_BUTTON_GROUP_OK_CANCEL:
		alert->button_pressed = FZ_ALERT_BUTTON_OK;
{'fraction_non_alphanumeric': 0.14441747572815533, 'fraction_numerical': 0.01779935275080906, 'mean_word_length': 4.483370288248337, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1829435', 'n_tokens_mistral': 1021, 'n_tokens_neox': 981, 'n_words': 275}