Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
5a89751
make re2c
let-def Apr 16, 2026
9b7af8e
Document engine.h
let-def Mar 29, 2026
577bb54
WIP Documentation
let-def Mar 29, 2026
4419657
Refactor frontend (WIP)
let-def Mar 22, 2026
d80f44e
Add fd_poll abstraction for synchronizing read events.
let-def Mar 22, 2026
10d1f7d
Prepare event management for fd_poll abstraction
let-def Mar 22, 2026
d6a5007
Printf-debugging for fd_poll
let-def Mar 22, 2026
e2857d5
Replace ad-hoc poll thread by fd_poll
let-def Mar 22, 2026
a84c931
Event-based stdin processing
let-def Mar 22, 2026
60c3bfe
Remove custom logic for double clicks, use SDL
let-def Mar 22, 2026
3f7b94b
reload -> hotload
let-def Mar 22, 2026
fd299a7
Remove need_synctex
let-def Mar 22, 2026
1d81c38
Cleanup work advance logic
let-def Mar 22, 2026
e6e1faf
Cleanup rendering loop
let-def Mar 23, 2026
371165b
WIP Refactor current page management
let-def Mar 23, 2026
4f7e9d9
Import multipage buffering and positioning code
let-def Mar 25, 2026
4994995
Document multipage header
let-def Mar 25, 2026
7549b0f
Cleanup multipage
let-def Mar 25, 2026
1faae07
Add pagebuffer abstraction
let-def Mar 26, 2026
5927133
WIP: New renderer
let-def Mar 26, 2026
e244301
multipage -> pagecollection
let-def Mar 30, 2026
2f5c69f
psum -> prefixsum
let-def Mar 30, 2026
a8aa616
Import new viewer code
let-def Mar 30, 2026
4e247be
WIP: Using new viewer abstraction
let-def Mar 30, 2026
a979987
Remove some-printf debugging
let-def Mar 30, 2026
32abdee
Fix page range processing
let-def Mar 30, 2026
aed378d
Fixup processing
let-def Mar 30, 2026
e03ab15
Remove deadcode from old viewer
let-def Mar 30, 2026
38f9f0d
Sleep only if document does not need advancing
let-def Mar 30, 2026
ca7f071
Lazier target page computation.
let-def Mar 30, 2026
324996b
Refactor type names
let-def Mar 30, 2026
2b2a5e9
Document engine
let-def Mar 31, 2026
581663b
dvi_reshooks -> dvi_resloader (resource loader)
let-def Mar 31, 2026
510ddfc
viewer: fast coordinate conversion
let-def Mar 31, 2026
7bb0e3d
Reimplement scroll to source coordinates.
let-def Mar 31, 2026
eb0c242
Simplify code.
let-def Mar 31, 2026
6ee6bcd
Implement horizontal scrolling too
let-def Mar 31, 2026
9780671
Experiment: detect and return clicks
let-def Mar 31, 2026
7a6b076
slop: cleanup clicks
let-def Mar 31, 2026
f11e6dc
scrolling higher is more pleasant
let-def Mar 31, 2026
d57bc25
viewer: bound margins by window size
let-def Apr 1, 2026
75ecb35
Tweak scrolling tolerance
let-def Apr 1, 2026
cfea575
Reimplement theming / color filtering
let-def Apr 1, 2026
50b4266
Reimplement theme / invert hotkey.
let-def Apr 1, 2026
b8b409c
Flush delayed changes after page update
let-def Apr 2, 2026
329e52a
main: initialize ui state
let-def Apr 7, 2026
7e7c839
theming logic: swapped bg (white point) and fg (black point)
let-def Apr 7, 2026
0d4fa16
Tweak synctex tracking and movement logic
let-def Apr 15, 2026
0edbeff
fix tests (proper handling of initialize_only)
let-def Apr 16, 2026
8202e63
dvi: fix loading of local fonts
let-def Apr 28, 2026
b568dcb
Tentative restart
let-def Apr 28, 2026
c570b7e
Fix synctex forwarding
let-def Apr 29, 2026
eaa94e6
Refactor synctex_scan
let-def Apr 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/common/texlive_provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static struct cell *lookup(struct table *table, const char *key)
static void grow(struct table *table)
{
if (LOG)
printf("growing table\n");
fprintf(stderr, "growing table\n");
struct cell *ocells = table->hash.cells;
int count = cell_count(table);

Expand Down Expand Up @@ -156,14 +156,14 @@ static const char *find(struct table *table, const char *key)
if (c->offset == 0)
{
if (LOG)
printf("find: %s not found\n", key);
fprintf(stderr, "find: %s not found\n", key);
return NULL;
}
const char *p = &table->entries.buffer[c->offset];
while (p[-1] != '\0')
p--;
if (LOG)
printf("find: %s found\n", key);
fprintf(stderr, "find: %s found\n", key);
return p;
}

