Re: [fpc-pascal] check if process ID is running under BSD
On Wed, 8 Jun 2011 12:58:55 +0200 (CEST) mar...@stack.nl (Marco van de Voort) wrote: > In our previous episode, Mattias Gaertner said: > > > I don't know if it exist a FPC function for that. > > > > > > i'll do an external commad like " ps -ef | grep bash | grep -v grep | awk > > > '{print $8}'". > > > > Thanks, I knew that. > > I prefer a more direct way - for example via a sysctl. > > > > I need to check under BSD if a PID is running and what name it has. > > Is there already a function for that? > > 2.5.1 since r17692 try this: > > uses freebsd,baseunix,sysutils; > > var pid : pid_t; > s: ansistring; > begin > pid:=strtointdef(paramstr(1),-1); > writeln('pid (-1 for current):',pid); > // loads name of process + args with #0's inbetween. > if kernproc_getargs(pid,s)<>-1 then // does not work with -1 > writeln('arguments:',s) > else > writeln('error fetching arguments:',fpgeterrno); > > // loads full path of running binary > if kernproc_getpath(pid,s)<>-1 then // -1 means own process > writeln('arguments:',s) > else > writeln('error fetching path:',fpgeterrno); > end. > > See the implementation of the above procedures in freebsd.pas for more info, > note that the kern_proc_* values were also updated in sysctl. Thanks a lot. This solution is only for FreeBSD. What about the other BSD flavors? What about darwin? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Userfriendly editor
Interresting, my needs are very basic, so I have some questions (maybe the answers could be put in the wiki): 1> What are the commands to download the source via git? 2> Does it support opening files by passing a command line argument? 3> Which syntaxes does it support? 4> Which encodings does it support? 5> It seams that it has no install script, I can contribute one, if there are instructions about how to generate a patch using git 6> Which rendering component does it use? SynEdit? -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Userfriendly editor
On Thu, Jun 9, 2011 at 10:38 AM, Felipe Monteiro de Carvalho < felipemonteiro.carva...@gmail.com> wrote: > Interresting, my needs are very basic, so I have some questions (maybe > the answers could be put in the wiki): > > 1> What are the commands to download the source via git? > There is download button in github project page for downloading the source. https://github.com/parmaja/miniedit/archives/master > > 2> Does it support opening files by passing a command line argument? > Yes, and one instance > > 3> Which syntaxes does it support? > > All syntaxes that SynEdit can support it. > 4> Which encodings does it support? > > Only UTF8, i need to write function to detect the encoding from the file. > 5> It seams that it has no install script, I can contribute one, if > there are instructions about how to generate a patch using git > > There is installer for Win32 using InnoSetup, but my target it is to be portable, so it is no need to have installer. For linux, you can write it. > 6> Which rendering component does it use? SynEdit? > Yes, Lazarus SynEdit But i still need to work on it before make a beta version of it. -- Zaher Dirkey ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Userfriendly editor
On Thu, Jun 9, 2011 at 12:13 PM, Zaher Dirkey wrote: >> 1> What are the commands to download the source via git? > > There is download button in github project page for downloading the source. > https://github.com/parmaja/miniedit/archives/master What is this "NativeLib" package that it requires? I tryed to simply remove this dependency, but then it can't find mnSockets -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Userfriendly editor
On Thu, Jun 9, 2011 at 12:33 PM, Felipe Monteiro de Carvalho < felipemonteiro.carva...@gmail.com> wrote: > On Thu, Jun 9, 2011 at 12:13 PM, Zaher Dirkey wrote: > >> 1> What are the commands to download the source via git? > > > > There is download button in github project page for downloading the > source. > > https://github.com/parmaja/miniedit/archives/master > > What is this "NativeLib" package that it requires? I tryed to simply > remove this dependency, but then it can't find mnSockets > > Yes, it is need minilib http://sourceforge.net/projects/minilib http://minilib.svn.sourceforge.net/viewvc/minilib/ I Updated the Wiki in github > -- > Felipe Monteiro de Carvalho > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > -- Zaher Dirkey ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Userfriendly editor
On Thu, Jun 9, 2011 at 12:46 PM, Zaher Dirkey wrote: > Yes, it is need minilib > > http://sourceforge.net/projects/minilib > http://minilib.svn.sourceforge.net/viewvc/minilib/ minilib doesn't compile: ntvTabSets.pas(24,22) Fatal: Can't find unit ntvThemes used by ntvTabSets Looks like that a file wasn't commited. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Userfriendly editor
On Thu, Jun 9, 2011 at 2:58 PM, Felipe Monteiro de Carvalho < felipemonteiro.carva...@gmail.com> wrote: > ntvTabSets commits, Thanks for being patient. -- Zaher Dirkey ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Userfriendly editor
On Thu, Jun 9, 2011 at 3:06 PM, Zaher Dirkey wrote: > commits, > Thanks for being patient. Some more issues: 1> miniedit is missing a dependency on the package minisocket, even while it requires it 2> The file mnStream.pas cannot be found by the package minisockets (it wasn't commited, it seams) -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Userfriendly editor
On Thu, Jun 9, 2011 at 3:12 PM, Felipe Monteiro de Carvalho < felipemonteiro.carva...@gmail.com> wrote: > On Thu, Jun 9, 2011 at 3:06 PM, Zaher Dirkey wrote: > > commits, > > Thanks for being patient. > > Some more issues: > > 1> miniedit is missing a dependency on the package minisocket, even > while it requires it > not understand? > > 2> The file mnStream.pas cannot be found by the package minisockets > (it wasn't commited, it seams) > > mnStreams.pas not mnStream.pas It is exists in minilib\lib > -- > Felipe Monteiro de Carvalho > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > -- Zaher Dirkey ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Userfriendly editor
On Thu, Jun 9, 2011 at 3:32 PM, Zaher Dirkey wrote: >> 1> miniedit is missing a dependency on the package minisocket, even >> while it requires it > > not understand? miniedit requires a lot of packages which are not added to it's Project Inspector. Try going to your Project Options dialog, then to Paths and remove everything under "Other Units" and "Include files" Now try to compile the project. Lots of units are missing, because you just added paths to them, which are only valid in your computer. The standard way is adding packages as dependencies in the Project Inspector. > mnStreams.pas not mnStream.pas > It is exists in minilib\lib But the paths in the package are wrong. Your lpk file says: - - - - Which is wrong, this file doesn't exist in the same directory as the LPK. It should be: + + + + msConsts.pas is also pointing to a wrong path. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Userfriendly editor
On Thu, Jun 9, 2011 at 3:43 PM, Felipe Monteiro de Carvalho wrote: > But the paths in the package are wrong. > > Your lpk file says: > > - > - > - > - Actually this unit should not be in this package, but in a separate package for the lib dir. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Userfriendly editor
On 09 Jun 2011, at 15:47, Felipe Monteiro de Carvalho wrote: On Thu, Jun 9, 2011 at 3:43 PM, Felipe Monteiro de Carvalho wrote: But the paths in the package are wrong. Your lpk file says: - - - - Actually this unit should not be in this package, but in a separate package for the lib dir. Please continue this discussion either in private or on the fpc-other list. It's getting really off-topic. Thanks, Jonas FPC mailing lists admin ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Userfriendly editor
On Thu, Jun 9, 2011 at 3:47 PM, Felipe Monteiro de Carvalho < felipemonteiro.carva...@gmail.com> wrote: > On Thu, Jun 9, 2011 at 3:43 PM, Felipe Monteiro de Carvalho > wrote: > > But the paths in the package are wrong. > > > > Your lpk file says: > > > > - > > - > > - > > - > > Ah, That is because u r trying to compile minisockets.lpk. it is very old :P In fact i only compile NativeLib.lpk, other sources i used it directly, but i think your way the correct way. > Actually this unit should not be in this package, but in a separate > package for the lib dir. > > -- > Felipe Monteiro de Carvalho > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > -- Zaher Dirkey ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Array of byte from a COM object
Hi, How I can a return "array of byte" from a COM object and put in a Stream? I use a OleVariant variable to get the return. But I can not convert in a string (the return is a XML). Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: Array of byte from a COM object
On Thu, Jun 9, 2011 at 11:26 AM, Marcos Douglas wrote: > > Hi, > How I can a return "array of byte" from a COM object and put in a Stream? > I use a OleVariant variable to get the return. But I can not convert > in a string (the return is a XML). I did using this function: procedure VariantToStream(const V: OleVariant; const Stream: TStream); var P: Pointer; L: Integer; begin Assert(VarType(V) = varByte or varArray); Assert(VarArrayDimCount(V) = 1); L := VarArrayHighBound(V, 1) - VarArrayLowBound(V, 1) + 1; Stream.Size := L; Stream.Position := 0; P := VarArrayLock(V); try Stream.Write(P^, Stream.Size); finally VarArrayUnlock(V); end; end; Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE : [fpc-pascal] Re: Array of byte from a COM object
If the Assert(VarType(V) = varByte or varArray); is not raising an error then you are not getting a Safearray. VarArrayLock is for safearrays. If you are getting an array of byte, you should be able to access the bytes as V[i]. Do you have the interface definition for the method returning the "array of byte"? Ludo > -Message d'origine- > De : fpc-pascal-boun...@lists.freepascal.org > [mailto:fpc-pascal-boun...@lists.freepascal.org] De la part > de Marcos Douglas > Envoyé : jeudi 9 juin 2011 17:21 > À : FPC-Pascal users discussions > Objet : [fpc-pascal] Re: Array of byte from a COM object > > > On Thu, Jun 9, 2011 at 11:26 AM, Marcos Douglas > wrote: > > > > Hi, > > How I can a return "array of byte" from a COM object and put in a > > Stream? I use a OleVariant variable to get the return. But > I can not > > convert in a string (the return is a XML). > > I did using this function: > > procedure VariantToStream(const V: OleVariant; const Stream: > TStream); var > P: Pointer; > L: Integer; > begin > Assert(VarType(V) = varByte or varArray); > Assert(VarArrayDimCount(V) = 1); > > L := VarArrayHighBound(V, 1) - VarArrayLowBound(V, 1) + 1; > Stream.Size := L; > Stream.Position := 0; > > P := VarArrayLock(V); > try > Stream.Write(P^, Stream.Size); > finally > VarArrayUnlock(V); > end; > end; > > Marcos Douglas > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal