您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ stgwrite函数代码示例

51自学网 2021-06-03 08:23:44
  C++
这篇教程C++ stgwrite函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中stgwrite函数的典型用法代码示例。如果您正苦于以下问题:C++ stgwrite函数的具体用法?C++ stgwrite怎么用?C++ stgwrite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了stgwrite函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: os_mod

/* *  modulus of (alternate % primary), result in primary (signed) */SC_FUNC void os_mod(void){  stgwrite("/tsdiv.alt/n");  stgwrite("/tmove.pri/n");     /* move ALT to PRI */  code_idx+=opcodes(2);}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:9,


示例2: os_ge

/* *  test ALT>=PRI (signed) */SC_FUNC void os_ge(void){  stgwrite("/txchg/n");  stgwrite("/tsgeq/n");  code_idx+=opcodes(2);}
开发者ID:jte,项目名称:pawn,代码行数:9,


示例3: invert

/* *  one's complement of primary register */SC_FUNC void invert(void){  stgwrite("/tinvert/n");  code_idx+=opcodes(1);}
开发者ID:jte,项目名称:pawn,代码行数:8,


示例4: ob_and

/* *  "and" of primary and secundairy registers (result in primary) */SC_FUNC void ob_and(void){  stgwrite("/tand/n");  code_idx+=opcodes(1);}
开发者ID:jte,项目名称:pawn,代码行数:8,


示例5: relop_prefix

/* Relational operator prefix for chained relational expressions. The * "suffix" code restores the stack. * For chained relational operators, the goal is to keep the comparison * result "so far" in PRI and the value of the most recent operand in * ALT, ready for a next comparison. * The "prefix" instruction pushed the comparison result (PRI) onto the * stack and moves the value of ALT into PRI. If there is a next comparison, * PRI can now serve as the "left" operand of the relational operator. */SC_FUNC void relop_prefix(void){  stgwrite("/tpush.pri/n");  stgwrite("/tmove.pri/n");  code_idx+=opcodes(2);}
开发者ID:jte,项目名称:pawn,代码行数:15,


示例6: ob_sub

/* *  subtract primary register from alternate register (result in primary) */SC_FUNC void ob_sub(void){  stgwrite("/tsub.alt/n");  code_idx+=opcodes(1);}
开发者ID:jte,项目名称:pawn,代码行数:8,


示例7: ou_sar

/* *  logical (unsigned) shift right of the alternate register by the *  number of bits given in the primary register (result in primary). */SC_FUNC void ou_sar(void){  stgwrite("/txchg/n");  stgwrite("/tshr/n");  code_idx+=opcodes(2);}
开发者ID:jte,项目名称:pawn,代码行数:10,


示例8: stradjust

SC_FUNC void stradjust(regid reg){  assert(reg==sPRI);  stgwrite("/tstradjust.pri/n");  code_idx+=opcodes(1);}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:6,


示例9: moveto1

/* Copy value in alternate register to the primary register */SC_FUNC void moveto1(void){  stgwrite("/tmove.pri/n");  code_idx+=opcodes(1)+opargs(0);}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:6,


示例10: endfunc

/*  endfunc * *  Declare a CODE ending point (function end) */SC_FUNC void endfunc(void){  stgwrite("/n");       /* skip a line */}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:8,


示例11: writeleader

