2
0
Эх сурвалжийг харах

Allow "-" in filenames

- adds another replace-with-underscore next to "."-replacement
Ronny Otto 11 жил өмнө
parent
commit
a014f5dfaa
5 өөрчлөгдсөн 10 нэмэгдсэн , 9 устгасан
  1. 1 1
      bcc.bmx
  2. 1 1
      config.bmx
  3. 1 1
      iparser.bmx
  4. 5 5
      parser.bmx
  5. 2 1
      translator.bmx

+ 1 - 1
bcc.bmx

@@ -95,7 +95,7 @@ Function SaveHeader(file:String, trans:TCTranslator, mung:String)
 
 	Local path:String = OutputFilePath(file, mung, "h")
 
-	Local header:String = BuildHeaderName(path).ToUpper().Replace(".", "_")
+	Local header:String = BuildHeaderName(path).ToUpper().Replace(".", "_").Replace("-","_")
 	Local text:String = HeaderComment()
 	text :+ "#ifndef " + header + "~n"
 	text :+ "#define " + header + "~n~n"

+ 1 - 1
config.bmx

@@ -214,7 +214,7 @@ End Function
 
 Function MungModuleName:String(ident:String)
 	Local mung:String = "__bb_" + ident + "_" + ident[ident.Find(".") + 1..]
-	Return mung.Replace(".", "_")
+	Return mung.Replace(".", "_").Replace("-", "_")
 End Function
 
 Function MungImportFromFile:String(file:String)

+ 1 - 1
iparser.bmx

@@ -167,7 +167,7 @@ DebugLog "FILE NOT FOUND : " + ipath
 						Local modpath:String
 						If opt_buildtype = BUILDTYPE_MODULE Then
 							modpath = opt_modulename + "_" + StripExt(iRelPath)
-							modpath = modpath.ToLower().Replace(".", "_")
+							modpath = modpath.ToLower().Replace(".", "_").Replace("-", "_")
 						Else
 							' todo file imports for apps
 							internalErr

+ 5 - 5
parser.bmx

@@ -2084,7 +2084,7 @@ End Rem
 			Local modpath:String
 			If opt_buildtype = BUILDTYPE_MODULE Then
 				modpath = opt_modulename + "_" + StripExt(filepath)
-				modpath = modpath.ToLower().Replace(".", "_")
+				modpath = modpath.ToLower().Replace(".", "_").Replace("-", "_")
 			Else
 				' todo file imports for apps
 				internalErr
@@ -2201,12 +2201,12 @@ End Rem
 				If dir.EndsWith(".mod") Then
 					dir = dir.Replace(".mod", "")
 				End If
-				dir = dir.Replace(".", "_")
+				dir = dir.Replace(".", "_").Replace("-", "_")
 				Local file:String = StripDir(opt_filepath).ToLower()
 				app.munged = "bb_" + dir + "_" + StripExt(file)
 			End If
 		End If
-		app.munged = app.munged.Replace(".", "_")
+		app.munged = app.munged.Replace(".", "_").Replace("-", "_")
 	End Method
 
 	' load external cast defs
@@ -2339,7 +2339,7 @@ End Rem
 			ValidateModIdent ident
 		Else If opt_buildtype = BUILDTYPE_MODULE Then
 			munged = opt_modulename + "_" + ident
-			munged = munged.ToLower().Replace(".", "_")
+			munged = munged.ToLower().Replace(".", "_").Replace("-", "_")
 		End If
 
 		If opt_ismain Then 'And opt_modulename <> "brl.blitz" Then
@@ -2439,7 +2439,7 @@ End Rem
 					Err "Module does not match commandline module"
 				End If
 
-				_module.munged = m.Replace(".", "_")
+				_module.munged = m.Replace(".", "_").Replace("-", "_")
 			Case "rem"
 				ParseRemStmt()
 			Case "nodebug"

+ 2 - 1
translator.bmx

@@ -128,7 +128,7 @@ Type TTranslator
 
 			If TModuleDecl( decl )
 				munged=decl.ModuleScope().munged+"_"+id
-				munged = munged.Replace(".", "_")
+				munged = munged.Replace(".", "_").Replace("-", "_")
 			EndIf
 
 '		End Select
@@ -830,3 +830,4 @@ End Rem
 	
 End Type
 
+