⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 summary.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 2 页
字号:
    {    new_node_ptr->next_ptr = first_node_ptr;    first_node_ptr = new_node_ptr;    }else    {    new_node_ptr->next_ptr  = curr_node_ptr;    prev_node_ptr->next_ptr = new_node_ptr;    }return (new_node_ptr);}/********************************************************************** ***************************** FIND_TYPE ****************************** **********************************************************************/TYPE_SUM_PTR find_type(type_ptr_ptr, line_ptr)TYPE_SUM_PTR *type_ptr_ptr;char         *line_ptr;{TYPE_SUM_PTR prev_type_ptr;TYPE_SUM_PTR curr_type_ptr;TYPE_SUM_PTR new_type_ptr;prev_type_ptr = *type_ptr_ptr;curr_type_ptr = *type_ptr_ptr;while (curr_type_ptr != NULL)    {    if (strcmp (line_ptr, curr_type_ptr->err_type) > 0)        {        prev_type_ptr = curr_type_ptr;        curr_type_ptr = curr_type_ptr->next_ptr;        continue;        }    if (strcmp (line_ptr, curr_type_ptr->err_type) < 0)        break;    curr_type_ptr->count++;    return (curr_type_ptr);    }new_type_ptr = alloc_type(line_ptr);if (*type_ptr_ptr == NULL)    *type_ptr_ptr = new_type_ptr;elseif (curr_type_ptr == NULL)    prev_type_ptr->next_ptr = new_type_ptr;elseif (prev_type_ptr == curr_type_ptr)    {    new_type_ptr->next_ptr = *type_ptr_ptr;    *type_ptr_ptr = new_type_ptr;    }else    {    new_type_ptr->next_ptr  = curr_type_ptr;    prev_type_ptr->next_ptr = new_type_ptr;    }return (new_type_ptr);}/********************************************************************** ***************************** FIND_ITEM ****************************** **********************************************************************/ITEM_SUM_PTR find_item(item_ptr_ptr, line_ptr)ITEM_SUM_PTR *item_ptr_ptr;char         *line_ptr;{ITEM_SUM_PTR prev_item_ptr;ITEM_SUM_PTR curr_item_ptr;ITEM_SUM_PTR new_item_ptr;char         *val_ptr;prev_item_ptr = *item_ptr_ptr;curr_item_ptr = *item_ptr_ptr;while (curr_item_ptr != NULL)    {    val_ptr = curr_item_ptr->values;    if (strcmp (line_ptr, val_ptr) > 0)        {        prev_item_ptr = curr_item_ptr;        curr_item_ptr = curr_item_ptr->next_ptr;        continue;        }    if (strcmp (line_ptr, val_ptr) < 0)        break;    curr_item_ptr->count++;    return (curr_item_ptr);    }new_item_ptr = alloc_item(line_ptr);if (*item_ptr_ptr == NULL)    *item_ptr_ptr = new_item_ptr;elseif (curr_item_ptr == NULL)    prev_item_ptr->next_ptr = new_item_ptr;elseif (prev_item_ptr == curr_item_ptr)    {    new_item_ptr->next_ptr = *item_ptr_ptr;    *item_ptr_ptr = new_item_ptr;    }else    {    new_item_ptr->next_ptr  = curr_item_ptr;    prev_item_ptr->next_ptr = new_item_ptr;    }return (new_item_ptr);}/********************************************************************** **************************** ALLOCATE_NODE *************************** **********************************************************************/NODE_SUM_PTR alloc_node (temp_node_ptr)NODE_SUM_PTR temp_node_ptr;{NODE_SUM_PTR new_node_ptr;new_node_ptr = (struct node_struc *)malloc(sizeof(NODE_SUM));new_node_ptr->next_ptr    = NULL;new_node_ptr->type_ptr    = NULL;new_node_ptr->count       = 1;new_node_ptr->sys_id      = temp_node_ptr->sys_id;new_node_ptr->sys_type    = temp_node_ptr->sys_type;strncpy(new_node_ptr->node, temp_node_ptr->node, 12);return (new_node_ptr);}/********************************************************************** ************************** ALLOCATE_TYPE ***************************** **********************************************************************/TYPE_SUM_PTR alloc_type(line_ptr)char         *line_ptr;{TYPE_SUM_PTR new_type_ptr;new_type_ptr = (struct type_struc *) malloc(sizeof(TYPE_SUM));new_type_ptr->next_ptr    = NULL;new_type_ptr->item_ptr    = NULL;new_type_ptr->count       = 1;strcpy (new_type_ptr->err_type, line_ptr);return (new_type_ptr);}/********************************************************************** ************************** ALLOCATE_ITEM ***************************** **********************************************************************/ITEM_SUM_PTR alloc_item(line_ptr)char    *line_ptr;{ITEM_SUM_PTR new_item_ptr;new_item_ptr = (struct item_struc *) malloc(sizeof(ITEM_SUM));new_item_ptr->next_ptr    = NULL;new_item_ptr->count       = 1;strcpy (new_item_ptr->values, line_ptr);return (new_item_ptr);}/********************************************************************** **************************** TRANS_ITEM ****************************** **********************************************************************/char *trans_item(ctx_ptr, len)DD$STD_DSD_CTX_PTR ctx_ptr;short   len;{DD$DSP_LABELS_PTR  label_dsd_ptr;#define str_max 20char    *str_ptr;char    str_val[str_max];unsigned long    value;short   i;strncpy(str_val, "                   ", len);str_val[len] = '\0';if ((ctx_ptr->item_VALID_code == DD$N_V$N_A) ||    (ctx_ptr->item_VALID_code == DD$N_A))    return(str_val);label_dsd_ptr = find_label_dsd(ctx_ptr->item_DSD_ptr->LABEL_IX);switch (ctx_ptr->item_DSD_ptr->TYPE)    {    case (DT_SHORT):    case (DT_SHORT_INDEX):        value = *(short *)ctx_ptr->item_ptr;    break;        case (DT_LONG):    case (DT_INDEXED):        value = *(long *)ctx_ptr->item_ptr;    break;    }if (value < 0)    return(str_val);switch (ctx_ptr->item_DSD_ptr->TYPE)    {    case (DT_SHORT_INDEX):    case (DT_INDEXED):        if ((int)(str_ptr = decode_std_item(ctx_ptr, value))                                        != DD$UNKNOWN_CODE)                  {            i = strlen(str_ptr);            i = len - i;            strcpy(str_val+i, str_ptr);            str_val[len] = '\0';            }     break;    case (DT_SHORT):    case (DT_LONG):        switch(label_dsd_ptr->TYPE)            {            case (DF_DEFAULT):            case (DF_DECIMAL):                sprintf(str_val, "%*d", len, value);            break;            case (DF_HEX):                sprintf(str_val, "%*x", len, value);            break;            case (DF_OCTAL):                sprintf(str_val, "%*o", len, value);            break;            }    break;    }str_val[len] = '\0';return (str_val);}/**********************************************************************//***************************  OUTPUT REPORT ***************************//**********************************************************************/long sum_print(out_form)short   out_form;{char                    *label_ptr;ITEM_SUM_PTR            curr_item_ptr;ITEM_SUM_PTR            next_item_ptr;TYPE_SUM_PTR            curr_type_ptr;NODE_SUM_PTR            curr_node_ptr;DD$STD_ITEMS_DSD_PTR    item_dsd_ptr;DD$STD_REGS_DSD_PTR     reg_dsd_ptr;DD$STD_CODES_DSD_PTR    codes_dsd_ptr;curr_node_ptr = first_node_ptr;while (curr_node_ptr != NULL)    {    if (out_form != UE$OUT_TERSE)        {        printf ("\n\n");        printf ("***************************************");        printf ("***************************************");        printf ("\n\n%4d RECORDS SUMMARIZED FOR \"%s\", %s, SYSID = x%8.8X\n",                                curr_node_ptr->count,                                curr_node_ptr->node,                                curr_node_ptr->sys_type,                                curr_node_ptr->sys_id);        }    curr_type_ptr = curr_node_ptr->type_ptr;    while (curr_type_ptr != NULL)        {        if (out_form != UE$OUT_TERSE)            {            printf ("\n%4d  %s\n", curr_type_ptr->count,                                    curr_type_ptr->err_type);            printf ("      %s\n",  curr_type_ptr->labels);            }        curr_item_ptr = curr_type_ptr->item_ptr;        while (curr_item_ptr != NULL)            {            if (out_form != UE$OUT_TERSE)                printf ("%4d  ", curr_item_ptr->count);            else                printf ("%4.4s  ", curr_type_ptr->err_type);            printf ("%s\n", curr_item_ptr->values);            curr_item_ptr = curr_item_ptr->next_ptr;            }        curr_type_ptr = curr_type_ptr->next_ptr;        }    curr_node_ptr = curr_node_ptr->next_ptr;    }if (out_form == UE$OUT_TERSE)    {    if ((curr_node_ptr = first_node_ptr) == NULL)        return;    if ((curr_type_ptr = curr_node_ptr->type_ptr) == NULL)        {        free (curr_node_ptr);        first_node_ptr = NULL;        return;        }    curr_item_ptr = curr_type_ptr->item_ptr;    while (curr_item_ptr != NULL)        {        next_item_ptr = curr_item_ptr->next_ptr;        free (curr_item_ptr);        curr_item_ptr = next_item_ptr;        }    free (curr_type_ptr);    free (curr_node_ptr);    first_node_ptr = NULL;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -