HEX
Server: Apache
System: Linux dinesh8149 5.15.98-grsec-sharedvalley-2.lc.el8.x86_64 #1 SMP Thu Mar 9 09:07:30 -03 2023 x86_64
User: usesambura1 (1212012)
PHP: 7.0.33
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: //usr/share/graphviz/gvpr/scalexy
/* finds root node of graph.
 * scales the x and y position of all other nodes using, first,
 * ARGV[0], or $G.scale.
 * 
 * The expected syntax is "x,y" where at least one of x or y must
 * be given. If only one is given, the other is taken as 1.
 */
BEGIN {
  double scalex, scaley;
  int r, done;

  int setScale (char* s) 
  {
    if ((sscanf (s, ",%f",&scaley))) {
        scalex = 1;
        return 1;
    }
    else {
      r = sscanf (s, "%f,%f",&scalex,&scaley);
      if (r) {
        if (r == 1) scaley = 1;
        return 1;
      }
    }
    return 0;
  }

}

BEG_G {
  node_t ctr = node($,aget($,"root"));
  double cx, cy, x, y, delx;
  
  /* get scale argument */
  done = 0;
  if (ARGC == 1)
    done = setScale (ARGV[0]);
  if (!done && isAttr($,"G","scale"))
    done = setScale ($.scale);
  if (!done)
    scalex = scaley = 1.0;

  if ((scalex == 1.0) && (scaley == 1.0))
    exit (0);

  $.bb = "";
  sscanf (ctr.pos, "%f,%f", &cx, &cy);
}
N [$ != ctr] {
    sscanf ($.pos, "%f,%f", &x, &y);
    delx = scalex*(x - cx) + cx;
    dely = scaley*(y - cy) + cy;
    $.pos = sprintf ("%f,%f", delx, dely);
}