コード例 #1
0
  void MesherFixedEvenStem::calcIndices(otTriangles* triangles)
  {
    if (circleRes <= 2) circleRes = 3;
    if (curveRes <= 0) curveRes = 1;

    getCap(triangles, false);
    for (int j = -1; j<curveRes+1; j++)
    {
      getSide(j, j+1, triangles);
    }
    getCap(triangles, true);
  }
コード例 #2
0
  void MesherFixedEvenStem::calcVertices(otVertices* vertices)
  {
    if (circleRes <= 2) circleRes = 3;
    if (curveRes <= 0) curveRes = 1;

    vertexOffset = vertices->getCount();

    getCap(vertices, false);
    for (int j = 0; j<=curveRes; j++)
    {
      getCircle(j, vertices);
    }
    getCap(vertices, true);
  }
コード例 #3
0
ファイル: reducecap.c プロジェクト: AlexanderS/util-vserver
int main (int argc, char *argv[])
{
  uint32_t		remove  = 0;
  bool			do_show = false;
  uint32_t		flags   = 0;
  pid_t			pid     = 0;
#ifdef VC_ENABLE_API_LEGACY
  bool			show_obsolete_warning = true;
#endif    

  while (1) {
    int		c = getopt_long(argc, argv, "+", CMDLINE_OPTIONS, 0);
    if (c==-1) break;

#ifdef VC_ENABLE_API_LEGACY
    if (c>=CMD_OBSOLETE_CHOWN && c<=CMD_OBSOLETE_X_QUOTACTL) {
      if (show_obsolete_warning) {
	WRITE_MSG(2, "reducecap: warning, obsolete CLI used\n");
	show_obsolete_warning = false;
      }

      remove = getCap(OBSOLETE_MAPPING[c-CMD_OBSOLETE_CHOWN]);
      continue;
    }
#endif    
    switch (c) {
      case CMD_HELP		:  showHelp(1, argv[0], 0);
      case CMD_VERSION		:  showVersion();
      case CMD_SHOW		:  do_show = true;  break; 
      case CMD_PID		:  pid     = atoi(optarg);   break;
#if defined(VC_ENABLE_API_COMPAT) || defined(VC_ENABLE_API_LEGACY)
      case CMD_SECURE		:  remove  = vc_get_insecurebcaps(); break;
      case CMD_CAP		:  remove  = getCap(optarg); break;
      case CMD_FLAG		: {
	struct vc_err_listparser	err;
	
	flags = vc_list2cflag_compat(optarg, 0, &err);
	if (err.ptr!=0) {
	  WRITE_MSG(2, "Unknown flag '");
	  Vwrite(2, err.ptr, err.len);
	  WRITE_MSG(2, "'\n");
	  exit(wrapper_exit_code);
	}
	break;
      }
#else
      case CMD_SECURE		:  
      case CMD_CAP		:
      case CMD_FLAG		:  flags = 0; remove = 0; break;
#endif
    }
  }

  if (!do_show && optind==argc) {
    WRITE_MSG(2, "No command given; use '--help' for more information\n");
    exit(wrapper_exit_code);
  }

  if (!do_show && pid!=0) {
    WRITE_MSG(2, "A pid can be specified in '--show' mode only; use '--help' for more information\n");
    exit(wrapper_exit_code);
  }  

  if (do_show && optind==argc)
    show(pid);
#if defined(VC_ENABLE_API_COMPAT) || defined(VC_ENABLE_API_LEGACY)
  else {
    Evc_new_s_context(VC_SAMECTX, remove, flags);
    if (do_show) show(pid);

    WRITE_MSG(2, "Executing\n");
    Eexecvp(argv[optind], argv+optind);
  }
#else
  else if (do_show)