w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

texluac.c File Reference
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lmem.h"
#include "lobject.h"
#include "lopcodes.h"
#include "lstring.h"
#include "lundump.h"
#include "lua/luatex-api.h"
Include dependency graph for texluac.c:

Go to the source code of this file.

Macros

#define luac_c
 
#define LUA_CORE
 
#define luaU_print   PrintFunction
 
#define __attribute__(x)
 
#define PROGNAME   "texluac"
 
#define OUTPUT   PROGNAME ".out"
 
#define IS(s)   (strcmp(argv[i],s)==0)
 
#define FUNCTION   "(function()end)();"
 
#define toproto(L, i)   getproto(L->top+(i))
 
#define VOID(p)   ((const void*)(p))
 
#define TSVALUE(o)   tsvalue(o)
 
#define getconststr(ts)    check_exp(sizeof((ts)->extra), cast(const char *, (ts)) + sizeof(UTString))
 
#define UPVALNAME(x)   ((f->upvalues[x].name) ? getstr(f->upvalues[x].name) : "-")
 
#define MYK(x)   (-1-(x))
 
#define SS(x)   ((x==1)?"":"s")
 
#define S(x)   (int)(x),SS(x)
 

Functions

static void PrintFunction (const Proto *f, int full)
 
static void fatal (const char *message)
 
static void cannot (const char *what)
 
static void usage (const char *message)
 
static int doargs (int argc, char *argv[])
 
static const char * reader (lua_State *L, void *ud, size_t *size)
 
static const Protocombine (lua_State *L, int n)
 
static int writer (lua_State *L, const void *p, size_t size, void *u)
 
static int pmain (lua_State *L)
 
int luac_main (int ac, char *av[])
 
static void PrintString (const TString *ts)
 
static void PrintConstant (const Proto *f, int i)
 
static void PrintCode (const Proto *f)
 
static void PrintHeader (const Proto *f)
 
static void PrintDebug (const Proto *f)
 

Variables

static int listing = 0
 
static int dumping = 1
 
static int stripping = 0
 
static char Output [] = { "texluac" ".out" }
 
static const char * output = Output
 
static const char * progname = "texluac"
 

Macro Definition Documentation

◆ __attribute__

#define __attribute__ (   x)

Definition at line 61 of file texluac.c.

◆ FUNCTION

#define FUNCTION   "(function()end)();"

Definition at line 185 of file texluac.c.

◆ getconststr

#define getconststr (   ts)     check_exp(sizeof((ts)->extra), cast(const char *, (ts)) + sizeof(UTString))

Definition at line 302 of file texluac.c.

◆ IS

#define IS (   s)    (strcmp(argv[i],s)==0)

Definition at line 129 of file texluac.c.

◆ LUA_CORE

#define LUA_CORE

Definition at line 38 of file texluac.c.

◆ luac_c

#define luac_c

Definition at line 37 of file texluac.c.

◆ luaU_print

#define luaU_print   PrintFunction

Definition at line 56 of file texluac.c.

◆ MYK

#define MYK (   x)    (-1-(x))

Definition at line 382 of file texluac.c.

◆ OUTPUT

#define OUTPUT   PROGNAME ".out"

Definition at line 70 of file texluac.c.

◆ PROGNAME

#define PROGNAME   "texluac"

Definition at line 66 of file texluac.c.

◆ S

#define S (   x)    (int)(x),SS(x)

Definition at line 482 of file texluac.c.

◆ SS

#define SS (   x)    ((x==1)?"":"s")

Definition at line 481 of file texluac.c.

◆ toproto

#define toproto (   L,
  i 
)    getproto(L->top+(i))

Definition at line 199 of file texluac.c.

◆ TSVALUE

#define TSVALUE (   o)    tsvalue(o)

Definition at line 298 of file texluac.c.

◆ UPVALNAME

#define UPVALNAME (   x)    ((f->upvalues[x].name) ? getstr(f->upvalues[x].name) : "-")

Definition at line 381 of file texluac.c.

◆ VOID

#define VOID (   p)    ((const void*)(p))

Definition at line 292 of file texluac.c.

Function Documentation

◆ cannot()

static void cannot ( const char *  what)
static

Definition at line 103 of file texluac.c.

References errno, exit(), EXIT_FAILURE, fprintf, progname, strerror(), and gen-indic-table::what.

Referenced by pmain().

◆ combine()

static const Proto* combine ( lua_State L,
int  n 
)
static

Definition at line 201 of file texluac.c.

References f, fatal(), i, L, lua_load(), LUA_OK, lua_tostring, n, NULL, PROGNAME, reader(), and toproto.

Referenced by pmain().

◆ doargs()

static int doargs ( int  argc,
char *  argv[] 
)
static

Definition at line 131 of file texluac.c.

References argc, argv, dumping, exit(), EXIT_SUCCESS, i, IS, listing, LUA_COPYRIGHT, LUA_QL, NULL, Output, printf(), progname, stripping, usage(), and version.

Referenced by luac_main().

◆ fatal()

static void fatal ( const char *  message)
static

Definition at line 97 of file texluac.c.

References exit(), EXIT_FAILURE, fprintf, message, and progname.

Referenced by combine(), luac_main(), and pmain().

◆ luac_main()

int luac_main ( int  ac,
char *  av[] 
)

◆ pmain()

◆ PrintCode()

◆ PrintConstant()

static void PrintConstant ( const Proto f,
int  i 
)
static

Definition at line 358 of file texluac.c.

References bvalue, f, i, LUA_NUMBER_FMT, LUA_TBOOLEAN, LUA_TNIL, LUA_TNUMBER, LUA_TSTRING, nvalue, printf(), PrintString(), TSVALUE, and ttype.

Referenced by PrintCode(), and PrintDebug().

◆ PrintDebug()

static void PrintDebug ( const Proto f)
static

Definition at line 504 of file texluac.c.

References f, getstr, i, n, PrintConstant(), printf(), UPVALNAME, and VOID.

Referenced by PrintFunction().

◆ PrintFunction()

static void PrintFunction ( const Proto f,
int  full 
)
static

Definition at line 528 of file texluac.c.

References f, i, n, PrintCode(), PrintDebug(), and PrintHeader().

◆ PrintHeader()

static void PrintHeader ( const Proto f)
static

Definition at line 484 of file texluac.c.

References f, getstr, LUA_SIGNATURE, printf(), s, S, SS, and VOID.

Referenced by PrintFunction().

◆ PrintString()

static void PrintString ( const TString ts)
static

◆ reader()

static const char* reader ( lua_State L,
void ud,
size_t size 
)
static

Definition at line 187 of file texluac.c.

References FUNCTION, L, NULL, size, and UNUSED.

Referenced by combine().

◆ usage()

static void usage ( const char *  message)
static

Definition at line 109 of file texluac.c.

References exit(), EXIT_FAILURE, fprintf, LUA_QL, LUA_QS, message, Output, and progname.

Referenced by doargs(), and luac_main().

◆ writer()

static int writer ( lua_State L,
const void p,
size_t  size,
void u 
)
static

Definition at line 221 of file texluac.c.

References FILE, fwrite(), L, p, size, u, and UNUSED.

Referenced by pmain().

Variable Documentation

◆ dumping

int dumping = 1
static

Definition at line 78 of file texluac.c.

Referenced by doargs(), and pmain().

◆ listing

int listing = 0
static

Definition at line 74 of file texluac.c.

Referenced by doargs(), and pmain().

◆ Output

char Output[] = { "texluac" ".out" }
static

Definition at line 86 of file texluac.c.

Referenced by doargs(), and usage().

◆ output

const char* output = Output
static

Definition at line 90 of file texluac.c.

◆ progname

const char* progname = "texluac"
static

Definition at line 94 of file texluac.c.

Referenced by cannot(), doargs(), fatal(), and usage().

◆ stripping

int stripping = 0
static

Definition at line 82 of file texluac.c.

Referenced by doargs(), and pmain().