mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-11 18:40:31 +01:00
MG: small updates and fixes
git-svn-id: trunk@1622 -
This commit is contained in:
parent
25b2c52fe6
commit
e98e669d0a
@ -221,9 +221,9 @@ type
|
||||
var NewX, NewY, NewTopLine: integer): boolean;
|
||||
|
||||
// source name e.g. 'unit UnitName;'
|
||||
function GetSourceName(Code: TCodeBuffer): string;
|
||||
function GetSourceName(Code: TCodeBuffer; SearchMainCode: boolean): string;
|
||||
function RenameSource(Code: TCodeBuffer; const NewName: string): boolean;
|
||||
function GetSourceType(Code: TCodeBuffer): string;
|
||||
function GetSourceType(Code: TCodeBuffer; SearchMainCode: boolean): string;
|
||||
|
||||
// uses sections
|
||||
function FindUnitInAllUsesSections(Code: TCodeBuffer;
|
||||
@ -888,9 +888,12 @@ writeln('TCodeToolManager.CompleteCode A ',Code.Filename,' x=',x,' y=',y);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCodeToolManager.GetSourceName(Code: TCodeBuffer): string;
|
||||
function TCodeToolManager.GetSourceName(Code: TCodeBuffer;
|
||||
SearchMainCode: boolean): string;
|
||||
begin
|
||||
Result:='';
|
||||
if (Code=nil)
|
||||
or ((not SearchMainCode) and (Code.LastIncludedByFile<>'')) then exit;
|
||||
{$IFDEF CTDEBUG}
|
||||
writeln('TCodeToolManager.GetSourceName A ',Code.Filename,' ',Code.SourceLength);
|
||||
{$ENDIF}
|
||||
@ -912,9 +915,12 @@ writeln('SourceName=',Result);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TCodeToolManager.GetSourceType(Code: TCodeBuffer): string;
|
||||
function TCodeToolManager.GetSourceType(Code: TCodeBuffer;
|
||||
SearchMainCode: boolean): string;
|
||||
begin
|
||||
Result:='';
|
||||
if (Code=nil)
|
||||
or ((not SearchMainCode) and (Code.LastIncludedByFile<>'')) then exit;
|
||||
{$IFDEF CTDEBUG}
|
||||
writeln('TCodeToolManager.GetSourceType A ',Code.Filename,' ',Code.SourceLength);
|
||||
{$ENDIF}
|
||||
|
||||
@ -3458,6 +3458,9 @@ begin
|
||||
|
||||
Result.Desc:=CurExprDesc;
|
||||
Result.Context:=CurContext;
|
||||
if Result.Desc=xtContext then
|
||||
Result:=Result.Context.Tool.ConvertNodeToExpressionType(Result.Context.Node,
|
||||
Params);
|
||||
{$IFDEF ShowExprEval}
|
||||
writeln(' FindExpressionTypeOfVariable Result=',ExprTypeToString(Result));
|
||||
{$ENDIF}
|
||||
@ -3638,6 +3641,7 @@ begin
|
||||
if WordIsBooleanOperator.DoItUpperCase(Src,BinaryOperator.StartPos,
|
||||
BinaryOperator.EndPos-BinaryOperator.StartPos)
|
||||
then begin
|
||||
// Boolean operators
|
||||
// < > <= >= <> in is
|
||||
Result.Desc:=xtBoolean;
|
||||
end
|
||||
@ -3649,13 +3653,17 @@ begin
|
||||
else if WordIsOrdNumberOperator.DoItUpperCase(Src,BinaryOperator.StartPos,
|
||||
BinaryOperator.EndPos-BinaryOperator.StartPos)
|
||||
then begin
|
||||
// ordinal number operator
|
||||
// or xor and mod div shl shr
|
||||
Result.Desc:=xtConstOrdInteger;
|
||||
end
|
||||
else if WordIsNumberOperator.DoItUpperCase(Src,BinaryOperator.StartPos,
|
||||
BinaryOperator.EndPos-BinaryOperator.StartPos)
|
||||
then begin
|
||||
// number operator (or string concatenating or set cut)
|
||||
// + - *
|
||||
|
||||
|
||||
if (Src[BinaryOperator.StartPos]='+')
|
||||
and (LeftOperand.Desc in [xtAnsiString,xtShortString,xtString,xtChar])
|
||||
then begin
|
||||
@ -4303,6 +4311,7 @@ function TFindDeclarationTool.IsCompatible(TargetType,
|
||||
ExpressionType: TExpressionType; Params: TFindDeclarationParams
|
||||
): TTypeCompatibility;
|
||||
// can ExpressionType be assigned to TargetType
|
||||
// both expression types must be base types
|
||||
var TargetNode, ExprNode: TCodeTreeNode;
|
||||
begin
|
||||
{$IFDEF ShowExprEval}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
//
|
||||
// FreePascal Bindings for libGL by NVIDIA (based on MESA Bindings from Sebastian Günther)
|
||||
// Version 0.0.3
|
||||
// supported NVIDIA Driver Version: 2802
|
||||
// supported NVIDIA Driver Version: 2880
|
||||
// this is UNPUBLISHED source code and may not be used by anyone (except matti) for anything
|
||||
// later it will be GPL'ed :)
|
||||
// Copyright (C) 2001 Satan
|
||||
@ -3436,6 +3436,9 @@ finalization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 2002/04/21 13:24:07 lazarus
|
||||
MG: small updates and fixes
|
||||
|
||||
Revision 1.3 2002/04/15 10:54:58 lazarus
|
||||
MG: fixes from satan
|
||||
|
||||
|
||||
@ -815,7 +815,7 @@ begin
|
||||
ParticleEngine.DrawParticles;
|
||||
if ParticleBlended then glDisable(GL_BLEND);
|
||||
//glFlush;
|
||||
glFinish;
|
||||
//glFinish;
|
||||
// Swap backbuffer to front
|
||||
gtk_gl_area_swap_buffers(PGtkGLArea(GTKGLAreaControl1.Widget));
|
||||
end;
|
||||
|
||||
19
ide/main.pp
19
ide/main.pp
@ -2434,9 +2434,10 @@ begin
|
||||
SaveAsFileExt:=EditorOpts.HighlighterList.GetDefaultFilextension(
|
||||
SrcEdit.SyntaxHighlighterType);
|
||||
end;
|
||||
SaveAsFilename:=CodeToolBoss.GetSourceName(AnUnitInfo.Source);
|
||||
AnUnitInfo.ReadUnitNameFromSource;
|
||||
SaveAsFilename:=AnUnitInfo.UnitName;
|
||||
if SaveAsFilename='' then
|
||||
SaveAsFilename:=AnUnitInfo.UnitName;
|
||||
SaveAsFilename:=ExtractFileNameOnly(AnUnitInfo.Filename);
|
||||
if SaveAsFilename='' then
|
||||
SaveAsFilename:='noname';
|
||||
|
||||
@ -2819,8 +2820,8 @@ begin
|
||||
// check if unit is a program
|
||||
if (not (ofProjectLoading in Flags))
|
||||
and FilenameIsPascalSource(AFilename)
|
||||
and (CodeToolBoss.GetSourceType(PreReadBuf)='PROGRAM') then begin
|
||||
NewProgramName:=CodeToolBoss.GetSourceName(PreReadBuf);
|
||||
and (CodeToolBoss.GetSourceType(PreReadBuf,false)='PROGRAM') then begin
|
||||
NewProgramName:=CodeToolBoss.GetSourceName(PreReadBuf,false);
|
||||
if NewProgramName<>'' then begin
|
||||
// source is a program
|
||||
// either this is a lazarus project
|
||||
@ -3638,7 +3639,8 @@ Begin
|
||||
MainUnitName:=SourceNoteBook.NoteBook.Pages[
|
||||
MainUnitInfo.EditorIndex];
|
||||
if MainUnitName='' then begin
|
||||
MainUnitName:=CodeToolBoss.GetSourceName(MainUnitInfo.Source);
|
||||
MainUnitInfo.ReadUnitNameFromSource;
|
||||
MainUnitName:=MainUnitInfo.UnitName;
|
||||
end;
|
||||
if MainUnitName='' then begin
|
||||
MainUnitName:=ExtractFileName(MainUnitInfo.Filename);
|
||||
@ -4224,8 +4226,8 @@ begin
|
||||
ActiveUnitInfo.IsPartOfProject:=true;
|
||||
if (ActiveUnitInfo.UnitName<>'')
|
||||
and (Project1.ProjectType in [ptProgram, ptApplication]) then begin
|
||||
ShortUnitName:=CodeToolBoss.GetSourceName(ActiveUnitInfo.Source);
|
||||
if ShortUnitName='' then ShortUnitName:=ActiveUnitInfo.UnitName;
|
||||
ActiveUnitInfo.ReadUnitNameFromSource;
|
||||
ShortUnitName:=ActiveUnitInfo.UnitName;
|
||||
if (ShortUnitName<>'') then
|
||||
CodeToolBoss.AddUnitToMainUsesSection(
|
||||
Project1.MainUnitInfo.Source,ShortUnitName,'');
|
||||
@ -6235,6 +6237,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.281 2002/04/21 13:24:05 lazarus
|
||||
MG: small updates and fixes
|
||||
|
||||
Revision 1.280 2002/04/21 06:53:52 lazarus
|
||||
MG: fixed save lrs to test dir
|
||||
|
||||
|
||||
@ -412,13 +412,13 @@ begin
|
||||
end;
|
||||
until Result<>mrRetry;
|
||||
if ReadUnitName then
|
||||
fUnitName:=CodeToolBoss.GetSourceName(fSource);
|
||||
fUnitName:=CodeToolBoss.GetSourceName(fSource,false);
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
procedure TUnitInfo.ReadUnitNameFromSource;
|
||||
begin
|
||||
fUnitName:=CodeToolBoss.GetSourceName(fSource);
|
||||
fUnitName:=CodeToolBoss.GetSourceName(fSource,false);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -919,7 +919,7 @@ begin
|
||||
|
||||
if AddToProjectFile and (MainUnit>=0) then begin
|
||||
// add unit to uses section
|
||||
ShortUnitName:=CodeToolBoss.GetSourceName(AUnit.Source);
|
||||
ShortUnitName:=AUnit.UnitName;
|
||||
if (ShortUnitName<>'') and (not UnitIsUsed(ShortUnitName)) then
|
||||
CodeToolBoss.AddUnitToMainUsesSection(Units[MainUnit].Source,
|
||||
ShortUnitName,'');
|
||||
@ -1429,6 +1429,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.62 2002/04/21 13:24:06 lazarus
|
||||
MG: small updates and fixes
|
||||
|
||||
Revision 1.61 2002/04/15 12:45:57 lazarus
|
||||
MG: added save projectunit flags
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user