Ticket #560: parrot_path_str.patch

File parrot_path_str.patch, 2.1 KB (added by wayland, 13 years ago)
  • src/library.c

     
    768768 
    769769/* 
    770770 
     771=item C<STRING* Parrot_lib_search_paths_as_string> 
     772 
     773Returns a STRING that contains the specified search path, separated by colons (:).   
     774 
     775The C<enum_runtime_ft type> is one or more of the types defined in 
     776F<include/parrot/library.h>. 
     777 
     778=cut 
     779 
     780*/ 
     781 
     782PARROT_EXPORT 
     783PARROT_WARN_UNUSED_RESULT 
     784PARROT_CAN_RETURN_NULL 
     785STRING* 
     786Parrot_lib_search_paths_as_string(PARROT_INTERP, enum_runtime_ft type) 
     787{ 
     788    ASSERT_ARGS(Parrot_lib_search_paths_as_string) 
     789    STRING *prefix; 
     790    STRING *full_search_path; 
     791    PMC    *paths; 
     792    INTVAL  i, n; 
     793 
     794/* TODO: Get the real separator, not this hacked-together stuff */ 
     795#ifdef WIN32 
     796    STRING * const env_search_path_sep = CONST_STRING(interp, ";");  
     797#else 
     798    STRING * const env_search_path_sep = CONST_STRING(interp, ":"); 
     799#endif 
     800 
     801    if (type & PARROT_RUNTIME_FT_DYNEXT) 
     802        paths = get_search_paths(interp, PARROT_LIB_PATH_DYNEXT); 
     803    else if (type & (PARROT_RUNTIME_FT_PBC | PARROT_RUNTIME_FT_SOURCE)) 
     804        paths = get_search_paths(interp, PARROT_LIB_PATH_LIBRARY); 
     805    else 
     806        paths = get_search_paths(interp, PARROT_LIB_PATH_INCLUDE); 
     807 
     808    full_search_path = Parrot_str_join(interp, env_search_path_sep, paths); 
     809 
     810    return full_search_path; 
     811} 
     812 
     813/* 
     814 
    771815=item C<char* Parrot_get_runtime_prefix(PARROT_INTERP)> 
    772816 
    773817Return a malloced C-string for the runtime prefix.  The calling function 
  • include/parrot/library.h

     
    8383        __attribute__nonnull__(2) 
    8484        FUNC_MODIFIES(*file); 
    8585 
     86PARROT_EXPORT 
     87PARROT_WARN_UNUSED_RESULT 
     88PARROT_CAN_RETURN_NULL 
     89STRING* Parrot_lib_search_paths_as_string(PARROT_INTERP, 
     90    enum_runtime_ft type) 
     91        __attribute__nonnull__(1); 
     92 
    8693void parrot_init_library_paths(PARROT_INTERP) 
    8794        __attribute__nonnull__(1); 
    8895