DEB_DD (1158343), страница 3

Файл №1158343 DEB_DD (Раздаточные материалы) 3 страницаDEB_DD (1158343) страница 32019-09-18СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 3)

void hash_RemoveAll( HASH_TABLE *HT );

HT – pointer to the HASH_TABLE structure.

Removing all elements from the hash-table.

In addition, the following macros are defined for working with a hash-table:

hash_Iterator(HT,Proc,Param)

It calls hash__Iterator function with Proc parameter cast to the to PFN_HASHITERATION type and Param parameter cast to the (void *) type.

hash_Find( HT, Val )

It calls hash__Find with Val parameter cast to the STORE_VALUE type.

hash_Insert( HT, Val, Assign )

It calls hash__Insert with Val parameter cast to the STORE_VALUE type and Assign parameter cast to the long type.

hash_Change( HT, Val, Assign )

It calls hash__Change Val parameter cast to the STORE_VALUE type and Assign parameter cast to the long type.

hash_Remove( HT, Val )

It calls hash__Remove with the Val parameter cast to the STORE_VALUE type.

2.3.Variable-table

The variable-table is intended to store information about variables and to fast access to it using the variable address. The variable-table uses hash-table for searching the information where a variable address is used as a key. The associated value of the hash-table contains element number of another table that keeps a variable information.

The variable-table uses such conception as variable level.

The root level is a level of the beginning sequential branch of the program execution. This level has zero number. When entering a parallel construction, the number of current level is incremented by one unit. When leaving parallel construction, the number of current level is decreased by one unit. Thus, the number of current level defines an enclosure depth of parallel constructions.

The number of the current level is important for work with variables, since the ideology of using variables depends on the current level. Each element of a variable-table keeps the reference to the same variable at the previous level (if the variable is used at several levels).

Types: DYNCNTRL.TYP

Prototypes: DYNCNTRL.DEC

Implementation: VARTABLE.C

Macros: DYNCNTRL.MAC

The following structure is used to store elements of variable-table:

typedef struct tag_VarInfo

{

byte Busy;

void * VarAddr;

long PrevNo;

int EnvirIndex;

byte Type;

SysHandle * Handle;

void * Info;

int Tag;

PFN_VARTABLE_ELEMDESTRUCTOR pfnDestructor;

}

VarInfo;

Busy – flag is equal 1 if this element contains valid variable information and 0 if variable is removed from the variable-table. This flag is used for work optimization and preventing frequent memory copying.

VarAddr – variable address.

PrevNo – the number of variable-table element that describes the same variable on a previous level.

EnvirIndex – number of the variable level.

Type – the variable DVM-type (type of using).

Handle – handle of a distributed array. It is not equal to zero if this element describes a distributed array.

Info – pointer to an additional variable information structure. It is depended on a variable type.

Tag – flag to store various variable attributes according to type of variable usage.

pfnDestructor – pointer to variable description destructor. This function is called when variable is removed from the variable-table. It can be equal NULL.

The following structure describes a variable table:

typedef struct tag_VAR_TABLE

{

HASH_TABLE hIndex;

TABLE vTable;

}

VAR_TABLE;

hIndex – hash-table. It is used for searching variable information by its address.

vTable – table used to keep variable information.

Figure 2. The variable-table representation

The following functions are intended for work with variable-table:

void vartable_Init( VAR_TABLE *VT, int vTableSize, int hIndexSize, int hTableSize, PFN_CALC_HASH_FUNC Func );

VT – pointer to initialized variable-table structure.

vTableSize – size of vTable expanding.

hIndexSize – size of hash-index array of hIndex.

hTableSize – size of hash-table hIndex expanding.

The function initializes the variable-table.

void vartable_Done( VAR_TABLE *VT );

VT – pointer to variable-table structure.

The function destructs variable-table.

VarInfo *vartable_GetVarInfo( VAR_TABLE *VT, long NoVar );

VT – pointer to variable-table structure.

NoVar – number of variable in the variable-table.

Getting the variable information from the variable-table by variable number. The NoVar should point to a valid variable-table element.

VarInfo *vartable_FindVar( VAR_TABLE *VT, void * Addr );

VT – pointer to variable-table structure.

Addr – variable address.

Getting the variable information from the variable-table by variable address. The function returns NULL if a variable with such address is not registered.

long vartable_FindNoVar( VAR_TABLE *VT, void * Addr );

VT – pointer to variable-table structure.

Addr – variable address.

Getting the variable number by variable address. The function returns –1 if a variable with such address is not registered.

long vartable_PutVariable( VAR_TABLE *VT, void * Addr, int Env, byte Type, SysHandle *Handle, int Tag, void *Info, PFN_VARTABLE_ELEMDESTRUCTOR pfnDestructor );

VT – pointer to variable-table structure.

Addr – variable address.

Env – variable level.

Type – type of variable usage.

Handle – distributed array handle if distributed array is registered.

Tag – variable attributes.

Info – pointer to additional variable information.

pfnDestructor – pointer to variable information destructor. It can be NULL.

Registration of a new variable in the variable-table. The function returns the number of the registered variable.

void vartable_VariableDone( VarInfo *Var );

Var – pointer to variable information structure.

The function uninitializes variable information structure. The function sets the Busy flag to 0 and calls corresponding variable information destructor if available.

void vartable_RemoveVariable( VAR_TABLE *VT, void * Addr );

VT – pointer to variable-table structure.

Addr – variable address.

Removing variable information from the variable-table.

void vartable_RemoveAll( VAR_TABLE *VT );

VT – pointer to variable-table structure.

Removing all variables from the variable-table.

void vartable_RemoveVarOnLevel( VAR_TABLE *VT, int Level );

VT – pointer to variable-table structure.

Level – executed level.

Removing all variables with the specified variable level.

void vartable_LevelDone( VAR_TABLE *VT );

VT – pointer to variable-table structure.

Finishing of the current parallel construction. The function removes all variables from the variable-table that have variable level equal to level of finishing construction.

void vartable_Iterator( VAR_TABLE *VT, PFN_VARTABLEITERATION Func );

VT – pointer to variable-table structure.

Func – iteration function with the following prototype: void (*PFN_VARTABLEITERATION)( VarInfo * ). All the pointers to variable information structures from the variable table are passed to the function.

The function performs the same operation for all the elements of the variable-table.

void vartable_LevelIterator( VAR_TABLE *VT, int Level, PFN_VARTABLEITERATION Func );

VT – pointer to variable-table structure.

Level – variable level.

Func – iteration function with the following prototype: void (*PFN_VARTABLEITERATION)( VarInfo * ). All the variable information structures of the variable-table with specified variable level are passed to the function.

The function performs the same operation for all the elements of the variable-table with specified variable level.

2.4.Diagnostics output

The module of diagnostics output has special requirements. The special requirements are demanded to the module of diagnostics. In the first, the detailed context of detected error should be reported. In the second, it is necessary to prevent output of many errors of the same type and in the same execution context that is possible when examining a program with the large loops.

At last, it is necessary to allow the user to output diagnostics both on a screen, and in a file for the consequent analysis.

The diagnostics module consists of two modules. The sub-module of context processing monitors current execution context of the program and allows to get a detailed current context description for diagnostics. The sub-module of diagnostics output prints detected errors and filters errors of the same type.

Types: CNTRLERR.TYP

Prototypes: CNTRLERR.DEC

Implementation: CNTRLERR.C

Diagnostics messages and other global variables and constants: CNTRLERR.VAR

2.4.1.Processing diagnostics context

The program execution context represents description of all current executed loops and current values of all their iteration variables. The current context varies each time, when entering or leaving the parallel or sequential loop or when new iteration execution begins.

The following structure is used to describe program execution context:

typedef struct _tag_CONTEXT

{

byte Rank;

byte Parallel;

int No;

byte ItersInit;

long Iters[MAXARRAYDIM];

}

CONTEXT;

Rank – loop rank.

Parallel – parallel or sequential loop.

No – unique loop number.

ItersInit – defines, whether at least one iteration of a loop was executed . The given flag is important for parallel loops, where between the beginning of a loop and first iteration the additional definitions can be.

Iters – array of current values of loop iteration variables.

Each CONTEXT structure describes one loop of the program. The sequence of such structures completely describes a current program execution context and order of a loop enclosure.

The global table gContext is used for storage the sequence of CONTEXT structures in the system. The root context with number zero is put to the gContext when system is initialized. This context corresponds to main() program procedure.

The following functions are intended to work execution context:

void cntx_Init(void);

The function initializes global variables that are used to work with execution contexts. This function also initializes the root context with zero number corresponding to the main program branch.

void cntx_Done(void);

The function uninitializes global variables used for the work with execution contexts.

void cntx_LevelInit( int No, byte Rank, byte IsParallel );

No – loop number.

Rank – loop rank.

IsParallel – parallel or sequential loop.

The function defines a new program execution context. The function is called when the program begins execution of a new parallel or sequential loop.

void cntx_LevelDone(void);

The function defines completion of the current program execution context. The function is called when leaving a parallel or sequential loop.

void cntx_SetIters( AddrType *index );

index – array of current iteration variable values. The rank of the array is equal to current loop rank.

Updating values of iteration variables. The function is called when a new iteration begins.

CONTEXT *cntx_CurrentLevel(void);

Getting pointer to current context definition. Return pointer of the CONTEXT type.

CONTEXT *cntx_GetLevel( long No );

Pointer to context definition with the specified context number is returned.

long cntx_LevelCount(void);

Count of registered program execution contexts is returned.

long cntx_GetDepth(void);

An enclosure depth of program parallel constructions (parallel loops) is returned.

int cntx_IsInitParLoop(void);

Характеристики

Список файлов учебной работы

Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
7021
Авторов
на СтудИзбе
260
Средний доход
с одного платного файла
Обучение Подробнее