/* When a subroutine returns to address 0, the AMX must halt. In earlier * releases, the RET and RETN opcodes checked for the special case 0 address. * Today, the compiler simply generates a HALT instruction at address 0. So * a subroutine can savely return to 0, and then encounter a HALT. */SC_FUNC void writeleader(symbol *root){  int lbl_nostate,lbl_table;  int statecount;  symbol *sym;  constvalue *fsa, *state, *stlist;  int fsa_id,listid;  char lbl_default[sNAMEMAX+1];  assert(code_idx==0);  begcseg();  stgwrite(";program exit point/n");  stgwrite("/thalt 0/n/n");  code_idx+=opcodes(1)+opargs(1);       /* calculate code length */  /* check whether there are any functions that have states */  for (sym=root->next; sym!=NULL; sym=sym->next)    if (sym->ident==iFUNCTN && (sym->usage & (uPUBLIC | uREAD))!=0 && sym->states!=NULL)      break;  if (sym==NULL)    return;             /* no function has states, nothing to do next */  /* generate an error function that is called for an undefined state */  stgwrite("/n;exit point for functions called from the wrong state/n");  lbl_nostate=getlabel();  setlabel(lbl_nostate);  stgwrite("/thalt ");  outval(AMX_ERR_INVSTATE,TRUE);  code_idx+=opcodes(1)+opargs(1);       /* calculate code length */  /* write the "state-selectors" table with all automatons (update the   * automatons structure too, as we are now assigning the address to   * each automaton state-selector variable)   */  assert(glb_declared==0);  begdseg();  for (fsa=sc_automaton_tab.next; fsa!=NULL; fsa=fsa->next) {    defstorage();    stgwrite("0/t; automaton ");    if (strlen(fsa->name)==0)      stgwrite("(anonymous)");    else      stgwrite(fsa->name);    stgwrite("/n");    fsa->value=glb_declared*sizeof(cell);    glb_declared++;  } /* for */  /* write stubs and jump tables for all state functions */  begcseg();  for (sym=root->next; sym!=NULL; sym=sym->next) {    if (sym->ident==iFUNCTN && (sym->usage & (uPUBLIC | uREAD))!=0 && sym->states!=NULL) {      stlist=sym->states->next;      assert(stlist!=NULL);     /* there should be at least one state item */      listid=stlist->index;      assert(listid==-1 || listid>0);      if (listid==-1 && stlist->next!=NULL) {        /* first index is the "fallback", take the next one (if available) */        stlist=stlist->next;        listid=stlist->index;      } /* if */      if (listid==-1) {        /* first index is the fallback, there is no second... */        strcpy(stlist->name,"0"); /* insert dummy label number */        /* this is an error, but we postpone adding the error message until the         * function definition         */        continue;      } /* if */      /* generate label numbers for all statelist ids */      for (stlist=sym->states->next; stlist!=NULL; stlist=stlist->next) {        assert(strlen(stlist->name)==0);        strcpy(stlist->name,itoh(getlabel()));      } /* for */      if (strcmp(sym->name,uENTRYFUNC)==0)        continue;               /* do not generate stubs for this special function */      sym->addr=code_idx;       /* fix the function address now */      /* get automaton id for this function */      assert(listid>0);      fsa_id=state_getfsa(listid);      assert(fsa_id>=0);        /* automaton 0 exists */      fsa=automaton_findid(fsa_id);      /* count the number of states actually used; at the sane time, check       * whether there is a default state function       */      statecount=0;      strcpy(lbl_default,itoh(lbl_nostate));      for (stlist=sym->states->next; stlist!=NULL; stlist=stlist->next) {        if (stlist->index==-1) {          assert(strlen(stlist->name)<sizeof lbl_default);          strcpy(lbl_default,stlist->name);        } else {          statecount+=state_count(stlist->index);        } /* if *///.........这里部分代码省略.........
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:101,


示例12: outval

/* write a value in hexadecimal; optionally adds a newline */SC_FUNC void outval(cell val,int newline){  stgwrite(itoh(val));  if (newline)    stgwrite("/n");}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:7,


示例13: jmp_eq0

/* *  Jumps to "label" if PRI == 0 */SC_FUNC void jmp_eq0(int number){  stgwrite("/tjzer ");  outval(number,TRUE);  code_idx+=opcodes(1)+opargs(1);}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:9,


示例14: dec

/*  decrement symbol * *  in case of an integer pointer, the symbol must be incremented by 2. */SC_FUNC void dec(value *lval){  symbol *sym;  sym=lval->sym;  if (lval->ident==iARRAYCELL) {    /* indirect decrement, address already in PRI */    stgwrite("/tdec.i/n");    code_idx+=opcodes(1);  } else if (lval->ident==iARRAYCHAR) {    /* indirect decrement of single character, address already in PRI */    stgwrite("/tpush.pri/n");    stgwrite("/tpush.alt/n");    stgwrite("/tmove.alt/n");   /* copy address */    stgwrite("/tlodb.i ");      /* read from PRI into PRI */    outval(sCHARBITS/8,TRUE);   /* read one or two bytes */    stgwrite("/tdec.pri/n");    stgwrite("/tstrb.i ");      /* write PRI to ALT */    outval(sCHARBITS/8,TRUE);   /* write one or two bytes */    stgwrite("/tpop.alt/n");    stgwrite("/tpop.pri/n");    code_idx+=opcodes(8)+opargs(2);  } else if (lval->ident==iREFERENCE) {    assert(sym!=NULL);    stgwrite("/tpush.pri/n");    /* load dereferenced value */    assert(sym->vclass==sLOCAL);    /* global references don't exist in Pawn */    if (sym->vclass==sLOCAL)      stgwrite("/tlref.s.pri ");    else      stgwrite("/tlref.pri ");    outval(sym->addr,TRUE);    /* decrement */    stgwrite("/tdec.pri/n");    /* store dereferenced value */    if (sym->vclass==sLOCAL)      stgwrite("/tsref.s.pri ");    else      stgwrite("/tsref.pri ");    outval(sym->addr,TRUE);    stgwrite("/tpop.pri/n");    code_idx+=opcodes(5)+opargs(2);  } else {    /* local or global variable */    assert(sym!=NULL);    if (sym->vclass==sLOCAL)      stgwrite("/tdec.s ");    else      stgwrite("/tdec ");    outval(sym->addr,TRUE);    code_idx+=opcodes(1)+opargs(1);  } /* if */}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:57,


示例15: modheap_i

SC_FUNC void modheap_i(){  stgwrite("/ttracker.pop.setheap/n");  code_idx+=opcodes(1);}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:5,


示例16: pushval

/* *  Push a constant value onto the stack */SC_FUNC void pushval(cell val){  stgwrite("/tpush.c ");  outval(val, TRUE);  code_idx+=opcodes(1)+opargs(1);}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:9,


示例17: setactivefile

voidsetactivefile(int fnum){    stgwrite("curfile ");    outval(fnum, TRUE);}
开发者ID:tguillem,项目名称:efl,代码行数:6,


示例18: swap1

/* *  swap the top-of-stack with the value in primary register */SC_FUNC void swap1(void){  stgwrite("/tswap.pri/n");  code_idx+=opcodes(1);}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:8,


示例19: ob_sal

/* *  arithmic shift left alternate register the number of bits *  given in the primary register (result in primary). *  There is no need for a "logical shift left" routine, since *  logical shift left is identical to arithmic shift left. */SC_FUNC void ob_sal(void){  stgwrite("/txchg/n");  stgwrite("/tshl/n");  code_idx+=opcodes(2);}
开发者ID:jte,项目名称:pawn,代码行数:12,


示例20: ffswitch

/* Switch statements * The "switch" statement generates a "case" table using the "CASE" opcode. * The case table contains a list of records, each record holds a comparison * value and a label to branch to on a match. The very first record is an * exception: it holds the size of the table (excluding the first record) and * the label to branch to when none of the values in the case table match. * The case table is sorted on the comparison value. This allows more advanced * abstract machines to sift the case table with a binary search. */SC_FUNC void ffswitch(int label){  stgwrite("/tswitch ");  outval(label,TRUE);           /* the label is the address of the case table */  code_idx+=opcodes(1)+opargs(1);}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:15,


示例21: ob_xor

/* *  "exclusive or" of primary and alternate registers (result in primary) */SC_FUNC void ob_xor(void){  stgwrite("/txor/n");  code_idx+=opcodes(1);}
开发者ID:jte,项目名称:pawn,代码行数:8,


示例22: ffcall

/* *  Call specified function */SC_FUNC void ffcall(symbol *sym,const char *label,int numargs){  char symname[2*sNAMEMAX+16];  char aliasname[sNAMEMAX+1];  int wasAlias = 0;  assert(sym!=NULL);  assert(sym->ident==iFUNCTN);  if (sc_asmfile)    funcdisplayname(symname,sym->name);  if ((sym->usage & uNATIVE)!=0) {    /* reserve a SYSREQ id if called for the first time */    assert(label==NULL);    stgwrite("/tsysreq.c ");    if (sc_status==statWRITE && (sym->usage & uREAD)==0 && sym->addr>=0)      sym->addr=ntv_funcid++;    /* Look for an alias */    if (lookup_alias(aliasname, sym->name)) {      symbol *asym = findglb(aliasname, sGLOBAL);      if (asym && asym->ident==iFUNCTN && ((sym->usage & uNATIVE) != 0)) {        sym = asym;        if (sc_status==statWRITE && (sym->usage & uREAD)==0 && sym->addr>=0) {          sym->addr=ntv_funcid++;          markusage(sym, uREAD);        }      }    }    outval(sym->addr,FALSE);    if (sc_asmfile) {      stgwrite("/t; ");      stgwrite(symname);    } /* if */    stgwrite("/n"); /* write on a separate line, to mark a sequence point for the peephole optimizer */    stgwrite("/tstack ");    outval((numargs+1)*sizeof(cell), TRUE);    code_idx+=opcodes(2)+opargs(2);  } else {    /* normal function */    stgwrite("/tcall ");    if (label!=NULL) {      stgwrite("l.");      stgwrite(label);    } else {      stgwrite(sym->name);    } /* if */    if (sc_asmfile        && (label!=NULL || (!isalpha(sym->name[0]) && sym->name[0]!='_'  && sym->name[0]!=sc_ctrlchar)))    {      stgwrite("/t; ");      stgwrite(symname);    } /* if */    stgwrite("/n");    code_idx+=opcodes(1)+opargs(1);  } /* if */}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:58,


示例23: ob_ne

/* *  test ALT!=PRI */SC_FUNC void ob_ne(void){  stgwrite("/tneq/n");  code_idx+=opcodes(1);}
开发者ID:jte,项目名称:pawn,代码行数:8,


示例24: ffabort

SC_FUNC void ffabort(int reason){  stgwrite("/thalt ");  outval(reason,TRUE);  code_idx+=opcodes(1)+opargs(1);}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:6,


示例25: os_lt

/* *  test ALT<PRI (signed) */SC_FUNC void os_lt(void){  stgwrite("/txchg/n");  stgwrite("/tsless/n");  code_idx+=opcodes(2);}
开发者ID:jte,项目名称:pawn,代码行数:9,


示例26: jumplabel

/* *  Jump to local label number (the number is converted to a name) */SC_FUNC void jumplabel(int number){  stgwrite("/tjump ");  outval(number,TRUE);  code_idx+=opcodes(1)+opargs(1);}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:9,


示例27: neg

/* *  two's complement primary register */SC_FUNC void neg(void){  stgwrite("/tneg/n");  code_idx+=opcodes(1);}
开发者ID:jte,项目名称:pawn,代码行数:8,


示例28: defstorage

/* *   Define storage (global and static variables) */SC_FUNC void defstorage(void){  stgwrite("dump ");}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:7,


示例29: nooperation

/* *  nop */SC_FUNC void nooperation(void){  stgwrite("/tnop/n");  code_idx+=opcodes(1);}
开发者ID:jte,项目名称:pawn,代码行数:8,


示例30: os_div

/* *  signed divide of alternate register by primary register (quotient in *  primary; remainder in alternate) */SC_FUNC void os_div(void){  stgwrite("/tsdiv.alt/n");  code_idx+=opcodes(1);}
开发者ID:KyleSanderson,项目名称:SourceMod,代码行数:9,



注:本文中的stgwrite函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ sthread_create函数代码示例
C++ stgMallocBytes函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。