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)  

util.c File Reference
#include <stdlib.h>
#include <string.h>
#include "main.h"
#include "util.h"
#include "parser.h"
Include dependency graph for util.c:

Go to the source code of this file.

Functions

int odd (int n)
 
int even (int n)
 
int strstr_count (char *s, char *t)
 
char * my_strndup (char *src, size_t n)
 
char * strdup_together (char *s, char *t)
 
char * strdup_nocomments (char *s)
 
char * strdup_noblanks (char *s)
 
char * strdup_nobadchars (char *text)
 
char * strdup_noendblanks (char *s)
 
char * ExtractLabelTag (char *text)
 
char * ExtractAndRemoveTag (char *tag, char *text)
 

Function Documentation

◆ even()

int even ( int  n)

purpose: returns true if n is even

Definition at line 43 of file util.c.

References n.

Referenced by asm_hrefk(), crc32_combine_(), main(), notex_(), ParsePages(), and SlurpDollarEquation().

◆ ExtractAndRemoveTag()

char* ExtractAndRemoveTag ( char *  tag,
char *  text 
)

purpose: remove 'tag{contents}' from text and return contents note that tag should typically be "\\caption"

Definition at line 235 of file util.c.

References diagnostics(), end, free, getBraceParam(), my_strndup(), NULL, PopSource(), PushSource(), s, start, strlen(), strstr(), and text.

Referenced by CmdFigure().

◆ ExtractLabelTag()

char* ExtractLabelTag ( char *  text)

purpose: return a copy of tag from \label{tag} in the string text

Definition at line 211 of file util.c.

References diagnostics(), free, getBraceParam(), label, NULL, PopSource(), PushSource(), s, strdup_nobadchars(), strlen(), and strstr().

Referenced by CmdFigure(), CmdTable(), and ConvertWholeDocument().

◆ my_strndup()

char* my_strndup ( char *  src,
size_t  n 
)

purpose: returns a new string with n characters from s (with '\0' at the end)

Definition at line 79 of file util.c.

References calloc(), link_confs::dst, n, NULL, link_confs::src, and strncpy().

Referenced by ExtractAndRemoveTag(), strdup_noendblanks(), TabbingNextCell(), and TabularNextCell().

◆ odd()

int odd ( int  n)

purpose: returns true if n is odd

Definition at line 34 of file util.c.

References n.

◆ strdup_nobadchars()

char* strdup_nobadchars ( char *  text)

purpose: duplicate text with only a..z A..Z 0..9 and _

Definition at line 168 of file util.c.

References dup(), s, and strdup_noblanks().

Referenced by CmdBibitem(), CmdCite(), CmdLabel(), ExtractLabelTag(), and InsertBookmark().

◆ strdup_noblanks()

char* strdup_noblanks ( char *  s)

purpose: duplicates a string without including spaces or newlines

Definition at line 148 of file util.c.

References dup(), malloc, NULL, p, s, and strlen().

Referenced by CmdCite(), CmdDocumentStyle(), CmdUsepackage(), setPackageInputenc(), and strdup_nobadchars().

◆ strdup_nocomments()

char* strdup_nocomments ( char *  s)

purpose: duplicates a string but removes TeX comment

Definition at line 120 of file util.c.

References dup(), malloc, NULL, p, s, and strlen().

Referenced by CmdCite().

◆ strdup_noendblanks()

char* strdup_noendblanks ( char *  s)

purpose: duplicates a string without spaces or newlines at front or end

Definition at line 190 of file util.c.

References my_strndup(), NULL, p, s, strdup, strlen(), and t.

Referenced by CmdFraction(), CmdMultiCol(), CmdTextColor(), SaveEquationAsFile(), TabbingGetRow(), TabbingNextCell(), and TabularNextCell().

◆ strdup_together()

◆ strstr_count()

int strstr_count ( char *  s,
char *  t 
)

purpose: count the number of occurences of the string t in the string s

Definition at line 52 of file util.c.

References len, n, NULL, p, s, strlen(), and strstr().

Referenced by CmdTabular().