nxScribe - Multi language management application (ver 1.0.2)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Would you mind, when you've time, trying it on Win NT. It should run okay.

Thanks.
I may look like a mule, but I'm not a complete ass.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

srod wrote:Would you mind, when you've time, trying it on Win NT. It should run okay.
Just tried (NT4 sp6 fr) : it crashed.
nxScribe.exe
Exception : violation d'accès (0xc0000005), adressse : 0x77f7754b
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Hi,

did it crash immediately on running?
I may look like a mule, but I'm not a complete ass.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

srod wrote:Hi,
did it crash immediately on running?
Immediately after I started it.
I didn't see any window.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Suggests either a resource problem or one with the language file used by nxScribe itself.

Difficult to get to the bottom of this though without access to a machine running NT.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Gnozal, would you mind trying the following test version on NT.

I've added on error support and so we should get some kind of report as to where and why it is crashing - it's worth a shot! :)

http://www.purecoder.net/nxScribeTEST.zip

Thanks.

**Edit : the egrid library uses the GradientFill() function which, as far as I can tell, is not shipped with either Win 95 and NT. However, if this is the problem then I do not understand why the Windows loader would not report a problem! We can test this though if I rip out all of the GradientFill() calls from the egrid library.
I may look like a mule, but I'm not a complete ass.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

An attemped read or write ... isn't allowed
c:\ ... \ LoadLanguageFile.pbi
Load Language
Error line 104
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Right, my orginal suspicion!

The following zip contains just the short procedure which is throwing the error.

If you unzip the two files within to a folder and run the LoadLanguageFile.pbi program you should see exactly where the crash occurs.

Thanks I really appreciate your help here.

http://www.purecoder.net/nxScribeLanguage.zip
I may look like a mule, but I'm not a complete ass.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

srod wrote:Right, my orginal suspicion!

The following zip contains just the short procedure which is throwing the error.

If you unzip the two files within to a folder and run the LoadLanguageFile.pbi program you should see exactly where the crash occurs.

Thanks I really appreciate your help here.

http://www.purecoder.net/nxScribeLanguage.zip
1. If English.nxScribelan is in the EXE directory, no error.
Debug view outputs 'Author - Stephen Rodriguez'
2. If English.nxScribelan is missing in the EXE directory, it crashes at line 103 'NextDirectoryEntry(1)'

EDIT : if you use "*.*" as filemask, it doesn't crash.
Last edited by gnozal on Wed Oct 10, 2007 3:43 pm, edited 1 time in total.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

REMOVED
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Gnozal if I remove the lan file from the exe directory then the program crashes because of the IncludeBinary() statement, which makes sense because of the missing file. This is of course a compilation error rather than a runtime one.

The fact that on your system it crashes at a different point, at run time, indicates a problem with Win NT or PB itself.

This is strange.

I presume you've compiled with the debugger enabled?

Can you try this :

Code: Select all

;'nxScribe'.
;===========
;Language file module.
Global Dim gLanguage$(0)

Enumeration ;Language strings.
  #lan_application
  #lan_author
  #lan_builddate
  #lan_language

  #lan_Error
  #lan_Terminating
  #lan_GUIProblem
  #lan_DuplicateIdentifier
  #lan_NoGroupSpaces
  #lan_NoIdentifierSpaces
  #lan_FileNotFound
  #lan_LanguageFile
  #lan_AbortingProcedure

  #lan_ttNewProject  
  #lan_ttOpenProject
  #lan_ttSaveProject
  #lan_ttSaveProjectAs
  #lan_ttChangeSettings
  #lan_ttLanguageFiles
  #lan_ttGenerateSource
  #lan_ttCloseProject
  #lan_ttHelp
  #lan_ttExit
  #lan_ttShiftLeft
  #lan_ttShiftRight
  #lan_ttContextMenus
  #lan_ttClickHeader
  #lan_ttRemoveSelectedLanguages
  #lan_ttAddRow

  #lan_menuAddRow
  #lan_menuInsertRowBefore
  #lan_menuInsertRowAfter
  #lan_menuDeleteRow
  #lan_menuCutRow
  #lan_menuCopyRow
  #lan_menuPasteNewRow

  #lan_gdLanguages
  #lan_gdAdd
  #lan_gdEdit
  #lan_gdDelete
  #lan_gdGroups
  #lan_gdNoLanguageGroup
  #lan_gdSelectedGroup
  #lan_gdSelectedGroupEntry
  #lan_gdSelectedGroupEntries
  #lan_gdIdentifier
  #lan_gdAddRow

  #lan_gdCreateLanguageFiles
  #lan_gdLanguagesFrame
  #lan_gdAvailableLanguages
  #lan_gdLanguageFilesToCreate
  #lan_gdLanguageFileFormat
  #lan_gdDestinationFolder
  #lan_gdCancel
  #lan_gdCreateFiles

  #lan_CloseCurrentProject
  #lan_NewGroupName
  #lan_GroupNewName
  #lan_GroupNameExists
  #lan_OutOfMemory
  #lan_DeleteGroup
  #lan_DeleteRow
  #lan_NewLanguageName
  #lan_LanguageNewName
  #lan_LanguageExists
  #lan_DeleteLanguage
  #lan_ProjectHasChanged
  #lan_SelectSaveLocation
  #lan_FileAlreadyExists
  #lan_SelectProjectToOpen
  #lan_ProblemOpeningProject
  #lan_InvalidProjectFile
  #lan_NoProjectOpen
  #lan_NoLanguages
  #lan_SelectAtLeastOneLanguage
  #lan_Module
  #lan_CreatedBy

  #_languagfileeend
