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

📄 deftab.c

📁 这是一个Linux下的集成开发环境
💻 C
📖 第 1 页 / 共 2 页
字号:
   tpdecl decl = search_next (Attribute.name.Ident, decls);   if (decl) {      field [field_ptr = 1] = cpl_use [cpl_use_ptr = 1] = decl;   } else {      decl = search_all (Attribute.name.Ident, decls, 1);      if (decl) {	 field [field_ptr = 1] = decl;      } else {	 int PrevSection = Section;	 Section = cWS_SCT;	 field [field_ptr = 1] =	 cpl_use [cpl_use_ptr = 1] = Declare (1, Attribute, oDATA, Attribute.name.EPos);	 Section = PrevSection;	 if (NameCheck) {	    MessageI ("name not declared", xxError, Attribute.Position, xxIdent, (char *) & Attribute.name.Ident);	    error_count ++;	 }      }   }   if (cross_ref_fp) {      if (cpl_use_ptr == 1) {	 put_cross_ref (PAF_REF_TO_GLOB_VAR, PAF_FUNC_DEF, PAF_REF_SCOPE_GLOBAL,	    null, current_subr, null, null, GetCStr (Attribute.name.Ident),	    null, current_file, (int) Attribute.Position.Line, acc);      } else {	 ref_class = GetCStr (cpl_use [cpl_use_ptr - 1]->name);	 if (ref_class [0] == '\0') ref_class = "FILLER";	 put_cross_ref (PAF_REF_TO_MBR_VAR, PAF_FUNC_DEF, PAF_REF_SCOPE_GLOBAL,	    null, current_subr, null, ref_class, GetCStr (Attribute.name.Ident),	    null, current_file, (int) Attribute.Position.Line, acc);      }   }   return decl;}tpdecl UseField#if defined __STDC__ | defined __cplusplus   (tScanAttribute Attribute, tpdecl decls)#else   (Attribute, decls) tScanAttribute Attribute; tpdecl decls;#endif{   tpdecl decl = search_next (Attribute.name.Ident, decls);   if (decl) {      field [++ field_ptr] = cpl_use [++ cpl_use_ptr] = decl;   } else {      decl = search_all (Attribute.name.Ident, decls, cpl_use_ptr + 1);      if (decl) {	 field [++ field_ptr] = decl;      } else {	 if (NameCheck) {	    MessageI ("field not declared", xxError, Attribute.Position, xxIdent, (char *) & Attribute.name.Ident);	    error_count ++;	 }      }   }   if (cross_ref_fp) {      if (cpl_use_ptr == 1) {	 put_cross_ref (PAF_REF_TO_MBR_VAR, PAF_FUNC_DEF, PAF_REF_SCOPE_GLOBAL,	    null, current_subr, null, null, GetCStr (Attribute.name.Ident),	    null, current_file, (int) Attribute.Position.Line, acc);      } else {	 ref_class = GetCStr (cpl_use [cpl_use_ptr - 1]->name);	 if (ref_class [0] == '\0') ref_class = "FILLER";	 put_cross_ref (PAF_REF_TO_MBR_VAR, PAF_FUNC_DEF, PAF_REF_SCOPE_GLOBAL,	    null, current_subr, null, ref_class, GetCStr (Attribute.name.Ident),	    null, current_file, (int) Attribute.Position.Line, acc);      }   }   return decl;}void UseForward#if defined __STDC__ | defined __cplusplus   (tScanAttribute Attribute)#else   (Attribute) tScanAttribute Attribute;#endif{   register tpuse use	= (tpuse) Alloc ((unsigned long) sizeof (tuse));   use->name		= Attribute.name.Ident;   use->position	= Attribute.Position;   use->end_pos		= Attribute.name.EPos;   use->next		= forwards;   use->fields		= NULL;   use->section		= Section;   forwards		= use;}void UseFieldForward#if defined __STDC__ | defined __cplusplus   (tScanAttribute Attribute)#else   (Attribute) tScanAttribute Attribute;#endif{   register tpuse p, use = (tpuse) Alloc ((unsigned long) sizeof (tuse));   use->name		= Attribute.name.Ident;   use->position	= Attribute.Position;   use->end_pos		= Attribute.name.EPos;   use->next		= NULL;   use->fields		= NULL;   use->section		= Section;   forwards->position	= Attribute.Position;   for (p = forwards; p->fields != NULL; p = p->fields);   p->fields		= use;}void UseLabel#if defined __STDC__ | defined __cplusplus   (tScanAttribute Attribute)#else   (Attribute) tScanAttribute Attribute;#endif{   register tplabel label = (tplabel) Alloc ((unsigned long) sizeof (tlabel));   label->name		= Attribute.name.Ident;   label->name2		= NoIdent;   label->scope		= sections;   label->position	= Attribute.Position;   label->end_pos	= Attribute.name.EPos;   label->next		= labels;   labels		= label;   if (cross_ref_fp) {      put_cross_ref (PAF_REF_TO_FUNCTION, PAF_FUNC_DEF, PAF_REF_SCOPE_GLOBAL,	 null, current_subr, null, null, GetCStr (Attribute.name.Ident),	 null, current_file, (int) Attribute.Position.Line, acc);   }}void UseLabel2#if defined __STDC__ | defined __cplusplus   (tScanAttribute Attribute, tScanAttribute Attribute2)#else   (Attribute, Attribute2) tScanAttribute Attribute; tScanAttribute Attribute2;#endif{   UseLabel (Attribute);   labels->name2 = Attribute2.name.Ident;   if (cross_ref_fp) {      put_cross_ref (PAF_REF_TO_FUNCTION, PAF_FUNC_DEF, PAF_REF_SCOPE_GLOBAL,	 null, current_subr, null, null, GetCStr (Attribute2.name.Ident),	 null, current_file, (int) Attribute2.Position.Line, acc);   }}void UseLabelExtern#if defined __STDC__ | defined __cplusplus   (tScanAttribute Attribute)#else   (Attribute) tScanAttribute Attribute;#endif{   if (cross_ref_fp) {      put_cross_ref (PAF_REF_TO_FUNCTION, PAF_FUNC_DEF, PAF_REF_SCOPE_GLOBAL,	 null, current_subr, null, null, GetCStr (Attribute.name.Ident),	 null, current_file, (int) Attribute.Position.Line, acc);   }}tpdecl search_next_label#if defined __STDC__ | defined __cplusplus   (register tIdent name, register tpdecl decls)#else   (name, decls) register tIdent name; register tpdecl decls;#endif{   while (decls) if (decls->name == name) return decls; else decls = decls->next;   return NULL;}tpdecl search_all_label#if defined __STDC__ | defined __cplusplus   (register tIdent name, register tpdecl decls)#else   (name, decls) register tIdent name; register tpdecl decls;#endif{   register tpdecl decl;   while (decls) {      if (decls->name == name) return decls;      decl = search_next_label (name, decls->fields);      if (decl) return decl;      decls = decls->next;   }   return NULL;}void CloseLabels ARGS ((void)){   tplabel label = labels;   register tpdecl decl, decl2;   if (! NameCheck) return;   while (label) {      if (label->name2 == NoIdent) {	 decl = search_next_label (label->name, label->scope);	 if (! decl) decl = search_all_label (label->name, sections);	 if (decl) {	    field_ptr = 1;	    field [1] = decl;	    if (decl->level == lPARAGRPH && decl->fields != NULL) {	       cpl_use_ptr = 2;	       cpl_use [1] = decl->fields;	       cpl_use [2] = decl;	    } else {	       cpl_use_ptr = 1;	       cpl_use [1] = decl;	    }	 } else {	    MessageI ("label not declared", xxError, label->position, xxIdent, (char *) & label->name);	    error_count ++;	 }      } else {	 decl = search_next_label (label->name2, sections);	 if (decl && decl->level == lSECTION) {	    decl2 = search_next_label (label->name, decl->fields);	    if (decl2) {	       field_ptr = cpl_use_ptr = 2;	       field [1] = cpl_use [1] = decl;	       field [2] = cpl_use [2] = decl2;	    } else {	       MessageI ("paragraph not declared", xxError, label->position, xxIdent, (char *) & label->name);	       error_count ++;	    }	 } else {	    MessageI ("section not declared", xxError, label->position, xxIdent, (char *) & label->name2);	    error_count ++;	 }      }      label = label->next;   }}void CloseDeftab ARGS ((void)){   CloseForwards	();   CloseLabels		();   /* WriteDeftab	(); */}static void ReleaseDecls#if defined __STDC__ | defined __cplusplus   (register tpdecl decls)#else   (decls) register tpdecl decls;#endif{   while (decls) {      tpdecl next = decls->next;      ReleaseDecls (decls->fields);      Free ((unsigned long) sizeof (tdecl), (char *) decls);      decls = next;   }}static void ReleaseForwards#if defined __STDC__ | defined __cplusplus   (register tpuse forwards)#else   (forwards) register tpuse forwards;#endif{   while (forwards) {      tpuse next = forwards->next;      ReleaseForwards (forwards->fields);      Free ((unsigned long) sizeof (tuse), (char *) forwards);      forwards = next;   }}static void ReleaseSections#if defined __STDC__ | defined __cplusplus   (register tpdecl sections, int k)#else   (sections, k) register tpdecl sections; int k;#endif{   while (sections) {      tpdecl next = sections->next;      if (k == 0) ReleaseSections (sections->fields, 1);      Free ((unsigned long) sizeof (tdecl), (char *) sections);      sections = next;   }}static void ReleaseLabels#if defined __STDC__ | defined __cplusplus   (register tplabel labels)#else   (labels) register tplabel labels;#endif{   while (labels) {      tplabel next = labels->next;      Free ((unsigned long) sizeof (tlabel), (char *) labels);      labels = next;   }}void ReleaseDeftab ARGS ((void)){   ReleaseForwards	(forwards);   ReleaseSections	(sections, 0);   ReleaseLabels	(labels);   ReleaseDecls		(decls);}static void GetEPos#if defined __STDC__ | defined __cplusplus   (register tpdecl decls, tPosition * e_pos)#else   (decls, e_pos) register tpdecl decls; tPosition * e_pos;#endif{	if (decls->next  ) GetEPos (decls->next  , e_pos);   else if (decls->fields) GetEPos (decls->fields, e_pos);   else * e_pos = decls->e_pos;}static void PutDecls#if defined __STDC__ | defined __cplusplus   (register tpdecl decls, int k)#else   (decls, k) register tpdecl decls; int k;#endif{   for (; decls; decls = decls->next) {      if (decls->name != NoIdent) {	 current_ident = GetCStr (decls->name);	 if (decls->level == 78 || decls->level == 88) {	    /* constant */	    put_symbol (PAF_CONS_DEF, null, current_ident, current_file,	       (int) decls->position.Line, (int) decls->position.Column - 1,	       (int) decls->end_pos.Line, (int) decls->end_pos.Column,	       attr, null, null, null, null, 0, 0, 0, 0);	 } else {	    if (k == 0) {	       /* variable declared on outer level */	       	       put_symbol (PAF_GLOB_VAR_DEF, null, current_ident, current_file,		  (int) decls->position.Line, (int) decls->position.Column - 1,		  (int) decls->end_pos.Line, (int) decls->end_pos.Column,		  attr, null, null, null, null, 0, 0, 0, 0);	    } else {	       /* variable declared on inner level */		  	       current_class = GetCStr (stack_2 [k - 1]->name);	       if (current_class [0] == '\0') current_class = "FILLER";	       put_symbol (PAF_MBR_VAR_DEF, current_class, current_ident, current_file,		  (int) decls->position.Line, (int) decls->position.Column - 1,		  (int) decls->end_pos.Line, (int) decls->end_pos.Column,		  attr, null, null, null, null, 0, 0, 0, 0);	    }	    if (decls->fields) {	       /* variable has members */		  	       tPosition e_pos; GetEPos (decls->fields, & e_pos);	   /* was PAF_STRUCT_DEF, does not work any more because of new paf.h */	       put_symbol (PAF_CLASS_DEF, null, current_ident, current_file,		  (int) decls->position.Line, (int) decls->position.Column - 1,		  (int) e_pos.Line, (int) e_pos.Column,		  attr | PAF_STRUCT_DEF, null, null, null, null, 0, 0, 0, 0);	       stack_2 [k] = decls;	       PutDecls (decls->fields, k + 1);	    } else {	       /* variable has no members */		  	    }	 }      } else {						/* FILLER */	 if (decls->level == 78 || decls->level == 88) {	    /* constant */	 } else {	    if (decls->fields) {	       /* FILLER has members */		  	       stack_2 [k] = decls;	       PutDecls (decls->fields, k + 1);	    }	 }      }   }}static void PutSections#if defined __STDC__ | defined __cplusplus   (register tpdecl sections, int k)#else   (sections, k) register tpdecl sections; int k;#endif{   for (; sections; sections = sections->next) {      current_ident = GetCStr (sections->name);      put_symbol (PAF_FUNC_DEF, null, current_ident, current_file,	 (int) sections->position.Line, (int) sections->position.Column - 1,	 (int) sections->e_pos.Line, (int) sections->e_pos.Column,	 attr, null, null, null, null, 0, 0, 0, 0);   /* put_symbol (PAF_FUNC_DCL, null, current_ident, current_file,	 (int) sections->position.Line, (int) sections->position.Column - 1,	 (int) sections->e_pos.Line, (int) sections->e_pos.Column,	 attr, null, null, null, null, 0, 0, 0, 0);   */   /* put_symbol (PAF_SUBR_DEF, null, current_ident, current_file,	 (int) sections->position.Line, (int) sections->position.Column - 1,	 (int) sections->e_pos.Line, (int) sections->e_pos.Column,	 attr, null, null, null, null, 0, 0, 0, 0);   */      if (k == 0) PutSections (sections->fields, 1);   }}void PutDeftab ARGS ((void)){   PutSections	(sections, 0);   PutDecls	(decls, 0);}

⌨️ 快捷键说明

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