PIPS
newgen_auto_string.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

string gen_strndup (string, size_t)
 string.c More...
 
string gen_strndup0 (string, size_t)
 Like strdup() but copy at most n characters. More...
 
char * i2a (int)
 I2A (Integer TO Ascii) yields a string for a given Integer. More...
 
void init_the_buffer (void)
 
string append_to_the_buffer (const char *)
 If the string is undefined, just skip it. More...
 
string get_the_buffer (void)
 
string concatenate (const char *,...)
 Return the concatenation of the given strings. More...
 
string strupper (string, const char *)
 
string strlower (string, const char *)
 
string bool_to_string (bool)
 
string nth_suffix (int)
 
string find_suffix (const string, const string)
 Find if a string s end with a suffix. More...
 
string chop_newline (string, bool)
 
string remove_newline_of_string (string)
 
list strsplit (const char *, const char *)
 
int gen_qsort_string_cmp (const void *, const void *)
 Callback for sorting string with qsort. More...
 
void str_prepend (string *, string)
 Prepend the prefix to the string. More...
 
void str_append (string *, string)
 Append the suffix to the string. More...
 

Function Documentation

◆ append_to_the_buffer()

string append_to_the_buffer ( const char *  s)

If the string is undefined, just skip it.

Well, I hope it will not hide some bugs by masking some deliberate string_undefined put to trigger a wrong assertion is some higher parts of the code...

reallocates if needed

Parameters
swhat to append to the buffer

Definition at line 145 of file string.c.

146 {
147  if (s != string_undefined)
148  {
149  size_t len = strlen(s);
150 
151  /* reallocates if needed
152  */
153  if (current+len >= buffer_size)
154  {
155  buffer_size = MAX(current+len+1,
157  buffer = realloc(buffer, buffer_size);
158  message_assert("enough memory", buffer);
159  }
160 
161  (void) memcpy(&buffer[current], s, len);
162  current += len;
163  buffer[current] = '\0' ;
164  }
165 
166  return buffer;
167 }
#define message_assert(msg, ex)
Definition: newgen_assert.h:47
#define string_undefined
Definition: newgen_types.h:40
static size_t current
Definition: string.c:115
static size_t buffer_size
Definition: string.c:114
#define BUFFER_SIZE_INCREMENT
CONCATENATE() *********** Last argument must be NULL.
Definition: string.c:108
#define MAX(x, y)
Definition: string.c:110
static string buffer
Definition: string.c:113

References buffer, buffer_size, BUFFER_SIZE_INCREMENT, current, MAX, message_assert, and string_undefined.

Referenced by concatenate().

+ Here is the caller graph for this function:

◆ bool_to_string()

◆ chop_newline()

string chop_newline ( string  s,
bool  flg 
)
Returns
a string whithout the last "\n" char
Parameters
s,thestring to process
flg,iftrue do a copy of the string
Parameters
flglg

Definition at line 294 of file string.c.

295 {
296  if ((s == string_undefined) || (s == NULL)) return s;
297  string r = s;
298  if (flg == true) r = strdup(s);
299  int l = strlen(s);
300  if (l > 0) {
301  if (*(r + l - 1) == '\n') *(r + l - 1) = '\0';
302  }
303  return r;
304 }
char * strdup()

References strdup(), and string_undefined.

Referenced by remove_newline_of_string().

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

◆ concatenate()

string concatenate ( const char *  next,
  ... 
)

Return the concatenation of the given strings.

CAUTION! concatenation is based on a static dynamically allocated buffer which is shared from one call to another.

Note that if a string is string_undefined, it is just skiped.

FC.

else first argument is the buffer itself...

now gets the strings and concatenates them

skipping first argument if is buffer

should stop after some count?

returns the static '\0' terminated buffer.

Parameters
nextext

Definition at line 183 of file string.c.

184 {
185  int count = 0;
186  va_list args;
187  char * initial_buffer = buffer;
188 
189  if (next && next!=initial_buffer)
190  init_the_buffer();
191  /* else first argument is the buffer itself... */
192 
193  /* now gets the strings and concatenates them
194  */
195  va_start(args, next);
196  while (next)
197  {
198  count++;
199  if (next!=initial_buffer) /* skipping first argument if is buffer */
200  (void) append_to_the_buffer(next);
201  next = va_arg(args, string);
202  message_assert("reuse concatenate result only as the first argument",
203  !next || next!=initial_buffer);
204  /* should stop after some count? */
205  }
206  va_end(args);
207 
208  /* returns the static '\0' terminated buffer.
209  */
210  return buffer;
211 }
static int count
Definition: SDG.c:519
string append_to_the_buffer(const char *s)
If the string is undefined, just skip it.
Definition: string.c:145
void init_the_buffer(void)
Definition: string.c:127

References append_to_the_buffer(), buffer, count, init_the_buffer(), and message_assert.

Referenced by actual_c_parser(), actual_symbol_table_dump(), add_address_of_value(), add_intermediate_value(), add_local_intermediate_value(), add_local_old_value(), add_new_value_name(), add_non_declared_reference_to_declaration(), add_old_value(), add_one_line_of_comment(), add_read_resource(), add_sizeof_value(), add_symbolic_constant_to_declaration(), add_synonym_values(), add_write_resource(), AddCommonToModule(), adg_get_integer_entity(), adg_read_paf(), adg_rename_entities(), alias_check(), append_comments_to_statement(), append_data_current_stmt_buffer_to_declarations(), atomic_function_of_operation(), attach_declaration_size_type_to_words(), bdt_read_paf(), bootstrap(), bound_parameter_name(), build_call_STEP_WaitAll(), build_new_ref(), build_outline_name(), build_pgm_makefile(), c_basic_string(), c_brace_expression_string(), c_call(), c_code_string(), c_declarations(), c_dim_string(), c_forloop(), c_head(), c_include(), c_loop(), c_macro(), c_parser_put_new_typedef(), c_qualifier_string(), c_reference(), c_sequence(), c_statement(), c_test(), c_unstructured(), c_whileloop(), callgraph_module_name(), check_delete_workspace(), check_input_file_syntax(), clean_statement_from_tags(), clean_up_sequences_rewrite(), clone_variable_with_new_name(), cmf_layout_align(), compile_a_pure_function(), compile_a_special_io_function(), compile_f90_module(), compile_mpi(), concat_labels(), conflicts_sort_callback(), constant_memory_access_path_to_location_name(), continue_create_workspace_notify(), copy_from_statement(), copy_to_statement(), craft_layout_align(), create_counter(), create_HRE_module(), create_local_index(), create_local_index2(), create_named_entity(), create_new_common_variable(), create_new_entity(), create_parameter_for_new_module(), create_parameter_variable_for_new_module(), create_pointer_to_array_stub_points_to(), create_private_integer_variable_for_new_module(), create_private_variable_for_new_module(), create_state_variable(), create_stub_entity(), create_tile_basis(), CreateMemberScope(), creer_nom_entite(), creer_nom_var(), csplit_copy(), csplit_open_compilation_unit(), davinci_dump_expressions(), davinci_print_control_nodes(), davinci_print_non_deterministic_unstructured(), db_build_file_resource_name(), db_get_directory_name_for_module(), db_get_workspace_directory_name(), dbll_stat_local_file(), debug_unstructured(), declare_common_variables_in_module(), default_common_hook(), default_hist_file_name(), default_tpipsrc(), direct_change_directory(), distribute_code(), do_recompile_module(), do_resource_usage_check(), dump_common_layout(), dump_functional(), edge_cost_polynome(), edit_notify(), effects_to_dma(), end_delete_workspace_notify(), EnterScope(), entities_type_and_name(), entity_all_module_xxx_locations_p(), entity_all_xxx_locations_p(), entity_and_common_name(), entity_empty_label(), entity_from_user_name(), entity_hpf_number(), entity_intrinsic(), entity_name_without_scope(), entity_to_declaration_constraints(), eov_add_entity_to_eliminate(), external_entity_to_old_value(), fetch_complexity_parameters(), filter_file(), find_entity(), find_file(), find_file_in_directories(), find_label_entity(), find_operator(), find_or_create_allocatable_struct(), find_or_create_coeff(), find_or_create_emulated_shared_variable(), find_or_create_scalar_entity(), find_or_create_typed_entity(), FindEntity(), FindEntityFromLocalName(), FindEntityFromLocalNameAndPrefix(), FindEntityFromLocalNameAndPrefixAndScope(), FindEntityFromUserName(), FindOrCreateEntityFromLocalNameAndPrefixAndScope(), FindOrCreateEntityLikeModel(), FixCInternalLabels(), flinter(), fopen_config(), full_graph_of_calls(), gather_all_comments_of_a_statement_filter(), gen_omp_parallel(), gen_omp_taskwait(), general_build_signature(), generate_all_liveness_but(), generate_copy_loop_nest(), generate_distributed_io_system(), generate_dynamic_liveness_for_primary(), generate_dynamic_liveness_management(), generate_io_statements_for_shared_arrays(), generate_io_system(), generate_pseudo_formal_variable_for_formal_label(), generate_remapping_include(), generate_remapping_system(), generate_shared_io_system(), GENERATION(), generic_c_words_simplified_entity(), generic_print_xml_application(), get_declaration_comments(), get_eole_command(), get_first_main_module(), get_main_entity_name(), get_new_user_file(), get_resource_file_name(), get_symbol_table(), get_time_ent(), get_view_file(), gfc2pips_check_entity_block_data_exists(), gfc2pips_check_entity_doesnt_exists(), gfc2pips_check_entity_exists(), gfc2pips_check_entity_module_exists(), gfc2pips_check_entity_program_exists(), gfc2pips_namespace(), gfc2pips_symbol2entity(), global_new_value_to_global_old_value(), gpips_file_view(), gpips_view_marked_busy(), gpu_ify_statement(), gpu_xml_dump(), graph_of_calls(), hbdsc_parallelization(), hpf_remapping(), hpfc_buffer_entity(), hpfc_common_hook(), hpfc_filter(), hpfc_generate_path_name_of_file_name(), hpfc_head_hook(), hpfc_install(), hpfc_make(), hpfc_print_file(), hpfc_run(), html_prettyprint(), html_prettyprint_symbol_table(), include(), include_path_to_include_flags(), init_c_implicit_variables(), init_cost_table(), init_loop_ctrl(), init_new_df_ref(), init_new_do_loop(), insert_check_alias_before_statement(), insert_comments_to_statement(), insert_flag_before_call_site(), insert_impact_description_as_comment(), insert_one_type_declaration(), insert_test_before_caller(), insert_test_before_statement(), interface_argument_declaration(), interface_basic_string(), interface_code_string(), interface_signature(), is_c_parser_keyword_typedef(), is_c_preprocessor_keyword_typedef(), isolate_code_portion(), keep_track_of_typedef(), list_to_string(), local_name_to_top_level_entity(), loop_annotate(), loop_statistics(), loop_test(), make_array_bounds(), make_bottom_up_abc_tests(), make_coeff(), make_derived_entity(), make_empty_blockdata(), make_empty_f95module(), make_empty_function(), make_empty_program(), make_empty_subroutine(), make_emulated_shared_variable(), make_entity_fullname(), make_get_rc_statement(), make_host_and_node_modules(), make_HRE_empty_module(), make_id_expression(), make_integer_constant_entity(), make_interprocedural_abc_tests(), make_local_value_entity(), make_movements_loop_body_wp65(), make_new_common(), make_new_integer_scalar_common_variable(), make_new_reduction_function(), make_new_simd_vector_with_prefix(), make_new_symbolic_entity(), make_nlc_entity(), make_nsp_entity(), make_nub_entity(), make_pred_commentary_sentence(), make_resource_from_starting_node(), make_scalar_entity(), make_scalar_integer_entity(), make_scanning_over_tiles(), make_statement_copy_i(), make_text_resource(), MakeAssignInst(), MakeCLabel(), MakeCurrentFunction(), MakeEntryCommon(), MakeForloop(), MakeReturn(), mchoose_notify(), MemberDerivedIdentifierToExpression(), meta_data_db_file_name(), module_entity_to_compilation_unit_entity(), module_initial_parameter_pv(), module_to_callgraph(), module_to_wp65_modules(), my_build_new_ref(), NameToCommon(), NameToFunctionalEntity(), new_eng_loop(), new_param(), new_step_directive(), nth_formal_name(), old_array_bound_check_instrumentation(), open_log_file(), open_warning_file(), pips_srcpath_append(), pips_user_value_name(), points_to_name(), points_to_rank(), ppt_assignement(), ppt_binary(), ppt_call(), ppt_min_max(), ppt_unary(), ppt_unary_post(), pragma_parameter_unknown_message(), pragma_to_string(), prepend_call(), prettyprint_dot_label(), prettyprint_graph_daVinci(), print_array_dfg(), print_bdt(), print_c_code(), print_call_precondition(), print_code_or_source(), print_code_or_source_comp(), print_code_semantics(), print_code_smalltalk(), print_code_with_comp_regions(), print_continuation_conditions(), print_crough(), print_dependence_or_chains_graph(), print_dinf_statistics(), print_dot_dependence_or_chains_graph(), print_dsup_statistics(), print_filtered_dg_or_dvdg(), print_interface(), print_list_of_entities(), print_list_of_expressions(), print_loopnest_dependence_cone(), print_loops(), print_module_name_to_toposorts(), print_plc(), print_proj_op_statistics(), print_sdg_task(), print_sesam_tasks_buffers_header(), print_umay_statistics(), print_umust_statistics(), print_variables(), print_xml_code(), print_xml_code_with_explicit_motif(), process_thru_C_pp(), process_thru_fortran_pp(), process_user_file(), purge_directory(), put_summary(), redeclaration_enter_statement(), reduction_as_str(), reference_to_address_entity(), region_entity_variable_to_new_declare_entity(), region_translation_statistics_close(), relative_name_if_necessary(), remapping_compile(), remapping_stats(), replace_sender_entity_by_receiver_entity_in_reference(), replicate_declaration(), rice_dependence_graph(), safe_list_files_in_directory(), safe_new_tmp_file(), safe_system_substitute(), SafeFindOrCreateEntity(), same_or_equivalence_argument_add_aliases(), sc_add_new_variable_name(), scalar_postlude(), scalar_prelude(), send_the_names_of_the_available_modules_to_emacs(), sentence_area(), sequence_dependence_graph(), set_env_log_and_free(), set_rc_function(), short_debug_unstructured(), simplify_minmax_contrainte(), smalltalk_code_string(), some_main_entity_p(), st_arguments(), st_brace_expression_as_string(), st_declaration(), st_declaration_comment(), st_declaration_init(), st_declarations(), st_declarations_comment(), st_declarations_init(), st_dim_string(), st_dimension_bound_as_string(), st_dimension_reference_as_string(), st_forloop(), st_header(), st_loop(), st_reference(), st_sequence(), st_statement(), st_test(), st_whileloop(), step_bison_parse(), step_compile_generated_module(), step_directive_to_strings(), step_function(), step_head_hook(), step_install(), store_sc_text_line(), string_array_join(), string_buffer_append_numeric(), string_buffer_append_symbolic(), string_buffer_append_word(), string_codefilename(), string_entitiesfilename(), string_fortranfilename(), string_par_codefilename(), string_par_fortranfilename(), string_pp_fortranfilename(), string_predicat_fortranfilename(), stub_var_decl(), task_time_polynome(), task_to_string(), text_area_included(), text_loop(), text_loop_default(), text_pointer_value(), text_points_to_relation(), text_region_no_action(), text_to_string(), text_whileloop(), the_actual_parser(), this_entity_cdeclaration(), this_entity_xmldeclaration(), top_down_abc_array(), tpips_read_a_line(), transfert_statement(), transformer_filter_subsumed_variables(), translate_complexity_from_local_to_current_name(), translate_global_value(), two_string_buffer_append_symbolic(), undefined_pointer_value_entity(), unique_entity_name_p(), unsplit_internal(), update_C_comment(), update_called_modules(), update_runtime_for_remapping(), used_before_set(), variable_to_string(), verify_array_element(), verify_array_variable(), verify_scalar_variable(), whileloop_test(), words_entity_list(), wpips_display_graph_file_display(), write_an_attachment_file(), writeresult(), xml_Application(), xml_Argument(), xml_Array(), xml_array_in_task(), xml_AssignArgument(), xml_Bounds(), xml_Boxes(), xml_Call(), xml_call_from_assignation(), xml_call_from_loopnest(), xml_Chain_Graph(), xml_code(), xml_code_string(), xml_Compute_and_Need(), xml_data(), xml_declarations(), xml_declarations_with_explicit_motif(), xml_dim_string(), xml_Full_Type(), xml_loop(), xml_Loop(), xml_loop_from_sequence(), xml_Matrix(), xml_ParameterUseToArrayBound(), xml_Pattern_Paving(), xml_reference(), xml_reference_with_explicit_motif(), xml_references(), xml_Region_Parameter(), xml_Region_Range(), xml_Scalar(), xml_sequence_from_task(), xml_Task(), xml_task(), xml_TaskParameter(), xml_TaskReturnParameter(), xml_tasks(), xml_tasks_with_motif(), xml_tiling(), xml_Transposition(), and xml_Type_Entity().

+ Here is the call graph for this function:

◆ find_suffix()

string find_suffix ( const string  s,
const string  suffix 
)

Find if a string s end with a suffix.

If yes, return a pointer to the suffix in s, if not, return NULL.

No way if the suffix is longer than the string!

Get it!

Not found:

Parameters
suffixuffix

Definition at line 273 of file string.c.

274 {
275  size_t l = strlen(s);
276  size_t l_suffix = strlen(suffix);
277 
278  if (l < l_suffix)
279  /* No way if the suffix is longer than the string! */
280  return NULL;
281 
282  string suffix_position = s + l - l_suffix;
283  if (memcmp(suffix_position, suffix, l_suffix) == 0)
284  /* Get it! */
285  return suffix_position;
286 
287  /* Not found: */
288  return NULL;
289 }

Referenced by displayable_file_p(), dot_c_file_p(), dot_f90_file_p(), dot_f95_file_p(), dot_F_file_p(), dot_f_file_p(), and preprocessed_to_user_file().

+ Here is the caller graph for this function:

◆ gen_qsort_string_cmp()

int gen_qsort_string_cmp ( const void *  s1,
const void *  s2 
)

Callback for sorting string with qsort.

Returns
see man strcmp
Parameters
s11
s22

Definition at line 332 of file string.c.

332  {
333  return strcmp(*(char **)s1, *(char **)s2);
334 }
s1
Definition: set.c:247

References s1.

Referenced by do_unfolding(), and entity_list_text_format().

+ Here is the caller graph for this function:

◆ gen_strndup()

string gen_strndup ( string  s,
size_t  n 
)

string.c

string.c

The return string is not null terminated. if the original string is a least n-byte long.

recopie

padding

Parameters
nla chaine a copier le nombre de caracteres a copier

Definition at line 59 of file string.c.

62 {
63  size_t i;
64 
65  string r = (string) malloc(n);
66  message_assert("allocated", r);
67 
68  /* recopie */
69  for (i = 0; i < n && s[i] != '\0'; i += 1 )
70  r[i] = s[i];
71 
72  /* padding */
73  while (i < n) {
74  r[i] = '\0';
75  i += 1;
76  }
77 
78  return r;
79 }
void * malloc(YYSIZE_T)
char * string
STRING.
Definition: newgen_types.h:39

References malloc(), and message_assert.

Referenced by AddPackageToName().

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

◆ gen_strndup0()

string gen_strndup0 ( string  s,
size_t  n 
)

Like strdup() but copy at most n characters.

The return string is null terminated.

recopie

padding

Parameters
nla chaine a copier le nombre de caracteres a copier

Definition at line 83 of file string.c.

86 {
87  register string r;
88  register size_t i;
89 
90  r = (string) malloc(n+1);
91  message_assert("allocated", r);
92 
93  /* recopie */
94  for (i = 0; i < n && s[i] != '\0'; i += 1 )
95  r[i] = s[i];
96 
97  /* padding */
98  while (i < n+1) {
99  r[i] = '\0';
100  i += 1;
101  }
102 
103  return r;
104 }

References malloc(), and message_assert.

Referenced by C_any_comment_to_text(), C_standard_comment_to_text(), scope_to_block_scope(), and xml_array_in_task().

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

◆ get_the_buffer()

string get_the_buffer ( void  )

Definition at line 169 of file string.c.

170 {
171  return buffer;
172 }

References buffer.

◆ i2a()

char* i2a ( int  i)

I2A (Integer TO Ascii) yields a string for a given Integer.

Moved in this global place from build.c since it used in many place in PIPS.

Definition at line 121 of file string.c.

121  {
122  static char buf[ 20 ] ;
123  sprintf( &buf[0], "%d", i ) ;
124  return buf;
125 }
static char buf[BSZ]
Definition: split_file.c:157

References buf.

Referenced by alloc(), allocated_memory_simple_in(), cluster_stage_spire(), comment(), copy_obj_out(), copy_obj_out_constructed(), copy_simple_in(), dag_dot_dump_prefix(), dagvtx_dot_node_sb(), dagvtx_nb(), dagvtx_number_str(), dagvtx_to_string(), davinci_print_control_nodes(), davinci_print_non_deterministic_unstructured(), dump_common_layout(), edge_cost_polynome(), eov_add_entity_to_eliminate(), freia_mppa_compile_calls(), freia_opencl_compile_calls(), freia_spoc_code_buildup(), freia_spoc_pipeline(), freia_terapix_call(), freia_trpx_compile_one_dag(), gen_alloc(), gen_alloc_constructed(), gen_arg(), gen_domain(), gen_size(), gen_trav_obj(), gen_trav_obj_constructed(), gen_trav_simple(), generate_wiring(), generic_c_words_simplified_entity(), get_symbol_table(), get_var(), gram_param(), init_member(), lookup(), make_com_loopbody(), make_statement_copy_i(), mppa_call_helper(), mppa_compile_dag(), opencl_compile_mergeable_dag(), opencl_generate_special_kernel_ops(), opencl_merge_and_compile(), persistant_simple_in(), pixel_name(), primitive_field(), print_domain(), print_sdg_task(), quick_multi_recurse_simple_in(), reconnect(), region_entity_variable_to_new_declare_entity(), replicate_declaration(), sc_delimiter(), sc_kernel_compute_loop(), sc_vtx_tostring(), select_imagelet(), set_to_string_buffer(), set_wiring(), shared_simple_in(), spoc_alu_conf(), spoc_measure_conf(), spoc_poc_conf(), spoc_th_conf(), stat_nb(), stmt_nb(), store_initial_value(), task_time_polynome(), terapix_get_reduction(), terapix_gram_management(), terapix_image(), terapix_init_row(), terapix_initialize_memory(), terapix_mcu_img(), terapix_mcu_int(), terapix_mcu_pval(), terapix_mcu_val(), xml_Argument(), xml_array_in_task(), xml_AssignArgument(), xml_expression(), xml_Full_Type(), xml_Matrix(), xml_ParameterUseToArrayBound(), xml_Pattern_Paving(), and xml_Region_Range().

◆ init_the_buffer()

void init_the_buffer ( void  )

initial allocation

Definition at line 127 of file string.c.

128 {
129  /* initial allocation
130  */
131  if (buffer_size==0)
132  {
133  message_assert("NULL buffer", buffer==NULL);
136  message_assert("enough memory", buffer);
137  }
138  current = 0;
139  buffer[0] = '\0';
140 }

References buffer, buffer_size, BUFFER_SIZE_INCREMENT, current, malloc(), and message_assert.

Referenced by concatenate().

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

◆ nth_suffix()

string nth_suffix ( int  i)
Returns
the english suffix for i.

Definition at line 250 of file string.c.

251 {
252  string suffix = string_undefined;
253 
254  message_assert("Formal parameter i is greater or equal to 1", i >= 1);
255 
256  switch(i) {
257  case 1: suffix = "st";
258  break;
259  case 2: suffix = "nd";
260  break;
261  case 3: suffix = "rd";
262  break;
263  default: suffix = "th";
264  break;
265  }
266  return suffix;
267 }

References message_assert, and string_undefined.

Referenced by update_functional_type_with_actual_arguments().

+ Here is the caller graph for this function:

◆ remove_newline_of_string()

string remove_newline_of_string ( string  s)
Returns
a copy of the string whithout the last "\n" char
Parameters
s,thestring to process

Definition at line 309 of file string.c.

310 {
311  return chop_newline(s, true) ;
312 }
string chop_newline(string s, bool flg)
Definition: string.c:294

References chop_newline().

Referenced by get_vertex_by_string(), print_graph_of_text_to_daVinci(), and print_marged_text_from_starting_node().

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

◆ str_append()

void str_append ( string dst,
string  suffix 
)

Append the suffix to the string.

Free the destination string if needed

Parameters
dst,thestring to be modified
suffix,thesuffix to be appended
Parameters
dstst
suffixuffix

Definition at line 356 of file string.c.

356  {
357  if ((suffix == NULL) || suffix == string_undefined || strlen (suffix) == 0)
358  return;
359  string old = * dst;
360  *dst = strdup (concatenate (*dst, suffix, NULL));
361  free (old);
362 }
void free(void *)
string concatenate(const char *next,...)
Return the concatenation of the given strings.
Definition: string.c:183

References concatenate(), free(), strdup(), and string_undefined.

Referenced by get_c_full_name().

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

◆ str_prepend()

void str_prepend ( string dst,
string  prefix 
)

Prepend the prefix to the string.

Free the destination string if needed

Parameters
dst,thestring to be modified
prefix,theprefix to be prepended
Parameters
dstst
prefixrefix

Definition at line 342 of file string.c.

342  {
343  if ((prefix == NULL) || prefix == string_undefined || strlen (prefix) == 0)
344  return;
345  string old = * dst;
346  *dst = strdup (concatenate (prefix, *dst,NULL));
347  free (old);
348 }
static const char * prefix

References concatenate(), free(), prefix, strdup(), and string_undefined.

Referenced by get_c_full_name().

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

◆ strlower()

string strlower ( string  s1,
const char *  s2 
)
Parameters
s11
s22

Definition at line 228 of file string.c.

229 {
230  char *r = s1;
231 
232  while (*s2) {
233  *s1 = (isupper((int)*s2)) ? tolower(*s2) : *s2;
234  s1++;
235  s2++;
236  }
237 
238  *s1 = '\0';
239 
240  return r;
241 }

References s1.

Referenced by c_call(), c_dim_string(), c_entity_local_name(), const_wrapper(), and make_loadsave_statement().

+ Here is the caller graph for this function:

◆ strsplit()

list strsplit ( const char *  s,
const char *  d 
)
Returns
array of string
Parameters
sstring considered @pram d delimiter

Definition at line 318 of file string.c.

319 {
320  string buffer=strdup(s);
321  list split = NIL;
322  for(string tmp = strtok(buffer,d); tmp;tmp=strtok(NULL,d))
323  split=CONS(STRING,strdup(tmp),split);
324  free(buffer);
325  return gen_nreverse(split);
326 }
#define STRING(x)
Definition: genC.h:87
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References buffer, CONS, free(), gen_nreverse(), NIL, strdup(), and STRING.

Referenced by do_unfolding(), find_receiver_cluster(), make_string_set_from_prop(), pragma_parse_PRAGMA_DISTRIBUTED(), string_to_entities(), and string_to_expressions().

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

◆ strupper()

string strupper ( string  s1,
const char *  s2 
)
Parameters
s11
s22

Definition at line 213 of file string.c.

214 {
215  char *r = s1;
216 
217  while (*s2) {
218  *s1 = (islower((int)*s2)) ? toupper(*s2) : *s2;
219  s1++;
220  s2++;
221  }
222 
223  *s1 = '\0';
224 
225  return r;
226 }

References s1.

Referenced by build_aliases(), get_operator_id(), get_simd_vector_type(), get_vect_name_from_data(), gfc2pips_namespace(), make_new_scalar_variable_with_prefix(), open_module(), outline(), sc_delimiter(), and xml_entity_local_name().

+ Here is the caller graph for this function: