Ejemplo n.º 1
0
/* convert_string_list return a list of strings. */
Handle convert_string_list(TaskData *mdTaskData, int count, char **strings)
{
    Handle saved = mdTaskData->saveVec.mark();
    Handle list  = SAVE(ListNull);
    
    /* It's simplest to process the strings in reverse order */
    for (int i = count - 1; 0 <= i; i--)
    {
        /* 
        The order of these declarations is important, becaue we don't
        want to have make to make the cons cell mutable. This is only
        safe if we promise to initialise it fully before the next
        ML heap allocation. SPF 29/11/96
        */
        Handle value = SAVE(C_string_to_Poly(mdTaskData, strings[i]));
        Handle next  = alloc_and_save(mdTaskData, SIZEOF(ML_Cons_Cell));
        
        DEREFLISTHANDLE(next)->h = DEREFWORDHANDLE(value); 
        DEREFLISTHANDLE(next)->t = DEREFLISTHANDLE(list);
        
        /* reset save vector to stop it overflowing */    
        mdTaskData->saveVec.reset(saved);
        list = SAVE(DEREFHANDLE(next));
    }
    
    return list;
}
Ejemplo n.º 2
0
Handle ShowHierarchy(TaskData *taskData)
// Return the list of files in the hierarchy.
{
    Handle saved = taskData->saveVec.mark();
    Handle list  = SAVE(ListNull);

    // Process this in reverse order.
    for (unsigned i = hierarchyDepth; i > 0; i--)
    {
        Handle value = SAVE(C_string_to_Poly(taskData, hierarchyTable[i-1]->fileName));
        Handle next  = alloc_and_save(taskData, sizeof(ML_Cons_Cell)/sizeof(PolyWord));
        DEREFLISTHANDLE(next)->h = DEREFWORDHANDLE(value); 
        DEREFLISTHANDLE(next)->t = DEREFLISTHANDLE(list);
        taskData->saveVec.reset(saved);
        list = SAVE(DEREFHANDLE(next));
    }
    return list;
}
Ejemplo n.º 3
0
// convert_string_list return a list of strings.
// This converts Unicode strings.
Handle convert_string_list(TaskData *mdTaskData, int count, WCHAR **strings)
{
    Handle saved = mdTaskData->saveVec.mark();
    Handle list  = SAVE(ListNull);
    
    // It's simplest to process the strings in reverse order */
    for (int i = count - 1; 0 <= i; i--)
    {
        Handle value = SAVE(C_string_to_Poly(mdTaskData, strings[i]));
        Handle next  = alloc_and_save(mdTaskData, SIZEOF(ML_Cons_Cell));
        
        DEREFLISTHANDLE(next)->h = DEREFWORDHANDLE(value); 
        DEREFLISTHANDLE(next)->t = DEREFLISTHANDLE(list);
        
        // reset save vector to stop it overflowing    
        mdTaskData->saveVec.reset(saved);
        list = SAVE(DEREFHANDLE(next));
    }
    
    return list;
}