PIPS
view.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <dirent.h>
#include <sys/stat.h>
#include <ctype.h>
#include <setjmp.h>
#include <unistd.h>
#include <errno.h>
#include "linear.h"
#include "genC.h"
#include "misc.h"
#include "ri-util.h"
#include "pipsdbm.h"
#include "pipsmake.h"
#include "top-level.h"
+ Include dependency graph for view.c:

Go to the source code of this file.

Functions

static string get_view_file (const char *print_type, bool displayable)
 returns the allocated full path name. More...
 
string build_view_file (const char *print_type)
 view.c More...
 
string get_dont_build_view_file (const char *print_type)
 

Function Documentation

◆ build_view_file()

string build_view_file ( const char *  print_type)

view.c

Parameters
print_typerint_type

Definition at line 97 of file view.c.

98 {
99  return get_view_file(print_type, true);
100 }
void print_type(type)
For debugging.
Definition: type.c:111
static string get_view_file(const char *print_type, bool displayable)
returns the allocated full path name.
Definition: view.c:54

References get_view_file(), and print_type().

Referenced by display(), display_a_resource(), gpips_display_graph_file_display(), gpips_display_plain_file(), wpips_display_graph_file_display(), wpips_display_plain_file(), and wpips_display_WP65_file().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_dont_build_view_file()

string get_dont_build_view_file ( const char *  print_type)
Parameters
print_typerint_type

Definition at line 102 of file view.c.

103 {
104  return get_view_file(print_type, false);
105 }

References get_view_file(), and print_type().

Referenced by wpips_display_WP65_file().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_view_file()

static string get_view_file ( const char *  print_type,
bool  displayable 
)
static

returns the allocated full path name.

the database is added if it is relative...

the file name is relative to the database. thus the workspace directory name is prefixed.

it is relative to pips pwd, or absolute.

should be show_message

Definition at line 54 of file view.c.

55 {
57 
58  if(displayable && !displayable_file_p(print_type)) {
59  pips_user_error("resource %s cannot be displayed\n", print_type);
60  }
61 
62  if (module_name != NULL)
63  {
65  {
66  string file_name =
68 
69  if (file_name[0]!='.' && file_name[0]!='/')
70  {
71  /* the file name is relative to the database.
72  * thus the workspace directory name is prefixed.
73  */
74  string pgm_wd, file_name_in_database;
75 
77  file_name_in_database =
78  strdup(concatenate(pgm_wd, "/", file_name, NULL));
79 
80  free(pgm_wd);
81  return file_name_in_database;
82  }
83  else
84  {
85  /* it is relative to pips pwd, or absolute. */
86  return strdup(file_name);
87  }
88  }
89  }
90  else {
91  /* should be show_message */
92  user_log("No current module; select a module\n");
93  }
94  return NULL;
95 }
void user_log(const char *format,...)
Definition: message.c:234
string db_get_current_module_name(void)
Also used to check whether set...
Definition: database.c:1059
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
void free(void *)
bool displayable_file_p(const char *name)
rather approximated.
Definition: lowlevel.c:361
#define pips_user_error
Definition: misc-local.h:147
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
#define db_get_file_resource
#define build_pgmwd
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...
Definition: workspace.c:82
bool safe_make(const char *res_n, const char *module_n)
Definition: pipsmake.c:1717
char * strdup()
static string file_name

References build_pgmwd, concatenate(), db_get_current_module_name(), db_get_current_workspace_name(), db_get_file_resource, displayable_file_p(), file_name, free(), module_name(), pips_user_error, print_type(), safe_make(), strdup(), and user_log().

Referenced by build_view_file(), and get_dont_build_view_file().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: