GNU PROLOG with UTF8 support
Data Structures | Macros | Functions | Variables
top_comp.c File Reference
#include "../EnginePl/gp_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
#include <ctype.h>
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#include <sys/param.h>
#include <sys/wait.h>
#include "../EnginePl/pl_params.h"
#include "../EnginePl/wam_regs.h"
#include "decode_hexa.c"
#include "copying.c"
#include "prolog_path.c"
#include "../EnginePl/machine1.c"
Include dependency graph for top_comp.c:

Data Structures

struct  FileInf
 
struct  CmdInf
 

Macros

#define READ_REGISTRY_ONLY
 
#define CMD_LINE_MAX_OPT   8192
 
#define CMD_LINE_LENGTH   (MAXPATHLEN + CMD_LINE_MAX_OPT + 1)
 
#define TEMP_FILE_PREFIX   GPLC
 
#define OBJ_FILE_ALL_PL_BIPS   "all_pl_bips"
 
#define OBJ_FILE_ALL_FD_BIPS   "all_fd_bips"
 
#define OBJ_FILE_TOP_LEVEL   "top_level"
 
#define OBJ_FILE_DEBUGGER   "debugger"
 
#define EXE_FILE_PL2WAM   "pl2wam"
 
#define EXE_FILE_WAM2MA   "wam2ma"
 
#define EXE_FILE_MA2ASM   "ma2asm"
 
#define EXE_FILE_ASM   AS
 
#define EXE_FILE_FD2C   "fd2c"
 
#define EXE_FILE_CC   CC
 
#define EXE_FILE_LINK   CC
 
#define EXE_FILE_STRIP   STRIP
 
#define FILE_PL   0
 
#define FILE_WAM   1
 
#define FILE_MA   2
 
#define FILE_ASM   3
 
#define FILE_OBJ   4
 
#define FILE_FD   5
 
#define FILE_C   6
 
#define FILE_LINK   7
 
#define LINK_OPTION   8
 
#define PL_SUFFIX   PROLOG_FILE_SUFFIX
 
#define PL_SUFFIX_ALTERNATE   PROLOG_FILE_SUFFIXES_ALT
 
#define WAM_SUFFIX   ".wam"
 
#define WBC_SUFFIX   ".wbc"
 
#define MA_SUFFIX   ".ma"
 
#define FD_SUFFIX   ".fd"
 
#define C_SUFFIX   ".c"
 
#define C_SUFFIX_ALTERNATE   "|.C|.cc|.CC|.cxx|.CXX|.c++|.C++|.cpp|.CPP|"
 
#define CC_COMPILE_OPT   "-c "
 
#define CC_INCLUDE_OPT   "-I"
 
#define Record_Link_Warn_Option(i)   sprintf(warn_str + strlen(warn_str), "%s ", argv[i])
 
#define Before_Cmd(cmd)
 
#define After_Cmd(error)
 
#define Check_Arg(i, str)   (last_opt = str, strncmp(argv[i], str, strlen(argv[i])) == 0)
 
#define Add_Last_Option(opt)   sprintf(opt + strlen(opt), "%s ", last_opt)
 
#define Add_Option(i, opt)   sprintf(opt + strlen(opt), "%s ", argv[i])
 
#define L(msg)   fprintf(stderr, "%s\n", msg)
 

Functions

char * Search_Path (char *file)
 
void Determine_Pathnames (void)
 
void Compile_Files (void)
 
void Create_Output_File_Name (FileInf *f, char *buff)
 
void New_Work_File (FileInf *f, int stage, int stop_after)
 
void Free_Work_File2 (FileInf *f)
 
void Compile_Cmd (CmdInf *c, FileInf *f)
 
void Link_Cmd (void)
 
void Exec_One_Cmd (char *str, int no_decode_hex)
 
int Spawn_Decode_Hex (char *arg[])
 
void Delete_Temp_File (char *name)
 
int Find_File (char *file, char *suff, char *file_path, int ignore_error)
 
char * Find_Suffix (char *suffixes, char *suffix)
 
void Pl_Fatal_Error (char *format,...)
 
void Parse_Arguments (int argc, char *argv[])
 
void Display_Help (void)
 
int main (int argc, char *argv[])
 

Variables

char * start_path
 
int devel_mode = 0
 
char * devel_dir []
 
FileInffile_lopt
 
int nb_file_lopt = 0
 
int stop_after = FILE_LINK
 
int verbose = 0
 
char * file_name_out = NULL
 
int pl_def_local_size = -1
 
int pl_def_global_size = -1
 
int pl_def_trail_size = -1
 
int pl_def_cstr_size = -1
 
int pl_def_max_atom = -1
 
int pl_fixed_sizes = 0
 
int needs_stack_file = 0
 
int bc_mode = 0
 
int gui_console = 0
 
int no_top_level = 0
 
int min_pl_bips = 0
 
int min_fd_bips = 0
 
int no_debugger = 0
 
int no_pl_lib = 0
 
int no_fd_lib = 0
 
int no_fd_lib_warn = 0
 
int strip = 0
 
int no_decode_hex = 0
 
char warn_str [1024] = ""
 
char * temp_dir = NULL
 
int no_del_temp_files = 0
 
CmdInf cmd_pl2wam = { EXE_FILE_PL2WAM, " ", "-o " }
 
CmdInf cmd_wam2ma = { EXE_FILE_WAM2MA, " ", "-o " }
 
CmdInf cmd_ma2asm = { EXE_FILE_MA2ASM, " ", "-o " }
 
CmdInf cmd_asm = { EXE_FILE_ASM, " " ASFLAGS " ", "-o " }
 
CmdInf cmd_fd2c = { EXE_FILE_FD2C, " ", "-o " }
 
CmdInf cmd_cc = { EXE_FILE_CC, " ", CC_OBJ_NAME_OPT }
 
CmdInf cmd_link = { EXE_FILE_LINK, " " CFLAGS_MACHINE " ", CC_EXE_NAME_OPT }
 
char * cc_fd2c_flags = CFLAGS " "
 
char * suffixes []
 
char * last_opt
 

Macro Definition Documentation

#define Add_Last_Option (   opt)    sprintf(opt + strlen(opt), "%s ", last_opt)
#define Add_Option (   i,
  opt 
)    sprintf(opt + strlen(opt), "%s ", argv[i])
#define After_Cmd (   error)
Value:
if (error) \
Pl_Fatal_Error("compilation failed");
void Pl_Fatal_Error(char *format,...)
Definition: top_comp.c:975
void error(void)
Definition: chkma.c:344
#define Before_Cmd (   cmd)
Value:
if (verbose) \
fprintf(stderr, "%s\n", cmd)
int verbose
Definition: top_comp.c:178
#define C_SUFFIX   ".c"
#define C_SUFFIX_ALTERNATE   "|.C|.cc|.CC|.cxx|.CXX|.c++|.C++|.cpp|.CPP|"
#define CC_COMPILE_OPT   "-c "
#define CC_INCLUDE_OPT   "-I"
#define Check_Arg (   i,
  str 
)    (last_opt = str, strncmp(argv[i], str, strlen(argv[i])) == 0)
#define CMD_LINE_LENGTH   (MAXPATHLEN + CMD_LINE_MAX_OPT + 1)
#define CMD_LINE_MAX_OPT   8192
#define EXE_FILE_ASM   AS
#define EXE_FILE_CC   CC
#define EXE_FILE_FD2C   "fd2c"
#define EXE_FILE_LINK   CC
#define EXE_FILE_MA2ASM   "ma2asm"
#define EXE_FILE_PL2WAM   "pl2wam"
#define EXE_FILE_STRIP   STRIP
#define EXE_FILE_WAM2MA   "wam2ma"
#define FD_SUFFIX   ".fd"
#define FILE_ASM   3
#define FILE_C   6
#define FILE_FD   5
#define FILE_LINK   7
#define FILE_MA   2
#define FILE_OBJ   4
#define FILE_PL   0
#define FILE_WAM   1
#define L (   msg)    fprintf(stderr, "%s\n", msg)
#define LINK_OPTION   8
#define MA_SUFFIX   ".ma"
#define OBJ_FILE_ALL_FD_BIPS   "all_fd_bips"
#define OBJ_FILE_ALL_PL_BIPS   "all_pl_bips"
#define OBJ_FILE_DEBUGGER   "debugger"
#define OBJ_FILE_TOP_LEVEL   "top_level"
#define PL_SUFFIX   PROLOG_FILE_SUFFIX
#define PL_SUFFIX_ALTERNATE   PROLOG_FILE_SUFFIXES_ALT
#define READ_REGISTRY_ONLY
#define Record_Link_Warn_Option (   i)    sprintf(warn_str + strlen(warn_str), "%s ", argv[i])
#define TEMP_FILE_PREFIX   GPLC
#define WAM_SUFFIX   ".wam"
#define WBC_SUFFIX   ".wbc"

Function Documentation

void Compile_Cmd ( CmdInf c,
FileInf f 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void Compile_Files ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

void Create_Output_File_Name ( FileInf f,
char *  buff 
)

Here is the caller graph for this function:

void Delete_Temp_File ( char *  name)

Here is the caller graph for this function:

void Determine_Pathnames ( void  )
void Display_Help ( void  )

Here is the caller graph for this function:

void Exec_One_Cmd ( char *  str,
int  no_decode_hex 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int Find_File ( char *  file,
char *  suff,
char *  file_path,
int  ignore_error 
)

Here is the call graph for this function:

Here is the caller graph for this function:

char * Find_Suffix ( char *  suffixes,
char *  suffix 
)

Here is the caller graph for this function:

void Free_Work_File2 ( FileInf f)

Here is the call graph for this function:

Here is the caller graph for this function:

void Link_Cmd ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

Here is the call graph for this function:

void New_Work_File ( FileInf f,
int  stage,
int  stop_after 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void Parse_Arguments ( int  argc,
char *  argv[] 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void Pl_Fatal_Error ( char *  format,
  ... 
)

Here is the call graph for this function:

Here is the caller graph for this function:

char* Search_Path ( char *  file)
int Spawn_Decode_Hex ( char *  arg[])

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

int bc_mode = 0
char* cc_fd2c_flags = CFLAGS " "
CmdInf cmd_asm = { EXE_FILE_ASM, " " ASFLAGS " ", "-o " }
CmdInf cmd_cc = { EXE_FILE_CC, " ", CC_OBJ_NAME_OPT }
CmdInf cmd_fd2c = { EXE_FILE_FD2C, " ", "-o " }
CmdInf cmd_link = { EXE_FILE_LINK, " " CFLAGS_MACHINE " ", CC_EXE_NAME_OPT }
CmdInf cmd_ma2asm = { EXE_FILE_MA2ASM, " ", "-o " }
CmdInf cmd_pl2wam = { EXE_FILE_PL2WAM, " ", "-o " }
CmdInf cmd_wam2ma = { EXE_FILE_WAM2MA, " ", "-o " }
char* devel_dir[]
Initial value:
= {
"EnginePl", "BipsPl", "EngineFD", "BipsFD", "Linedit", "W32GUICons",
NULL }
int devel_mode = 0
FileInf* file_lopt
char* file_name_out = NULL
int gui_console = 0
char* last_opt
int min_fd_bips = 0
int min_pl_bips = 0
int nb_file_lopt = 0
int needs_stack_file = 0
int no_debugger = 0
int no_decode_hex = 0
int no_del_temp_files = 0
int no_fd_lib = 0
int no_fd_lib_warn = 0
int no_pl_lib = 0
int no_top_level = 0
int pl_def_cstr_size = -1
int pl_def_global_size = -1
int pl_def_local_size = -1
int pl_def_max_atom = -1
int pl_def_trail_size = -1
int pl_fixed_sizes = 0
char* start_path
int stop_after = FILE_LINK
int strip = 0
char* suffixes[]
Initial value:
=
{ PL_SUFFIX, WAM_SUFFIX, MA_SUFFIX, ASM_SUFFIX, OBJ_SUFFIX, FD_SUFFIX, C_SUFFIX, NULL }
#define FD_SUFFIX
Definition: top_comp.c:126
#define PL_SUFFIX
Definition: top_comp.c:121
#define C_SUFFIX
Definition: top_comp.c:127
#define MA_SUFFIX
Definition: top_comp.c:125
#define WAM_SUFFIX
Definition: top_comp.c:123
char* temp_dir = NULL
int verbose = 0
char warn_str[1024] = ""