本文整理汇总了C++中PRINT_MSG函数的典型用法代码示例。如果您正苦于以下问题:C++ PRINT_MSG函数的具体用法?C++ PRINT_MSG怎么用?C++ PRINT_MSG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PRINT_MSG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: botfs_open
/**
* Oeffnet eine Datei
* \param filename Dateiname
* \param *file Zeiger auf Datei-Deskriptor
* \param mode Modus, in dem die Datei geoeffnet wird
* \param *buffer Puffer fuer mindestens BOTFS_BLOCK_SIZE Byte
* \return 0, falls kein Fehler
*/
int8_t botfs_open(const char * filename, botfs_file_descr_t * file, uint8_t mode, void * buffer) {
botfs_acquire_lock_low(&botfs_mutex);
/* Datei suchen */
botfs_file_t * ptr = search_file(filename, buffer);
if (ptr == NULL) {
botfs_release_lock_low(&botfs_mutex);
PRINT_MSG("botfs_open(): file not found");
return -1;
}
/* Datei-Deskriptor laden und updaten */
*file = ptr->descr;
file->mode = mode;
file->pos = file->start + BOTFS_HEADER_SIZE;
/* Datei-Header laden */
if (botfs_read_low(file->start, buffer) != 0) {
botfs_release_lock_low(&botfs_mutex);
PRINT_MSG("botfs_open(): read_low()-error");
return -2;
}
/* benutzte Bloecke lt. Header in den Datei-Deskriptor uebernehmen */
botfs_file_header_t * ptr_head = buffer;
file->used = ptr_head->used_blocks;
// PRINT_MSG("botfs_open(): start=0x%x end=0x%x", file->used.start, file->used.end);
int8_t tmp = 0;
if (mode == BOTFS_MODE_W) {
PRINT_MSG("botfs_open(): Datei wird geleert...");
tmp = clear_file(file, buffer);
}
botfs_release_lock_low(&botfs_mutex);
return tmp;
}
示例2: botfs_unlink
/**
* Entfernt eine Datei
* \param *filename Dateiname
* \param *buffer Puffer fuer mindestens BOTFS_BLOCK_SIZE Byte
* \return 0, falls kein Fehler
*/
int8_t botfs_unlink(const char * filename, void * buffer) {
botfs_acquire_lock_low(&botfs_mutex);
/* Datei suchen */
botfs_file_t * ptr = search_file(filename, buffer);
if (ptr == NULL) {
botfs_release_lock_low(&botfs_mutex);
PRINT_MSG("botfs_unlink(): Datei nicht vorhanden");
return -1;
}
/* Root-Dir Eintrag loeschen */
ptr->name[0] = 0;
ptr->name[1] = 0;
botfs_seek(&botfs_vol_data.rootdir, -1, SEEK_CUR); // Dateizeiger stand auf naechstem Dir-Block => -1
if (botfs_write(&botfs_vol_data.rootdir, buffer) != 0) {
botfs_release_lock_low(&botfs_mutex);
PRINT_MSG("botfs_unlink(): Fehler beim Schreiben des Root-Blocks");
return -2;
}
const uint16_t start = ptr->descr.start;
const uint16_t end = ptr->descr.end;
/* Freelist aktualisieren */
int8_t res = add_to_freelist(start, end, buffer);
botfs_release_lock_low(&botfs_mutex);
PRINT_MSG("botfs_unlink(): Datei \"%s\" wurde geloescht", filename);
return res;
}
示例3: botfs_init
/**
* Initialisiert ein Volume
* \param *image Dateiname des Images
* \param *buffer Puffer fuer mindestens BOTFS_BLOCK_SIZE Byte
* \param create Soll das Volume erzeugt werden, falls es nicht existiert?
* \return 0, falls kein Fehler
*/
int8_t botfs_init(char * image, void * buffer, uint8_t create) {
init_state = 0;
/* Volume laden */
PRINT_MSG("botfs_init_low(\"%s\")...", image);
if (botfs_init_low(image, buffer, create) != 0) {
PRINT_MSG("botfs_init(): botfs_init_low() schlug fehl");
return -1;
}
/* Header einlesen */
if (botfs_read_low(BOTFS_HEADER_POS, buffer) != 0) {
PRINT_MSG("botfs_init(): botfs_read_low(BOTFS_HEADER_POS) schlug fehl");
return -2;
}
/* Root-Dir- und Freelist-Adresse speichern */
botfs_volume_t * volume = buffer;
botfs_vol_data = volume->data.ctrldata;
init_state = 1;
if (botfs_check_volume_low(image, buffer) != 0) {
PRINT_MSG("botfs_init(): Volume fehlerhaft");
init_state = 0;
return -3;
}
PRINT_MSG("botfs_init() erfolgreich");
return 0;
}
示例4: main
int main (int argc, char **argv)
{
uint_t err = 0;
if (argc < 2) {
err = 2;
PRINT_ERR("not enough arguments\n");
PRINT_MSG("read a wave file as a mono vector\n");
PRINT_MSG("usage: %s <source_path> [samplerate] [win_size] [hop_size]\n", argv[0]);
return err;
}
uint_t samplerate = 0;
if ( argc >= 3 ) samplerate = atoi(argv[2]);
uint_t win_size = 1024; // window size
if ( argc >= 4 ) win_size = atoi(argv[3]);
uint_t hop_size = win_size / 4;
if ( argc >= 5 ) hop_size = atoi(argv[4]);
uint_t n_frames = 0, read = 0;
char_t *source_path = argv[1];
aubio_source_t * source = new_aubio_source(source_path, samplerate, hop_size);
if (!source) { err = 1; goto beach; }
if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(source);
// create some vectors
fvec_t * in = new_fvec (hop_size); // input audio buffer
fvec_t * out = new_fvec (1); // output position
// create tempo object
aubio_tempo_t * o = new_aubio_tempo("default", win_size, hop_size, samplerate);
do {
// put some fresh data in input vector
aubio_source_do(source, in, &read);
// execute tempo
aubio_tempo_do(o,in,out);
// do something with the beats
if (out->data[0] != 0) {
PRINT_MSG("beat at %.3fms, %.3fs, frame %d, %.2fbpm with confidence %.2f\n",
aubio_tempo_get_last_ms(o), aubio_tempo_get_last_s(o),
aubio_tempo_get_last(o), aubio_tempo_get_bpm(o), aubio_tempo_get_confidence(o));
}
n_frames += read;
} while ( read == hop_size );
PRINT_MSG("read %.2fs, %d frames at %dHz (%d blocks) from %s\n",
n_frames * 1. / samplerate,
n_frames, samplerate,
n_frames / hop_size, source_path);
// clean up memory
del_aubio_tempo(o);
del_fvec(in);
del_fvec(out);
del_aubio_source(source);
beach:
aubio_cleanup();
return err;
}
示例5: remove_old_socket
static ret_t
remove_old_socket (const char *path)
{
int re;
struct stat info;
/* It might not exist
*/
re = cherokee_stat (path, &info);
if (re != 0) {
return ret_ok;
}
/* If exist, it must be a socket
*/
if (! S_ISSOCK(info.st_mode)) {
PRINT_MSG ("ERROR: Something happens; '%s' isn't a socket.\n", path);
return ret_error;
}
/* Remove it
*/
re = unlink (path);
if (re != 0) {
PRINT_MSG ("ERROR: Couldn't remove unix socket '%s'.\n", path);
return ret_error;
}
return ret_ok;
}
示例6: sizeof
// --------------------------------------------------------------------------
// From class CMMFCodec.
// The function sets codec configuration.
// value used for aConfigType must be KUidMmfCodecAudioSettings
// (defined in include\mmf\plugins\mmfCodecImplementationUIDs.hrh)
//
// --------------------------------------------------------------------------
//
void CAriAmrNbEncMmfCodec::ConfigureL( TUid /* aConfigType */,
const TDesC8& aParam )
{
PRINT_ENTRY;
if ( !iConfigured )
{
TInt encMode = 0;
TInt dtx = 0;
TInt offset = 0;
Mem::Copy( &encMode, aParam.Ptr() + offset, sizeof( TInt ) );
offset += sizeof(TInt);
Mem::Copy( &dtx, aParam.Ptr() + offset, sizeof( TInt ) );
offset += sizeof(TInt);
iParam.iMode = ( TInt16 )encMode;
iParam.iDtx = ( TInt16 )dtx;
PRINT_MSG( LEVEL_HIGH, ( "Mode: %d", iParam.iMode ) );
PRINT_MSG( LEVEL_HIGH, ( "DTX: %d", iParam.iDtx ) );
User::LeaveIfError( iCodec->Reset( &iParam ) );
iConfigured = ETrue;
}
PRINT_EXIT;
}
示例7: PRINT_MSG
// --------------------------------------------------------------------------
// Second phase of the two-phased constructor.
// Creates an instance of encoder
// --------------------------------------------------------------------------
//
void CAriAacLCEncMmfCodec::ConstructL()
{
PRINT_ENTRY;
iCodec = CAriAacLCEncWrapper::NewL();
iInternalInputBuffer = ( TUint8* ) User::AllocZL( KMinBytesInput );
iInternalOutputBuffer = ( TUint8* ) User::AllocZL( KMinDstLen );
PRINT_MSG( LEVEL_HIGH, ( "Default NumberOfChannels: %d",
iParam.iNumberOfChannels ) );
PRINT_MSG( LEVEL_HIGH, ( "Default OutputBitRate: %d",
iParam.iOutputBitRate ) );
PRINT_MSG( LEVEL_HIGH, ( "Default OutputFormat: %d",
iParam.iOutputFormat ) );
PRINT_MSG( LEVEL_HIGH, ( "Default SamplingFrequency: %d",
iParam.iSamplingFrequency ) );
//Reset encoder with default parameters
User::LeaveIfError( iCodec->Reset( &iParam ) );
iSrclenToProcess = sizeof( TInt16 ) * KNoOfSamples *
iParam.iNumberOfChannels;
PRINT_EXIT;
}
示例8: botfs_init_low
/**
* Laedt das Volume
* \param *image Dateiname des Images
* \param *buffer Puffer fuer mindestens BOTFS_BLOCK_SIZE Byte
* \param create Soll das Volume erzeugt werden, falls es nicht existiert?
* \return 0, falls kein Fehler
*/
int8_t botfs_init_low(char * image, void * buffer, uint8_t create) {
(void) buffer; // kein warning
#ifdef DEBUG_BOTFS_LOGFILE
botfs_acquire_lock_low(&log_mutex);
botfs_log_fd = fopen(BOTFS_DEBUG_LOGFILE, "wb");
botfs_release_lock_low(&log_mutex);
#endif // DEBUG_BOTFS_LOGFILE
botfs_acquire_lock_low(&file_mutex);
image_file = fopen(image, "r+b");
botfs_release_lock_low(&file_mutex);
if (image_file == NULL) {
PRINT_MSG("botfs_init_low(): Image-Datei \"%s\" konnte nicht geoeffnet werden", image);
if (create != 1) {
return -1;
}
PRINT_MSG("botfs_init_low(): Lege neues Images \"%s\" an...", image);
if (botfs_create_volume(image, BOTFS_DEFAULT_VOL_NAME, BOTFS_DEFAULT_VOL_SIZE) != 0) {
PRINT_MSG("botfs_init_low(): botfs_create_volume(\"%s\") schlug fehl", image);
return -2;
}
botfs_acquire_lock_low(&file_mutex);
image_file = fopen(image, "r+b");
botfs_release_lock_low(&file_mutex);
if (image_file == NULL) {
PRINT_MSG("botfs_init_low(): angelegte Image-Datei \"%s\" konnte nicht geoeffnet werden", image);
return -3;
}
}
PRINT_MSG("botfs_init_low() erfolgreich");
return 0;
}
示例9: check_worker_version
static ret_t
check_worker_version (const char *this_exec)
{
FILE *f;
char tmp[256];
char *line, *p;
int re;
snprintf (tmp, sizeof(tmp), "%s -i", cherokee_worker);
f = popen (tmp, "r");
if (f == NULL) {
PRINT_MSG ("(critical) Cannot execute '%s'\n", tmp);
goto error;
}
while (! feof(f)) {
/* Skip line until it found the version entry
*/
line = fgets (tmp, sizeof(tmp), f);
if (line == NULL)
continue;
line = strstr (line, "Version: ");
if (line == NULL)
continue;
/* Compare both version strings
*/
line += 9;
re = strncmp (line, PACKAGE_VERSION, strlen(PACKAGE_VERSION));
if (re == 0) {
pclose(f);
return ret_ok;
}
/* Remove the new line character and report the error
*/
p = line;
while (*p++ != '\n');
*p = '\0';
PRINT_MSG_S ("ERROR: Broken installation detected\n");
PRINT_MSG (" Cherokee (%s) %s\n", this_exec, PACKAGE_VERSION);
PRINT_MSG (" Cherokee-worker (%s) %s\n", cherokee_worker, line);
PRINT_MSG_S ("\n");
PRINT_MSG_S ("This issue is usually caused by a secondary Cherokee installation in your $PATH.\n");
PRINT_MSG_S ("The following command might help to find where the installations were performed:\n\n");
PRINT_MSG_S ("find `echo $PATH | sed 's/:/ /g'` -name 'cherokee*' -exec dirname \"{}\" \\; | uniq\n");
PRINT_MSG_S ("\n");
goto error;
}
PRINT_MSG ("(critical) Couldn't find the version string: '%s -i'\n", cherokee_worker);
error:
if (f != NULL) {
pclose(f);
}
return ret_error;
}
示例10: sem_new
static int
sem_new (void)
{
int i;
int re;
int sem;
union semun ctrl;
/* Create */
sem = semget (getpid(), SEM_LAUNCH_TOTAL, IPC_CREAT | SEM_R | SEM_A);
if (sem < 0) {
PRINT_MSG ("Could not create semaphore: %s\n", strerror(errno));
return -1;
}
/* Initialize */
for (i=0; i < SEM_LAUNCH_TOTAL; i++) {
ctrl.val = 0;
re = semctl (sem, i, SETVAL, ctrl);
if (re < 0) {
goto error;
}
}
return sem;
error:
PRINT_MSG ("Could not initialize semaphore: %s\n", strerror(errno));
return -1;
}
示例11: main
int main (int argc, char **argv)
{
sint_t err = 0;
if (argc < 3) {
err = 2;
PRINT_ERR("not enough arguments\n");
PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] [hop_size]\n", argv[0]);
return err;
}
char_t *source_path = argv[1];
char_t *sink_path = argv[2];
uint_t samplerate = 0;
uint_t hop_size = 256;
if ( argc >= 4 ) samplerate = atoi(argv[3]);
if ( argc >= 5 ) hop_size = atoi(argv[4]);
if ( argc >= 6 ) {
err = 2;
PRINT_ERR("too many arguments\n");
return err;
}
fvec_t *vec = new_fvec(hop_size);
if (!vec) { err = 1; goto beach_fvec; }
aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size);
if (!i) { err = 1; goto beach_source; }
if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i);
aubio_sink_t *o = new_aubio_sink(sink_path, samplerate);
if (!o) { err = 1; goto beach_sink; }
uint_t n_frames = 0, read = 0;
do {
aubio_source_do(i, vec, &read);
aubio_sink_do(o, vec, read);
n_frames += read;
} while ( read == hop_size );
PRINT_MSG("read %d frames at %dHz (%d blocks) from %s written to %s\n",
n_frames, samplerate, n_frames / hop_size,
source_path, sink_path);
del_aubio_sink(o);
beach_sink:
del_aubio_source(i);
beach_source:
del_fvec(vec);
beach_fvec:
return err;
}
示例12: main
int main (int argc, char **argv)
{
uint_t err = 0;
if (argc < 2) {
err = 2;
PRINT_ERR("not enough arguments\n");
PRINT_MSG("read a wave file as a mono vector\n");
PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]);
PRINT_MSG("examples:\n");
PRINT_MSG(" - read file.wav at original samplerate\n");
PRINT_MSG(" %s file.wav\n", argv[0]);
PRINT_MSG(" - read file.wav at 32000Hz\n");
PRINT_MSG(" %s file.aif 32000\n", argv[0]);
PRINT_MSG(" - read file.wav at original samplerate with 4096 blocks\n");
PRINT_MSG(" %s file.wav 0 4096 \n", argv[0]);
return err;
}
#if __APPLE__
uint_t samplerate = 0;
uint_t hop_size = 256;
uint_t n_frames = 0, read = 0;
if ( argc == 3 ) samplerate = atoi(argv[2]);
if ( argc == 4 ) hop_size = atoi(argv[3]);
char_t *source_path = argv[1];
aubio_source_apple_audio_t * s =
new_aubio_source_apple_audio(source_path, samplerate, hop_size);
if (!s) { err = 1; goto beach; }
fvec_t *vec = new_fvec(hop_size);
if (samplerate == 0 ) samplerate = aubio_source_apple_audio_get_samplerate(s);
do {
aubio_source_apple_audio_do(s, vec, &read);
fvec_print (vec);
n_frames += read;
} while ( read == hop_size );
PRINT_MSG("read %d frames at %dHz (%d blocks) from %s\n", n_frames, samplerate,
n_frames / hop_size, source_path);
del_fvec (vec);
del_aubio_source_apple_audio (s);
beach:
#else
err = 3;
PRINT_ERR("aubio was not compiled with aubio_source_apple_audio\n");
#endif /* __APPLE__ */
return 0;
}
示例13: sem_chmod
static int
sem_chmod (int sem, char *worker_uid)
{
int i;
int re;
struct semid_ds buf;
union semun semopts;
struct passwd *passwd;
int uid = 0;
/* Read the UID
*/
uid = (int)strtol (worker_uid, (char **)NULL, 10);
if (uid == 0) {
passwd = getpwnam (worker_uid);
if (passwd != NULL) {
uid = passwd->pw_uid;
}
}
if (uid == 0) {
PRINT_MSG ("(warning) Couldn't get UID for user '%s'\n", worker_uid);
return -1;
}
/* Initialize the memory
*/
memset (&buf, 0, sizeof(struct semid_ds));
memset (&semopts, 0, sizeof(union semun));
semopts.buf = &buf;
/* Set the permissions
*/
for (i=0; i<SEM_LAUNCH_TOTAL; i++) {
re = semctl (sem, i, IPC_STAT, semopts);
if (re != -0) {
PRINT_MSG ("(warning) Couldn't IPC_STAT: errno=%d\n", errno);
return -1;
}
buf.sem_perm.uid = uid;
re = semctl (spawn_shared_sems, i, IPC_SET, semopts);
if (re != 0) {
PRINT_MSG ("(warning) Couldn't IPC_SET: uid=%d errno=%d\n", uid, errno);
return -1;
}
}
return 0;
}
示例14: PRINT_MSG
// --------------------------------------------------------------------------
// Second phase of the two-phased constructor.
// Creates an instance of encoder
// --------------------------------------------------------------------------
//
void CAriAmrNbEncMmfCodec::ConstructL()
{
PRINT_ENTRY;
iCodec = CAriAmrNbEncWrapper::NewL();
iInternalInputBuffer = ( TUint8* ) User::AllocZL( KMinBytesInput );
iInternalOutputBuffer = ( TUint8* ) User::AllocZL( KMinDstLen );
PRINT_MSG( LEVEL_HIGH, ( "Default mode: %d", iParam.iMode ) );
PRINT_MSG( LEVEL_HIGH, ( "Default DTX: %d", iParam.iDtx ) );
//Reset encoder with default parameters
User::LeaveIfError( iCodec->Reset( &iParam ) );
PRINT_EXIT;
}
示例15: zarlinkCaculateDevObj
int zarlinkCaculateDevObj(RTKDevType dev_type)
{
int fxs_dev;
int fxo_dev;
int fxsfxo_dev;
int fxsfxs_dev=0;
int total_dev;
if (DEV_FXS==dev_type) //display once
PRINT_MSG("Total %d lines. %d fxs and %d fxo from Global configuration\n",
ZARLINK_SLIC_CH_NUM, ZARLINK_FXS_LINE_NUM, ZARLINK_FXO_LINE_NUM);
/* Use minimum number of device to caculate possible combination */
fxsfxo_dev = MIN(ZARLINK_FXS_LINE_NUM, ZARLINK_FXO_LINE_NUM);/* FXS+FXO dev */
#if defined (CONFIG_RTK_VOIP_SLIC_ZARLINK_880_SERIES)
fxsfxs_dev = (ZARLINK_FXS_LINE_NUM - fxsfxo_dev) >> 1; /* FXS+FXS dev */
#endif
fxs_dev = ZARLINK_FXS_LINE_NUM - fxsfxo_dev - 2*fxsfxs_dev; /* FXS device */
fxo_dev = ZARLINK_FXO_LINE_NUM - fxsfxo_dev; /* FXO device */
total_dev = fxs_dev+fxsfxs_dev+fxo_dev+fxsfxo_dev;
if (DEV_FXS==dev_type) //display once
PRINT_MSG("Total %d devices\tFXS:%d, FXS+FXS:%d, FXS+FXO:%d, FXO:%d\n",
total_dev, fxs_dev, fxsfxs_dev, fxsfxo_dev, fxo_dev );
if (ZARLINK_SLIC_DEV_NUM < total_dev) {
PRINT_R("error : %s() Not enough space for chObj\n",__FUNCTION__);
return FAILED;
}
switch (dev_type) {
case DEV_FXS:
return fxs_dev;
break;
case DEV_FXO:
return fxo_dev;
break;
case DEV_FXSFXS:
return fxsfxs_dev;
break;
case DEV_FXSFXO:
return fxsfxo_dev;
break;
default:
return 0;
break;
}
return 0;
}