Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #define _CLASS_
  2.  
  3.  
  4.  
  5. #include "tok.h"
  6.  
  7.  
  8.  
  9. structteg *searchteg=NULL;
  10.  
  11. int destructor=FALSE;
  12.  
  13.  
  14.  
  15. void notclassname(char *name)
  16.  
  17. {
  18.  
  19. char buf[90];
  20.  
  21.         sprintf(buf,"'%s' not class name",name);
  22.  
  23.         preerror(buf);
  24.  
  25.         nexttok();      //¯à®¯ã᪠::
  26.  
  27.         nexttok();
  28.  
  29. }
  30.  
  31.  
  32.  
  33. void notclassproc(char *classname, char* procname)
  34.  
  35. {
  36.  
  37. char buf[160];
  38.  
  39.         sprintf(buf,"'%s' not member class '%s'",procname,classname);
  40.  
  41.         preerror(buf);
  42.  
  43. }
  44.  
  45.  
  46.  
  47. void AddThis()
  48.  
  49. {
  50.  
  51.         int lsize=(am32==TRUE?4:2);
  52.  
  53.         localrec *lrec=addlocalvar("this",(am32==TRUE?tk_dwordvar:tk_wordvar),paramsize);
  54.  
  55.         lrec->rec.recsize=lsize;
  56.  
  57.         lrec->rec.type=tp_paramvar;
  58.  
  59.         lrec->fuse=USEDVAR;
  60.  
  61.         paramsize+=lsize;
  62.  
  63. }
  64.  
  65.  
  66.  
  67. void doclassproc(unsigned int tproc)
  68.  
  69. {
  70.  
  71. int type=itok.rm;       //⨯ ¢®§¢à â 
  72.  
  73. unsigned int flag=itok.flag;
  74.  
  75. unsigned int npointr=itok.npointr;
  76.  
  77. char classname[IDLENGTH];
  78.  
  79.         if((searchteg=FindTeg(TRUE,itok.name))!=NULL){
  80.  
  81.                 strcpy(classname,itok.name);
  82.  
  83.                 nexttok();      //¯à®¯ã᪠::
  84.  
  85.                 if(tok2==tk_tilda){
  86.  
  87.                         nexttok();
  88.  
  89.                         destructor=TRUE;
  90.  
  91.                         flag|=fs_destructor;
  92.  
  93.                         type=tk_void;
  94.  
  95.                 }
  96.  
  97.                 nexttok();
  98.  
  99.                 char *tn;
  100.  
  101.                 char name[IDLENGTH];
  102.  
  103.                 strcpy(name,itok.name);
  104.  
  105.                 if((tn=strchr(name,'@'))!=NULL)*tn=0;
  106.  
  107.  
  108.  
  109.                 if(strcmp(classname,name)==0&&(flag&fs_destructor)==0)flag|=fs_constructor;
  110.  
  111.                 if((tok!=tk_declare&&tok!=tk_undefproc)||(itok.flag&f_classproc)==0){
  112.  
  113.                         notclassproc(classname,name);
  114.  
  115.                         searchteg=NULL;
  116.  
  117.                         define_procedure();
  118.  
  119.                         return;
  120.  
  121.                 }
  122.  
  123.                 if(tproc==0){
  124.  
  125.                         if(CidOrID()==tk_ID)tproc=tk_fastcall;
  126.  
  127.                         else tproc=(comfile==file_w32?tk_stdcall:tk_pascal);
  128.  
  129.                 }
  130.  
  131.                 flag|=(tproc-tk_pascal)*2;
  132.  
  133.                 if(type==tokens)type=am32==FALSE?tk_word:tk_dword;
  134.  
  135.                 if(flag!=itok.flag||type!=itok.rm||(unsigned short)npointr!=itok.npointr){
  136.  
  137. //              printf("flag %08X - %08X\n",flag,itok.flag);
  138.  
  139. //              printf("type %u - %u\n",type,itok.rm);
  140.  
  141.                         redeclare(name);
  142.  
  143.                 }
  144.  
  145.                 if(dynamic_flag){
  146.  
  147.                         dynamic_proc();
  148.  
  149.                         searchteg=NULL;
  150.  
  151.                         return;
  152.  
  153.                 }
  154.  
  155. //              if(itok.flag&f_static)searchteg=NULL;
  156.  
  157.                 if(AlignProc!=FALSE)AlignCD(CS,alignproc);
  158.  
  159.                 if(dbg)AddLine();
  160.  
  161.                 setproc(1);
  162.  
  163.         }
  164.  
  165.         else{
  166.  
  167.                 notclassname(itok.name);
  168.  
  169.                 setproc(0);
  170.  
  171.         }
  172.  
  173.         dopoststrings();
  174.  
  175. }
  176.  
  177.