void handleComment()
    {
        if (m_currentComment == 0 || m_currentEntry == 0)
        { return; }

        QCString text(m_currentComment->text);

        m_currentEntry->docFile = m_currentComment->fileName;
        m_currentEntry->docLine = m_currentComment->line;

        int position(0);
        bool needs_entry(false);
        bool brief(false);
        Protection prot(Public);
        int lineNr = lineNumber();

        while (parseCommentBlock(m_parser,
                                 m_currentEntry,
                                 text, m_fileName.data(), 
                                 lineNr,
                                 brief, m_currentComment->isJavaStyle,
                                 false,
                                 prot,
                                 position,
                                 needs_entry))
        {
            if (needs_entry) { createEntry(); }
        }
        if (needs_entry) { createEntry(); }

        delete m_currentComment;
        m_currentComment = 0;
    }
/* description: take two entries and cluster info and populates	them with 
 * '.' and '..' entriy information. The entries are	ready for writing to 
 * the disk after this. helper function for mkdir()
  */
int makeSpecialDirEntries(struct DIR_ENTRY * dot, 
						struct DIR_ENTRY * dotDot,
						uint32_t newlyAllocatedCluster,
						uint32_t pwdCluster ) {
	createEntry(dot, ".", "", TRUE, newlyAllocatedCluster, 0, FALSE, FALSE);	
	createEntry(dotDot, "..", "", TRUE, pwdCluster, 0, FALSE, FALSE);	
	return 0;
}
void TrajectoryVideoLookup::putVideoURL(const std::string& tkey, const std::string& vkey, const std::string& url)
{
  TrajectoryHashtable::iterator entry;
  if( !hasEntry(tkey, entry) )
    createEntry(tkey, entry);
  entry->second.addVideoURL(vkey, url);
}
Beispiel #4
0
/**
 * returns entry in hashtable for the given connection
 * if it was not found, a new entry is created and returned
 */
RBSWormDetector::RBSEntry* RBSWormDetector::getEntry(Connection* conn)
{
	time_t curtime = time(0);
	uint32_t hash = crc32(0, 4, reinterpret_cast<char*>(&conn->srcIP)) & (hashSize-1);

	//regularly adapt new values
	if (lastAdaption+timeAdaptInterval < (uint32_t) curtime) 
	{
		lastAdaption = curtime;
		adaptFrequencies();
		
	}

	// regularly cleanup expired entries in hashtable
	if (lastCleanup+timeCleanupInterval < (uint32_t)curtime) {
		lastCleanup = curtime;
		cleanupEntries();		
	}

	list<RBSEntry*>::iterator iter = rbsEntries[hash].begin();
	while (iter != rbsEntries[hash].end()) {
		if ((*iter)->srcIP == conn->srcIP) {
			// found the entry
			return *iter;
		}
		iter++;
	}

	// no entry found, create a new one
	RBSEntry* rbs = createEntry(conn);
	rbsEntries[hash].push_back(rbs);

	return rbs;
}
bool RollingValueStore::declareKey(char* key,int numSamples)
{
	RollingValueStoreEntry* current;
	bool exists = store->get(key,(void**)&current,RollingValue);

	RollingValueStoreEntry* newEntry=newEntry = createEntry(numSamples);
	bool isSuccess = store->put(key,newEntry,RollingValue);
	if(isSuccess)
	{
		//free the memory of the earlier entry if it exists
		if(exists) {
			deleteEntry(current);
		}

		return true;
	}
	else
	{
		//could not add the rolling value to the store so free the memory
		deleteEntry(newEntry);
		return false;

	}


}
void TrajectoryVideoLookup::put(const std::string& tkey, moveit_msgs::RobotTrajectory rt)
{
  TrajectoryHashtable::iterator entry;
  if( !hasEntry(tkey, entry) )
    createEntry(tkey, entry);
  entry->second.rt = rt;
}
void TrajectoryVideoLookup::put(const std::string& tkey, moveit_msgs::MotionPlanRequest mpr )
{
  TrajectoryHashtable::iterator entry;
  if( !hasEntry(tkey, entry) )
    createEntry(tkey, entry);
  entry->second.mpr = mpr;
}
void ToolBarDialog::addBookmark(QAction *action)
{
	if (action && action->data().type() == QVariant::ModelIndex)
	{
		m_ui->currentEntriesItemView->insertRow(createEntry(QLatin1String("bookmarks:") + QString::number(action->data().toModelIndex().data(BookmarksModel::IdentifierRole).toULongLong())));
	}
}
Beispiel #9
0
	bool doRedo()
	{
		if (!created)
			return deleteEntry();
		else
			return createEntry();
	}
Beispiel #10
0
	bool doUndo()
	{
		if (created)
			return deleteEntry();
		else
			return createEntry();
	}
Beispiel #11
0
// Searches through the linked list looking for a match on hashID. If
// multiple elements hash to the same value, a strcmp must be done to
// check for match. The goal is to have very large hashId space so that
// string compares are minimized
StringTableEntry *CeeSectionString::findStringInsert(
                        StringTableEntry *&head, __in_z LPWSTR target, ULONG hashId)
{
    StringTableEntry *cur, *prev;
    cur = prev = head;
    while (cur && cur->m_hashId < hashId) {
        prev = cur;
        cur = cur->m_next;
    }
    while (cur && cur->m_hashId == hashId) {
        if (wcscmp(target, (LPWSTR)(computePointer(cur->m_offset))) == 0)
            return cur;
        prev = cur;
        cur = cur->m_next;
    }
    // didn't find in chain so insert at prev
    StringTableEntry *entry = createEntry(target, hashId);
    if (cur == head) {
        head = entry;
        entry->m_next = prev;
    } else {
        prev->m_next = entry;
        entry->m_next = cur;
    }
    return entry;
}
Beispiel #12
0
void* hashmapPut(Hashmap* map, void* key, void* value) {
    int hash = hashKey(map, key);
    size_t index = calculateIndex(map->bucketCount, hash);
    
    Entry** p = &(map->buckets[index]);
    while (true) {
        Entry* current = *p;
        
        // Add a new entry.
        if (current == NULL) {
            *p = createEntry(key, hash, value);
            if (*p == NULL) {
                errno = ENOMEM;
                return NULL;
            }
            map->size++;
            expandIfNecessary(map);
            return NULL;
        }
        
        // Replace existing entry.
        if (equalKeys(current->key, current->hash, key, hash, map->equals)) {
            void* oldValue = current->value;
            current->value = value;
            return oldValue;
        }
        
        // Move to next entry.
        p = &current->next;
    }
}
Beispiel #13
0
void* hashmapMemoize(Hashmap* map, void* key,
                     void* (*initialValue)(void* key, void* context), void* context) {
    int hash = hashKey(map, key);
    size_t index = calculateIndex(map->bucketCount, hash);
    
    Entry** p = &(map->buckets[index]);
    while (true) {
        Entry* current = *p;
        
        // Add a new entry.
        if (current == NULL) {
            *p = createEntry(key, hash, NULL);
            if (*p == NULL) {
                errno = ENOMEM;
                return NULL;
            }
            void* value = initialValue(key, context);
            (*p)->value = value;
            map->size++;
            expandIfNecessary(map);
            return value;
        }
        
        // Return existing value.
        if (equalKeys(current->key, current->hash, key, hash, map->equals)) {
            return current->value;
        }
        
        // Move to next entry.
        p = &current->next;
    }
}
/**
 * returns entry in hashtable for the given connection
 * if it was not found, a new entry is created and returned
 */
IPRecord* AutoFocus::getEntry(Connection* conn)
{
	time_t curtime = time(0);
	uint32_t hash = crc32(0, 4, reinterpret_cast<char*>(&conn->srcIP)) & (hashSize-1);


	if (lastTreeBuilt+timeTreeInterval < (uint32_t) curtime) 
	{
		lastTreeBuilt = curtime;
		buildTree();
	}

	list<IPRecord*>::iterator iter = listIPRecords[hash].begin();
	while (iter != listIPRecords[hash].end()) {
		if ((*iter)->subnetIP == conn->srcIP) {
			// found the entry
			return *iter;
		}
		iter++;
	}

	// no entry found, create a new one
	IPRecord* te = createEntry(conn);
	listIPRecords[hash].push_back(te);

	return te;
}
void TrajectoryVideoLookup::put(const std::string& tkey, view_controller_msgs::CameraPlacement view)
{
  TrajectoryHashtable::iterator entry;
  if( !hasEntry(tkey, entry) )
    createEntry(tkey, entry);
  entry->second.addView( view );
}
/**
 * returns entry in hashtable for the given connection
 * if it was not found, a new entry is created and returned
 */