Expand Down Expand Up @@ -274,7 +274,7 @@ static void add(struct table *table,
if (!has_dot)
{
if (0)
printf("add: skipping %s/%s/%s\n (no dot: assuming it is a directory)\n",
fprintf(stderr, "add: skipping %s/%s/%s\n (no dot: assuming it is a directory)\n",
root, dir, name);
return;
}
Expand All @@ -286,12 +286,12 @@ static void add(struct table *table,
while (p[-1])
p -= 1;
if (rank(p, root, dir))
printf("add: %s/%s/%s shadows previous binding\n (already having: %s)\n",
fprintf(stderr, "add: %s/%s/%s shadows previous binding\n (already having: %s)\n",
root, dir, name, p);
else
{
if (LOG)
printf("add: skipping %s/%s/%s\n (already having: %s)\n", root, dir,
fprintf(stderr, "add: skipping %s/%s/%s\n (already having: %s)\n", root, dir,
name, p);
return;
}
Expand All @@ -300,7 +300,7 @@ static void add(struct table *table,
{
table->hash.count += 1;
if (LOG)
printf("add: adding %s\n", name);
fprintf(stderr, "add: adding %s\n", name);
}

int rlen = strlen(root);
Expand All @@ -312,7 +312,7 @@ static void add(struct table *table,
if (table->entries.cap < tlen)
{
if (LOG)
printf("add: growing buffer\n");
fprintf(stderr, "add: growing buffer\n");
while (table->entries.cap < tlen)
table->entries.cap *= 2;
table->entries.buffer = realloc(table->entries.buffer, table->entries.cap);
Expand Down Expand Up @@ -351,7 +351,7 @@ static void process_line(struct table *table, char *path)
if (!f)
{
perror("Cannot open file");
printf("File: %s\n", path);
fprintf(stderr, "File: %s\n", path);
return;
}

Expand Down Expand Up @@ -449,7 +449,7 @@ static bool list_texlive_files(void)
{
if (LOG)
{
printf("Retrieved line of length %zd:\n", len);
fprintf(stderr, "Retrieved line of length %zd:\n", len);
fwrite(line, len, 1, stdout);
}

Expand All @@ -469,7 +469,7 @@ static bool list_texlive_files(void)
if (ret == -1)
perror("pclose");
else if (ret > 0)
printf("Exit code: %d\n", ret);
fprintf(stderr, "Exit code: %d\n", ret);
else
loaded = 1;

Expand Down
4 changes: 2 additions & 2 deletions src/dvi/dvi_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@

#include "mydvi.h"

dvi_context *dvi_context_new(fz_context *ctx, dvi_reshooks hooks)
dvi_context *dvi_context_new(fz_context *ctx, dvi_resloader loader)
{
dvi_context *dc = fz_malloc_struct(ctx, dvi_context);

dc->dev = NULL;
dc->resmanager = dvi_resmanager_new(ctx, hooks);
dc->resmanager = dvi_resmanager_new(ctx, loader);
dvi_scratch_init(&dc->scratch);

dvi_state *st = &dc->root;
Expand Down
28 changes: 14 additions & 14 deletions src/dvi/dvi_resmanager.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct cell_image {
};

struct dvi_resmanager {
dvi_reshooks hooks;
dvi_resloader loader;
cell_dvi_font *first_dvi_font;
cell_tex_enc *first_tex_enc;
cell_pdf_doc *first_pdf_doc;
Expand Down Expand Up @@ -233,10 +233,10 @@ tectonic_hooks_open_file(fz_context *ctx, void *env, dvi_reskind kind, const cha
return result;
}

dvi_reshooks dvi_tectonic_hooks(fz_context *ctx, const char *document_dir)
dvi_resloader dvi_tectonic_loader(fz_context *ctx, const char *document_dir)
{
char *path = fz_strdup(ctx, document_dir ? document_dir : "");
return (dvi_reshooks){
return (dvi_resloader){
.env = path,
.free_env = default_hooks_free_env,
.open_file = tectonic_hooks_open_file,
Expand Down Expand Up @@ -282,7 +282,7 @@ texlive_hooks_open_file(fz_context *ctx, void *env, dvi_reskind kind, const char
break;

case RES_FONT:
if (name[0] == '/' || name[0] == '.')
if (strchr(name, '/'))
{
path = (char *)name;
break;
Expand Down Expand Up @@ -375,29 +375,29 @@ texlive_hooks_open_file(fz_context *ctx, void *env, dvi_reskind kind, const char
return result;
}

dvi_reshooks dvi_texlive_hooks(fz_context *ctx, const char *document_dir)
dvi_resloader dvi_texlive_loader(fz_context *ctx, const char *document_dir)
{
char *path = fz_strdup(ctx, document_dir ? document_dir : "");
return (dvi_reshooks){
return (dvi_resloader){
.env = path,
.free_env = default_hooks_free_env,
.open_file = texlive_hooks_open_file,
};
}

void dvi_free_hooks(fz_context *ctx, const dvi_reshooks *hooks)
void dvi_free_loader(fz_context *ctx, const dvi_resloader *loader)
{
if (hooks->free_env)
hooks->free_env(ctx, hooks->env);
if (loader->free_env)
loader->free_env(ctx, loader->env);
}


static fz_stream *dvi_resmanager_open_file(fz_context *ctx, dvi_resmanager *rm, dvi_reskind kind, const char *path)
{
if (!rm->hooks.open_file)
if (!rm->loader.open_file)
return NULL;

return rm->hooks.open_file(ctx, rm->hooks.env, kind, path);
return rm->loader.open_file(ctx, rm->loader.env, kind, path);
}

static void load_fontmap(fz_context *ctx, dvi_resmanager *rm)
Expand Down Expand Up @@ -428,15 +428,15 @@ static void load_fontmap(fz_context *ctx, dvi_resmanager *rm)
fz_try_rethrow(ctx);
}

dvi_resmanager *dvi_resmanager_new(fz_context *ctx, dvi_reshooks hooks)
dvi_resmanager *dvi_resmanager_new(fz_context *ctx, dvi_resloader loader)
{
dvi_resmanager *rm = fz_malloc_struct(ctx, dvi_resmanager);
rm->first_dvi_font = NULL;
rm->first_tex_enc = NULL;
rm->first_pdf_doc = NULL;
rm->first_fz_font = NULL;
rm->first_image = NULL;
rm->hooks = hooks;
rm->loader = loader;

load_fontmap(ctx, rm);

Expand All @@ -445,7 +445,7 @@ dvi_resmanager *dvi_resmanager_new(fz_context *ctx, dvi_reshooks hooks)

void dvi_resmanager_free(fz_context *ctx, dvi_resmanager *rm)
{
dvi_free_hooks(ctx, &rm->hooks);
dvi_free_loader(ctx, &rm->loader);

if (rm->map)
{
Expand Down
Loading
Loading