moved many variables that were constructed during every make out into
the environment. cleaned up convoluted shell commands to make more
efficient. removed old compiler tags that were hiding chunks of code.
still need to get the create guid app online; was not working due to
errors in comdef.h from cygwin (could not find new.h, some kind of
snafu in the cygwin headers).
45 files changed:
issued
and just show the output of running those commands.
</big>
issued
and just show the output of running those commands.
</big>
- <h4><big>OP_SYSTEM</big></h4>
+ <h4><big>OPERATING_SYSTEM</big></h4>
<big> This is a flag that defines the
operating
system
<big> This is a flag that defines the
operating
system
#include <CxxToken.hxx>
#include <stdio.h>
#include <CxxToken.hxx>
#include <stdio.h>
-#else
-#include <malloc.h>
+//#else
+//#include <malloc.h>
void advance_search();
void end_search(CxxToken *aToken);
YACC_MARK_TYPE mark();
void advance_search();
void end_search(CxxToken *aToken);
YACC_MARK_TYPE mark();
// we don't need a long string to be parsed; the list is ready.
return listo_cmds;
}
// we don't need a long string to be parsed; the list is ready.
return listo_cmds;
}
#elif defined(_MSC_VER)
// we have easy access to the original list of commands.
for (int i = 0; i < _global_argc; i++) {
#elif defined(_MSC_VER)
// we have easy access to the original list of commands.
for (int i = 0; i < _global_argc; i++) {
listo_cmds += _global_argv[i];
}
return listo_cmds;
listo_cmds += _global_argv[i];
}
return listo_cmds;
#else
COMPLAIN_CMDS("this OS doesn't support getting the command line.");
return listo_cmds;
#else
COMPLAIN_CMDS("this OS doesn't support getting the command line.");
return listo_cmds;
#elif defined(_MSC_VER)
// for win32 we need to support four different environments--console mode,
// borland compilation, MFC programs and regular windows programs.
#elif defined(_MSC_VER)
// for win32 we need to support four different environments--console mode,
// borland compilation, MFC programs and regular windows programs.
return to_run_obj.execute_application(); \
}
#endif
return to_run_obj.execute_application(); \
}
#endif
// zap all of them using our signal.
for (int i = 0; i < pids.length(); i++) {
// zap all of them using our signal.
for (int i = 0; i < pids.length(); i++) {
-//would linux be better served with sigterm also?
-#ifndef _MSC_VER
+//hmmm: would linux be better served with sigterm instead, like we used to do for windoze?
+//#ifndef _MSC_VER
-#else
-//lame--goes to whole program.
- raise(SIGTERM);
-#endif
+//#else
+////lame--goes to whole program.
+// raise(SIGTERM);
+//#endif
//hmmm: check results...
}
//hmmm: check results...
}
// setup signal handler for HUP signal. this is the one used to tell us
// to leave.
// setup signal handler for HUP signal. this is the one used to tell us
// to leave.
signal(SIGHUP, handle_OS_signal);
signal(SIGHUP, handle_OS_signal);
// setup a handler for interrupt (e.g. ctrl-C) also.
signal(SIGINT, handle_OS_signal);
// setup a handler for interrupt (e.g. ctrl-C) also.
signal(SIGINT, handle_OS_signal);
-#ifdef _MSC_VER
- signal(SIGBREAK, handle_OS_signal);
-#endif
+//#ifdef _MSC_VER
+// signal(SIGBREAK, handle_OS_signal);
+//#endif
using namespace filesystem;
using namespace structures;
using namespace filesystem;
using namespace structures;
// this implementation only works on windows currently.
//hmmm: i suppose we could fake it with an ini file.
// this implementation only works on windows currently.
//hmmm: i suppose we could fake it with an ini file.
// the longest that value names can be in the registry.
// a default we hope never to see in the registry.
// the longest that value names can be in the registry.
// a default we hope never to see in the registry.
-//SAFE_STATIC_CONST(astring, registry_configurator::reg_str_fake_default,
- // ("bogus_never_should_see"));
const astring ®istry_configurator::reg_str_fake_default()
{
static astring _hidden = "bogus_never_should_see";
const astring ®istry_configurator::reg_str_fake_default()
{
static astring _hidden = "bogus_never_should_see";
if (!to_store.length()) return delete_entry(section, entry);
else if (!section.length()) return false;
if (!to_store.length()) return delete_entry(section, entry);
else if (!section.length()) return false;
HKEY key;
long ret = RegOpenKeyEx((HKEY)translate_hive(_hive),
to_unicode_temp(section), 0, KEY_WRITE, &key);
HKEY key;
long ret = RegOpenKeyEx((HKEY)translate_hive(_hive),
to_unicode_temp(section), 0, KEY_WRITE, &key);
if (!section_in) return false;
if (!entry) {} // not a problem.
astring section = fix_section(section_in);
if (!section_in) return false;
if (!entry) {} // not a problem.
astring section = fix_section(section_in);
HKEY key;
long ret = RegOpenKeyEx((HKEY)translate_hive(_hive),
to_unicode_temp(section), 0, KEY_QUERY_VALUE, &key);
HKEY key;
long ret = RegOpenKeyEx((HKEY)translate_hive(_hive),
to_unicode_temp(section), 0, KEY_QUERY_VALUE, &key);
info.reset();
if (!section_in.length()) return false;
astring section = fix_section(section_in);
info.reset();
if (!section_in.length()) return false;
astring section = fix_section(section_in);
HKEY key;
long ret = RegOpenKeyEx((HKEY)translate_hive(_hive),
to_unicode_temp(section), 0, KEY_QUERY_VALUE, &key);
HKEY key;
long ret = RegOpenKeyEx((HKEY)translate_hive(_hive),
to_unicode_temp(section), 0, KEY_QUERY_VALUE, &key);
FUNCDEF("section_exists");
if (!section_in.length()) return false;
astring section = fix_section(section_in);
FUNCDEF("section_exists");
if (!section_in.length()) return false;
astring section = fix_section(section_in);
HKEY key;
long ret = RegOpenKeyEx((HKEY)translate_hive(_hive),
to_unicode_temp(section), 0, KEY_QUERY_VALUE, &key);
HKEY key;
long ret = RegOpenKeyEx((HKEY)translate_hive(_hive),
to_unicode_temp(section), 0, KEY_QUERY_VALUE, &key);
if (!section_in.length()) return false;
astring section = fix_section(section_in);
//if the key doesn't exist, should that be a failure?
if (!section_in.length()) return false;
astring section = fix_section(section_in);
//if the key doesn't exist, should that be a failure?
long ret = SHDeleteKey((HKEY)translate_hive(_hive),
to_unicode_temp(section));
if (ret != ERROR_SUCCESS) {
long ret = SHDeleteKey((HKEY)translate_hive(_hive),
to_unicode_temp(section));
if (ret != ERROR_SUCCESS) {
astring section = fix_section(section_in);
if (!entry) {} // no problem.
astring section = fix_section(section_in);
if (!entry) {} // no problem.
HKEY key;
long ret = RegOpenKeyEx((HKEY)translate_hive(_hive),
to_unicode_temp(section), 0, KEY_SET_VALUE, &key);
HKEY key;
long ret = RegOpenKeyEx((HKEY)translate_hive(_hive),
to_unicode_temp(section), 0, KEY_SET_VALUE, &key);
// gnarly headers that are needed for certain types of compilation...
//unix headers not needed in here for new purpose of file.
// gnarly headers that are needed for certain types of compilation...
//unix headers not needed in here for new purpose of file.
#include <unistd.h>
#ifdef __GNU_WINDOWS__
#include <sys/unistd.h>
#endif
#include <unistd.h>
#ifdef __GNU_WINDOWS__
#include <sys/unistd.h>
#endif
#ifndef NO_XWINDOWS
#ifdef __XWINDOWS__
#include <Intrinsic.h>
#ifndef NO_XWINDOWS
#ifdef __XWINDOWS__
#include <Intrinsic.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#ifdef _MSC_VER
#undef strcasecmp
#undef strncasecmp
#define strcasecmp strcmpi
#define strncasecmp strnicmp
#endif
#ifdef _MSC_VER
#undef strcasecmp
#undef strncasecmp
#define strcasecmp strcmpi
#define strncasecmp strnicmp
#endif
//#define DEBUG_STRING
// uncomment for debugging version.
//#define DEBUG_STRING
// uncomment for debugging version.
// compiler specific dumping ground for global settings...
// compiler specific dumping ground for global settings...
#ifdef _MSC_VER
// turns off annoying complaints from visual c++.
#pragma warning(disable : 4251 4275 4003 4800 4355 4786 4290 4996 4407)
#ifdef _MSC_VER
// turns off annoying complaints from visual c++.
#pragma warning(disable : 4251 4275 4003 4800 4355 4786 4290 4996 4407)
// typedef long long __int64;
//#define __SIZE_TYPE__ long unsigned int
#endif // ms visual c++.
// typedef long long __int64;
//#define __SIZE_TYPE__ long unsigned int
#endif // ms visual c++.
#include <stdlib.h>
#include <sys/types.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/times.h>
#include <unistd.h>
#include <sys/times.h>
/*
#ifdef _MSC_VER
#define _WINSOCKAPI_ // make windows.h happy about winsock.
/*
#ifdef _MSC_VER
#define _WINSOCKAPI_ // make windows.h happy about winsock.
astring environment::get(const astring &variable_name)
{
astring environment::get(const astring &variable_name)
{
-#ifdef _MSC_VER
- char *value = getenv(variable_name.upper().observe());
- // dos & os/2 require upper case for the name, so we just do it that way.
-#else
+//#ifdef _MSC_VER
+// char *value = getenv(variable_name.upper().observe());
+// // dos & os/2 require upper case for the name, so we just do it that way.
+//#else
char *value = getenv(variable_name.observe());
// reasonable OSes support mixed-case environment variables.
char *value = getenv(variable_name.observe());
// reasonable OSes support mixed-case environment variables.
astring to_return;
if (value)
to_return = astring(value);
astring to_return;
if (value)
to_return = astring(value);
bool environment::set(const astring &variable_name, const astring &value)
{
int ret = 0;
bool environment::set(const astring &variable_name, const astring &value)
{
int ret = 0;
-#ifdef _MSC_VER
- astring assignment = variable_name + "=" + value;
- ret = _putenv(assignment.s());
-#else
+//#ifdef _MSC_VER
+// astring assignment = variable_name + "=" + value;
+// ret = _putenv(assignment.s());
+//#else
ret = setenv(variable_name.s(), value.s(), true);
ret = setenv(variable_name.s(), value.s(), true);
return !ret;
}
basis::un_int environment::system_uptime()
{
return !ret;
}
basis::un_int environment::system_uptime()
{
-#ifdef _MSC_VER
- return timeGetTime();
-#else
+//#ifdef _MSC_VER
+// return timeGetTime();
+//#else
static clock_t __ctps = sysconf(_SC_CLK_TCK); // clock ticks per second.
static const double __multiplier = 1000.0 / double(__ctps);
// the multiplier gives us our full range for the tick counter.
static clock_t __ctps = sysconf(_SC_CLK_TCK); // clock ticks per second.
static const double __multiplier = 1000.0 / double(__ctps);
// the multiplier gives us our full range for the tick counter.
// emulation) and thus it becomes a bug around 49 days and 17 hours into
// OS uptime because the value gets stuck at 2^32-1 and never rolls over.
return basis::un_int(ticks_up);
// emulation) and thus it becomes a bug around 49 days and 17 hours into
// OS uptime because the value gets stuck at 2^32-1 and never rolls over.
return basis::un_int(ticks_up);
#define from_unicode_persist(name, s) null_transcoder name(s, true)
#endif
#define from_unicode_persist(name, s) null_transcoder name(s, true)
#endif
-#ifdef _MSC_VER
- //! sends UTF-8 information to the diagnostic view in the IDE.
- #define TRACE_PRINT(s) TRACE(_T("%s"), to_unicode_temp(s))
-#endif
+//#ifdef _MSC_VER
+// //! sends UTF-8 information to the diagnostic view in the IDE.
+// #define TRACE_PRINT(s) TRACE(_T("%s"), to_unicode_temp(s))
+//#endif
operator char * () { return (char *)_converted; }
operator const char * () const { return (const char *)_converted; }
operator char * () { return (char *)_converted; }
operator const char * () const { return (const char *)_converted; }
+ operator astring() const { return astring((const char *)_converted); }
+ //!< converts the char pointer into an astring object.
+
private:
bool _make_own_copy;
const UTF8 *_converted;
private:
bool _make_own_copy;
const UTF8 *_converted;
#include <mach-o/dyld.h>
#include <limits.h>
#endif
#include <mach-o/dyld.h>
#include <limits.h>
#endif
-#ifdef _MSC_VER
- #include <direct.h>
- #include <process.h>
-#else
+//#ifdef _MSC_VER
+// #include <direct.h>
+// #include <process.h>
+//#else
#include <dirent.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
to_return = (char *)buffer;
#elif defined(__UNIX__) || defined(__GNU_WINDOWS__)
to_return = get_cmdline_from_proc();
to_return = (char *)buffer;
#elif defined(__UNIX__) || defined(__GNU_WINDOWS__)
to_return = get_cmdline_from_proc();
#elif defined(_MSC_VER)
flexichar low_buff[MAX_ABS_PATH + 1];
GetModuleFileName(NULL_POINTER, low_buff, MAX_ABS_PATH - 1);
astring buff = from_unicode_temp(low_buff);
buff.to_lower(); // we lower-case the name since windows seems to UC it.
to_return = buff;
#elif defined(_MSC_VER)
flexichar low_buff[MAX_ABS_PATH + 1];
GetModuleFileName(NULL_POINTER, low_buff, MAX_ABS_PATH - 1);
astring buff = from_unicode_temp(low_buff);
buff.to_lower(); // we lower-case the name since windows seems to UC it.
to_return = buff;
#else
#pragma error("hmmm: no means of finding app name is implemented.")
SET_BOGUS_NAME("not_implemented_for_this_OS");
#else
#pragma error("hmmm: no means of finding app name is implemented.")
SET_BOGUS_NAME("not_implemented_for_this_OS");
-#if defined(__UNIX__) || defined(_MSC_VER) || defined(__GNU_WINDOWS__)
+#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
+//defined(_MSC_VER) ||
basis::un_int application_configuration::process_id() { return getpid(); }
#else
#pragma error("hmmm: need process id implementation for this OS!")
basis::un_int application_configuration::process_id() { return getpid(); }
#else
#pragma error("hmmm: need process id implementation for this OS!")
char buff[MAX_ABS_PATH];
getcwd(buff, MAX_ABS_PATH - 1);
to_return = buff;
char buff[MAX_ABS_PATH];
getcwd(buff, MAX_ABS_PATH - 1);
to_return = buff;
-#elif defined(_MSC_VER)
- flexichar low_buff[MAX_ABS_PATH + 1];
- GetCurrentDirectory(MAX_ABS_PATH, low_buff);
- to_return = from_unicode_temp(low_buff);
+//#elif defined(_MSC_VER)
+// flexichar low_buff[MAX_ABS_PATH + 1];
+// GetCurrentDirectory(MAX_ABS_PATH, low_buff);
+// to_return = from_unicode_temp(low_buff);
#else
#pragma error("hmmm: need support for current directory on this OS.")
to_return = ".";
#else
#pragma error("hmmm: need support for current directory on this OS.")
to_return = ".";
utsname kernel_parms;
uname(&kernel_parms);
to_return = version(kernel_parms.release);
utsname kernel_parms;
uname(&kernel_parms);
to_return = version(kernel_parms.release);
-#elif defined(_MSC_VER)
- OSVERSIONINFO info;
- info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- ::GetVersionEx(&info);
- to_return = version(a_sprintf("%u.%u.%u.%u", basis::un_short(info.dwMajorVersion),
- basis::un_short(info.dwMinorVersion), basis::un_short(info.dwPlatformId),
- basis::un_short(info.dwBuildNumber)));
+//#elif defined(_MSC_VER)
+// OSVERSIONINFO info;
+// info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+// ::GetVersionEx(&info);
+// to_return = version(a_sprintf("%u.%u.%u.%u", basis::un_short(info.dwMajorVersion),
+// basis::un_short(info.dwMinorVersion), basis::un_short(info.dwPlatformId),
+// basis::un_short(info.dwBuildNumber)));
#else
#pragma error("hmmm: need version info for this OS!")
#endif
#else
#pragma error("hmmm: need version info for this OS!")
#endif
// that don't include a directory name.
if (_where == OS_DIRECTORY) use_appdir = false;
if (_where == ALL_USERS_DIRECTORY) use_appdir = false;
// that don't include a directory name.
if (_where == OS_DIRECTORY) use_appdir = false;
if (_where == ALL_USERS_DIRECTORY) use_appdir = false;
-#ifdef _MSC_VER
- use_appdir = true;
-#endif
+//#ifdef _MSC_VER
+// use_appdir = true;
+//#endif
// we must create the filename if they specified no directory at all.
if (!_ini_name->had_directory()) {
if (use_appdir) {
// we must create the filename if they specified no directory at all.
if (!_ini_name->had_directory()) {
if (use_appdir) {
//hmmm: refactor section_exists to use the sections call, if it's faser?
bool ini_configurator::section_exists(const astring §ion)
{
//hmmm: refactor section_exists to use the sections call, if it's faser?
bool ini_configurator::section_exists(const astring §ion)
{
-#ifdef _MSC_VER
- string_table infos;
- // heavy-weight call here...
- return get_section(section, infos);
-#else
+//#ifdef _MSC_VER
+// string_table infos;
+// // heavy-weight call here...
+// return get_section(section, infos);
+//#else
return _parser->section_exists(section);
return _parser->section_exists(section);
}
#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
}
#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
bool ini_configurator::delete_section(const astring §ion)
{
bool ini_configurator::delete_section(const astring §ion)
{
-#ifdef _MSC_VER
- return put_profile_string(section, "", "");
-#else
+//#ifdef _MSC_VER
+// return put_profile_string(section, "", "");
+//#else
// zap the section.
bool to_return = _parser->delete_section(section);
// schedule the file to write.
write_ini_file();
return to_return;
// zap the section.
bool to_return = _parser->delete_section(section);
// schedule the file to write.
write_ini_file();
return to_return;
}
bool ini_configurator::delete_entry(const astring §ion, const astring &ent)
{
}
bool ini_configurator::delete_entry(const astring §ion, const astring &ent)
{
-#ifdef _MSC_VER
- return put_profile_string(section, ent, "");
-#else
+//#ifdef _MSC_VER
+// return put_profile_string(section, ent, "");
+//#else
// zap the entry.
bool to_return = _parser->delete_entry(section, ent);
// schedule the file to write.
write_ini_file();
return to_return;
// zap the entry.
bool to_return = _parser->delete_entry(section, ent);
// schedule the file to write.
write_ini_file();
return to_return;
}
bool ini_configurator::put(const astring §ion, const astring &entry,
}
bool ini_configurator::put(const astring §ion, const astring &entry,
if (!to_store.length()) return delete_entry(section, entry);
else if (!entry.length()) return delete_section(section);
else if (!section.length()) return false;
if (!to_store.length()) return delete_entry(section, entry);
else if (!entry.length()) return delete_section(section);
else if (!section.length()) return false;
-#ifdef _MSC_VER
- return put_profile_string(section, entry, to_store);
-#else
+//#ifdef _MSC_VER
+// return put_profile_string(section, entry, to_store);
+//#else
// write the entry.
bool to_return = _parser->put(section, entry, to_store);
// schedule file write.
write_ini_file();
return to_return;
// write the entry.
bool to_return = _parser->put(section, entry, to_store);
// schedule file write.
write_ini_file();
return to_return;
}
bool ini_configurator::get(const astring §ion, const astring &entry,
}
bool ini_configurator::get(const astring §ion, const astring &entry,
bool ini_configurator::put_section(const astring §ion,
const string_table &info)
{
bool ini_configurator::put_section(const astring §ion,
const string_table &info)
{
#ifdef _MSC_VER
variable_tokenizer parser("\1", "=");
parser.table() = info;
#ifdef _MSC_VER
variable_tokenizer parser("\1", "=");
parser.table() = info;
return WritePrivateProfileSection(to_unicode_temp(section),
to_unicode_temp(flat), to_unicode_temp(name()));
#else
return WritePrivateProfileSection(to_unicode_temp(section),
to_unicode_temp(flat), to_unicode_temp(name()));
#else
// write the section.
bool to_return = _parser->put_section(section, info);
// schedule file write.
write_ini_file();
return to_return;
// write the section.
bool to_return = _parser->put_section(section, info);
// schedule file write.
write_ini_file();
return to_return;
#ifdef _MSC_VER
bool ini_configurator::put_profile_string(const astring §ion,
const astring &entry, const astring &to_store)
#ifdef _MSC_VER
bool ini_configurator::put_profile_string(const astring §ion,
const astring &entry, const astring &to_store)
return_buffer, buffer_size, to_unicode_temp(name()));
}
#endif
return_buffer, buffer_size, to_unicode_temp(name()));
}
#endif
file_location_default _where; //!< where to find and store the file.
bool _add_spaces; //!< tracks whether we're adding spaces around equals.
file_location_default _where; //!< where to find and store the file.
bool _add_spaces; //!< tracks whether we're adding spaces around equals.
#ifdef _MSC_VER
bool put_profile_string(const basis::astring §ion, const basis::astring &entry,
const basis::astring &to_store);
#ifdef _MSC_VER
bool put_profile_string(const basis::astring §ion, const basis::astring &entry,
const basis::astring &to_store);
int buffer_size);
//!< encapsulates windows' ini retrieval method.
#else
int buffer_size);
//!< encapsulates windows' ini retrieval method.
#else
void read_ini_file();
//!< reads the INI file's contents into memory.
void write_ini_file();
//!< store the current contents into the INI file.
void read_ini_file();
//!< reads the INI file's contents into memory.
void write_ini_file();
//!< store the current contents into the INI file.
// not to be called.
ini_configurator(const ini_configurator &);
// not to be called.
ini_configurator(const ini_configurator &);
#include <string.h>
#include <unistd.h>
#endif
#include <string.h>
#include <unistd.h>
#endif
-#ifdef _MSC_VER
- #include <direct.h>
-#endif
+//#ifdef _MSC_VER
+// #include <direct.h>
+//#endif
{
char abs_path[MAX_ABS_PATH + 1];
abs_path[0] = '\0';
{
char abs_path[MAX_ABS_PATH + 1];
abs_path[0] = '\0';
-#ifdef _MSC_VER
- if (!_fullpath(abs_path, rel_path.s(), MAX_ABS_PATH)) return "";
- return abs_path;
-#else
+//#ifdef _MSC_VER
+// if (!_fullpath(abs_path, rel_path.s(), MAX_ABS_PATH)) return "";
+// return abs_path;
+//#else
if (!realpath(rel_path.s(), abs_path)) return "";
return abs_path;
if (!realpath(rel_path.s(), abs_path)) return "";
return abs_path;
}
astring directory::current()
{
astring to_return("."); // failure result.
}
astring directory::current()
{
astring to_return("."); // failure result.
-#ifdef _MSC_VER
- flexichar buffer[MAX_ABS_PATH + 1] = { '\0' };
- GetCurrentDirectory(MAX_ABS_PATH, buffer);
- to_return = from_unicode_temp(buffer);
-#else
+//#ifdef _MSC_VER
+// flexichar buffer[MAX_ABS_PATH + 1] = { '\0' };
+// GetCurrentDirectory(MAX_ABS_PATH, buffer);
+// to_return = from_unicode_temp(buffer);
+//#else
char buffer[MAX_ABS_PATH + 1] = { '\0' };
if (realpath(".", buffer)) to_return = buffer;
char buffer[MAX_ABS_PATH + 1] = { '\0' };
if (realpath(".", buffer)) to_return = buffer;
_folders->reset();
astring cur_dir = ".";
astring par_dir = "..";
_folders->reset();
astring cur_dir = ".";
astring par_dir = "..";
#ifdef _MSC_VER
// start reading the directory.
WIN32_FIND_DATA wfd;
#ifdef _MSC_VER
// start reading the directory.
WIN32_FIND_DATA wfd;
} while (FindNextFile(search_handle, &wfd));
FindClose(search_handle);
#else
} while (FindNextFile(search_handle, &wfd));
FindClose(search_handle);
#else
DIR *dir = opendir(_path->s());
//hmmm: could check errno to determine what caused the problem.
if (!dir) return false;
DIR *dir = opendir(_path->s());
//hmmm: could check errno to determine what caused the problem.
if (!dir) return false;
entry = readdir(dir);
}
closedir(dir);
entry = readdir(dir);
}
closedir(dir);
shell_sort(_files->access(), _files->length());
shell_sort(_folders->access(), _folders->length());
shell_sort(_files->access(), _files->length());
shell_sort(_folders->access(), _folders->length());
#include <timely/time_stamp.h>
#include <stdio.h>
#include <timely/time_stamp.h>
#include <stdio.h>
-#ifndef _MSC_VER
- #include <errno.h>
-#endif
using namespace basis;
using namespace structures;
using namespace basis;
using namespace structures;
{
#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
return errno;
{
#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
return errno;
-#elif defined(_MSC_VER)
- return GetLastError();
+//#elif defined(_MSC_VER)
+// return GetLastError();
#else
#pragma error("hmmm: no code for error number for this operating system")
return 0;
#else
#pragma error("hmmm: no code for error number for this operating system")
return 0;
{
#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
return strerror(to_name);
{
#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
return strerror(to_name);
#elif defined(_MSC_VER)
char error_text[1000];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL_POINTER, to_name,
#elif defined(_MSC_VER)
char error_text[1000];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL_POINTER, to_name,
|| (to_return[to_return.end()] == '\n') )
to_return.zap(to_return.end(), to_return.end());
return to_return;
|| (to_return[to_return.end()] == '\n') )
to_return.zap(to_return.end(), to_return.end());
return to_return;
#else
#pragma error("hmmm: no code for error text for this operating system")
return "";
#else
#pragma error("hmmm: no code for error text for this operating system")
return "";
namespace loggers {
//! This macro wraps the notion of stopping in the debugger.
namespace loggers {
//! This macro wraps the notion of stopping in the debugger.
-//hmmm: need a unix equivalent for this. supporting gcc might be enough.
+//hmmm: need a unix equivalent for this, see old below for doze?
+/*
#else
#ifdef __MINGW32__
extern "C" {
#else
#ifdef __MINGW32__
extern "C" {
#define CAUSE_BREAKPOINT __debugbreak()
#endif
#endif
#define CAUSE_BREAKPOINT __debugbreak()
#endif
#endif
//! Tests the value "check" to ensure that it's not zero.
/*! This can be used instead of an ASSERT macro to check conditions in
//! Tests the value "check" to ensure that it's not zero.
/*! This can be used instead of an ASSERT macro to check conditions in
#include <structures/static_memory_gremlin.h>
#include <timely/time_control.h>
#include <structures/static_memory_gremlin.h>
#include <timely/time_control.h>
-#ifdef _MSC_VER
- #include <process.h>
-#elif defined(__UNIX__) || defined(__GNU_WINDOWS__)
+//#ifdef _MSC_VER
+// #include <process.h>
+//#elif defined(__UNIX__) || defined(__GNU_WINDOWS__)
-#else
- #error unknown OS for thread support.
-#endif
+//#else
+ //#error unknown OS for thread support.
+//#endif
using namespace basis;
using namespace loggers;
using namespace basis;
using namespace loggers;
_thread_active(false),
_stop_thread(false),
_data(NULL_POINTER),
_thread_active(false),
_stop_thread(false),
_data(NULL_POINTER),
-#ifdef _MSC_VER
- _handle(0),
-#else
+//#ifdef _MSC_VER
+// _handle(0),
+//#else
_sleep_time(0),
_periodic(false),
_next_activation(new time_stamp),
_sleep_time(0),
_periodic(false),
_next_activation(new time_stamp),
_thread_active(false),
_stop_thread(false),
_data(NULL_POINTER),
_thread_active(false),
_stop_thread(false),
_data(NULL_POINTER),
-#ifdef _MSC_VER
- _handle(0),
-#else
+//#ifdef _MSC_VER
+// _handle(0),
+//#else
_sleep_time(sleep_timer),
_periodic(true),
_next_activation(new time_stamp),
_sleep_time(sleep_timer),
_periodic(true),
_next_activation(new time_stamp),
{
stop();
WHACK(_next_activation);
{
stop();
WHACK(_next_activation);
}
///void ethread::pre_thread() {}
}
///void ethread::pre_thread() {}
int error = 0;
int attempts = 0;
while (attempts++ < MAXIMUM_CREATE_ATTEMPTS) {
int error = 0;
int attempts = 0;
while (attempts++ < MAXIMUM_CREATE_ATTEMPTS) {
pthread_attr_t attribs; // special flags for creation of thread.
int aret = pthread_attr_init(&attribs);
if (aret) LOG("failed to init attribs.");
pthread_attr_t attribs; // special flags for creation of thread.
int aret = pthread_attr_init(&attribs);
if (aret) LOG("failed to init attribs.");
(void *)this);
if (!ret) success = true;
else error = ret;
(void *)this);
if (!ret) success = true;
else error = ret;
#else
if (_periodic)
_handle = _beginthread(periodic_thread_driver, 0, (void *)this);
#else
if (_periodic)
_handle = _beginthread(periodic_thread_driver, 0, (void *)this);
if (_handle != -1) success = true;
else error = critical_events::system_error();
#endif
if (_handle != -1) success = true;
else error = critical_events::system_error();
#endif
if (success) break; // got it created.
LOG("failed to create thread; trying again...");
time_control::sleep_ms(SNOOZE_FOR_RETRY);
if (success) break; // got it created.
LOG("failed to create thread; trying again...");
time_control::sleep_ms(SNOOZE_FOR_RETRY);
cancel(); // tell thread to leave.
if (!thread_started()) return; // not running.
while (!thread_finished()) {
cancel(); // tell thread to leave.
if (!thread_started()) return; // not running.
while (!thread_finished()) {
#ifdef _MSC_VER
int result = 0;
if (!GetExitCodeThread((HANDLE)_handle, (LPDWORD)&result)
#ifdef _MSC_VER
int result = 0;
if (!GetExitCodeThread((HANDLE)_handle, (LPDWORD)&result)
time_control::sleep_ms(10); // wait for thread to leave.
}
}
time_control::sleep_ms(10); // wait for thread to leave.
}
}
{
_thread_active = false;
_thread_ready = false;
{
_thread_active = false;
_thread_ready = false;
-#ifdef _MSC_VER
- _handle = 0;
-#endif
+//#ifdef _MSC_VER
+// _handle = 0;
+//#endif
-#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
+//#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
void *ethread::one_shot_thread_driver(void *hidden_pointer)
void *ethread::one_shot_thread_driver(void *hidden_pointer)
-#elif defined(_MSC_VER)
-void ethread::one_shot_thread_driver(void *hidden_pointer)
-#else
-#error unknown thread signature.
-#endif
+//#elif defined(_MSC_VER)
+//void ethread::one_shot_thread_driver(void *hidden_pointer)
+//#else
+//#error unknown thread signature.
+//#endif
{
FUNCDEF("one_shot_thread_driver");
ethread *manager = (ethread *)hidden_pointer;
{
FUNCDEF("one_shot_thread_driver");
ethread *manager = (ethread *)hidden_pointer;
if (!manager) return NULL_POINTER;
if (!manager) return NULL_POINTER;
-#else
- if (!manager) return;
-#endif
+//#else
+ //if (!manager) return;
+//#endif
#ifdef COUNT_THREADS
_current_threads().increment();
#endif
#ifdef COUNT_THREADS
_current_threads().increment();
#endif
#ifdef COUNT_THREADS
_current_threads().decrement();
#endif
#ifdef COUNT_THREADS
_current_threads().decrement();
#endif
pthread_exit(NULL_POINTER);
return NULL_POINTER;
pthread_exit(NULL_POINTER);
return NULL_POINTER;
-#else
- _endthread();
-#endif
+//#else
+ //_endthread();
+//#endif
-#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
+//#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
void *ethread::periodic_thread_driver(void *hidden_pointer)
void *ethread::periodic_thread_driver(void *hidden_pointer)
-#elif defined(_MSC_VER)
-void ethread::periodic_thread_driver(void *hidden_pointer)
-#else
-#error unknown thread signature.
-#endif
+//#elif defined(_MSC_VER)
+//void ethread::periodic_thread_driver(void *hidden_pointer)
+//#else
+//#error unknown thread signature.
+//#endif
{
FUNCDEF("periodic_thread_driver");
ethread *manager = (ethread *)hidden_pointer;
{
FUNCDEF("periodic_thread_driver");
ethread *manager = (ethread *)hidden_pointer;
-#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
+//#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
if (!manager) return NULL_POINTER;
if (!manager) return NULL_POINTER;
-#elif defined(_MSC_VER)
- if (!manager) return;
-#endif
+//#elif defined(_MSC_VER)
+// if (!manager) return;
+//#endif
#ifdef COUNT_THREADS
_current_threads().increment();
#endif
#ifdef COUNT_THREADS
_current_threads().increment();
#endif
#ifdef COUNT_THREADS
_current_threads().decrement();
#endif
#ifdef COUNT_THREADS
_current_threads().decrement();
#endif
pthread_exit(NULL_POINTER);
return NULL_POINTER;
pthread_exit(NULL_POINTER);
return NULL_POINTER;
-#else
- _endthread();
-#endif
+//#else
+ //_endthread();
+//#endif
bool _thread_active; //!< is the thread currently performing?
bool _stop_thread; //!< true if the thread should stop now.
void *_data; //!< holds the thread's link back to whatever.
bool _thread_active; //!< is the thread currently performing?
bool _stop_thread; //!< true if the thread should stop now.
void *_data; //!< holds the thread's link back to whatever.
pthread_t *_handle; //!< thread structure for our thread.
pthread_t *_handle; //!< thread structure for our thread.
-#else
- uintptr_t _handle; //!< thread handle for the active thread, or zero.
-#endif
+//#else
+ //uintptr_t _handle; //!< thread handle for the active thread, or zero.
+//#endif
int _sleep_time; //!< threads perform at roughly this interval.
bool _periodic; //!< true if this thread should run repeatedly.
timely::time_stamp *_next_activation; //!< the next time perform_activity is called.
timed_thread_types _how; //!< how is the period evaluated?
// the OS level thread functions.
int _sleep_time; //!< threads perform at roughly this interval.
bool _periodic; //!< true if this thread should run repeatedly.
timely::time_stamp *_next_activation; //!< the next time perform_activity is called.
timed_thread_types _how; //!< how is the period evaluated?
// the OS level thread functions.
static void *periodic_thread_driver(void *hidden_pointer);
static void *one_shot_thread_driver(void *hidden_pointer);
static void *periodic_thread_driver(void *hidden_pointer);
static void *one_shot_thread_driver(void *hidden_pointer);
-#else
- static void periodic_thread_driver(void *hidden_pointer);
- static void one_shot_thread_driver(void *hidden_pointer);
-#endif
+//#else
+ //static void periodic_thread_driver(void *hidden_pointer);
+ //static void one_shot_thread_driver(void *hidden_pointer);
+//#endif
// forbidden.
ethread(const ethread &);
// forbidden.
ethread(const ethread &);
#include <timely/time_control.h>
#include <stdlib.h>
#include <timely/time_control.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <process.h>
#include <shellapi.h>
#include <shlobj.h>
#endif
#include <process.h>
#include <shellapi.h>
#include <shlobj.h>
#endif
//#define DEBUG_LAUNCH_PROCESS
// uncomment for noisier debugging info.
//#define DEBUG_LAUNCH_PROCESS
// uncomment for noisier debugging info.
#ifdef _MSC_VER
bool launch_process::event_poll(MSG &message)
{
#ifdef _MSC_VER
bool launch_process::event_poll(MSG &message)
{
#define SUPPORT_SHELL_EXECUTE
// if this is not commented out, then the ShellExecute version of launch_
#define SUPPORT_SHELL_EXECUTE
// if this is not commented out, then the ShellExecute version of launch_
//const int MAXIMUM_COMMAND_LINE = 32 * KILOBYTE;
// maximum command line that we'll deal with here.
//const int MAXIMUM_COMMAND_LINE = 32 * KILOBYTE;
// maximum command line that we'll deal with here.
void launch_process::exiting_child_signal_handler(int sig_num)
{
FUNCDEF("exiting_child_signal_handler");
void launch_process::exiting_child_signal_handler(int sig_num)
{
FUNCDEF("exiting_child_signal_handler");
//hmmm: this doesn't seem to account for quoting properly at all?
char_star_array launch_process::break_line(astring &app, const astring ¶meters)
//hmmm: this doesn't seem to account for quoting properly at all?
char_star_array launch_process::break_line(astring &app, const astring ¶meters)
app_name.insert(0, "\"");
if (app_name[app_name.end()] != '"')
app_name += "\"";
app_name.insert(0, "\"");
if (app_name[app_name.end()] != '"')
app_name += "\"";
-#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
+//#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
// unix / linux implementation.
if (flag & RETURN_IMMEDIATELY) {
// they want to get back right away.
// unix / linux implementation.
if (flag & RETURN_IMMEDIATELY) {
// they want to get back right away.
// assume they want to wait.
return system((app_name + " " + command_line).s());
}
// assume they want to wait.
return system((app_name + " " + command_line).s());
}
#elif defined(_MSC_VER)
//checking on whether we have admin rights for the launch.
#elif defined(_MSC_VER)
//checking on whether we have admin rights for the launch.
#else
#pragma error("hmmm: launch_process: no implementation for this OS.")
#endif
#else
#pragma error("hmmm: launch_process: no implementation for this OS.")
#endif
static void exiting_child_signal_handler(int sig_num);
//!< awaits the child processes rather than leaving process handles willy nilly.
static void exiting_child_signal_handler(int sig_num);
//!< awaits the child processes rather than leaving process handles willy nilly.
#else
static bool event_poll(tagMSG &message);
//!< tries to process one win32 event and retrieve the "message" from it.
#else
static bool event_poll(tagMSG &message);
//!< tries to process one win32 event and retrieve the "message" from it.
- /*!< this is a very general poll and will retrieve any message that's
+ / *!< this is a very general poll and will retrieve any message that's
available for the current thread. the message is actually processed
here also, by calling translate and dispatch. the returned structure
available for the current thread. the message is actually processed
here also, by calling translate and dispatch. the returned structure
- is mainly interesting for knowing what was done. */
+ is mainly interesting for knowing what was done. * /
#define CLOSE_TEMPORARY_FILE { \
/* continuable_error("process_control", "get_processes_with_ps", error); */ \
#define CLOSE_TEMPORARY_FILE { \
/* continuable_error("process_control", "get_processes_with_ps", error); */ \
private:
process_implementation_hider *_ptrs; //!< our OS baggage.
private:
process_implementation_hider *_ptrs; //!< our OS baggage.
mathematics::chaos *_rando; //!< used for process list.
mathematics::chaos *_rando; //!< used for process list.
-#else
- bool _use_psapi; //!< true if we should be using the PSAPI on NT and family.
-#endif
+//#else
+ //bool _use_psapi; //!< true if we should be using the PSAPI on NT and family.
+//#endif
bool _healthy; //!< true if construction succeeded.
bool _healthy; //!< true if construction succeeded.
bool get_processes_with_ps(process_entry_array &to_fill);
//!< asks the ps program what processes exist.
bool get_processes_with_ps(process_entry_array &to_fill);
//!< asks the ps program what processes exist.
#else
// fill in our function pointers to access the kernel functions appropriate
// for either NT (psapi) or 9x (toolhelp).
#else
// fill in our function pointers to access the kernel functions appropriate
// for either NT (psapi) or 9x (toolhelp).
bool get_processes_with_toolhelp(process_entry_array &to_fill);
//!< uses the toolhelp support for windows 9x, ME, 2000.
#endif
bool get_processes_with_toolhelp(process_entry_array &to_fill);
//!< uses the toolhelp support for windows 9x, ME, 2000.
#endif
PROJECT = security
TYPE = library
PROJECT = security
TYPE = library
-ifeq "$(OP_SYSTEM)" "WIN32"
+ifeq "$(OPERATING_SYSTEM)" "WIN32"
SOURCE = nt_security.cpp win32_security.cpp windows_firewall.cpp
endif
TARGETS = security.lib
SOURCE = nt_security.cpp win32_security.cpp windows_firewall.cpp
endif
TARGETS = security.lib
* Please send any updates to: fred@gruntose.com *
\*****************************************************************************/
* Please send any updates to: fred@gruntose.com *
\*****************************************************************************/
#include "win32_security.h"
#include "win32_security.h"
#include <timely/time_stamp.h>
#include <unit_test/unit_base.h>
#include <timely/time_stamp.h>
#include <unit_test/unit_base.h>
-#ifdef _MSC_VER
- #include <comdef.h>
-#endif
+//#ifdef _MSC_VER
+// #include <comdef.h>
+//#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef _MSC_VER
-basis::un_int *timer_driver::real_timer_id() { return _real_timer_id; }
-#endif
+//#ifdef _MSC_VER
+//basis::un_int *timer_driver::real_timer_id() { return _real_timer_id; }
+//#endif
bool timer_driver::zap_timer(timeable *to_remove)
{
bool timer_driver::zap_timer(timeable *to_remove)
{
#ifdef DEBUG_TIMER_DRIVER
LOG(a_sprintf("hooking next OS timer in %d ms.", duration));
#endif
#ifdef DEBUG_TIMER_DRIVER
LOG(a_sprintf("hooking next OS timer in %d ms.", duration));
#endif
-#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
+//#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
// just make our thread hit after the duration specified.
_prompter->reschedule(duration);
// just make our thread hit after the duration specified.
_prompter->reschedule(duration);
+/*#elif defined(_MSC_VER)
int max_tries_left = 100;
while (max_tries_left-- >= 0) {
_real_timer_id = (basis::un_int *)SetTimer(NULL_POINTER, 0, duration,
int max_tries_left = 100;
while (max_tries_left-- >= 0) {
_real_timer_id = (basis::un_int *)SetTimer(NULL_POINTER, 0, duration,
break; // success hooking timer.
}
#endif
break; // success hooking timer.
}
#endif
}
void timer_driver::unhook_OS_timer()
}
void timer_driver::unhook_OS_timer()
#ifdef DEBUG_TIMER_DRIVER
FUNCDEF("unhook_OS_timer");
#endif
#ifdef DEBUG_TIMER_DRIVER
FUNCDEF("unhook_OS_timer");
#endif
-#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
+//#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
// postpone the thread for quite a while so we can take care of business.
_prompter->reschedule(LONG_TIME);
// postpone the thread for quite a while so we can take care of business.
_prompter->reschedule(LONG_TIME);
-#elif defined(_MSC_VER)
- if (_real_timer_id) KillTimer(NULL_POINTER, (UINT_PTR)_real_timer_id);
-#endif
+//#elif defined(_MSC_VER)
+// if (_real_timer_id) KillTimer(NULL_POINTER, (UINT_PTR)_real_timer_id);
+//#endif
#ifdef DEBUG_TIMER_DRIVER
LOG("unhooked OS timer.");
#endif
#ifdef DEBUG_TIMER_DRIVER
LOG("unhooked OS timer.");
#endif
#if defined(_MSC_VER)
basis::un_int *real_timer_id();
//!< provides the timer id for comparison on windows platforms.
#endif
#if defined(_MSC_VER)
basis::un_int *real_timer_id();
//!< provides the timer id for comparison on windows platforms.
#endif
void handle_system_timer();
//!< invoked by the OS timer support and must be called by main thread.
void handle_system_timer();
//!< invoked by the OS timer support and must be called by main thread.
#define __build_FILE_VERSION "108.420.1024.10008"
#endif
#define __build_FILE_VERSION "108.420.1024.10008"
#endif
-#ifdef _MSC_VER
- #include <direct.h>
+#ifdef __WIN32__
+// #include <direct.h>
#include <winver.h>
#endif
#include <winver.h>
#endif
-#if defined(_MSC_VER)
-//#ifdef __WIN32__
// ensures that we handle the data properly regardless of unicode settings.
#ifdef UNICODE
#define render_ptr(ptr) from_unicode_temp( (UTF16 *) ptr)
// ensures that we handle the data properly regardless of unicode settings.
#ifdef UNICODE
#define render_ptr(ptr) from_unicode_temp( (UTF16 *) ptr)
bool version_checker::loaded(const astring &library_file_name)
{
//#ifdef __WIN32__
bool version_checker::loaded(const astring &library_file_name)
{
//#ifdef __WIN32__
return bool(get_handle(library_file_name) != 0);
#else
//temp code.
return bool(get_handle(library_file_name) != 0);
#else
//temp code.
void *version_checker::get_handle(const astring &library_file_name)
{
//#ifdef __WIN32__
void *version_checker::get_handle(const astring &library_file_name)
{
//#ifdef __WIN32__
return GetModuleHandle(to_unicode_temp(library_file_name));
#else
if (library_file_name.t()) return NULL_POINTER; else return NULL_POINTER;
return GetModuleHandle(to_unicode_temp(library_file_name));
#else
if (library_file_name.t()) return NULL_POINTER; else return NULL_POINTER;
astring version_checker::module_name(const void *module_handle)
{
astring version_checker::module_name(const void *module_handle)
{
-#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
+#if defined(__UNIX__)
+//|| defined(__GNU_WINDOWS__)
if (module_handle) {}
return application_configuration::application_name();
if (module_handle) {}
return application_configuration::application_name();
+#elif defined(__WIN32__)
//#elif defined(__WIN32__)
flexichar low_buff[MAX_ABS_PATH + 1];
GetModuleFileName((HMODULE)module_handle, low_buff, MAX_ABS_PATH - 1);
//#elif defined(__WIN32__)
flexichar low_buff[MAX_ABS_PATH + 1];
GetModuleFileName((HMODULE)module_handle, low_buff, MAX_ABS_PATH - 1);
// determine the required size of the version info buffer.
int required_size;
// determine the required size of the version info buffer.
int required_size;
- un_long module_handle; // filled with the dll or exe handle.
+ DWORD module_handle; // filled with the dll or exe handle.
required_size = GetFileVersionInfoSize(to_unicode_temp(filename), &module_handle);
#else
required_size = 0 && filename.t();
required_size = GetFileVersionInfoSize(to_unicode_temp(filename), &module_handle);
#else
required_size = 0 && filename.t();
// read the version info into our buffer.
bool success = false;
// read the version info into our buffer.
bool success = false;
//#ifdef __WIN32__
success = GetFileVersionInfo(to_unicode_temp(filename), module_handle,
required_size, to_fill.access());
//#ifdef __WIN32__
success = GetFileVersionInfo(to_unicode_temp(filename), module_handle,
required_size, to_fill.access());
//#ifdef __WIN32__
// determine the language that the version's written in.
basis::un_int data_size;
//#ifdef __WIN32__
// determine the language that the version's written in.
basis::un_int data_size;
version version_checker::retrieve_version(const astring &filename)
{
//#ifdef UNIX
version version_checker::retrieve_version(const astring &filename)
{
//#ifdef UNIX
-#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
+#if defined(__UNIX__)
+// || defined(__GNU_WINDOWS__)
// totally bogus stand-in; this just returns the version we were built with
// rather than the version that's actually tagged on the file.
// totally bogus stand-in; this just returns the version we were built with
// rather than the version that's actually tagged on the file.
astring file_version_key(root_key + astring("\\FileVersion"));
astring version_string;
astring file_version_key(root_key + astring("\\FileVersion"));
astring version_string;
abyte *file_version_pointer;
basis::un_int data_size;
if (!VerQueryValue(version_info_found.access(),
abyte *file_version_pointer;
basis::un_int data_size;
if (!VerQueryValue(version_info_found.access(),
// the various version pieces are retrieved...
//#ifdef __WIN32__
// the various version pieces are retrieved...
//#ifdef __WIN32__
basis::un_int data_size;
void *data_pointer;
basis::un_int data_size;
void *data_pointer;
to_show += astring("]. ");
to_show += *_version_complaint;
//#ifdef __UNIX__
to_show += astring("]. ");
to_show += *_version_complaint;
//#ifdef __UNIX__
-#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
+#if defined(__UNIX__)
+//|| defined(__GNU_WINDOWS__)
continuable_error("version checking", "failure", to_show.s());
continuable_error("version checking", "failure", to_show.s());
+#elif defined(__WIN32__)
MessageBox(0, to_unicode_temp(to_show),
to_unicode_temp("version_checking::failure"), MB_OK);
#endif
MessageBox(0, to_unicode_temp(to_show),
to_unicode_temp("version_checking::failure"), MB_OK);
#endif
-#ifdef _MSC_VER
- #undef strcasecmp
- #undef strncasecmp
- #define strcasecmp strcmpi
- #define strncasecmp strnicmp
-#endif
+//#ifdef _MSC_VER
+// #undef strcasecmp
+// #undef strncasecmp
+// #define strcasecmp strcmpi
+// #define strncasecmp strnicmp
+//#endif
extern inclist inc_list[MAXFILES], *inclistp;
extern char *includedirs[ ];
extern inclist inc_list[MAXFILES], *inclistp;
extern char *includedirs[ ];
-#ifdef _MSC_VER
-#include <io.h>
-#else
+//#ifdef _MSC_VER
+//#include <io.h>
+//#else
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <string.h>
TYPE = application
SOURCE = cppsetup.cpp ifparser.cpp include.cpp parse.cpp pr.cpp
#DEFINITIONS += __BUILD_STATIC_APPLICATION__
TYPE = application
SOURCE = cppsetup.cpp ifparser.cpp include.cpp parse.cpp pr.cpp
#DEFINITIONS += __BUILD_STATIC_APPLICATION__
-ifeq "$(OP_SYSTEM)" "WIN32"
+ifeq "$(OPERATING_SYSTEM)" "WIN32"
SOURCE += makedep_version.rc
endif
TARGETS = makedep.exe
SOURCE += makedep_version.rc
endif
TARGETS = makedep.exe
#include <structures/static_memory_gremlin.h>
#include <textual/string_manipulation.h>
#include <structures/static_memory_gremlin.h>
#include <textual/string_manipulation.h>
+#ifdef __WIN32__
+// #define DO_GUIDS
+//hmmm: currently disabled due to problems compiling in cygwin using this header; complains about new.h being missing.
+#endif
+
+#ifdef DO_GUIDS
#include <comdef.h>
#endif
#include <comdef.h>
#endif
{
FUNCDEF("execute");
SETUP_CONSOLE_LOGGER;
{
FUNCDEF("execute");
SETUP_CONSOLE_LOGGER;
-#if defined(__UNIX__) || defined(__GNU_WINDOWS__)
-
// this is completely bogus for the time being. it just produces a random
// number rather than a guid.
#define add_random \
// this is completely bogus for the time being. it just produces a random
// number rather than a guid.
#define add_random \
for (int i = 0; i < 8; i++) add_random;
faux_guid += "}";
BASE_LOG(faux_guid.lower());
for (int i = 0; i < 8; i++) add_random;
faux_guid += "}";
BASE_LOG(faux_guid.lower());
-#elif defined (_MSC_VER)
+#elif defined (DO_GUIDS)
GUID guid;
CoCreateGuid(&guid);
const int BUFFER_SIZE = 1024;
GUID guid;
CoCreateGuid(&guid);
const int BUFFER_SIZE = 1024;
ifeq "$(OMIT_VERSIONS)" ""
SOURCE += simple_utils_version.rc
endif
ifeq "$(OMIT_VERSIONS)" ""
SOURCE += simple_utils_version.rc
endif
+ifeq "$(OPERATING_SYSTEM)" "WIN32"
+ LIBS_USED += winmm
+endif
DEFINITIONS += __BUILD_STATIC_APPLICATION__
UNDEFINITIONS += ENABLE_MEMORY_HOOK ENABLE_CALLSTACK_TRACKING
DEFINITIONS += __BUILD_STATIC_APPLICATION__
UNDEFINITIONS += ENABLE_MEMORY_HOOK ENABLE_CALLSTACK_TRACKING
#include <loggers/console_logger.h>
#include <structures/static_memory_gremlin.h>
#include <loggers/console_logger.h>
#include <structures/static_memory_gremlin.h>
#include <mmsystem.h>
#endif
#include <mmsystem.h>
#endif
return 12;
}
for (int i = 1; i < argc; i++) {
return 12;
}
for (int i = 1; i < argc; i++) {
-// out.log(astring(astring::SPRINTF, "soundfile %d: %s", i, argv[i]));
-#ifdef _MSC_VER
- if (!PlaySound(to_unicode_temp(argv[i]), NULL_POINTER, SND_FILENAME))
- out.log(astring("failed to play ") + argv[i], ALWAYS_PRINT);
+ astring sound_file = argv[i];
+out.log(a_sprintf("soundfile %d: %s", i, sound_file.s()), ALWAYS_PRINT);
+ if (sound_file.ends(".mp3")) {
+ out.log(astring("skipping MP3 file ") + sound_file, ALWAYS_PRINT);
+ continue;
+ }
+#ifdef __WIN32__
+ if (!PlaySound(to_unicode_temp(sound_file), NULL_POINTER, SND_FILENAME))
+ out.log(astring("failed to play ") + sound_file, ALWAYS_PRINT);
- out.log(astring("this program is a NO-OP, ignoring ") + argv[i], ALWAYS_PRINT);
+ out.log(astring("this program is a NO-OP, ignoring ") + sound_file, ALWAYS_PRINT);
include cpp/variables.def
PROJECT = rebaser
include cpp/variables.def
PROJECT = rebaser
-#ifeq "$(OP_SYSTEM)" "WIN32"
+#ifeq "$(OPERATING_SYSTEM)" "WIN32"
# TARGETS = perform_rebasing
#endif
TYPE = hierarchy
# TARGETS = perform_rebasing
#endif
TYPE = hierarchy
#TARGETS = check_versions.exe
DEFINITIONS += __BUILD_STATIC_APPLICATION__
#TARGETS = check_versions.exe
DEFINITIONS += __BUILD_STATIC_APPLICATION__
-ifeq "$(OP_SYSTEM)" "WIN32"
+ifeq "$(OPERATING_SYSTEM)" "WIN32"
ifeq "$(BOOT_STRAPPING)" ""
LAST_TARGETS = run_checks
endif
ifeq "$(BOOT_STRAPPING)" ""
LAST_TARGETS = run_checks
endif
# this flag selects whether to build with unicode enabled. this mainly affects
# win32 OSes, and right now we know it affects them badly if this is enabled.
# unix may build slightly differently too, such as for WX widgets.
# this flag selects whether to build with unicode enabled. this mainly affects
# win32 OSes, and right now we know it affects them badly if this is enabled.
# unix may build slightly differently too, such as for WX widgets.
-ifneq "$(OP_SYSTEM)" "WIN32"
+ifneq "$(OPERATING_SYSTEM)" "WIN32"
# DEFINITIONS += UNICODE=t
endif
# DEFINITIONS += UNICODE=t
endif
# this flag selects whether to build with unicode enabled. this mainly affects
# win32 OSes, and right now we know it affects them badly if this is enabled.
# unix may build slightly differently too, such as for WX widgets.
# this flag selects whether to build with unicode enabled. this mainly affects
# win32 OSes, and right now we know it affects them badly if this is enabled.
# unix may build slightly differently too, such as for WX widgets.
-ifeq "$(OP_SYSTEM)" "WIN32"
+ifeq "$(OPERATING_SYSTEM)" "WIN32"
###
### do not enable on win32 right now.
### DEFINITIONS += UNICODE=t
###
### do not enable on win32 right now.
### DEFINITIONS += UNICODE=t
CC = g++
# CLAM_COMPILER_ROOT_DIR = /
PLATFORM_ADD_IN = linux_
CC = g++
# CLAM_COMPILER_ROOT_DIR = /
PLATFORM_ADD_IN = linux_
-# ARCHITECTURE = $(shell machine 2>/dev/null || arch 2>/dev/null || echo i686)
+## ARCHITECTURE = $(shell machine 2>/dev/null || arch 2>/dev/null || echo i686)
- export CLAM_COMPILER_VERSION = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/get_version.sh $(CLAM_COMPILER) $(CLAM_COMPILER_ROOT_DIR) )
+## export CLAM_COMPILER_VERSION = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/get_version.sh $(CLAM_COMPILER) $(CLAM_COMPILER_ROOT_DIR) )
DEFINITIONS += _FILE_OFFSET_BITS=64
DEFINITIONS += _FILE_OFFSET_BITS=64
CC = $(CLAM_COMPILER_ROOT_DIR)/bin/g++
PLATFORM_ADD_IN = linux_
CC = $(CLAM_COMPILER_ROOT_DIR)/bin/g++
PLATFORM_ADD_IN = linux_
- export CLAM_COMPILER_VERSION = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/get_version.sh $(CLAM_COMPILER) $(CLAM_COMPILER_ROOT_DIR) )
+## export CLAM_COMPILER_VERSION = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/get_version.sh $(CLAM_COMPILER) $(CLAM_COMPILER_ROOT_DIR) )
SNAPGEAR_ROOT_DIR = $(HOME)/snapgear
SNAPGEAR_ROOT_DIR = $(HOME)/snapgear
##hmmm: below fixes nothing! argh!
## ARCHITECTURE = i386
##hmmm: below fixes nothing! argh!
## ARCHITECTURE = i386
- export CLAM_COMPILER_VERSION = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/get_version.sh $(CLAM_COMPILER) $(CLAM_COMPILER_ROOT_DIR) )
+## export CLAM_COMPILER_VERSION = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/get_version.sh $(CLAM_COMPILER) $(CLAM_COMPILER_ROOT_DIR) )
# RC := $(CLAM_COMPILER_ROOT_DIR)/bin/windres
PLATFORM_ADD_IN = w32_
# RC := $(CLAM_COMPILER_ROOT_DIR)/bin/windres
PLATFORM_ADD_IN = w32_
PLATFORM_ADD_IN = darwin
## ARCHITECTURE = $(shell machine 2>/dev/null || arch 2>/dev/null || echo i686)
PLATFORM_ADD_IN = darwin
## ARCHITECTURE = $(shell machine 2>/dev/null || arch 2>/dev/null || echo i686)
- export CLAM_COMPILER_VERSION = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/get_version.sh $(CLAM_COMPILER) $(CLAM_COMPILER_ROOT_DIR) )
+## export CLAM_COMPILER_VERSION = $(shell $(SHELL) $(CLAM_SCRIPTS)/cpp/get_version.sh $(CLAM_COMPILER) $(CLAM_COMPILER_ROOT_DIR) )
DEFINITIONS += _FILE_OFFSET_BITS=64
DEFINITIONS += _FILE_OFFSET_BITS=64
mkdir "$(CLAM_TMP)"; \
fi'
ifeq "$(QUIET)" ""
mkdir "$(CLAM_TMP)"; \
fi'
ifeq "$(QUIET)" ""
- $(HIDER)echo Project $(PROJECT) [$(shell basename $(shell dirname $(shell pwd) ) )/$(shell basename $(shell pwd) )] v. $(major).$(minor).$(revision).$(build)
+ $(HIDER)echo Project $(PROJECT) [$(shell echo $(CURRENT_DIR) | sed -e 's/.*\/\([^\/]*\)\/\([^\/]*\)/\1\/\2/')] v. $(major).$(minor).$(revision).$(build)
endif
$(HIDER)rm -f $(FLAG_FILES)
endif
$(HIDER)rm -f $(FLAG_FILES)
export TARGETS
# "ACTUAL_TARGETS" is how the targets are expected to be passed to the rules
export TARGETS
# "ACTUAL_TARGETS" is how the targets are expected to be passed to the rules
-# file; this allows rules from a plug-in module to manipulate the TARGETS to make
-# sure that important files do not get deleted by the automatic deletion done
-# with "make clean." If the real module used does not create a variable called
-# ACTUAL_TARGETS from the TARGETS, then the default specified here is used.
+# file. This allows rules from a plug-in module to manipulate the TARGETS to
+# make sure that important files do not get deleted by the automatic deletion
+# done with "make clean." If the real module used does not create a variable
+# called ACTUAL_TARGETS from the TARGETS, then the default specified here is
+# used.
export ACTUAL_TARGETS = $(TARGETS)
# "FIRST_TARGETS" and "LAST_TARGETS" are targets that need to be processed
export ACTUAL_TARGETS = $(TARGETS)
# "FIRST_TARGETS" and "LAST_TARGETS" are targets that need to be processed
export SVN_SSH="ssh -i $HOME/.ssh/others/id_dsa_sourceforge"
# Error and success noises for CLAM.
export SVN_SSH="ssh -i $HOME/.ssh/others/id_dsa_sourceforge"
# Error and success noises for CLAM.
- export CLAM_ERROR_SOUND='/z/walrus/media/sounds/effects/bwaaang.wav /z/walrus/media/sounds/cartoons/doh4.wav'
- export CLAM_FINISH_SOUND='/z/walrus/media/sounds/cartoons/meepmeep.wav'
+ export CLAM_ERROR_SOUND='/z/walrus/media/sounds/effects/bwaaang.mp3 /z/walrus/media/sounds/cartoons/doh4.mp3'
+ export CLAM_FINISH_SOUND='/z/walrus/media/sounds/cartoons/meepmeep.mp3'
# Setup for nethack adventure.
export NETHACKOPTIONS="name:Manjusri-W,dogname:Fred,catname:Zonker"
# Setup for nethack adventure.
export NETHACKOPTIONS="name:Manjusri-W,dogname:Fred,catname:Zonker"
# outer check on whether this already was run or not.
if [ -z "$BUILD_VARS_LOADED" ]; then
# outer check on whether this already was run or not.
if [ -z "$BUILD_VARS_LOADED" ]; then
+echo build variables were not loaded so recalculating.
+
# perform some calculations to get the right paths from our parameters.
if [ ! -z "$PARM_1" ]; then
# use the first real parameter since this is probably the 'source' version.
# perform some calculations to get the right paths from our parameters.
if [ ! -z "$PARM_1" ]; then
# use the first real parameter since this is probably the 'source' version.
if [ -f "/usr/bin/play" ]; then
#echo we see /usr/bin/play available...
BASIC_PLAY_CMD=/usr/bin/play
if [ -f "/usr/bin/play" ]; then
#echo we see /usr/bin/play available...
BASIC_PLAY_CMD=/usr/bin/play
+elif [ ! -z "$WINDIR" ]; then
+#echo "kludge for win32; we provide our own sound player."
+ BASIC_PLAY_CMD=playsound
elif [ ! -z "$(whichable afplay)" ]; then
#echo we see afplay available...
BASIC_PLAY_CMD=afplay
elif [ ! -z "$(whichable afplay)" ]; then
#echo we see afplay available...
BASIC_PLAY_CMD=afplay
elif [ ! -z "$(psfind pulseaudio)" ]; then
#echo we see pulse running...
BASIC_PLAY_CMD="padsp aplay"
elif [ ! -z "$(psfind pulseaudio)" ]; then
#echo we see pulse running...
BASIC_PLAY_CMD="padsp aplay"
-elif [ ! -z "$WINDIR" ]; then
-#echo kludge for win32; we provide our own sound player.
- BASIC_PLAY_CMD=playsound
else
echo "I don't know how to play basic sound files for this OS and sound system."
fi
else
echo "I don't know how to play basic sound files for this OS and sound system."
fi