Examples of Pointer


Examples of com.sun.jna.Pointer

    return new CLibrary.group(pg).getName();
  }

  public String defaultGroup(String user)
  {
    Pointer p = CLibrary.INSTANCE.getpwnam(user);
    if (p == null)
    {
      log("could not get user " + user);
      return null;
    }
    int gid = new CLibrary.passwd(p).getGid();
    System.out.println("default group gid " + gid);
    Pointer pg = CLibrary.INSTANCE.getgrgid(gid);
    if (pg == null)
    {
      log("could not get default group for user " + user);
      return null;
    }
View Full Code Here

Examples of com.sun.jna.Pointer

    log("switch group " + currentGroup + " -> " + group);

    if (currentGroup != null && !currentGroup.equals(group))
    {
      Pointer p = CLibrary.INSTANCE.getgrnam(group);
      CLibrary.group g = new CLibrary.group(p);
      int newGid = g.getGid();
      String nam = g.getName();
      if (newGid == 0)
        log("could not get group " + group);
      // System.out.println("switching to group name/id "+nam+"/"+newGid);
      int res = CLibrary.INSTANCE.setregid(newGid, newGid);
      if (res != 0)
        log("could not change to group " + group);
    }

    log("switch user " + currentUser + " -> " + user);

    if (currentUser != null && !currentUser.equals(user))
    {
      Pointer p = CLibrary.INSTANCE.getpwnam(user);
      int newUid = new CLibrary.passwd(p).getUid();
      if (newUid == 0)
        log("could not get user " + user);
      int res = CLibrary.INSTANCE.setreuid(newUid, newUid);
      if (res != 0)
View Full Code Here

Examples of com.sun.jna.Pointer

        Matcher m = p.matcher(status);
        m.find();
        // get ruid
        int ruid = Integer.parseInt(m.group(1));
        System.out.println("rudi " + ruid);
        Pointer po = CLibrary.INSTANCE.getpwuid(ruid);
        if (po == null)
          System.out.println("could not get user");
        return new CLibrary.passwd(po).getName().trim();
      }
      catch (Exception ex)
View Full Code Here

Examples of com.sun.jna.Pointer

        }
        return new JNAMemoryPointer(context.getRuntime(), io, 0, size);
    }
    @JRubyMethod(name = "to_s", optional = 1)
    public IRubyObject to_s(ThreadContext context, IRubyObject[] args) {
        Pointer address = getAddress();
        String hex = address != null ? address.toString() : "native@0x0";
        return RubyString.newString(context.getRuntime(), MEMORY_POINTER_NAME + "[address=" + hex + "]");
    }
View Full Code Here

Examples of com.sun.jna.Pointer

                RubyNumeric.fix2long(value));
    }
   
    @JRubyMethod(name = "put_pointer", required = 2)
    public IRubyObject put_pointer(ThreadContext context, IRubyObject offset, IRubyObject value) {
        Pointer ptr;
        if (value instanceof JNAMemoryPointer) {
            ptr = ((JNAMemoryPointer) value).getAddress();
        } else if (value.isNil()) {
            ptr = Pointer.NULL;
        } else {
View Full Code Here

Examples of er.chronic.tags.Pointer

    tokens.add(new Token("years"));
    tokens.add(new Token("past"));
   
    tokens.get(0).tag(new Scalar(Integer.valueOf(3)));
    tokens.get(1).tag(new RepeaterYear());
    tokens.get(2).tag(new Pointer(Pointer.PointerType.PAST));
   
    assertTrue(handler.match(tokens, Handler.definitions(_options)));
  }
View Full Code Here

Examples of gnu.classpath.Pointer

     * @param resource a memory resource to wrap
     * @return the new ByteBuffer
     */
    public static ByteBuffer wrap(MemoryResource resource) {
        final Object owner = resource.getOwner();
        final Pointer address = new MemoryRawData(resource);
        final int size = resource.getSize().toInt();
        final ByteBuffer result = new DirectByteBufferImpl.ReadWrite(owner, address, size, size, 0);
        result.mark();
        return result;
    }
View Full Code Here

Examples of javax.jmdns.impl.DNSRecord.Pointer

    public Collection<DNSRecord> answers(DNSRecordClass recordClass, boolean unique, int ttl, HostInfo localHost) {
        List<DNSRecord> list = new ArrayList<DNSRecord>();
        // [PJYF Dec 6 2011] This is bad hack as I don't know what the spec should really means in this case. i.e. what is the class of our registered services.
        if ((recordClass == DNSRecordClass.CLASS_ANY) || (recordClass == DNSRecordClass.CLASS_IN)) {
            if (this.getSubtype().length() > 0) {
                list.add(new Pointer(this.getTypeWithSubtype(), DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE, ttl, this.getQualifiedName()));
            }
            list.add(new Pointer(this.getType(), DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE, ttl, this.getQualifiedName()));
            list.add(new Service(this.getQualifiedName(), DNSRecordClass.CLASS_IN, unique, ttl, _priority, _weight, _port, localHost.getName()));
            list.add(new Text(this.getQualifiedName(), DNSRecordClass.CLASS_IN, unique, ttl, this.getTextBytes()));
        }
        return list;
    }
View Full Code Here

Examples of jcuda.Pointer

   */
  public static DenseDoubleMatrix multiply(Pointer a, Pointer b,
      MatrixDimension dim) {

    // Prepare the pointer for the result in DEVICE memory
    Pointer deviceResultPointer = new Pointer();
    int resMatrixSize = dim.getM() * dim.getN();
    int transA = dim.isTransposeA() ? cublasOperation.CUBLAS_OP_T
        : cublasOperation.CUBLAS_OP_N;
    int transB = dim.isTransposeB() ? cublasOperation.CUBLAS_OP_T
        : cublasOperation.CUBLAS_OP_N;

    if (CUBLAS2_AVAILABLE) {
      JCuda.cudaMalloc(deviceResultPointer, Sizeof.DOUBLE * resMatrixSize);
      Pointer alpha = Pointer.to(new double[] { 1.0d });
      Pointer beta = Pointer.to(new double[] { 0.0d });
      JCublas2.cublasDgemm(handle, transA, transB, dim.getM(), dim.getN(),
          dim.getK(), alpha, a, dim.getLdA(), b, dim.getLdB(), beta,
          deviceResultPointer, dim.getLdC());
      freePointer(alpha);
      freePointer(beta);
View Full Code Here

Examples of jnr.ffi.Pointer

       
        int creationFlags = WindowsLibC.NORMAL_PRIORITY_CLASS | WindowsLibC.CREATE_UNICODE_ENVIRONMENT;
        WindowsProcessInformation processInformation = new WindowsProcessInformation(getRuntime());

        // FIXME: Convert envp into useful wideEnv
        Pointer wideEnv = null;
        byte[] programW = WindowsHelpers.toWString(program);
        byte[] cwd = WindowsHelpers.toWString(WindowsHelpers.escapePath(handler.getCurrentWorkingDirectory().toString()) +"\\");
        ByteBuffer commandW = ByteBuffer.wrap(WindowsHelpers.toWString(command));
        boolean returnValue = wlibc().CreateProcessW(programW, commandW,
                securityAttributes, securityAttributes,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.