Skip to content

Commit

Permalink
Fixed computers/data_pol manual link
Browse files Browse the repository at this point in the history
Filled in some blank pages in POL documentation
Moved IICompTest to POLComputerTest and made it a JUnit test
  • Loading branch information
Pabilo8 committed Dec 13, 2024
1 parent 227cda1 commit 423ba1b
Show file tree
Hide file tree
Showing 20 changed files with 463 additions and 255 deletions.
117 changes: 0 additions & 117 deletions src/main/java/pl/pabilo8/immersiveintelligence/IICompTest.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class IIDataTypeUtils
public static final Map<Class<? extends DataType>, TypeMetaInfo<?>> metaTypesByClass = new LinkedHashMap<>();
public static final Map<String, TypeMetaInfo<?>> metaTypesByName = new LinkedHashMap<>();

static
public static void registerDataTypes()
{
//null
registerType("null", DataTypeNull.class, DataTypeNull::new, IIColor.fromPackedRGB(0x8f2fb3));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public DataType execute(DataPacket packet, DataTypeExpression data)
t1 = packet.getVarInType(NumericDataType.class, data.getArgument(0));
t2 = packet.getVarInType(NumericDataType.class, data.getArgument(1));

if(t2.floatValue()==0)
return new DataTypeFloat(0);

if(t1 instanceof DataTypeFloat||t2 instanceof DataTypeFloat)
return new DataTypeFloat(t1.floatValue()%t2.floatValue());
return new DataTypeInteger(t1.intValue()%t2.intValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class DataOperationEqual extends DataOperation
@Override
public DataType execute(DataPacket packet, DataTypeExpression data)
{
return new DataTypeBoolean(data.getArgument(0).equals(data.getArgument(1)));
DataType t1 = packet.evaluateVariable(data.getArgument(0), false);
DataType t2 = packet.evaluateVariable(data.getArgument(1), false);

return new DataTypeBoolean(t1.equals(t2));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public void addPages()
functionalCircuits.addSource(circuit.getName(), getSourceForItem(IIContent.itemCircuit.getStack(circuit)));
addEntry("functions/"+circuit.getName());
}
addEntry("computers/data_pol");

addEntry("redstone_interface");

Expand Down Expand Up @@ -175,8 +176,5 @@ public void addPages()
.toArray(ItemStack[]::new)
));


addEntry("folder/device/sekritdokuments/data_pol");

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import pl.pabilo8.immersiveintelligence.api.ammo.parts.IAmmoTypeItem;
import pl.pabilo8.immersiveintelligence.api.crafting.DustUtils;
import pl.pabilo8.immersiveintelligence.api.data.IIDataOperationUtils;
import pl.pabilo8.immersiveintelligence.api.data.IIDataTypeUtils;
import pl.pabilo8.immersiveintelligence.api.rotary.CapabilityRotaryEnergy;
import pl.pabilo8.immersiveintelligence.api.rotary.IIRotaryUtils;
import pl.pabilo8.immersiveintelligence.api.utils.IUpgradableMachine;
Expand Down Expand Up @@ -345,6 +346,9 @@ public void preInit()

IIContent.init();

IIDataTypeUtils.registerDataTypes();
IIDataOperationUtils.registerDataOperations();

//ALWAYS REGISTER BULLETS IN PRE-INIT! (so they get their texture registered before TextureStitchEvent.Pre)
//Bullets
AmmoRegistry.registerAmmoType(IIContent.itemAmmoHeavyArtillery);
Expand Down Expand Up @@ -485,7 +489,6 @@ public void preInit()

public void init()
{
IIDataOperationUtils.registerDataOperations();
PenetrationRegistry.init();
IICompatModule.doModulesInit();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,67 +28,70 @@ code execution pt. 2
proudly uses polish notation ^^

# statements
**Statements** are the building blocks of a **POL** program. Each **Statement** has a distinct name it’s called by and performs a different action.
Examples of an action are setting a value of a variable, stopping the program or running an internal function.
**Statements** are the building blocks of a **POL** program. Each **Statement** has a distinct name it’s called by and performs a different action.
Examples of an action are setting a value of a variable, stopping the program, or running an internal function.
Each **Statement** takes exactly one line, but some, like the if **Statement** require another statement to work properly.
The following pages list all the **Statements**, their usage and exemplary use cases.
The following pages list all the **Statements**, their usage, and exemplary use cases.

# statements_use

use

# statements_end

end

The **USE
** statement is used to include a library of functions from a [Circuit](../functions/_functional_circuits.md) to be used by the program.
# statements_begin_end
The **BEGIN** and **END** statements are used to mark a fragment of a program, called a *code block*.
A *code
block* is treated as a single statement, but if consisting of more than one statements, it will have a longer execution time, equal to the sum of all the statements within it.
Multiple *code blocks* can be nested within each other, but each **BEGIN** statement must have a corresponding **END
** statement.
Although both exist as keywords, the recommended way to use them is through adding indentation to the code.
# statements_wait

wait
The **WAIT** statement is used to pause the program for a specified amount of ticks.
During this time, the program will not execute any other statements.

# statements_sign

sign
The **SIGN
** statement is used to switch one of the 16 colored signal lamps on a Computer Terminal to a lit or unlit state.
The states are persistent and will remain until changed by another **SIGN
** statement or power is cut off from the terminal.

# statements_mark

mark
The **MARK
** statement is used to set a label in the program that can be jumped to by the [GOTO](#statement_goto) statement.
A **MARK** label cannot contain spaces or names reserved by operations, and must be unique within the program.

# statement_goto

goto
The **GOTO** statement is used to jump to a label set by the [MARK](#statement_mark) statement.
This can be useful for creating loops or conditional jumps in the program.

# statements_exec

exec

The **EXEC
** statement is used to jump to a label set by the [MARK](#statement_mark) statement and then return to the original position in the program.
This can be useful for defining callable *functions* in the program.
# statements_ext
The **EXT** statement is used call another POL program from the current one.
The program will share the same memory, but will not share imported functions and [External Device] links from the one calling it.
# statements_if

if
The **IF** statement is used to execute a block of code if a condition is met.
If the condition is not met, the program will skip the next instruction or block of code.

# statements_else

else

# statements_while

while
The **ELSE
** statement is used to execute a block of code if the condition of the preceding [IF](#statement_if) statement is not met.

# statements_page

page
The **PAGE
** statement is used to switch the [memory page](../data_main.md#packets_basics) of the computer to a different one.
This can be useful for setting separate memory for different routines of the program.

# statements_wipe

wipe
The **WIPE** statement is used to clear all the current memory page of the computer.

# statements_copy

copy
The **COPY** statement is used to copy the value of one variable to another.
The copied variable will have the same value as the original, but changes to one will not affect the other.

# statements_move

move
The **MOVE** statement is used to move the value of one variable to another, leaving the original variable empty.

# statements_swap
The **SWAP** statement is used to exchange the values of two variables in memory.

swap
Original file line number Diff line number Diff line change
Expand Up @@ -2668,9 +2668,7 @@ ie.manual.category.ii_other.name=Other


ie.manual.folder.functions=Function Reference
ie.manual.folder.folder=Folder
ie.manual.folder.device=Device
ie.manual.folder.sekritdokuments=Sekrit Dokuments
ie.manual.folder.computers=Computers

ie.manual.entry.traits.level_beginner=Complexity: Pre-Industrial
ie.manual.entry.traits.level_early_industrial=Complexity: Early Industrial
Expand Down
16 changes: 0 additions & 16 deletions src/pol/loop_test.pol

This file was deleted.

38 changes: 0 additions & 38 deletions src/pol/main.pol

This file was deleted.

12 changes: 0 additions & 12 deletions src/pol/skrypcik.pol

This file was deleted.

Loading

0 comments on commit 423ba1b

Please sign in to comment.