Commit 449c3d5a authored by Diederik van Arkel's avatar Diederik van Arkel

Mass update mac version

parent 2fbf9de1
......@@ -482,8 +482,24 @@ read_object_file (object_file_offset,object_file_size) file_name file_n file nam
(file_contents,file) = read_object_data nametable_names file;
{FileContents|code_list,code_offset,data_list,data_offset,symbol_table,text_relocation_n,text_relocations,data_relocation_n,data_relocations}=file_contents;
{text_symbols,data_symbols,toc_symbols,bss_symbols,toc0_symbol,imported_symbols,symbols}=symbol_table;
code_list = file_contents.FileContents.code_list;
code_offset = file_contents.FileContents.code_offset;
data_list = file_contents.FileContents.data_list;
data_offset = file_contents.FileContents.data_offset;
symbol_table = file_contents.FileContents.symbol_table;
text_relocation_n = file_contents.FileContents.text_relocation_n;
text_relocations = file_contents.FileContents.text_relocations;
data_relocation_n = file_contents.FileContents.data_relocation_n;
data_relocations = file_contents.FileContents.data_relocations;
// {text_symbols,data_symbols,toc_symbols,bss_symbols,toc0_symbol,imported_symbols,symbols}=symbol_table;
text_symbols = symbol_table.text_symbols;
data_symbols = symbol_table.data_symbols;
toc_symbols = symbol_table.toc_symbols;
bss_symbols = symbol_table.bss_symbols;
toc0_symbol = symbol_table.toc0_symbol;
imported_symbols = symbol_table.imported_symbols;
symbols = symbol_table.symbols;
(imported_symbols,symbols,file,names_table) = read_object_names nametable_names (object_file_offset+name_table_offset) file_contents.local_symbols imported_symbols file_n symbols file names_table;
......
......@@ -2,7 +2,17 @@ definition module IdePlatform
import StdPSt, StdString
import StdIOCommon
from IdeState import General
from IdeState import :: General
PlatformProcessAttributes :: [ProcessAttribute *(PSt General)]
RunProgram :: !.String !*(PSt General) -> *PSt General
SetWindowIcon :: !Id !Int !(PSt .l) -> PSt .l
SetProcessIcon :: !Int !(PSt .l) -> PSt .l
GetDialogBackgroundColour :: !(PSt .l) -> (!Colour, !PSt .l)
ProjectIcon :== 32513
ImpmodIcon :== 32516
DefmodIcon :== 32515
CleanIcon :== 32512
AbcmodIcon :== 32514
......@@ -5,7 +5,11 @@ import StdArray, StdEnum, StdList
import StdFunc
import PmCleanSystem
import errwin
from IdeState import General
from IdeState import :: General
GetDialogBackgroundColour :: !(PSt .l) -> (!Colour,!PSt .l)
GetDialogBackgroundColour ps
= (LightGrey, ps)
PlatformProcessAttributes :: [ProcessAttribute *(PSt General)]
PlatformProcessAttributes = []
......@@ -17,3 +21,16 @@ RunProgram path ps
(ps,_) = Execute updateErrorWindow path ao ps
= ps
//-- Win only for now ?!
SetWindowIcon :: !Id !Int !(PSt .l) -> PSt .l
SetWindowIcon wId iId ps = ps
SetProcessIcon :: !Int !(PSt .l) -> PSt .l
SetProcessIcon iId ps = ps
ProjectIcon :== 32513
ImpmodIcon :== 32516
DefmodIcon :== 32515
CleanIcon :== 32512
AbcmodIcon :== 32514
......@@ -2,10 +2,16 @@ definition module Platform
import StdPSt, StdString
import StdIOCommon
from IdeState import General
PlatformDependant win mac :== mac
initPlatformCommandLine :: !*(PSt .l) -> (![String],!*PSt .l)
installPlatformEventHandlers :: !*(PSt .l) -> *(PSt .l)
openPlatformWindowMenu :: !*(PSt .l) -> *(PSt .l)
TooltempDir :: String
EnvsDir :: String
PrefsDir :: String
batchOptions :: !*World -> (!Bool,Bool,String,*File,!*World)
wAbort :: !String !*World -> *World
implementation module Platform
import StdInt
import StdInt, StdMisc, StdFile
import StdPSt
//import menuwindowmenu
import PmCleanSystem
import StdIOCommon, IdeState
import errwin
import StdIOCommon
import StdSystem
PlatformDependant w m :== m
PlatformDependant win mac
:== mac
initPlatformCommandLine :: !*(PSt .l) -> (![String],!*PSt .l)
initPlatformCommandLine ps
......@@ -26,9 +25,31 @@ openPlatformWindowMenu ps
= ps
// = openWindowMenu ps
batchOptions :: !*World -> (!Bool,Bool,String,*File,!*World)
batchOptions world
# interact = True
force_update = undef
prj_name = undef
logfile = undef
= (interact,force_update,prj_name,logfile,world)
wAbort :: !String !*World -> *World
wAbort message world
# stderr = fwrites message stderr
# (_,world) = fclose stderr world
= world
install_apple_event_handlers :: Int
install_apple_event_handlers
= code ()(r=D0) {
call .install_apple_event_handlers
}
TooltempDir :: String
TooltempDir = applicationpath "Temp"
EnvsDir :: String
EnvsDir = applicationpath "Config"
PrefsDir :: String
PrefsDir = applicationpath "Config"
......@@ -34,7 +34,7 @@ instance == CodeGenerateAsmOrCode
| Patherror Pathname
instance == CompilerMsg
:: WindowFun env :== !([String]) -> env -> env
:: WindowFun env :== ([String]) -> env -> env
Compile :: // Compiles the given file:
!String // compiler exe name and options
......@@ -103,6 +103,7 @@ Link :: // Links the given file:
!Bool // generate dll?
!String // name of file containing symbols to be exported from dll
!Pathname // startup directory
!Bool // add 'carb' 0 resource?
!*(PSt .l) // state
->
( !*(PSt .l) // state
......@@ -162,7 +163,7 @@ CompilePollCompleted :: !*env -> (!CompilePollCompletedResult, !*env) | FileEnv
:: CompilingInfo
InitCompilingInfo :: !*CompilingInfo
InitCompilingInfo :: *CompilingInfo
ExitCleanCompiler :: !*(!*CompilingInfo,*env) -> *(!*CompilingInfo,*env)
......
......@@ -5,7 +5,7 @@ implementation module PmCleanSystem
//import StdEnv
import StdArray, StdBool, StdChar, StdFunc, StdInt, StdList
import StdSystem, StdPStClass
import StdSystem, StdPStClass, StdMisc
import Directory
import PmCompilerOptions, UtilStrictLists, PmPath, PmProject
......@@ -13,18 +13,18 @@ import UtilNewlinesFile
import WriteOptionsFile
from PmParse import IsTypeSpec, IsImportError13, IsImportError20
from linkargs import ReadLinkErrors,WriteLinkOpts,LinkInfo`,LPathname
from linkargs import ReadLinkErrors,WriteLinkOpts,:: LinkInfo`(..),:: LPathname
import xcoff_linker
import ostoolbox
from files import LaunchApplication
from files import LaunchApplicationFSSpec, FSMakeFSSpec
import memory,appleevents
KAEQueueReply :== 2
//import StdDebug,dodebug
import dodebug
//import dodebug
trace_n _ f :== f
fopena :== fopen
......@@ -54,7 +54,7 @@ standardStaticLibraries :: !LinkMethod -> List String
standardStaticLibraries method
= case method of
LM_Static -> ("library0" :! "library1" :! "library2" :! Nil)
LM_Eager -> ("library0" :! "library1" :! "library2" :! Nil)//("kernel_library" :! "StaticClientChannel_library" :! Nil)
// LM_Eager -> ("library0" :! "library1" :! "library2" :! Nil)//("kernel_library" :! "StaticClientChannel_library" :! Nil)
LM_Dynamic -> ("library0" :! "library1" :! "library2" :! Nil)//("kernel_library" :! "ClientChannel_library" :! Nil)
standardObjectFiles :: !Bool !Bool -> List String
......@@ -134,7 +134,7 @@ where
(==) (Patherror _) (Patherror _) = True
(==) _ _ = False
:: WindowFun env :== !([String]) -> env -> env
:: WindowFun env :== ([String]) -> env -> env
out_file_path :: String Int -> String
out_file_path startupdir slot
......@@ -165,7 +165,7 @@ Compile cocl` write_module_times errwin typewin compileOrCheckSyntax path paths
// # signature = CleanCompilerSignature // XOXOXOX
// # name = CleanCompilerName // XOXOXOX
# (error_code,error_n,ss) = trace_n command send_command_to_clean_compiler_cc signature name command Wait
# (error_code,error_n,ss) = send_command_to_clean_compiler_cc signature name command Wait
| error_code <> 0 =
( errwin ( [ "Unable to run compiler: "+++cocl
+++ "; "+++ toString error_code
......@@ -433,13 +433,13 @@ where
Link :: !String !(WindowFun *(PSt .l)) !Pathname !ApplicationOptions
!Pathname !(List Pathname) !(List Pathname) !(List Pathname) !Bool
!Bool !Bool !Bool !String !Bool !String !Pathname !*(PSt .l)
!Bool !Bool !Bool !String !Bool !String !Pathname !Bool !*(PSt .l)
-> (!*(PSt .l),!Bool)
Link linker` winfun path
applicationOptions=:{fs,fn,em,ss,hs,initial_heap_size,profiling,heap_size_multiple,o,memoryProfilingMinimumHeapSize=minheap}
optionspathname library_file_names object_file_names
static_libraries static gen_relocs gen_linkmap
link_resources resource_path gen_dll dll_names startupdir ps
link_resources resource_path gen_dll dll_names startupdir add_carb_resource ps
# (ok,linker) = mangleLinker linker` startupdir
| not ok
# ps = winfun [linker] ps
......@@ -489,7 +489,7 @@ Link linker` winfun path
// #! ps = trace_l libraryFileNames ps
# ((link_ok,link_errors),ps)
= accFiles (link_xcoff_files objectFileNames libraryFileNames path
(fs,fn) hs heap_size_multiple ss flags em initial_heap_size minheap False) ps
(fs,fn) hs heap_size_multiple ss flags em initial_heap_size minheap False add_carb_resource) ps
# (errtext,errlines) = (link_errors, length link_errors);
| errlines<>0
......@@ -569,7 +569,10 @@ Execute winfun path _ ps
Launch :: !{#Char} !.a -> (!Int, !.a)
Launch execpath env
# (error_n,_) = LaunchApplication execpath 0xC8000000 OSNewToolbox
# (error_n,fsspec,tb) = FSMakeFSSpec execpath OSNewToolbox
| error_n <> 0 = (error_n,env)
# (error_n,tb) = LaunchApplicationFSSpec fsspec 0xC800 tb
// # (error_n,_) = LaunchApplication execpath 0xC8000000 OSNewToolbox
= (error_n, env)
//--- OTHER STUFF
......@@ -620,15 +623,22 @@ NoWait :== False
send_command_to_clean_compiler :: !String !String !String !Bool -> (!Int,!Int,!String);
send_command_to_clean_compiler signature name command wait_for_reply
# (os_error_code,error_n,output_string)
= send_command_to_clean_compiler0 signature command wait_for_reply;
# (os_error_code,error_n,output_string,tb)
= send_command_to_clean_compiler0 signature command wait_for_reply OSNewToolbox
| error_n<>(-2)
= (os_error_code,error_n,output_string);
# (launch_error_n,_)
= LaunchApplication name 0xCA000000 OSNewToolbox; // Hangs under OS X?
# (error_n,fsspec,tb) = FSMakeFSSpec name tb
| error_n <> 0
= (error_n,-2,output_string)
# (launch_error_n,tb) = LaunchApplicationFSSpec fsspec 0xCA00 tb
// # (launch_error_n,_)
// = LaunchApplication name 0xCA000000 OSNewToolbox; // Hangs under OS X?
| launch_error_n>=0
= send_command_to_clean_compiler0 signature command wait_for_reply;
= (os_error_code,-2,output_string);
# (os_error_code,error_n,output_string,tb)
= send_command_to_clean_compiler0 signature command wait_for_reply tb
= (os_error_code,error_n,output_string)
= (os_error_code,-2,output_string);
//--
......@@ -654,52 +664,54 @@ clean_compiler_signature slot
import events
KAEApplicationDied :== 0x6F626974; // 'obit'
send_command_to_clean_compiler0 :: !String !String !Bool-> (!Int,!Int,!String);
send_command_to_clean_compiler0 signature command wait
send_command_to_clean_compiler0 :: !String !String !Bool !*OSToolbox -> (!Int,!Int,!String,!*OSToolbox);
send_command_to_clean_compiler0 signature command wait tb
| error_code1<>0
= (error_code1,-1,"NewPtr failed");
= (error_code1,-1,"NewPtr failed",tb);
// # error_code2 = AECreateDesc TypeApplSignature "MPSX" descriptor; // Tool Server
# error_code2
= AECreateDesc TypeApplSignature signature descriptor;
= trace_n "AECreateDesc" AECreateDesc TypeApplSignature signature descriptor;
| error_code2<>0
= (free_memory error_code2,-1,"AECreateDesc failed");
= (free_memory error_code2,-1,"AECreateDesc failed",tb);
# error_code3
= AECreateAppleEvent KAEMiscStandards KAEDoScript descriptor KAutoGenerateReturnID KAnyTransactionID apple_event;
= trace_n "AECreateAppleEvent" AECreateAppleEvent KAEMiscStandards KAEDoScript descriptor KAutoGenerateReturnID KAnyTransactionID apple_event;
| error_code3<>0
= (free_descriptor_and_memory error_code3,-1,"AECreateAppleEvent failed");
= (free_descriptor_and_memory error_code3,-1,"AECreateAppleEvent failed",tb);
# error_code4
= AEPutParamPtr apple_event KeyDirectObject TypeChar command;
= trace_n "AEPutParamPtr" AEPutParamPtr apple_event KeyDirectObject TypeChar command;
| error_code4<>0
= (free_apple_event_and_desciptor_and_memory error_code4,-1,"AEPutParamPtr failed");
= (free_apple_event_and_desciptor_and_memory error_code4,-1,"AEPutParamPtr failed",tb);
# error_code5
= case wait of
True -> AESend apple_event result_apple_event KAEWaitReply KAENormalPriority KNoTimeOut 0 0;
True -> trace_n "AESend wait" AESend apple_event result_apple_event KAEWaitReply KAENormalPriority KNoTimeOut 0 0;
// True -> loop OSNewToolbox;
_ -> AESend apple_event 0 KAEQueueReply KAENormalPriority KNoTimeOut 0 0;
_ -> trace_n "AESend nowait" AESend apple_event 0 KAEQueueReply KAENormalPriority KNoTimeOut 0 0;
| error_code5==(-600)
= (free_apple_event_and_desciptor_and_memory error_code5,-2,"AESend failed",tb);
| error_code5==(-609)
= (free_apple_event_and_desciptor_and_memory error_code5,-2,"AESend failed");
= (free_apple_event_and_desciptor_and_memory error_code5,-2,"AESend failed",tb);
| error_code5==(-903)
= (free_apple_event_and_desciptor_and_memory error_code5,-2,"need to add HighLevel event aware to SIZE resource of IDE...");
= (free_apple_event_and_desciptor_and_memory error_code5,-2,"need to add HighLevel event aware to SIZE resource of IDE...",tb);
| error_code5==(-1712)
= (free_apple_event_and_desciptor_and_memory error_code5,-1,"AESend failed; Application died");
= (free_apple_event_and_desciptor_and_memory error_code5,-1,"AESend failed; Application died",tb);
| error_code5<>0
= (free_apple_event_and_desciptor_and_memory error_code5,-1,"AESend failed");
= (free_apple_event_and_desciptor_and_memory error_code5,-1,"AESend failed",tb);
| not wait
= (free_apple_event_and_desciptor_and_memory error_code5,0,"");
= (free_apple_event_and_desciptor_and_memory error_code5,0,"",tb);
# (error_code6,_,v1,_)
= AEGetIntParamPtr result_apple_event KeyErrorNumber TypeLongInteger;
= trace_n "AEGetIntParamPtr" AEGetIntParamPtr result_apple_event KeyErrorNumber TypeLongInteger;
# (error_code7,_,s2)
= AEGetStringParamPtr result_apple_event KeyErrorString TypeChar result_string;
= trace_n "AEGetStringParamPtr" AEGetStringParamPtr result_apple_event KeyErrorString TypeChar result_string;
# os_error_code
= free_result_apple_event_and_apple_event_and_desciptor_and_memory error_code6 error_code7
= trace_n "fraeaaeadam" free_result_apple_event_and_apple_event_and_desciptor_and_memory error_code6 error_code7
# error_n
= if (error_code6<0) 0 v1
# output_string
= if (error_code7<>0) "" (result_string % (0,s2-1))
= (os_error_code,error_n,output_string)
= (os_error_code,error_n,output_string,tb)
where
loop tb
# err = trace_n` "TICK!" AESend apple_event result_apple_event KAEWaitReply KAENormalPriority (60) 0 0;
# err = AESend apple_event result_apple_event KAEWaitReply KAENormalPriority (60) 0 0;
| err==(-1712)
# (avail,what,message,when,wherex,wherey,modifiers,tb) = EventAvail NetworkMask tb
| avail && what == HighLevelEvent && message == KCoreEventClass && wherex == KAEApplicationDied
......@@ -750,6 +762,15 @@ where
where
(free_error_code,_) = DisposPtr memory 0;
DisposPtr p t
# t = DisposePtr p t
= MemError t
where
MemError :: !*Toolbox -> (!Int,!*Toolbox)
MemError _ = code {
ccall MemError "P:I:I"
}
send_quit_event_to_clean_compiler :: !String -> Int;
send_quit_event_to_clean_compiler signature
| error_code1<>0
......@@ -800,20 +821,6 @@ where
(free_error_code,_) = DisposPtr memory 0;
//--
/*
trace_l [] s = trace_n "[]" s
trace_l [h:t] s
#! s = trace_n ("["+++toString h) s
= list t s
where
list [] s = trace_n "]" s
list [h:t] s
#! s = trace_n (","+++toString h) s
= list t s
*/
//--
// RWS ...
import StdMaybe
......@@ -887,7 +894,8 @@ CompileHandleExitCode exitcode cocl startupdir slot errwin typewin path listType
//:: CompilePollCompletedResult :== Maybe !(!Int,!Int)
CompilePollCompleted :: !*env -> (!CompilePollCompletedResult, !*env) | FileEnv env
//CompilePollCompleted env = (Nothing, env)
CompilePollCompleted env = (NoFinishedCompiler, env)
/*
CompilePollCompleted env
# (compiler_id,exit_code) = get_finished_compiler_id_and_exit_code
// = abort ("CompilePollCompleted "+++toString compiler_id+++" "+++toString exit_code)
......@@ -904,14 +912,14 @@ get_finished_compiler_id_and_exit_code :: (!Int/*compiler_id*/,!Int/*exit_code*/
get_finished_compiler_id_and_exit_code = code {
ccall get_finished_compiler_id_and_exit_code ":II"
}
*/
// ... RWS
// JVG ...
:: CompilingInfo = CompilingInfo
InitCompilingInfo :: !*CompilingInfo
InitCompilingInfo :: *CompilingInfo
InitCompilingInfo = CompilingInfo
ExitCleanCompiler :: !*(!*CompilingInfo,*env) -> *(!*CompilingInfo,*env)
......
......@@ -25,3 +25,9 @@ FReadOnly :: !{#Char} !*env -> (!Bool, !*env) | FileSystem env
GetLongPathName :: !String -> String;
GetShortPathName :: !String -> (!Bool,!String);
import StdPSt, StdMaybe
selectDirectory` :: !(PSt .l) -> (!Maybe String,!(PSt .l))
ShellDefault :: !{#Char} !(PSt .l) -> (!Int,!(PSt .l))
......@@ -8,7 +8,7 @@ import UtilDate
import StdSystem
import ostypes, OS_utilities;
from files import GetFInfo,GetCatInfo1,GetCatInfo2,GetWDInfo,HGetVol;
from files import GetFInfo,GetCatInfo1,GetCatInfo2/*,GetWDInfo*/,HGetVol;
//---
......@@ -41,11 +41,13 @@ FReadOnly path files
= ((hd dct).fileInfo.pi_fileInfo.isReadOnly,files)
*/
//--
import files
//import files
from PmCleanSystem import Launch
LaunchApplication :: !{#Char} !{#Char} !Bool !Files -> ( !Bool, !Files)
LaunchApplication execpath homepath console files
// set working directory???
# (error_n,_) = LaunchApplication` execpath 0xC8000000 OSNewToolbox
# (error_n,files) = Launch execpath files
| error_n >= 0
= (True,files)
= (False,files)
......@@ -56,7 +58,7 @@ LaunchApplication execpath homepath console files
FExists :: !String !Files -> (!Bool, !Files);
FExists name disk = (result == 0, disk);
where
(result,_,_) = GetFInfo name OSNewToolbox;
(result,_,_) = GetFInfo name NewToolbox;
/* Returns the last modification date of the indicated file.
......@@ -67,7 +69,7 @@ FModified path disk
| result <> 0 = (NoDate,disk);
= ({exists=True,yy=years,mm=months,dd=days,h=hours,m=minutes,s=seconds},disk);
where
(result,modification,_) = GetFInfo path OSNewToolbox;
(result,modification,_) = GetFInfo path NewToolbox;
(years,months,days,_,_) = Secs2Date modification 0;
(hours,minutes,seconds,_) = Secs2Time modification 0;
......@@ -80,7 +82,7 @@ FStartUpDir applicationname files
| result==0
= (pathName % (0,size pathName-2), files);
where
(result,wd_vref_num,directory_id,tb1) = HGetVol OSNewToolbox;
(result,wd_vref_num,directory_id,tb1) = HGetVol NewToolbox;
(pathName,_) = Get_directory_path wd_vref_num directory_id "" tb1;
GetFullApplicationPath :: !*Files -> ({#Char}, *Files);
......@@ -104,14 +106,14 @@ LastColon s i
= (True, i);
= LastColon s (dec i);
Get_name_and_parent_id_of_directory :: !Int !Int !*OSToolbox -> (!String,!Int,!*OSToolbox);
Get_name_and_parent_id_of_directory :: !Int !Int !*Toolbox -> (!String,!Int,!*Toolbox);
Get_name_and_parent_id_of_directory volumeNumber directoryId tb
| 0 == osError = (folderName,parentId,tb1);
= abort ("Error code returned by BPGetCatInfo: " +++ toString osError);
where
(osError,folderName,parentId,tb1) = GetCatInfo2 volumeNumber directoryId String64 tb;
Get_directory_path :: !Int !Int !String !*OSToolbox -> (!String, !*OSToolbox);
Get_directory_path :: !Int !Int !String !*Toolbox -> (!String, !*Toolbox);
Get_directory_path volumeNumber directoryId path tb
| directoryId==2
= (folderName +++ ":" +++ path, tb1);
......@@ -135,7 +137,7 @@ GetShortPathName :: !String -> (!Bool,!String);
GetShortPathName s = (True,s)//quoted_string s)
//--
GetFName :: !.{#Char} !*OSToolbox -> (!Int,!Int,!*OSToolbox);
GetFName :: !.{#Char} !*Toolbox -> (!Int,!Int,!*Toolbox);
GetFName ioNamePtr t = code (ioNamePtr=R80O0D0SD1,t=U)(ioResult=D0,ioDate_and_Time=I80A0,t2=Z){
instruction 0x39400000 | li r10,0
instruction 0x9141000C | stw r10,12(sp)
......@@ -149,3 +151,18 @@ GetFName ioNamePtr t = code (ioNamePtr=R80O0D0SD1,t=U)(ioResult=D0,ioDate_and_Ti
instruction 0x8321004C | lwz r25,76(sp)
};
import StdFileSelect, StdPSt, StdPStClass
selectDirectory` :: !(PSt .l) -> (!Maybe String,!PSt .l)
selectDirectory` ps
# (ms,ps) = selectDirectory ps
# ms = mapMaybe removeDirsep ms
= (ms,ps)
where
removeDirsep s
# final = dec (size s)
| s.[final] == ':' = s%(0,dec final)
= s
ShellDefault :: !{#Char} !(PSt .l) -> (!Int,!(PSt .l))
ShellDefault _ ps = abort "no ShellDefault on a Mac silly:-)"
......@@ -3,7 +3,7 @@ definition module UtilNewlinesFile
//1.3
from StdString import String
//3.1
from StdClass import ==, toString
from StdClass import class ==, class toString
:: NewlineConvention
= NewlineConventionNone | NewlineConventionMac | NewlineConventionUnix | NewlineConventionDos
......@@ -34,7 +34,7 @@ readLine file
// the second argument is the newline string
// the file should have been opened with mode FWriteData
writeAnyLine :: !{#Char} !{#Char} !*File -> !*File
writeAnyLine :: !{#Char} !{#Char} !*File -> *File
convertLine :: !*{#Char} -> (NewlineConvention, *{#Char})
......
......@@ -38,7 +38,7 @@ instance toString NewlineConvention where
= "\xd\xa"
// slice that returns a unique array
(%.) infixl 9 :: !.{#Char} !(!Int,!Int) -> !.{#Char}
(%.) infixl 9 :: !.{#Char} !(!Int,!Int) -> .{#Char}
(%.) string indices
= code
{
......@@ -92,7 +92,7 @@ readLine file
(_, line, file`)
= readAnyLine file
writeAnyLine :: !{#Char} !{#Char} !*File -> !*File
writeAnyLine :: !{#Char} !{#Char} !*File -> *File
writeAnyLine line newlineString file
# maxIndex
= size line - 1
......
definition module linker2;
from StdString import String;
from StdFile import Files;
from StdFile import :: Files;
:: SymbolArray :== {!Symbol};
......
......@@ -202,13 +202,15 @@ create_names_table :: *NamesTable;
create_names_table = createArray SYMBOL_TABLE_SIZE EmptyNamesTableElement;
insert_symbol_in_symbol_table :: !String Int Int !*NamesTable -> *NamesTable;
insert_symbol_in_symbol_table symbol_name symbol_n file_n names_table=:{[symbol_hash]=symbol_list}
insert_symbol_in_symbol_table symbol_name symbol_n file_n names_table/*=:{[symbol_hash]=symbol_list}*/
#! symbol_list=names_table.[symbol_hash];
| symbol_in_symbol_table_list symbol_list
= names_table;
= { names_table & [symbol_hash] = NamesTableElement symbol_name symbol_n file_n symbol_list};
{}{
= { names_table & [symbol_hash] = NamesTableElement symbol_name symbol_n file_n symbol_list};
{};{
symbol_hash=symbol_name_hash symbol_name;
symbol_in_symbol_table_list EmptyNamesTableElement
= False;
symbol_in_symbol_table_list (NamesTableElement string _ _ symbol_table_list)
......@@ -218,7 +220,8 @@ insert_symbol_in_symbol_table symbol_name symbol_n file_n names_table=:{[symbol_
}
find_symbol_in_symbol_table :: !String !*NamesTable -> (!NamesTableElement,!*NamesTable);
find_symbol_in_symbol_table symbol_name names_table=:{[symbol_hash]=symbol_list}
find_symbol_in_symbol_table symbol_name names_table/*=:{[symbol_hash]=symbol_list}*/
#! symbol_list=names_table.[symbol_hash];
= (symbol_in_symbol_table_list symbol_list,names_table);
{
symbol_hash=symbol_name_hash symbol_name;
......@@ -302,10 +305,10 @@ sort_symbols symbols symbol_array0
heap_sort_lp :: *SortArray Int Int Int SortElement-> *SortArray;
heap_sort_lp a i j max_index ir