TRWPortscanDetector::TRWEntry* TRWPortscanDetector::getEntry(Connection* conn)
{
	time_t curtime = time(0);
	uint32_t hash = crc32(0, 2, &reinterpret_cast<char*>(&conn->srcIP)[2]) & (hashSize-1);

	// regularly cleanup expired entries in hashtable
	if (lastCleanup+timeCleanupInterval < (uint32_t)curtime) {
		cleanupEntries();
		lastCleanup = curtime;
	}

	list<TRWEntry*>::iterator iter = trwEntries[hash].begin();
	while (iter != trwEntries[hash].end()) {
		if ((*iter)->srcIP == conn->srcIP) {
			// found the entry
			return *iter;
		}
		iter++;
	}

	// no entry found, create a new one
	TRWEntry* trw = createEntry(conn);
	trwEntries[hash].push_back(trw);

	return trw;
}
void TrajectoryVideoLookup::put(const std::string& tkey, moveit_msgs::PlanningScene ps)
{
  TrajectoryHashtable::iterator entry;
  if( !hasEntry(tkey, entry) )
    createEntry(tkey, entry);
  entry->second.ps = ps;
}
Beispiel #18
0
GtkWidget* createFrame(GPtrArray *entries, GPtrArray *all, const gchar name[], const gchar *names[], const gchar *wnames[], const int size)
{
    GtkWidget *_frame;
    GtkWidget *_label;
    GtkWidget *_vbox;
    int i;

    _frame = gtk_frame_new(NULL);
    _vbox = gtk_vbox_new(FALSE, 5);
    _label = gtk_check_button_new_with_label(name);
    g_ptr_array_add(all, _label);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(_label), TRUE);
    gtk_frame_set_label_widget(GTK_FRAME(_frame), GTK_WIDGET(_label));
    for ( i=0; i<size; i++ )
    {
        gtk_container_add(GTK_CONTAINER(_vbox), createEntry(entries, all, names[i], wnames[i]));

    }

    gtk_container_add(GTK_CONTAINER(_frame), GTK_WIDGET(_vbox));
    gtk_container_set_border_width(GTK_CONTAINER(_frame), 5);
    
    g_signal_connect(G_OBJECT(_label), "toggled",
            G_CALLBACK(toggle_action), (gpointer) _vbox);
    return _frame;
}
int main(int argc, char *argv[]){
  system("npm init");
  system("npm i babel-core -S");
  system("npm i babel-preset-es2015 -S");
  createEntry();
  return 0;
}
Beispiel #20
0
void FileSystem::prepareBeforeLoadFile(const QString &filename)
{
    checkSelectedFileIsSupported(filename);
    createEntry(filename);
    setWorkDirectory(filename);

    Config::changeLastWorkDirectory(filename);
}
// Create an entry and place it in |exifData|, the entry is initialized with
// the string provided in |value|
static bool createEntry(ExifData* exifData,
                        ExifIfd ifd,
                        int tag,
                        const char* value) {
    unsigned int length = strlen(value) + 1;
    const unsigned char* data = reinterpret_cast<const unsigned char*>(value);
    return createEntry(exifData, ifd, tag, data, length, EXIF_FORMAT_ASCII);
}
void TrajectoryVideoLookup::put(const std::string& tkey, TrajectoryVideoEntry vid)
{
  TrajectoryHashtable::iterator entry;
  if( !hasEntry(tkey, entry) )
    createEntry(tkey, entry);
  entry->second.addVideoFile(vid.name, vid.file);
  entry->second.addVideoURL(vid.name, vid.url);
}
// Create an entry with a single float |value| in it and place it in |exifData|
static bool createEntry(ExifData* exifData,
                        ExifIfd ifd,
                        int tag,
                        const float value,
                        float denominator = 1000.0) {
    float values[1] = { value };
    // Recycling functions is good for the environment
    return createEntry(exifData, ifd, tag, values, denominator);
}
Beispiel #24
0
/*
 * Process clients for disk archiving.
 */
static void
procClients(void)
{
	/*
	 * Create entry for trusted disk archiving client.
	 */
	(void) createEntry("", dirname, "/", 1, DT_client);
	DiskVolClientCount++;
}
Beispiel #25
0
/*
 * Process disk volume configuration entry.
 */
