TEACL is a fork of TECOC created for the purpose of describing diffs in a document being collaboratively edited
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.6 KiB

  1. /*****************************************************************************
  2. DoFlag()
  3. This function gets or sets the value of a TECO mode control flag.
  4. The TECO mode control flags are ED, EH, ES, ET, EU, EV, EZ and ^X.
  5. The EO flag can only be examined, not set, so ExeEO does not call this
  6. function.
  7. *****************************************************************************/
  8. #include "zport.h" /* define portability identifiers */
  9. #include "tecoc.h" /* define general identifiers */
  10. #include "defext.h" /* define external global variables */
  11. DEFAULT DoFlag(Flag) /* handle a mode control flag */
  12. WORD *Flag;
  13. {
  14. DBGFEN(2,"DoFlag",NULL);
  15. if ((EStTop == EStBot) || /* if no numeric arg or */
  16. (EStack[EStTop].ElType != OPERAND)) { /* partial expression */
  17. DBGFEX(2,DbgFNm,"PushEx");
  18. return PushEx((LONG)*Flag, OPERAND); /* return the flag */
  19. }
  20. if (GetNmA() == FAILURE) { /* get the numeric argument */
  21. DBGFEX(2,DbgFNm,"FAILURE, GetNmA() failed");
  22. return FAILURE;
  23. }
  24. if ((CmdMod & MARGIS) == '\0') { /* if it's n<flag> */
  25. *Flag = (WORD)NArgmt; /* set the flag to n */
  26. } else if (MArgmt && NArgmt) { /* else if it's m,n<flag> */
  27. *Flag &= (WORD)~MArgmt; /* turn off m bits */
  28. *Flag |= (WORD)NArgmt; /* turn on n bits */
  29. } else if ((MArgmt == 0) && NArgmt) { /* else if it's 0,n<flag> */
  30. *Flag |= (WORD)NArgmt; /* turn on n bits */
  31. } else if ((MArgmt) && (NArgmt == 0)) { /* else if it's m,0<flag> */
  32. *Flag &= (WORD)~MArgmt; /* turn off m bits */
  33. }
  34. EStTop = EStBot; /* clear expression stack */
  35. CmdMod = '\0'; /* clear modifiers flags */
  36. DBGFEX(2,DbgFNm,"SUCCESS");
  37. return SUCCESS;
  38. }