Skip to content

Commit

Permalink
In progress
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaurens committed Mar 23, 2024
1 parent 8eaa70b commit bbef3aa
Show file tree
Hide file tree
Showing 16 changed files with 1,070 additions and 596 deletions.
59 changes: 31 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,42 @@ DerivedData/*
build
meson/build

documentation/*
documentation
!document/DoxyFile
!document/Readme.md

.vscode

synctex test files/1/big/1.synctex
synctex test files/1/big/1.pdf

synctex standalone/test_engine/**/*-blx.bib
synctex standalone/test_engine/**/*.1"
synctex standalone/test_engine/**/*.acn
synctex standalone/test_engine/**/*.acr
synctex standalone/test_engine/**/*.alg
synctex standalone/test_engine/**/*.aux
synctex standalone/test_engine/**/*.bbl
synctex standalone/test_engine/**/*.blg
synctex standalone/test_engine/**/*.end
synctex standalone/test_engine/**/*.fdb_latexmk
synctex standalone/test_engine/**/*.glg
synctex standalone/test_engine/**/*.glo
synctex standalone/test_engine/**/*.gls
synctex standalone/test_engine/**/*.idx
synctex standalone/test_engine/**/*.ind
synctex standalone/test_engine/**/*.ilg
synctex standalone/test_engine/**/*.ist
synctex standalone/test_engine/**/*.lof
synctex standalone/test_engine/**/*.log
synctex standalone/test_engine/**/*.lot
synctex standalone/test_engine/**/*.out
synctex standalone/test_engine/**/*.pdf
synctex standalone/test_engine/**/*.run.xml
synctex standalone/test_engine/**/*.sind
synctex standalone/test_engine/**/*.synctex
synctex standalone/test_engine/**/*.synctex.gz
synctex standalone/test_engine/**/*.toc
synctex standalone/test_*/**/*-blx.bib
synctex standalone/test_*/**/*.1"
synctex standalone/test_*/**/*.acn
synctex standalone/test_*/**/*.acr
synctex standalone/test_*/**/*.alg
synctex standalone/test_*/**/*.aux
synctex standalone/test_*/**/*.bbl
synctex standalone/test_*/**/*.blg
synctex standalone/test_*/**/*.end
synctex standalone/test_*/**/*.fdb_latexmk
synctex standalone/test_*/**/*.glg
synctex standalone/test_*/**/*.glo
synctex standalone/test_*/**/*.gls
synctex standalone/test_*/**/*.idx
synctex standalone/test_*/**/*.ind
synctex standalone/test_*/**/*.ilg
synctex standalone/test_*/**/*.ist
synctex standalone/test_*/**/*.lof
synctex standalone/test_*/**/*.log
synctex standalone/test_*/**/*.lot
synctex standalone/test_*/**/*.out
synctex standalone/test_*/**/*.pdf
synctex standalone/test_*/**/*.run.xml
synctex standalone/test_*/**/*.sind
synctex standalone/test_*/**/*.synctex
synctex standalone/test_*/**/*.synctex.gz
synctex standalone/test_*/**/*.toc