static void
cfgVolume(void)
{
	char *host;
	char *path;
	int	pathlen;
	int i;
	size_t offset;
	int dtype;
	struct diskVolsConfig *config;

	/*
	 *	Check for invalid (too long) volume name.
	 */
	if (strlen(dirname) > (sizeof (vsn_t) - 1)) {
		ReadCfgError(CustMsg(2881));
	}

	/*
	 *	Check for duplicate volume definition.
	 */
	for (i = 0, offset = 0; i < diskVols.count; i++) {
		config = (struct diskVolsConfig *)(void *)
		    ((char *)&diskVols.data[0] + offset);
		if (strcmp(dirname, config->vsn) == 0) {
			ReadCfgError(CustMsg(4463), dirname);
		}
		offset += STRUCT_RND(sizeof (struct diskVolsConfig) +
		    config->pathlen);
	}

	/*
	 *	Check if honeycomb configuration.
	 */
	if (strcmp(token, HONEYCOMB_RESOURCE_NAME) == 0) {
		assignHoneycombProps(dirname);
		return;
	}

	if ((path = strchr(token, ':')) != NULL) {
		host = token;
		*path++ = '\0';
	} else {
		host = "";
		path = token;
	}

	pathlen = strlen(path) + 1;

	/*
	 * Create a disk volume configuration entry.
	 */
	config = createEntry(dirname, host, path, pathlen, DT_disk);
	config->media = DT_DISK;

}
Beispiel #26
0
int main() {
    if (!isSupportedPlatform()) {
        fwprintf(stderr, L"Windows Vista or greater is required.\n");
        return 1;
    }

    DWORD entryFound = FALSE;
    BOOL connectedFound = FALSE;
    BOOL ok = TRUE;

    wprintf(L"=== Hubei EXin Dialer for Windows ===\n");
    wprintf(L"Algorithm Version: ");
    printf("%s\n", EXIN_VERSION);
    wprintf(L"Windows Dialer Version: %ls\n\n", RAS_DIALER_VERSION);
    wprintf(L"Homepage: https://github.com/Xinkai/Hubei-Exin\n");

    ok = findCurrentlyConnected(&connectedFound);
    if (!ok) {
        fwprintf(stderr, L"Error occured when tried to test if HubeiExin is currently connected\n");
        return 1;
    }
    if (connectedFound) {
        fwprintf(stderr, L"Already Connected\n");
        return 0;
    }

    ok = findEntry(&entryFound);
    if (!ok) {
        fwprintf(stderr, L"Error occurred when tried to find Entry 'HubeiExin'\n");
        return 1;
    }

    if (!entryFound) {
        wprintf(L"Entry not found, trying to create\n");
        ok = createEntry();
        if (!ok) {
            fwprintf(stderr, L"Cannot create entry\n");
            return 1;
        };
    }

    wprintf(L"Entry is OK\n");

    ok = setEntryProperties();
    if (!ok) {
        return 1;
    }

    ok = dial();
    if (!ok) {
        return 1;
    }

    return 0;
}
void FSBMRecentFolders::setRecents(const QStringList &recents)
{
	_recents = recents;

	_entries.clear();

	foreach (const QString &path, recents)
		_entries.append(createEntry(path, FSEntry::Folder));

	emit entriesChanged();
}
    void setSection()
    {
        Entry * current = createEntry();
        current->reset();

        current->name    = m_fileName;
        current->section = Entry::SOURCE_SEC;

        // Open/Close the scope to do the bookkeeping:
        openScopes(current);
        closeScopes();
    }
    Entry * openNamespace(const QString & name)
    {
        Entry * current_namespace = createEntry();
        QCString scoped_name(getCurrentScope());
        if (!scoped_name.isEmpty())
        { scoped_name.append("::"); }
        scoped_name.append(name.utf8());
        current_namespace->name = scoped_name;
        current_namespace->section = Entry::NAMESPACE_SEC;
        current_namespace->type = "namespace" ;

        return current_namespace;
    }
Beispiel #30
0
void DayModelHandler::startElement(wchar_t * qName, int len, ISAXAttributes *pAttr)
{
    if(m_type != None && equalsString(const_cast<TCHAR *>(ELEMENTS[TIMEENTRY]), qName, len))
        createEntry(pAttr);
    else if(m_pEntry && equalsString(const_cast<TCHAR *>(ELEMENTS[TASKNAME]), qName, len))
    {
        m_pTaskName = new StringBuffer();
    }
    else if(m_pEntry && equalsString(const_cast<TCHAR *>(ELEMENTS[ANNOTATION]), qName, len))
    {
        m_pAnnotation = new StringBuffer();
    }
}