Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - reinier maliepaard

#1
Hello,



A minor thing about the newLisp documentation on running an executable on Linux. Given the following:



;; uppercase.lsp - Link example - from the Manual:

(println (upper-case (main-args 1)))

(exit)

---

;;make executable on Linux via command line:

newlisp -x uppercase.lsp uppercase

chmod 755 uppercase

uppercase "hello"

---



I think that it is more clear for newbies if the command  uppercase "hello" is replaced by the command ./uppercase "hello" - only the latter with ./ does the job -as far as I can see.



If my observation is valid, then some modifications in the manual and some tutorials should be made:

- manual on newlisp.org ("Linking a source file with newLISP for a new executable")

- en.wikibooks.org/wiki/Introduction_to_newLISP

- newlisp.org/newLISP_in_21_minutes.html



Best regards,

Reinier
#2
Hi,



Thanks. Meanwhile I made a PHP solution:



https://www.mcmusiceditor.com/hyphenate/">//https://www.mcmusiceditor.com/hyphenate/



based on a well maintained source: https://github.com/vanderlee/phpSyllable">//https://github.com/vanderlee/phpSyllable. In the folder Languages you'll find the tex files, the software uses.



For my project MC Musiceditor (that uses newlisp.dll) the PHP solution will do for the moment. Despite of this online solution, I'll really appreciate your help and suggestions how I can make a newLisp solution.



Best regards,

Reinier
#3
Hello,



In Ruby I wrote one in Ruby (using a Ruby library, supporting 29 languages: https://github.com/halostatue/text-hyphen">//https://github.com/halostatue/text-hyphen) to split words into syllables.



For newlisp I am not aware of such a solution. Is there anyone who knows a solution?



Thanks.



Reinier
#4
newLISP in the real world / Pascal code - newLisp
June 14, 2015, 10:12:59 AM
Hello,

 I've made a program in Object Pascal which works ok. I was wondering if the Pascal code below could be done with newLisp. That would for me a more convenient solution for my project, that already uses newlisp.dll (see http://www.mcmusiceditor.com">http://www.mcmusiceditor.com). Here the central part of the Pascal code that does the job (the complete code is at the end of the email). The idea: if there is no default PDF viewer, invoke MCMsumatrapdf.exe only if the loaded file is test2.pdf; otherwise show a message. Of course, if there is a default PDF viewer, then the file will be shown.



SetCurrentDirectory(pchar(ExtractFilePath(paramstr(0))));
 result:=ShellExecute(0, 'open', pchar(paramstr(1)), nil, nil, SW_SHOWNORMAL);

 if result = SE_ERR_NOASSOC
 then
   begin
   (* if no duplicates as in case of calling the help file helptest2.ppx, invoke MCMsumatrapdf.exe; in other cases like View PDF show the message box *)
   if paramstr(1) = 'helptest2.pdf'
   then
    begin
     cmd:='MCMsumatrapdf.exe ';
     cmd:=cmd+'"'+paramstr(1)+'"';
     WinExec(pchar(cmd),SW_SHOWNORMAL);
    end
   else
    MessageBox(0,'There is no application associated with a PDF file. ...','No PDF file association!',MB_OK or MB_ICONINFORMATION)
   end
 except
 end;
end.


Thanks in advance.



Regards,

Reinier



{$H+}
{$R manifest.res}

program pdfview;
uses
 {$IFNDEF FPC}
  ShellApi,
 {$ENDIF}
  Windows;

{$IFNDEF FPC}
const
 AllowDirectorySeparators : set of char = ['','/'];
 AllowDriveSeparators : set of char = [':'];
{$ENDIF}

var
 cmd:string;
 result:thandle;

function ExtractFilePath(const FileName: string): string;
 var
   i : longint;
   EndSep : Set of Char;
 begin
   i := Length(FileName);
   EndSep:=AllowDirectorySeparators+AllowDriveSeparators;
   while (i > 0) and not (FileName[i] in EndSep) do
     Dec(i);
   If I>0 then
     Result := Copy(FileName, 1, i)
   else
     Result:='';
end;

begin
 try

 SetCurrentDirectory(pchar(ExtractFilePath(paramstr(0))));
 result:=ShellExecute(0, 'open', pchar(paramstr(1)), nil, nil, SW_SHOWNORMAL);

 if result = SE_ERR_NOASSOC
 then
   begin
   (* if no duplicates as in case of calling the help file helptest2.ppx, invoke MCMsumatrapdf.exe; in other cases like View PDF show the message box *)
   if paramstr(1) = 'helptest2.pxx'
   then
    begin
     cmd:='MCMsumatrapdf.exe ';
     cmd:=cmd+'"'+paramstr(1)+'"';
     WinExec(pchar(cmd),SW_SHOWNORMAL);
    end
   else
    MessageBox(0,'There is no application associated with a PDF file. Save your composition as PDF via MCMsumatrapdf or associate PDF files with a PDF viewer like Adobe Acrobat Reader or Foxit Reader.','No PDF file association!',MB_OK or MB_ICONINFORMATION)
   end
 else if (result = ERROR_FILE_NOT_FOUND) or (result =  ERROR_PATH_NOT_FOUND)
 then
  MessageBox(0,'The pdf file cannot be found!','Error',MB_OK or MB_ICONERROR)
 else if result < 33
 then
  MessageBox(0,'Cannot display the pdf file!','Error',MB_OK or MB_ICONERROR);

 except
 end;

end.
#5
newLISP in the real world / MC Musiceditor 8.0.0
December 08, 2013, 08:06:00 AM
Hello,



I'm glad to announce my free/open source MC Musiceditor 8.0.0 (GPL2 or above). On http://www.mcmusiceditor.com">http://www.mcmusiceditor.com you can find all sources (button Download).



The reason for this separate announcement is that I rewrote many parts of the software with newLisp. Why? First: it appeared that my VBScript version of MCM did not run on all Windows machines. Second: VBScript code gave errors on Linux under Wine. With the current newLisp solution, these problems are gone.



Thanks to Hans-Peter Wickern who made a 'GPL2 or above' version of his newLisp plugin. Now I could publish MCM/newLisp without any licensing issues.

Thanks to Neosoft Corporation for their impressive Neobook.



Regards,

Reinier
#6
Hello,



The following code adds to one or more apostroph's a backslash only when the (first) apostroph is preceded by a lowercase letter. My two-step-solution works, but I -newLisp newbie- have doubts on it. Does someone has a better idea? Thanks in advance.



Regards,

Reinier

...............................................................

(setq mcString "C''' g''''' c' A''")



;first step

(replace "([a-g])([']+)" mcString (append $1 "\" $2) 0)



;second step

(while (find "\''" mcString)

(replace "\''" mcString "\'\'")

)



;result is ok:  C''' g''''' c' A''

(println "result:   " mcString)

...............................................................