test standalone/**/lua_modules/lib/lua
test standalone/**/lua_modules/lib/luarocks/rocks-5.3/luafilesystem
Expand Down
15 changes: 11 additions & 4 deletions man1/synctex.1
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
.Nd command line client tool to support the Synchronize TeXnology available in most TeX engines.
.Sh SYNOPSIS
.Nm
[\fIglobal options\fP] \fIcommand\fP [\fIoptions\fP] [\fIargs\fP]
\fIcommand\fP [\fIglobal options\fP] [\fIoptions\fP] [\fIargs\fP]
.Sh OVERVIEW
The Synchronization TeXnology is a feature of recent TeX engines.
The Synchronization TeXnology is a feature of most TeX engines.
It allows one to synchronize between input and output,
which means to navigate from the source document to the typeset material
and vice versa.
Expand Down Expand Up @@ -40,10 +40,17 @@ Notice that LuaTeX option is `--synctex=NUMBER' with two dashes.
.Sh AUTHOR
The Synchronize TeXnology is essentially due to Jerome Laurens,
with useful suggestions by some well known actors of the TeX world.
In the TeX engines that support it (e-TeX, pdfTeX, LuaTeX...), the code
related to SyncTeX is mainly due to Jerome Laurens despite he is not
credited as one of the contributors.
.\" .Sh BUGS \" Document known, unremedied bugs
SyncTeX is maintained as part of TeX Live.
SyncTeX support in TeX engines is maintained as part of TeX Live,
whereas the \fIsynctex\fP command line tool is maintained
as a separate project at https://github.com/jlaurens/synctex.
In particular, this project allows to embed the SyncTeX parser library
in desktop applications out of TeXLive.
.Sh HISTORY \" Document history if command behaves in a unique manner
Revised on Tue 5 mar 2024 21:13:57 UTC.
Revised on Fri Mar 22 07:27:03 UTC 2024.
.\" nroff -man synctex.1 | less
.\"groff -man -Tascii synctex.1 | less
.\"To convert a man page to plain pre-formatted text (e.g for spell checking) use:
Expand Down
47 changes: 36 additions & 11 deletions synctex_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
# define _ISOC99_SOURCE /* to get the fmax() prototype */
# endif

# ifdef SYNCTEX_STANDALONE
# if defined(SYNCTEX_STANDALONE)
# include <synctex_parser_c-auto.h>
/* for inline && HAVE_xxx */
# else
Expand Down Expand Up @@ -101,10 +101,20 @@
inline static double my_fmax(double x, double y) { return (x < y) ? y : x; }
#endif

/* I use the definition in kpathsea --ak*/
/* I use the definition in kpathsea --ak
#ifdef WIN32
# define snprintf _snprintf
#endif
*/

#if defined(WIN32) && defined(SYNCTEX_STANDALONE)
# define snprintf _snprintf
#endif

#if defined(WIN32) && !defined(SYNCTEX_STANDALONE)
# include <kpathsea/progname.h>
#endif


#if SYNCTEX_DEBUG
# ifdef WIN32
Expand Down Expand Up @@ -139,7 +149,7 @@ int main(int argc, char *argv[])
{
int i = 0;
int status = 0;
#if defined(WIN32) && !defined(__SYNCTEX_WORK)
#if defined(WIN32) && !defined(SYNCTEX_STANDALONE)
kpse_set_program_name(argv[0], "synctex");
#endif
printf("This is SyncTeX command line utility, version " SYNCTEX_CLI_VERSION_STRING "\n");
Expand Down Expand Up @@ -425,21 +435,36 @@ void synctex_help_view(const char * error,...) {
return;
}

/**
* @brief Data structure for view queries
*
*/
typedef struct {
/** The line number*/
int line;
/** The column number*/
int column;
/** The page number*/
int page;
/** The offset hint */
unsigned int offset;
/** name of the input file */
char * input;
/** name of the output file */
char * output;
/** name of the directory, defaults to the current working directory */
char * directory;
/** command to launch the viewer */
char * viewer;
/** text before hint */
char * before;
/** middle text hint */
char * middle;
/** after text hint */
char * after;
} synctex_view_t;
} _synctex_view_t;

synctex_view_t g_view = {-1,0,0,-1,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
_synctex_view_t g_view = {-1,0,0,-1,NULL,NULL,NULL,NULL,NULL,NULL,NULL};

char * synctex_view_i(char * arg) {
char * ans;
Expand Down Expand Up @@ -484,8 +509,8 @@ int synctex_view(int argc, char *argv[]) {
return -1;
}
if (synctex_view_i(argv[i]) <= argv[i]) {
synctex_help_view("Bad -i argument");
return -1;
synctex_help_view("Bad -i argument");
return -1;
}
if((++i>=argc) || strcmp("-o",argv[i]) || (++i>=argc)) {
synctex_help_view("Missing -o required argument");
Expand Down Expand Up @@ -756,9 +781,9 @@ typedef struct {
char * directory;
char * editor;
char * context;
} synctex_edit_t;
} _synctex_edit_t;

synctex_edit_t g_edit = {0,0,0,0,NULL,NULL,NULL,NULL};
_synctex_edit_t g_edit = {0,0,0,0,NULL,NULL,NULL,NULL};

char * synctex_edit_o(char * arg) {
char * ans;
Expand Down Expand Up @@ -789,8 +814,8 @@ int synctex_edit(int argc, char *argv[]) {
}
char * arg = argv[i];
if (synctex_edit_o(arg) <= arg) {
synctex_help_edit("Bad -o argument");
return -1;
synctex_help_edit("Bad -o argument");
return -1;
}
/* now scan the optional arguments */
if(++i<argc) {
Expand Down
Loading

0 comments on commit bbef3aa

Please sign in to comment.