X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmain.C;h=e41f0cbe9c9369c28491e70839d9d0264c6c3f0b;hb=3c357d8bcdb855ea71487d2b2b6e518bf8a493f6;hp=84a3cad3422b807b4f4246d0fe3c702caa438d1e;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/main.C b/cinelerra-5.1/cinelerra/main.C index 84a3cad3..e41f0cbe 100644 --- a/cinelerra-5.1/cinelerra/main.C +++ b/cinelerra-5.1/cinelerra/main.C @@ -22,7 +22,7 @@ #include "batchrender.h" #include "bcsignals.h" #include "edl.h" -#include "file.inc" +#include "file.h" #include "filexml.h" #include "filesystem.h" #include "language.h" @@ -35,15 +35,23 @@ #include "pluginserver.h" #include "preferences.h" #include "renderfarmclient.h" +#include "units.h" #include "versioninfo.h" #include #include #include -#define PACKAGE "cinelerra" -#define LOCALEDIR "/locale/" - +#ifdef LEAKER +#define STRC(v) printf("==new %p from %p sz %jd\n", v, __builtin_return_address(0), n) +#define STRD(v) printf("==del %p from %p\n", v, __builtin_return_address(0)) +void *operator new(size_t n) { void *vp = malloc(n); STRC(vp); bzero(vp,n); return vp; } +void operator delete(void *t) { STRD(t); free(t); } +void operator delete(void *t,size_t n) { STRD(t); free(t); } +void *operator new[](size_t n) { void *vp = malloc(n); STRC(vp); bzero(vp,n); return vp; } +void operator delete[](void *t) { STRD(t); free(t); } +void operator delete[](void *t,size_t n) { STRD(t); free(t); } +#endif enum { @@ -105,45 +113,21 @@ int main(int argc, char *argv[]) char deamon_path[BCTEXTLEN]; char config_path[BCTEXTLEN]; char batch_path[BCTEXTLEN]; - char locale_path[BCTEXTLEN]; - char exe_path[BCTEXTLEN]; - char env_path[BCTEXTLEN]; int nice_value = 20; config_path[0] = 0; batch_path[0] = 0; deamon_path[0] = 0; EDL::id_lock = new Mutex("EDL::id_lock"); + Units::init(); + + File::init_cin_path(); + const char *locale_path = File::get_locale_path(); + const char *cin = File::get_cin(); + + bindtextdomain(cin, locale_path); + textdomain(cin); + setlocale(LC_MESSAGES, ""); - get_exe_path(exe_path); - snprintf(env_path, sizeof(env_path), "CINELERRA_PATH=%s", exe_path); - putenv(env_path); - sprintf(locale_path, "%s%s", exe_path, LOCALEDIR); - -// detect an UTF-8 locale and try to use a non-Unicode locale instead -// <---Beginning of dirty hack -// This hack will be removed as soon as Cinelerra is UTF-8 compliant -// char *s, *language; - -// Query user locale -// if ((s = getenv("LC_ALL")) || -// (s = getenv("LC_MESSAGES")) || -// (s = getenv("LC_CTYPE")) || -// (s = getenv ("LANG"))) -// { -// Test if user locale is set to Unicode -// if (strstr(s, ".UTF-8")) -// { -// extract language from language-charset@variant -// language = strtok (s, ".@"); -// set language as the default locale -// setenv("LANG", language, 1); -// } -// } -// End of dirty hack ---> - - bindtextdomain (PACKAGE, locale_path); - textdomain (PACKAGE); - setlocale (LC_MESSAGES, ""); #ifdef X_HAVE_UTF8_STRING char *loc = setlocale(LC_CTYPE, ""); if( loc ) { @@ -308,12 +292,10 @@ int main(int argc, char *argv[]) printf(_("-d = Run in the background as renderfarm client. The port (400) is optional.\n")); printf(_("-f = Run in the foreground as renderfarm client. Substitute for -d.\n")); printf(_("-n = Nice value if running as renderfarm client. (20)\n")); - printf(_("-c = Configuration file to use instead of %s%s.\n"), - BCASTDIR, - CONFIG_FILE); - printf(_("-r = batch render the contents of the batch file (%s%s) with no GUI. batch file is optional.\n"), - BCASTDIR, - BATCH_PATH); + printf(_("-c = Configuration file to use instead of %s/%s.\n"), + File::get_config_path(), CONFIG_FILE); + printf(_("-r = batch render the contents of the batch file (%s/%s) with no GUI. batch file is optional.\n"), + File::get_config_path(), BATCH_PATH); printf(_("filenames = files to load\n\n\n")); exit(0); break; @@ -426,6 +408,7 @@ DISABLE_BUFFER filenames.remove_all_objects(); delete EDL::id_lock; EDL::id_lock = 0; + Units::finit(); return 0; }