Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
srcpos.c File Reference
#include <stdio.h>
#include "dtc.h"
#include "srcpos.h"

Go to the source code of this file.

Data Structures

struct  search_path
 

Macros

#define _GNU_SOURCE
 
#define MAX_SRCFILE_DEPTH   (100)
 
#define TAB_SIZE   8
 

Functions

FILE * srcfile_relative_open (const char *fname, char **fullnamep)
 
void srcfile_push (const char *fname)
 
int srcfile_pop (void)
 
void srcfile_add_search_path (const char *dirname)
 
void srcpos_update (struct srcpos *pos, const char *text, int len)
 
struct srcpossrcpos_copy (struct srcpos *pos)
 
void srcpos_dump (struct srcpos *pos)
 
charsrcpos_string (struct srcpos *pos)
 
void srcpos_verror (struct srcpos *pos, char const *fmt, va_list va)
 
void srcpos_error (struct srcpos *pos, char const *fmt,...)
 
void srcpos_warn (struct srcpos *pos, char const *fmt,...)
 
void srcpos_set_line (char *f, int l)
 

Variables

FILE * depfile
 
struct srcfile_statecurrent_srcfile
 
struct srcpos srcpos_empty
 

Macro Definition Documentation

#define _GNU_SOURCE

Definition at line 20 of file srcpos.c.

#define MAX_SRCFILE_DEPTH   (100)

Definition at line 56 of file srcpos.c.

#define TAB_SIZE   8

Definition at line 212 of file srcpos.c.

Function Documentation

void srcfile_add_search_path ( const char dirname)

Add a new directory to the search path for input files

The new path is added at the end of the list.

Parameters
dirnameDirectory to add

Definition at line 183 of file srcpos.c.

int srcfile_pop ( void  )

Definition at line 162 of file srcpos.c.

void srcfile_push ( const char fname)

Definition at line 143 of file srcpos.c.

FILE* srcfile_relative_open ( const char fname,
char **  fullnamep 
)

Open a source file.

If the source file is a relative pathname, then it is searched for in the current directory (the directory of the last source file read) and after that in the search path.

We work through the search path in order from the first path specified to the last.

If the file is not found, then this function does not return, but calls die().

Parameters
fnameFilename to search
fullnamepIf non-NULL, it is set to the allocated filename of the file that was opened. The caller is then responsible for freeing the pointer.
Returns
pointer to opened FILE

Definition at line 117 of file srcpos.c.

struct srcpos* srcpos_copy ( struct srcpos pos)
read

Definition at line 239 of file srcpos.c.

void srcpos_dump ( struct srcpos pos)

Definition at line 252 of file srcpos.c.

void srcpos_error ( struct srcpos pos,
char const fmt,
  ... 
)

Definition at line 306 of file srcpos.c.

void srcpos_set_line ( char f,
int  l 
)

Definition at line 332 of file srcpos.c.

char* srcpos_string ( struct srcpos pos)

Definition at line 265 of file srcpos.c.

void srcpos_update ( struct srcpos pos,
const char text,
int  len 
)

Definition at line 214 of file srcpos.c.

void srcpos_verror ( struct srcpos pos,
char const fmt,
va_list  va 
)

Definition at line 294 of file srcpos.c.

void srcpos_warn ( struct srcpos pos,
char const fmt,
  ... 
)

Definition at line 317 of file srcpos.c.

Variable Documentation

struct srcfile_state* current_srcfile

Definition at line 53 of file srcpos.c.

FILE* depfile

Definition at line 52 of file srcpos.c.

struct srcpos srcpos_empty
Initial value:
= {
.first_line = 0,
.first_column = 0,
.last_line = 0,
.last_column = 0,
.file = NULL,
}

Definition at line 204 of file srcpos.c.