EndEnumeration


;Returns non zero if no error.
Procedure.l LoadLanguageFile()
  Define blnTemp, languagefilename$, temp$, i, result, fileformat
  Dim gLanguage$(#_languagfileeend-1)
  ;We need to scan the current directory looking for language files.
  ;If there are some, then we select the first found.
  ;Else, we unpack the default language file to a temporary location.
    If ExamineDirectory(1,GetPathPart(ProgramFilename()),"*.nxScribelan")
      If NextDirectoryEntry(1)
        languagefilename$=DirectoryEntryName(1)
      EndIf
    EndIf
    FinishDirectory(1)
    If languagefilename$=""
      languagefilename$=GetTemporaryDirectory()+"English.nxScribelan"
      If CreateFile(1,languagefilename$)
        blnTemp = #True ; Signify that we will have to delete the temporary file.
        WriteData(1,?englanstart,?englanend-?englanstart)
        CloseFile(1)
      EndIf
    Else
      languagefilename$=GetPathPart(ProgramFilename())+languagefilename$
    EndIf
    ;Now we need to load the language file into the language$ array,
    If ReadFile(1, languagefilename$)
      ;Determine the format of the file.
        fileformat=ReadStringFormat(1)
      If fileformat<=#PB_Ascii ;Recongnised format.
        While Not(Eof(1))
          temp$=Trim(ReadString(1, fileformat))
          If temp$<>"" And Left(temp$,1)<>";"
            gLanguage$(i)=temp$
            i+1
          EndIf
        Wend
        result = 1
      EndIf
      CloseFile(1)
    EndIf
  If blnTemp
    DeleteFile(languagefilename$)
  EndIf
  ProcedureReturn result
EndProcedure




;-Data section.
;******************************************************************************************
DataSection
  englanstart:
  IncludeBinary "English.nxScribelan"
  englanend:
EndDataSection 


LoadLanguageFile()
MessageRequester("",gLanguage$(1))

You are better off creating an exe when running this.
I may look like a mule, but I'm not a complete ass.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

srod wrote:Gnozal if I remove the lan file from the exe directory then the program crashes because of the IncludeBinary() statement, which makes sense because of the missing file. This is of course a compilation error rather than a runtime one.

The fact that on your system it crashes at a different point, at run time, indicates a problem with Win NT or PB itself.

This is strange.
I compile 'LoadLanguageFile.pbi' without error (IncludeBinary works as English.nxScribelan is in the pbi's directory).
Now, if I move the EXE to another directory without English.nxScribelan, it crashes.
srod wrote:I presume you've compiled with the debugger enabled?
Yes

EDIT : same result (crash with the other code)

EDIT2:

So it works :

Code: Select all

  If ExamineDirectory(1,GetPathPart(ProgramFilename()),"*.*") 
    While NextDirectoryEntry(1) 
      If LCase(GetExtensionPart(DirectoryEntryName(1))) = "nxscribelan"
        languagefilename$=DirectoryEntryName(1) 
        Break
      EndIf
    Wend 
    FinishDirectory(1) 
  EndIf 
Last edited by gnozal on Wed Oct 10, 2007 4:06 pm, edited 2 times in total.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Hi,

did you try the code in my previous post?
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

One last try then, following your "*.*" hint, can you try the following which is a bit of a rewrite :

Code: Select all

;'nxScribe'.
;===========
;Language file module.
Global Dim gLanguage$(0)

Enumeration ;Language strings.
  #lan_application
  #lan_author
  #lan_builddate
  #lan_language

  #lan_Error
  #lan_Terminating
  #lan_GUIProblem
  #lan_DuplicateIdentifier
  #lan_NoGroupSpaces
  #lan_NoIdentifierSpaces
  #lan_FileNotFound
  #lan_LanguageFile
  #lan_AbortingProcedure

  #lan_ttNewProject  
  #lan_ttOpenProject
  #lan_ttSaveProject
  #lan_ttSaveProjectAs
  #lan_ttChangeSettings
  #lan_ttLanguageFiles
  #lan_ttGenerateSource
  #lan_ttCloseProject
  #lan_ttHelp
  #lan_ttExit
  #lan_ttShiftLeft
  #lan_ttShiftRight
  #lan_ttContextMenus
  #lan_ttClickHeader
  #lan_ttRemoveSelectedLanguages
  #lan_ttAddRow

  #lan_menuAddRow
  #lan_menuInsertRowBefore
  #lan_menuInsertRowAfter
  #lan_menuDeleteRow
  #lan_menuCutRow
  #lan_menuCopyRow
  #lan_menuPasteNewRow

  #lan_gdLanguages
  #lan_gdAdd
  #lan_gdEdit
  #lan_gdDelete
  #lan_gdGroups
  #lan_gdNoLanguageGroup
  #lan_gdSelectedGroup
  #lan_gdSelectedGroupEntry
  #lan_gdSelectedGroupEntries
  #lan_gdIdentifier
  #lan_gdAddRow

  #lan_gdCreateLanguageFiles
  #lan_gdLanguagesFrame
  #lan_gdAvailableLanguages
  #lan_gdLanguageFilesToCreate
  #lan_gdLanguageFileFormat
  #lan_gdDestinationFolder
  #lan_gdCancel
  #lan_gdCreateFiles

  #lan_CloseCurrentProject
  #lan_NewGroupName
  #lan_GroupNewName
  #lan_GroupNameExists
  #lan_OutOfMemory
  #lan_DeleteGroup
  #lan_DeleteRow
  #lan_NewLanguageName
  #lan_LanguageNewName
  #lan_LanguageExists
  #lan_DeleteLanguage
  #lan_ProjectHasChanged
  #lan_SelectSaveLocation
  #lan_FileAlreadyExists
  #lan_SelectProjectToOpen
  #lan_ProblemOpeningProject
  #lan_InvalidProjectFile
  #lan_NoProjectOpen
  #lan_NoLanguages
  #lan_SelectAtLeastOneLanguage
  #lan_Module
  #lan_CreatedBy

  #_languagfileeend
EndEnumeration


;Returns non zero if no error.
Procedure.l LoadLanguageFile()
  Define blnTemp, languagefilename$, temp$, i, result, fileformat
  Dim gLanguage$(#_languagfileeend-1)
  ;We need to scan the current directory looking for language files.
  ;If there are some, then we select the first found.
  ;Else, we unpack the default language file to a temporary location.
    If ExamineDirectory(1,GetPathPart(ProgramFilename()),"*.*")
      While NextDirectoryEntry(1)
        If GetExtensionPart(DirectoryEntryName(1)) = ".nxScribelan"
          languagefilename$=DirectoryEntryName(1)
          Break
        EndIf
      Wend
      FinishDirectory(1)
    EndIf
    If languagefilename$=""
      languagefilename$=GetTemporaryDirectory()+"English.nxScribelan"
      If CreateFile(1,languagefilename$)
        blnTemp = #True ; Signify that we will have to delete the temporary file.
        WriteData(1,?englanstart,?englanend-?englanstart)
        CloseFile(1)
      EndIf
    Else
      languagefilename$=GetPathPart(ProgramFilename())+languagefilename$
    EndIf
    ;Now we need to load the language file into the language$ array,
    If ReadFile(1, languagefilename$)
      ;Determine the format of the file.
        fileformat=ReadStringFormat(1)
      If fileformat<=#PB_Ascii ;Recongnised format.
        While Not(Eof(1))
          temp$=Trim(ReadString(1, fileformat))
          If temp$<>"" And Left(temp$,1)<>";"
            gLanguage$(i)=temp$
            i+1
          EndIf
        Wend
        result = 1
      EndIf
      CloseFile(1)
    EndIf
  If blnTemp
    DeleteFile(languagefilename$)
  EndIf
  ProcedureReturn result
EndProcedure




;-Data section.
;******************************************************************************************
DataSection
  englanstart:
  IncludeBinary "English.nxScribelan"
  englanend:
EndDataSection 


LoadLanguageFile()
MessageRequester("",gLanguage$(1))
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Sorry, Gnozal just caught your edit above; are you saying it now works?

(srod has his fingers crossed! :wink: )
I may look like a mule, but I'm not a complete ass.
Post Reply