| 1 | /////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2000-2014 Ericsson Telecom AB |
| 3 | // All rights reserved. This program and the accompanying materials |
| 4 | // are made available under the terms of the Eclipse Public License v1.0 |
| 5 | // which accompanies this distribution, and is available at |
| 6 | // http://www.eclipse.org/legal/epl-v10.html |
| 7 | /////////////////////////////////////////////////////////////////////////////// |
| 8 | #ifndef XPATHER_H_ |
| 9 | #define XPATHER_H_ |
| 10 | |
| 11 | #include <stdio.h> |
| 12 | |
| 13 | typedef int boolean; |
| 14 | #define TRUE 1 |
| 15 | #define FALSE 0 |
| 16 | |
| 17 | enum tpd_result { TPD_FAILED = -1, TPD_SKIPPED = 0, TPD_SUCCESS = 1 }; |
| 18 | |
| 19 | struct string_list { |
| 20 | char* str; |
| 21 | struct string_list* next; |
| 22 | }; |
| 23 | |
| 24 | struct string2_list { |
| 25 | char* str1; |
| 26 | char* str2; |
| 27 | struct string2_list* next; |
| 28 | }; |
| 29 | |
| 30 | #ifdef __cplusplus |
| 31 | extern "C" |
| 32 | #endif |
| 33 | boolean isTopLevelExecutable(const char* projName); |
| 34 | |
| 35 | #ifdef __cplusplus |
| 36 | extern "C" |
| 37 | #endif |
| 38 | boolean isDynamicLibrary(const char* key); |
| 39 | |
| 40 | #ifdef __cplusplus |
| 41 | extern "C" |
| 42 | #endif |
| 43 | const char* findLibraryPath(const char* libraryName, const char* projName); |
| 44 | |
| 45 | #ifdef __cplusplus |
| 46 | extern "C" |
| 47 | #endif |
| 48 | const char* findLibraryName(const char* libraryName, const char* projName); |
| 49 | |
| 50 | #ifdef __cplusplus |
| 51 | extern "C" |
| 52 | #endif |
| 53 | void erase_libs(); |
| 54 | |
| 55 | #ifdef __cplusplus |
| 56 | extern "C" |
| 57 | #endif |
| 58 | const char* getLibFromProject(const char* projName); |
| 59 | |
| 60 | #ifdef __cplusplus |
| 61 | extern "C" |
| 62 | #endif |
| 63 | struct string_list* getExternalLibs(const char* projName); |
| 64 | |
| 65 | #ifdef __cplusplus |
| 66 | extern "C" |
| 67 | #endif |
| 68 | struct string_list* getExternalLibPathes(const char* projName); |
| 69 | |
| 70 | #ifdef __cplusplus |
| 71 | extern "C" |
| 72 | #endif |
| 73 | struct string2_list* getLinkerLibs(const char* projName); |
| 74 | |
| 75 | #ifdef __cplusplus |
| 76 | extern "C" |
| 77 | #endif |
| 78 | struct string_list* getRefWorkingDirs(const char* projName); |
| 79 | |
| 80 | #ifdef __cplusplus |
| 81 | extern "C" |
| 82 | #endif |
| 83 | boolean hasExternalLibrary(const char* libName, const char* projName); |
| 84 | |
| 85 | #ifdef __cplusplus |
| 86 | extern "C" |
| 87 | #endif |
| 88 | boolean hasSubProject(const char* projName); |
| 89 | |
| 90 | #ifdef __cplusplus |
| 91 | extern "C" |
| 92 | #endif |
| 93 | void print_libs(); |
| 94 | |
| 95 | #ifdef __cplusplus |
| 96 | extern "C" |
| 97 | #endif |
| 98 | boolean isTtcn3ModuleInLibrary(const char* moduleName); |
| 99 | |
| 100 | #ifdef __cplusplus |
| 101 | extern "C" |
| 102 | #endif |
| 103 | const char* getTPDFileName(const char* projName); |
| 104 | |
| 105 | #ifdef __cplusplus |
| 106 | extern "C" |
| 107 | #endif |
| 108 | const char* getPathToRootDir(const char* projName); |
| 109 | |
| 110 | #ifdef __cplusplus |
| 111 | extern "C" |
| 112 | #endif |
| 113 | boolean isAsn1ModuleInLibrary(const char* moduleName); |
| 114 | |
| 115 | #ifdef __cplusplus |
| 116 | extern "C" |
| 117 | #endif |
| 118 | boolean isSourceFileInLibrary(const char* fileName); |
| 119 | |
| 120 | #ifdef __cplusplus |
| 121 | extern "C" |
| 122 | #endif |
| 123 | boolean isHeaderFileInLibrary(const char* fileName); |
| 124 | |
| 125 | #ifdef __cplusplus |
| 126 | extern "C" |
| 127 | #endif |
| 128 | boolean isTtcnPPFileInLibrary(const char* fileName); |
| 129 | |
| 130 | #ifdef __cplusplus |
| 131 | extern "C" |
| 132 | #endif |
| 133 | boolean buildObjects(const char* projName, boolean add_referenced); |
| 134 | |
| 135 | |
| 136 | /** |
| 137 | * |
| 138 | * @param p_tpd_name filename |
| 139 | * @param actcfg actual configuration name |
| 140 | * @param file_list_path the argument of the -P switch |
| 141 | * @param argc pointer to argv |
| 142 | * @param argv pointer to argc |
| 143 | * @param optind pointer to optind |
| 144 | * @param ets_name from the -e switch |
| 145 | * @param gnu_make from the -g switch |
| 146 | * @param single_mode -s switch |
| 147 | * @param central_storage -c switch |
| 148 | * @param absolute_paths -a switch |
| 149 | * @param preprocess -p switch |
| 150 | * @param use_runtime_2 -R switch |
| 151 | * @param dynamic dynamic linking, -l switch |
| 152 | * @param makedepend -m switch |
| 153 | * @param filelist -P switch |
| 154 | * @param recursive -r switch |
| 155 | * @param force_overwrite -F switch |
| 156 | * @param output_file from the -o switch |
| 157 | * @param abs_work_dir workingDirectory element of TPD will be stored here, must be Free()'d |
| 158 | * @param sub_project_dirs directories of sub-projects that need to be built before this one, |
| 159 | if set to NULL when calling this function then it won't be set, otherwise it must be deallocated after the call |
| 160 | * @param program_name original value of argv[0], which is the executable path used to start this program |
| 161 | * @param prj_graph_fp write project graph xml data into this file if not NULL |
| 162 | * @create_symlink_list a list of symlinks to be created |
| 163 | * @param ttcn3_prep_includes TTCN3preprocessorIncludes |
| 164 | * @param ttcn3_prep_defines preprocessorDefines |
| 165 | * @param prep_includes preprocessorIncludes |
| 166 | * @param prep_defines preprocessorDefines |
| 167 | * @param codesplit codeSplitting |
| 168 | * @param quietly quietly |
| 169 | * @param disablesubtypecheck disableSubtypeChecking |
| 170 | * @param cxxcompiler CxxCompiler |
| 171 | * @param optlevel optimizationLevel |
| 172 | * @param optflags otherOptimizationFlags |
| 173 | * @param disableber disableBER -b |
| 174 | * @param disableraw disableRAW -r |
| 175 | * @param disabletext disableTEXT -x |
| 176 | * @param disablexer disableXER -X |
| 177 | * @param disablejson disableJSON -j |
| 178 | * @param forcexerinasn forceXERinASN.1 -a |
| 179 | * @param defaultasomit defaultasOmit -d |
| 180 | * @param gccmessageformat gccMessageFormat -g |
| 181 | * @param linenumber lineNumbersOnlyInMessages -i |
| 182 | * @param includesourceinfo includeSourceInfo -L |
| 183 | * @param addsourcelineinfo addSourceLineInfo -l |
| 184 | * @param suppresswarnings suppressWarnings -S |
| 185 | * @param outparamboundness outParamBoundness -Y |
| 186 | * @param solspeclibs SolarisSpecificLibraries |
| 187 | * @param sol8speclibs Solaris8SpecificLibraries |
| 188 | * @param linuxspeclibs LinuxSpecificLibraries |
| 189 | * @param freebsdspeclibs FreeBSDSpecificLibraries |
| 190 | * @param win32speclibs Win32SpecificLibraries |
| 191 | * @param ttcn3preprocessor ttcn3preprocessor |
| 192 | * @param linkerlibs linkerlibs |
| 193 | * @param linkerlibrarysearchpath linkerlibrarysearchpath |
| 194 | * @param Vflag -V switch |
| 195 | * @param Dflag -D switch |
| 196 | * @param generatorCommandOutput the output of the command that generates a Makefile snippet |
| 197 | * @param target_placement_list a list of (target,placement) strings pairs from the TPD |
| 198 | * @param prefix_workdir prefix working directory with project name |
| 199 | * @param run_command_list contains the working directories and the makefilegen commands to be called there |
| 200 | * @return TPD_SUCESS if parsing successful, TPD_SKIPPED if the tpd |
| 201 | * was seen already, or TPD_FAILED on error. |
| 202 | */ |
| 203 | #ifdef __cplusplus |
| 204 | extern "C" |
| 205 | #else |
| 206 | enum |
| 207 | #endif |
| 208 | tpd_result process_tpd(const char *p_tpd_name, const char *actcfg, |
| 209 | const char *file_list_path, |
| 210 | int *argc, char ***argv, |
| 211 | int *optind, char **ets_name, char **project_name, |
| 212 | boolean *gnu_make, boolean *single_mode, |
| 213 | boolean *central_storage, boolean *absolute_paths, |
| 214 | boolean *preprocess, boolean *use_runtime_2, |
| 215 | boolean *dynamic, boolean *makedepend, boolean *filelist, |
| 216 | boolean *library, boolean recursive, boolean force_overwrite, boolean gen_only_top_level, |
| 217 | const char *output_file, char** abs_work_dir, struct string_list* sub_project_dirs, |
| 218 | const char* program_name, FILE* prj_graph_fp, struct string2_list* create_symlink_list, struct string_list* ttcn3_prep_includes, |
| 219 | struct string_list* ttcn3_prep_defines, struct string_list* ttcn3_prep_undefines, struct string_list* prep_includes, |
| 220 | struct string_list* prep_defines, struct string_list* prep_undefines, boolean *codesplit, boolean *quietly, boolean *disablesubtypecheck, |
| 221 | char** cxxcompiler, char** optlevel, char** optflags, boolean *disableber, boolean *disableraw, boolean *disabletext, boolean *disablexer, |
| 222 | boolean *disablejson, boolean *forcexerinasn, boolean *defaultasomit, boolean *gccmessageformat, |
| 223 | boolean *linenumber, boolean *includesourceinfo, boolean *addsourcelineinfo, boolean *suppresswarnings, |
| 224 | boolean *outparamboundness, struct string_list* solspeclibs, struct string_list* sol8speclibs, |
| 225 | struct string_list* linuxspeclibs, struct string_list* freebsdspeclibs, struct string_list* win32speclibs, |
| 226 | char** ttcn3preprocessor, struct string_list* linkerlibs, struct string_list* additionalObjects, struct string_list* linkerlibsearchpath, boolean Vflag, boolean Dflag, |
| 227 | boolean *Zflag, boolean *Hflag, char** generatorCommandOutput, struct string2_list* target_placement_list, boolean prefix_workdir, struct string2_list* run_command_list, |
| 228 | struct string2_list* required_configs); |
| 229 | |
| 230 | #endif /* XPATHER_H_ */ |